Simulation.h 3.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/**
 * @file    Simulation.h
 * @date Created on: Dec 15, 2010
 * Copyright (C) <2009-2011>
 *
 * @section LICENSE
 * This file is part of JuPedSim.
 *
 * JuPedSim is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * JuPedSim is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
 *
 * \section description
 * The Simulation class represents a simulation of pedestrians
 * based on a certain model in a specific scenario. A simulation is defined by
 * various parameters and functions.
 *
Ulrich Kemloh's avatar
Ulrich Kemloh committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40
 */

#ifndef SIMULATION_H_
#define SIMULATION_H_

#include "general/ArgumentParser.h"
#include "geometry/Building.h"
#include "IO/OutputHandler.h"
#include "IO/IODispatcher.h"
#include "math/ForceModel.h"
#include "math/ODESolver.h"
#include "routing/GlobalRouter.h"
#include "routing/QuickestPathRouter.h"
#include "routing/DirectionStrategy.h"
41
#include "routing/DummyRouter.h"
42
#include "routing/GraphRouter.h"
43
#include "routing/NavMesh.h"
44
#include "routing/MeshRouter.h"
45
#include "routing/RoutingEngine.h"
46
#include "routing/SafestPathRouter.h"
Ulrich Kemloh's avatar
Ulrich Kemloh committed
47
#include "pedestrian/PedDistributor.h"
48
#include "events/EventManager.h" //neuer Header fuer die Events
Ulrich Kemloh's avatar
Ulrich Kemloh committed
49 50 51 52 53 54


extern OutputHandler* Log;

class Simulation {
private:
55 56 57 58 59 60 61 62
	///Number of pedestrians in the simulation
    int _nPeds;
    ///Maximum simulation time
    double _tmax;
    /// time step
    double _deltaT;
    /// frame rate for the trajectories
    double _fps;
63 64
    ///seed using for the random number generator
    unsigned int _seed;
65 66 67 68 69 70 71 72 73 74 75 76
    /// building object
    Building* _building;
    ///initial distribution of the pedestrians
    PedDistributor* _distribution;
    /// door crossing strategy for the pedestrians
    DirectionStrategy* _direction;
    /// Force model to use
    ForceModel* _model;
    /// differential equation solver
    ODESolver* _solver;
    /// writing the trajectories to file
    IODispatcher* _iod;
77 78
    ///new: EventManager
    EventManager _em;
Ulrich Kemloh's avatar
Ulrich Kemloh committed
79

80

Ulrich Kemloh's avatar
Ulrich Kemloh committed
81 82 83
public:
    Simulation();
    virtual ~Simulation();
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

    /**
     * Initialize the number of agents in the simulation
     */
    void SetPedsNumber(int i);

    /**
     * Initialize the number of agents in the simulation
     */
    int GetPedsNumber() const;

    /**
     * Returns the number of agents when running on a distributed system (MPI)
     * NOT IMPLEMENTED
     */
Ulrich Kemloh's avatar
Ulrich Kemloh committed
99
    int GetNPedsGlobal() const;
100 101 102 103

    /**
     * @return the building object containing all geometry elements
     */
Ulrich Kemloh's avatar
Ulrich Kemloh committed
104
    Building* GetBuilding() const;
105 106 107 108

    /**
     * Read parameters from the argument parser class.
     */
Ulrich Kemloh's avatar
Ulrich Kemloh committed
109
    void InitArgs(ArgumentParser *args);
110 111 112 113 114

    /**
     *
     * @return the total simulated/evacuation time
     */
Ulrich Kemloh's avatar
Ulrich Kemloh committed
115
    int RunSimulation();
116 117 118 119 120

    /**
     * Update the pedestrians states: positions, velocity, route
     */
    void Update();
Ulrich Kemloh's avatar
Ulrich Kemloh committed
121 122 123 124

};

#endif /*SIMULATION_H_*/