• Documentation
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API

    Show / Hide Table of Contents
    • MARS DSL Language
    • MARS Runtime System
      • Getting started with MARS
      • Basic Concepts
        • Multi-Agent-Simulation
        • Agents
        • Layers
        • Entities
        • Environments
          • SpatialHashEnvironment
          • GeoHashEnvironment
          • SpatialGraphEnvironment
          • CollisionEnvironment
        • Model Setup
      • Model Configuration
        • Agent and Entity Configuration
        • Layer Configuration
        • Output Filter
        • Simulation Configuration Options
        • Simulation Output Formats
      • Data Sources
        • Geospatial Data Sources
        • Geospatial Data Types
        • ASCII grid (.asc)
        • CSV
        • Time-series Data
      • Analysis and Visualization
        • Visualizing Agent Movement Trajectories
        • Simple Live Visualization
        • Analyzing Output Data
      • Tutorials
        • Creating a new MARS C# project
        • Creating a starting point for your model
        • Creating vector and raster layer files
        • Building your first model (wolf-sheep-grass)
        • Common problems and solutions
        • Acquire geo data for layers
        • Build and start your model in Kubernetes cluster
    • SmartOpenHamburg
      • Quick Start
      • Ready to use scenarios (boxes)
        • Ferry Transfer
        • Green4Bikes
        • Results
        • Result Schemas
      • Layer
        • Multimodal Layer
        • Modal Layer
        • Scheduling Layer
        • Vector Layer
      • Agents
        • Behaviour Model
        • Multimodal
        • Multi-Capable
        • Multi-Modality
        • Citizen
        • Traveler
      • Entities
        • Referencing
        • Street Vehicles
        • Bicycle Vehicles
        • Ferry

    Getting started with MARS

    The MARS runtime system provides agent-based simulation and geographical query processing methods with a set of standard mathematical functions and data structures for .NET Core.

    The framework provides simulation core to execute the simulation with variable step-size. It is compatible with multiple platforms including Microsoft Windows, MacOS, Xamarin, Unity3D, Windows Store applications, Linux or mobile.

    The framework offers a unified API to develop and execute individual-based models and scenarios.

    Concepts

    A simulation is the execution of a model (representation of a system) in a predefined scenario. The scenario consists of configurations of certain aspects like the simulation time frame (start and endpoint) or the tick size (in our tick-based-system every tick represents a time frame; the simulation is executed tick by tick) or the number of involved agents, and input data that is used in the model to initialize or update agents, entities and layers. Every scenario, therefore, consists of a model description that defines which parts of the model are part of the scenario (e.g. which layers and agents are involved) and the mentioned simulation config. The model is described by the concept of agents, entities and layers.

    Agents are independent and active components that can sense surroundings and act upon these findings and their internal state (memory, goals, desires, ..).

    Entities are like agents components with a life-cycle (they are created initially, initialized with data and eventually removed from the simulation later). Unlike agents, they cannot act. They, therefore, represent model objects that exist in the model and can be used by the agent.

    Layers could be described as playgrounds of the simulation if you would describe agents as players. They provide information for certain aspects of the model and can be used by agents to acquire tempo-spatial data or provide an interface for exploring entities or other agents. There is a specific bond between agents and their main layer, initially provided to the agent on initialization. This layer may be responsible for creating the agent with an AgentManager.

    Sample Model: Wolf-Sheep-Predation

    Check out the Wolf-Sheep-Model to make yourself familiar with the basic concepts, like layers and agents.

    The folder WolfSheepPredation contains a simple predation model in which sheep and wolves move on a grid. Sheep eat grass and periodically increased by a GrassGrowthAgent). Wolf hunt sheep and eat them if close enough. Both animals reproduce eventually by losing half their energy. Energy is also consumed in every tick and can be replenished by eating food. If the energy is zero, the animal dies.

    The following tutorial video explains the relevant aspects of that model in more detail:

    The repository also contains a second folder WolfSheepGrassPredation that promotes Grass to an own agent type that can vary in growth. Further concepts are introduced and are explained in a second tutorial video.

    These are for adept users and can be skipped for beginners.

    The design concepts can be found in the Design-folder.

    Getting started with your own model

    To install the framework in your application, please use the public nuget feed from Microsoft and is compatible with netstandard2.0. It is designed to use with netcore. The runtime system is available as a public NuGet package and simply be added to your project using the dotnet CLI or your preferred IDE:

    dotnet add package Mars.Life.Simulations
    

    Optional when you are using the IDE:

    • If you are using Visual Studio, right-click on the References item in your solution folder, and select Manage NuGet Packages.
    • If you are using Jetbrains Rider, click on NuGet package management below.

    Search for Mars.Life.Simulations (or equivalently Mars) and select "Install."

    You can also checkout this simple model stub that provides the required model structure and MARS dependencies.

    Further examples are provided for a simple Grid-model and a simple Geo-model.

    Back to top Copyright © MARS GROUP.
    HAW Hamburg