Commit 923ecc45 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Add U-bottleneck and use correct path

- Use path of the vtk-file in both contructors
parent ca5d3c6b
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<geometry version="0.5" caption="Projectname" gridSizeX="20.000000"
gridSizeY="20.000000" unit="m"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://134.94.2.137/jps_geoemtry.xsd ">
<rooms>
<room id="0" caption="botleneck" zpos="0.000000">
<subroom id="0" closed="0" class="subroom">
<polygon caption="oben">
<vertex px="65.000000" py="104.000000" />
<vertex px="62.000000" py="104.000000" />
<vertex px="62.000000" py="103.000" />
</polygon>
<polygon caption="unten">
<vertex px="62.000000" py="101.000" />
<vertex px="62.000000" py="100.000000" />
<vertex px="65.000000" py="100.000000" />
</polygon>
</subroom>
<subroom id="1" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="62.000000" py="103.000" />
<vertex px="60.000000" py="103.000" />
</polygon>
<polygon caption="wall">
<vertex px="60.000000" py="101.000" />
<vertex px="62.000000" py="101.000" />
</polygon>
</subroom>
<subroom id="2" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="60.000000" py="103.000" />
<vertex px="60.000000" py="104.000000" />
<vertex px="56.000000" py="104.000000" />
</polygon>
<polygon caption="wall">
<vertex px="56.000000" py="100.000000" />
<vertex px="60.000000" py="100.000000" />
<vertex px="60.000000" py="101.000" />
</polygon>
</subroom>
<crossings>
<crossing id="0" subroom1_id="0" subroom2_id="1">
<vertex px="62.000000" py="103.000" />
<vertex px="62.000000" py="101.000" />
</crossing>
<crossing id="1" subroom1_id="1" subroom2_id="2">
<vertex px="60.000000" py="103.000" />
<vertex px="60.000000" py="101.000" />
</crossing>
</crossings>
</room>
<room id="1" caption="botleneckHolding" zpos="0.000000">
<subroom id="0" closed="0" class="subroom">
<polygon caption="wall">
<vertex px="56.000000" py="104.000000" />
<vertex px="50.000000" py="104.000000" />
<vertex px="50.000000" py="100.000000" />
<vertex px="56.000000" py="100.000000" />
</polygon>
<obstacle id="0" caption="Obstacle 0" closed="1">
<polygon caption="wall">
<vertex px="55.000000" py="103.000000" />
<vertex px="51.000000" py="103.000000" />
<vertex px="51.000000" py="102.500000" />
<vertex px="54.500000" py="102.500000" />
<vertex px="54.500000" py="101.500000" />
<vertex px="51.000000" py="101.500000" />
<vertex px="51.000000" py="101.000000" />
<vertex px="55.000000" py="101.000000" />
<vertex px="55.000000" py="103.000000" />
</polygon>
</obstacle>
</subroom>
</room>
</rooms>
<transitions>
<transition id="2" caption="No_Name" type="emergency"
room1_id="0" subroom1_id="0" room2_id="-1" subroom2_id="-1">
<vertex px="65.000000" py="104.000000" />
<vertex px="65.000000" py="100.000000" />
</transition>
<transition id="3" caption="No_Name" type="emergency"
room1_id="0" subroom1_id="2" room2_id="1" subroom2_id="0">
<vertex px="56.000000" py="104.000000" />
<vertex px="56.000000" py="100.000000" />
</transition>
</transitions>
</geometry>
<?xml version="1.0" encoding="UTF-8" ?>
<JuPedSim project="JPS-Project" version="0.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://134.94.2.137/jps_ini_core.xsd">
<!-- seed used for initialising random generator -->
<seed>12542</seed>
<max_sim_time>900</max_sim_time>
<!-- geometry file -->
<geometry>2.0_bottleneckX.xml</geometry>
<!-- traectories file and format -->
<trajectories format="xml-plain" fps="8">
<file location="2.0_TrajBottleneckX.xml"/>
</trajectories>
<!-- where to store the logs -->
<logfile>log</logfile>
<!-- traffic information: e.g closed doors or smoked rooms -->
<traffic_constraints>
<!-- room states are: good or smoked -->
<!-- <rooms> -->
<!-- <room room_id="0" state="good" /> -->
<!-- </rooms> -->
<!-- <rooms> -->
<!-- <room room_id="1" state="good" /> -->
<!-- </rooms> -->
<!-- doors states are: close or open -->
<doors>
<door trans_id="2" caption="" state="open" />
</doors>
</traffic_constraints>
<routing>
<goals>
<goal id="0" final="true" caption="goal 1">
<polygon>
<vertex px="70" py="101" />
<vertex px="70" py="103" />
<vertex px="75" py="103" />
<vertex px="75" py="101" />
<vertex px="70" py="101" />
</polygon>
</goal>
</goals>
</routing>
<!--persons information and distribution -->
<agents operational_model_id="3">
<agents_distribution>
<group group_id="2" agent_parameter_id="0" room_id="1" subroom_id="0" number="10" goal_id="0" router_id="1" x_min="51" x_max="54" y_max="102" y_min="101"/>
<!-- <group group_id="0" room_id="0" subroom_id="2" number="4" goal_id="0" router_id="1" route_id="" /> -->
<!-- <group group_id="1" room_id="1" number="10" goal_id="0" router_id="1" route_id="" /> -->
</agents_distribution>
<!-- frequency in persons/minute -->
<!-- <agents_sources/> -->
</agents>
<!-- These parameters may be overwritten -->
<operational_models>
<model operational_model_id="1" description="gcfm">
<model_parameters>
<solver>euler</solver>
<stepsize>0.001</stepsize>
<exit_crossing_strategy>4</exit_crossing_strategy>
<linkedcells enabled="true" cell_size="2.2" />
<force_ped nu="0.2" dist_max="3" disteff_max="2" interpolation_width="0.1" />
<force_wall nu="0.2" dist_max="3" disteff_max="2" interpolation_width="0.1" />
</model_parameters>
<agent_parameters agent_parameter_id="1">
<v0 mu="0.5" sigma="0.0" />
<bmax mu="0.25" sigma="0.001" />
<bmin mu="0.20" sigma="0.001" />
<amin mu="0.18" sigma="0.001" />
<tau mu="0.5" sigma="0.001" />
<atau mu="0.5" sigma="0.001" />
</agent_parameters>
</model>
<model operational_model_id="3" description="gradnav">
<model_parameters>
<solver>euler</solver>
<stepsize>0.01</stepsize>
<exit_crossing_strategy>6</exit_crossing_strategy>
<floorfield delta_h="0.0625" wall_avoid_distance="0.4" use_wall_avoidance="true" />
<linkedcells enabled="true" cell_size="4.2" />
<force_ped nu="3" b="1.0" c="3.0" />
<force_wall nu="1" b="0.70" c="3.0" />
<anti_clipping slow_down_distance=".5" />
</model_parameters>
<agent_parameters agent_parameter_id="0">
<v0 mu="1.5" sigma="0.0" />
<bmax mu="0.25" sigma="0.001" />
<bmin mu="0.20" sigma="0.001" />
<amin mu="0.18" sigma="0.001" />
<tau mu="0.5" sigma="0.001" />
<atau mu="0.23" sigma="0.001" />
</agent_parameters>
</model>
</operational_models>
<route_choice_models>
<router router_id="1" description="global_shortest">
<parameters>
<!-- <navigation_lines file="routing.xml" /> -->
</parameters>
</router>
</route_choice_models>
</JuPedSim>
......@@ -38,7 +38,6 @@
#include <fstream>
DirectionStrategy::DirectionStrategy()
{
}
......@@ -288,11 +287,16 @@ double DirectionFloorfield::GetDistance2Wall(Pedestrian* ped) const
void DirectionFloorfield::Init(Building* building, double stepsize, double threshold, bool useDistancMap) {
//implement mechanic, that can read-in an existing floorfield (from a previous run)
std::ifstream test(("FF"+building->GetGeometryFilename() + ".vtk").c_str());
string s = building->GetGeometryFilename();
s.erase(s.find_last_of(".", string::npos)); // delete ending
string FF_filename = (building->GetProjectRootDir() + "FF_" + s + ".vtk").c_str();
std::ifstream test(FF_filename);
if (test.good()) {
ffviafm = new FloorfieldViaFM(("FF"+building->GetGeometryFilename() + ".vtk").c_str());
Log->Write("INFO: \tRead Floor field from file <" + FF_filename + ">");
ffviafm = new FloorfieldViaFM(FF_filename);
} else {
ffviafm = new FloorfieldViaFM(building, stepsize, stepsize, threshold, useDistancMap);
Log->Write("INFO: \tWrite Floor field to file <" + FF_filename + ">");
ffviafm = new FloorfieldViaFM(building, stepsize, stepsize, threshold, useDistancMap, FF_filename);
}
initDone = true;
}
......
......@@ -54,9 +54,7 @@ FloorfieldViaFM::~FloorfieldViaFM()
}
FloorfieldViaFM::FloorfieldViaFM(const Building* const buildingArg, const double hxArg, const double hyArg,
const double slowdownDistance, const bool useDistancefield) {
std::cerr << "Bin im old constructor" << std::endl;
std::cout << "Bin im old constructor" << std::endl;
const double slowdownDistance, const bool useDistancefield, const std::string& filename) {
//ctor
threshold = -1; //negative value means: ignore threshold
......@@ -85,7 +83,7 @@ FloorfieldViaFM::FloorfieldViaFM(const Building* const buildingArg, const double
calculateFloorfield(useDistancefield); //use distance2Wall
testoutput("AAFloorfield.vtk","AAFloorfield.txt", cost);
writeFF(("FF" + buildingArg->GetGeometryFilename() + ".vtk").c_str());
writeFF(filename);
}
FloorfieldViaFM::FloorfieldViaFM(const std::string& filename) {
......@@ -107,8 +105,6 @@ FloorfieldViaFM::FloorfieldViaFM(const std::string& filename) {
// ...
// comments show lineformat in .vtk file (below)
std::cerr << "Bin im read file constructor" << std::endl;
std::cout << "Bin im read file constructor" << std::endl;
std::ifstream file(filename);
std::string line;
......@@ -1028,7 +1024,7 @@ void FloorfieldViaFM::testoutput(const char* filename1, const char* filename2, c
//std::cerr << "INFO: \tFile closed: " << filename1 << std::endl;
}
void FloorfieldViaFM::writeFF(const char* filename) {
void FloorfieldViaFM::writeFF(const std::string& filename) {
std::ofstream file;
int numX = (int) ((grid->GetxMax()-grid->GetxMin())/grid->Gethx());
......
......@@ -52,7 +52,7 @@ class FloorfieldViaFM
public:
FloorfieldViaFM();
FloorfieldViaFM(const std::string&);
FloorfieldViaFM(const Building* const buildingArg, const double hxArg, const double hyArg, const double slowdownDistance, const bool useDistancefield);
FloorfieldViaFM(const Building* const buildingArg, const double hxArg, const double hyArg, const double slowdownDistance, const bool useDistancefield, const std::string&);
virtual ~FloorfieldViaFM();
FloorfieldViaFM(const FloorfieldViaFM& other);
//FloorfieldViaFM& operator=(const FloorfieldViaFM& other);
......@@ -80,7 +80,7 @@ class FloorfieldViaFM
inline double twosidedCalc(double x, double y, double hDivF);
void testoutput(const char*, const char*, const double*);
void writeFF(const char*);
void writeFF(const std::string&);
#ifdef TESTING
void setGrid(RectGrid* gridArg) {grid = gridArg;}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment