Commit 6c7fd1c6 authored by Mohcine Chraibi's avatar Mohcine Chraibi

(WIP): Add new attributes to class source (#258)

parent 96dffc13
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<!-- seed used for initialising random generator --> <!-- seed used for initialising random generator -->
<seed>12542</seed> <seed>12542</seed>
<!-- geometry file --> <!-- geometry file -->
<geometry>bidirectional_geo.xml</geometry> <geometry>geometry.xml</geometry>
<max_sim_time>5000</max_sim_time> <max_sim_time>5000</max_sim_time>
<!-- trajectories file and format --> <!-- trajectories file and format -->
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
<!--<hybrid_simulation server="zam597" port="9999" />--> <!--<hybrid_simulation server="zam597" port="9999" />-->
<!-- where to store the logs --> <!-- where to store the logs -->
<!--<logfile>outputfiles/log.txt</logfile> --> <!-- <logfile>log.txt</logfile> -->
<!-- traffic information: e.g closed doors or smoked rooms --> <!-- traffic information: e.g closed doors or smoked rooms -->
<traffic_constraints> <traffic_constraints>
<!-- doors states are: close or open --> <!-- doors states are: close or open -->
<doors> <doors>
<!-- <door trans_id="5" caption="exit" state="close" /> --> <!-- <door trans_id="1" caption="exit" state="open" /> -->
</doors> </doors>
</traffic_constraints> </traffic_constraints>
...@@ -79,16 +79,15 @@ ...@@ -79,16 +79,15 @@
<group group_id="3" room_id="3" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="2" /> <group group_id="3" room_id="3" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="2" />
<group group_id="4" room_id="4" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="2" /> <group group_id="4" room_id="4" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="2" />
<!-- real start group --> <!-- real start group -->
<group group_id="5" room_id="0" subroom_id="0" number="60" router_id="1" agent_parameter_id="1" goal_id="2" y_min="5.2"/> <group group_id="5" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="2" y_min="5.2"/>
<group group_id="6" room_id="2" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="4" /> <group group_id="6" room_id="2" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="4" />
<group group_id="7" room_id="1" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" start_x="4.5" start_y="-1.63" goal_id="4" /> <group group_id="7" room_id="1" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" start_x="4.5" start_y="-1.63" goal_id="4" />
</agents_distribution> </agents_distribution>
<agents_sources><!-- frequency in persons/seconds --> <agents_sources><!-- frequency in persons/seconds -->
<source id="1" frequency="2" agents_max="80" group_id="6" caption="source 1" /> <source id="1" frequency="2" agents_max="2" group_id="6" caption="source 1" />
<source_ id="2" frequency="5" agents_max="80" group_id="5" caption="source 2" /> <source id="2" agent_id="26" time="5" group_id="5" caption="source 2" />
<source_ id="3" frequency="10" agents_max="50" group_id="3" caption="source 3" /> <source_ id="3" agent_id="27" time="3" group_id="5" caption="source 3" />
<source_ id="4" frequency="10" agents_max="50" group_id="4" caption="source 4" />
</agents_sources> </agents_sources>
</agents> </agents>
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
#include <iostream> #include <iostream>
AgentsSource::AgentsSource(int id, const std::string& caption,int max_agents,int group_id,int frequency, bool greedy): AgentsSource::AgentsSource(int id, const std::string& caption,int max_agents,int group_id,int frequency, bool greedy, double time, int agent_id):
_id(id), _frequency(frequency), _maxAgents(max_agents), _groupID(group_id), _caption(caption), _greedy(greedy) _id(id), _frequency(frequency), _maxAgents(max_agents), _groupID(group_id), _caption(caption), _greedy(greedy), _agent_id(agent_id), _time(time)
{ {
_agentsGenerated=0; _agentsGenerated=0;
_boundaries[0] = 0; _boundaries[0] = 0;
...@@ -133,6 +133,17 @@ int AgentsSource::GetId() const ...@@ -133,6 +133,17 @@ int AgentsSource::GetId() const
return _id; return _id;
} }
int AgentsSource::GetAgentId() const
{
return _agent_id;
}
double AgentsSource::GetPlanTime() const
{
return _time;
}
int AgentsSource::GetMaxAgents() const int AgentsSource::GetMaxAgents() const
{ {
return _maxAgents; return _maxAgents;
...@@ -163,11 +174,15 @@ void AgentsSource::Dump() const ...@@ -163,11 +174,15 @@ void AgentsSource::Dump() const
{ {
Log->Write("\n--------------------------"); Log->Write("\n--------------------------");
Log->Write("Dumping Source"); Log->Write("Dumping Source");
Log->Write("Caption: %s", this->GetCaption().c_str());
Log->Write("ID: %d", _id); Log->Write("ID: %d", _id);
Log->Write("Group ID: %d", _groupID); Log->Write("Group ID: %d", _groupID);
Log->Write("Frequency: %d", _frequency); Log->Write("Frequency: %d", _frequency);
Log->Write("Agents Max: %d", _maxAgents); Log->Write("Agents Max: %d", _maxAgents);
Log->Write("Agents Pool: %d", _agents.size()); Log->Write("Agents Pool: %d", _agents.size());
Log->Write("Agent id: %d", this->GetAgentId());
Log->Write("Time: %f", this->GetPlanTime());
Log->Write("\n--------------------------\n");
//getc(stdin); //getc(stdin);
} }
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
/** /**
* Constructor * Constructor
*/ */
AgentsSource(int id, const std::string& caption,int max_agents,int group_id,int frequency, bool greedy); AgentsSource(int id, const std::string& caption,int max_agents,int group_id,int frequency, bool greedy, double time, int agent_id);
/** /**
* Destructor * Destructor
...@@ -110,6 +110,8 @@ public: ...@@ -110,6 +110,8 @@ public:
int GetFrequency() const; int GetFrequency() const;
int GetGroupId() const; int GetGroupId() const;
int GetId() const; int GetId() const;
int GetAgentId() const;
double GetPlanTime() const;
int GetMaxAgents() const; int GetMaxAgents() const;
bool Greedy() const; bool Greedy() const;
void SetStartDistribution(std::shared_ptr<StartDistribution>); void SetStartDistribution(std::shared_ptr<StartDistribution>);
...@@ -125,6 +127,8 @@ private: ...@@ -125,6 +127,8 @@ private:
bool _greedy = false; bool _greedy = false;
int _agentsGenerated=0; int _agentsGenerated=0;
double _boundaries[4];// = { 0, 0, 0, 0 }; double _boundaries[4];// = { 0, 0, 0, 0 };
int _agent_id;
double _time;
std::vector<Pedestrian*> _agents; std::vector<Pedestrian*> _agents;
std::shared_ptr<StartDistribution> _startDistribution; std::shared_ptr<StartDistribution> _startDistribution;
......
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