GCFMModel.h 4.16 KB
Newer Older
Ulrich Kemloh's avatar
Ulrich Kemloh committed
1
/**
2 3
 * \file        GCFMModel.h
 * \date        Apr 15, 2014
4 5
 * \version     v0.7
 * \copyright   <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
Ulrich Kemloh's avatar
Ulrich Kemloh committed
6
 *
7
 * \section License
Ulrich Kemloh's avatar
Ulrich Kemloh committed
8 9 10
 * This file is part of JuPedSim.
 *
 * JuPedSim is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Lesser General Public License as published by
Ulrich Kemloh's avatar
Ulrich Kemloh committed
12 13 14 15 16 17 18 19
 * 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.
 *
20
 * You should have received a copy of the GNU Lesser General Public License
Ulrich Kemloh's avatar
Ulrich Kemloh committed
21 22
 * along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
 *
23
 * \section Description
Ulrich Kemloh's avatar
Ulrich Kemloh committed
24 25 26 27
 * Implementation of classes for force-based models.
 * Actually we've got two different models:
 * 1. Generalized Centrifugal Force Model
 *
28 29
 *
 **/
Ulrich Kemloh's avatar
Ulrich Kemloh committed
30 31 32 33 34 35 36 37


#ifndef GCFMMODEL_H_
#define GCFMMODEL_H_

#include <vector>

#include "../geometry/Building.h"
38
#include "OperationalModel.h"
Ulrich Kemloh's avatar
Ulrich Kemloh committed
39 40 41 42 43 44 45 46



//forward declaration
class Pedestrian;
class DirectionStrategy;


47 48
class GCFMModel : public OperationalModel
{
Ulrich Kemloh's avatar
Ulrich Kemloh committed
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
public:

    GCFMModel(DirectionStrategy* dir, double nuped, double nuwall, double dist_effPed, double dist_effWall,
            double intp_widthped, double intp_widthwall, double maxfped, double maxfwall);
    virtual ~GCFMModel(void);

    // Getter
    DirectionStrategy* GetDirection() const;
    double GetNuPed() const;
    double GetNuWall() const;
    double GetDistEffMax() const;
    double GetIntpWidthPed() const;
    double GetIntpWidthWall() const;
    double GetMaxFPed() const;
    double GetMaxFWall() const;
    double GetDistEffMaxPed() const;
    double GetDistEffMaxWall() const;

67 68 69 70 71 72 73
    /**
     * Compute the next simulation step
     * Solve the differential equations and update the positions and velocities
     * @param current the actual time
     * @param deltaT the next timestep
     * @param building the geometry object
     */
74 75
    virtual void ComputeNextTimeStep(double current, double deltaT, Building* building) const;
    virtual std::string GetDescription() const;
76
    virtual bool Init (Building* building) const;
Ulrich Kemloh's avatar
Ulrich Kemloh committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

private:
    /// define the strategy for crossing a door (used for calculating the driving force)
    DirectionStrategy* _direction;
    // Modellparameter
    double _nuPed;                /**< strength of the pedestrian repulsive force */
    double _nuWall;               /**< strength of the wall repulsive force */
    double _intp_widthPed; /**< Interpolation cutoff radius (in cm) */
    double _intp_widthWall; /**< Interpolation cutoff radius (in cm) */
    double _maxfPed;
    double _maxfWall;
    double _distEffMaxPed; // maximal effective distance
    double _distEffMaxWall; // maximal effective distance

    // Private Funktionen
    /**
     * Driving force \f$ F_i =\frac{\mathbf{v_0}-\mathbf{v_i}}{\tau}\f$
     *
     * @param ped Pointer to Pedestrians
     * @param room Pointer to Room
     *
     * @return Point
     */
    Point ForceDriv(Pedestrian* ped, Room* room) const;
    /**
     * Repulsive force between two pedestrians ped1 and ped2 according to
     * the Generalized Centrifugal Force Model (chraibi2010a)
     *
     * @param ped1 Pointer to Pedestrian: First pedestrian
     * @param ped2 Pointer to Pedestrian: Second pedestrian
     *
     * @return Point
     */
    Point ForceRepPed(Pedestrian* ped1, Pedestrian* ped2) const;
    /**
     * Repulsive force acting on pedestrian <ped> from the walls in
     * <subroom>. The sum of all repulsive forces of the walls in <subroom> is calculated
     * @see ForceRepWall
     * @param ped Pointer to Pedestrian
     * @param subroom Pointer to SubRoom
     *
     * @return
     */
    Point ForceRepRoom(Pedestrian* ped, SubRoom* subroom) const;
Ulrich Kemloh's avatar
Ulrich Kemloh committed
121
    Point ForceRepWall(Pedestrian* ped, const Line& l) const;
Ulrich Kemloh's avatar
Ulrich Kemloh committed
122 123 124 125 126 127 128
    Point ForceRepStatPoint(Pedestrian* ped, const Point& p, double l, double vn) const;
    Point ForceInterpolation(double v0, double K_ij, const Point& e, double v, double d, double r, double l) const;

};


#endif /* GCFMMODEL_H_ */