Commit 85977972 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Resolve "Sources"

parent 2ee17177
...@@ -89,6 +89,13 @@ void IODispatcher::WriteFooter() ...@@ -89,6 +89,13 @@ void IODispatcher::WriteFooter()
it->WriteFooter(); it->WriteFooter();
} }
} }
void IODispatcher::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources)
{
for(auto const it : _outputHandlers)
{
it->WriteSources(sources);
}
}
string TrajectoriesJPSV04::WritePed(Pedestrian* ped) string TrajectoriesJPSV04::WritePed(Pedestrian* ped)
...@@ -363,7 +370,22 @@ void TrajectoriesFLAT::WriteFooter() ...@@ -363,7 +370,22 @@ void TrajectoriesFLAT::WriteFooter()
{ {
} }
void TrajectoriesFLAT::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources)
{
}
void TrajectoriesVTK::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources)
{
}
void TrajectoriesJPSV06::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources)
{
}
void TrajectoriesXML_MESH::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources)
{
}
/** /**
* VTK Implementation of the geometry and trajectories * VTK Implementation of the geometry and trajectories
...@@ -620,7 +642,21 @@ void TrajectoriesJPSV05::WriteHeader(long nPeds, double fps, Building* building, ...@@ -620,7 +642,21 @@ void TrajectoriesJPSV05::WriteHeader(long nPeds, double fps, Building* building,
tmp.append("\t</header>\n"); tmp.append("\t</header>\n");
_outputHandler->Write(tmp); _outputHandler->Write(tmp);
} }
void TrajectoriesJPSV05::WriteSources(const std::vector<std::shared_ptr<AgentsSource> > sources)
{
std::string tmp("");
for (const auto& src: sources) {
auto BB = src->GetBoundaries();
tmp += "<source id=\"" + std::to_string(src->GetId()) +
"\" caption=\"" + src->GetCaption() + "\"" +
" x_min=\"" + to_string(BB[0]) + "\"" +
" x_max=\"" + to_string(BB[1]) + "\"" +
" y_min=\"" + to_string(BB[2]) + "\"" +
" y_max=\"" + to_string(BB[3]) + "\" />\n";
}
_outputHandler->Write(tmp);
}
void TrajectoriesJPSV05::WriteGeometry(Building* building) void TrajectoriesJPSV05::WriteGeometry(Building* building)
{ {
// just put a link to the geometry file // just put a link to the geometry file
...@@ -645,7 +681,9 @@ void TrajectoriesJPSV05::WriteGeometry(Building* building) ...@@ -645,7 +681,9 @@ void TrajectoriesJPSV05::WriteGeometry(Building* building)
embed_geometry.append("\t</geometry>\n"); embed_geometry.append("\t</geometry>\n");
_outputHandler->Write(embed_geometry); _outputHandler->Write(embed_geometry);
//write sources
// if(building->G )
//
_outputHandler->Write("\t<AttributeDescription>"); _outputHandler->Write("\t<AttributeDescription>");
_outputHandler->Write("\t\t<property tag=\"x\" description=\"xPosition\"/>"); _outputHandler->Write("\t\t<property tag=\"x\" description=\"xPosition\"/>");
_outputHandler->Write("\t\t<property tag=\"y\" description=\"yPosition\"/>"); _outputHandler->Write("\t\t<property tag=\"y\" description=\"yPosition\"/>");
...@@ -695,4 +733,3 @@ void TrajectoriesJPSV05::WriteFooter() ...@@ -695,4 +733,3 @@ void TrajectoriesJPSV05::WriteFooter()
{ {
_outputHandler->Write("</trajectories>\n"); _outputHandler->Write("</trajectories>\n");
} }
...@@ -38,6 +38,8 @@ extern OutputHandler* Log; ...@@ -38,6 +38,8 @@ extern OutputHandler* Log;
class Trajectories; class Trajectories;
class AgentsSource;
class IODispatcher class IODispatcher
{ {
private: private:
...@@ -53,6 +55,8 @@ public: ...@@ -53,6 +55,8 @@ public:
void WriteGeometry(Building* building); void WriteGeometry(Building* building);
void WriteFrame(int frameNr, Building* building); void WriteFrame(int frameNr, Building* building);
void WriteFooter(); void WriteFooter();
void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >);
}; };
class Trajectories class Trajectories
...@@ -67,8 +71,9 @@ public: ...@@ -67,8 +71,9 @@ public:
virtual void WriteGeometry(Building* building)=0; virtual void WriteGeometry(Building* building)=0;
virtual void WriteFrame(int frameNr, Building* building)=0; virtual void WriteFrame(int frameNr, Building* building)=0;
virtual void WriteFooter()=0; virtual void WriteFooter()=0;
virtual void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >)=0;
void Write(const std::string& str) void Write(const std::string& str)
{ {
_outputHandler->Write(str); _outputHandler->Write(str);
} }
...@@ -120,6 +125,7 @@ public: ...@@ -120,6 +125,7 @@ public:
virtual void WriteGeometry(Building* building); virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building); virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter(); virtual void WriteFooter();
virtual void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >);
}; };
...@@ -137,6 +143,7 @@ public: ...@@ -137,6 +143,7 @@ public:
virtual void WriteGeometry(Building* building); virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building); virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter(); virtual void WriteFooter();
virtual void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >);
}; };
...@@ -154,6 +161,7 @@ public: ...@@ -154,6 +161,7 @@ public:
virtual void WriteGeometry(Building* building); virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building); virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter(); virtual void WriteFooter();
virtual void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >);
}; };
...@@ -174,6 +182,7 @@ public: ...@@ -174,6 +182,7 @@ public:
//virtual void WriteFrame(int frameNr, Building* building); //virtual void WriteFrame(int frameNr, Building* building);
//virtual void WriteFooter(); //virtual void WriteFooter();
virtual void WriteGeometry(Building* building); virtual void WriteGeometry(Building* building);
virtual void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >);
}; };
class TrajectoriesJPSV06: public Trajectories class TrajectoriesJPSV06: public Trajectories
...@@ -187,6 +196,8 @@ public: ...@@ -187,6 +196,8 @@ public:
virtual void WriteGeometry(Building* building); virtual void WriteGeometry(Building* building);
virtual void WriteFrame(int frameNr, Building* building); virtual void WriteFrame(int frameNr, Building* building);
virtual void WriteFooter(); virtual void WriteFooter();
virtual void WriteSources(const std::vector<std::shared_ptr<AgentsSource> >);
}; };
#endif /* _IODISPATCHER_H */ #endif /* _IODISPATCHER_H */
...@@ -55,7 +55,7 @@ std::string ver_string(int a, int b, int c) { ...@@ -55,7 +55,7 @@ std::string ver_string(int a, int b, int c) {
std::string true_cxx = std::string true_cxx =
#ifdef __clang__ #ifdef __clang__
"clang++"; "clang++";
#elif defined(__GNU__) #elif defined(__GNUC__)
"g++"; "g++";
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
"MinGW"; "MinGW";
...@@ -69,7 +69,7 @@ std::string true_cxx = ...@@ -69,7 +69,7 @@ std::string true_cxx =
std::string true_cxx_ver = std::string true_cxx_ver =
#ifdef __clang__ #ifdef __clang__
ver_string(__clang_major__, __clang_minor__, __clang_patchlevel__); ver_string(__clang_major__, __clang_minor__, __clang_patchlevel__);
#elif defined(__GNU__) #elif defined(__GNUC__)
ver_string(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); ver_string(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
ver_string(__MINGW32__, __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION); ver_string(__MINGW32__, __MINGW32_MAJOR_VERSION, __MINGW32_MINOR_VERSION);
......
...@@ -170,20 +170,74 @@ bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDist ...@@ -170,20 +170,74 @@ bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDist
int group_id = xmltoi(e->Attribute("group_id"), -1); int group_id = xmltoi(e->Attribute("group_id"), -1);
string caption = xmltoa(e->Attribute("caption"), "no caption"); string caption = xmltoa(e->Attribute("caption"), "no caption");
string str_greedy = xmltoa(e->Attribute("greedy"), "false"); string str_greedy = xmltoa(e->Attribute("greedy"), "false");
float percent = xmltof(e->Attribute("percent"), 1);
float rate = xmltof(e->Attribute("rate"), 1);
double time = xmltof(e->Attribute("time"), 0); double time = xmltof(e->Attribute("time"), 0);
int agent_id = xmltoi(e->Attribute("agent_id"), -1); int agent_id = xmltoi(e->Attribute("agent_id"), -1);
float startx = xmltof(e->Attribute("startX"), std::numeric_limits<float>::quiet_NaN()); float startx = xmltof(e->Attribute("startX"), std::numeric_limits<float>::quiet_NaN());
float starty = xmltof(e->Attribute("startY"), std::numeric_limits<float>::quiet_NaN()); float starty = xmltof(e->Attribute("startY"), std::numeric_limits<float>::quiet_NaN());
bool greedy = (str_greedy == "true")?true:false; bool greedy = (str_greedy == "true")?true:false;
float xmin = xmltof(e->Attribute("x_min"), std::numeric_limits<float>::lowest());
float xmax = xmltof(e->Attribute("x_max"), std::numeric_limits<float>::max());
float ymin = xmltof(e->Attribute("y_min"), std::numeric_limits<float>::lowest());
float ymax = xmltof(e->Attribute("y_max"), std::numeric_limits<float>::max());
float chunkAgents = xmltof(e->Attribute("N_create"), 1);
int timeMin = xmltof(e->Attribute("time_min"), std::numeric_limits<int>::min());
int timeMax = xmltof(e->Attribute("time_max"), std::numeric_limits<int>::max());
std::vector<float> boundaries = {xmin, xmax, ymin, ymax};
std::vector<int> lifeSpan = {timeMin, timeMax};
float SizeBB = 1;
bool isBigEnough = (abs(xmin-xmax) > SizeBB) && (abs(ymin-ymax) > SizeBB);
if(!isBigEnough )
{
Log->Write("Warning: Source %d got too small bounding box.\n\t BB [Dx, Dy] should be such Dx>%.2f and Dy>%.2f. Ignoring BB!!", id, SizeBB, SizeBB);
xmin = std::numeric_limits<float>::min();
xmax = std::numeric_limits<float>::max();
ymin = std::numeric_limits<float>::min();
ymax = std::numeric_limits<float>::max();
}
if(timeMin > timeMax)
{
Log->Write("Warning: Source %d given wrong life span. Assuming timeMin = timeMax.", id);
timeMin = timeMax;
}
if(time > 0)
{
timeMin = std::numeric_limits<int>::min();
timeMax = std::numeric_limits<int>::max();
Log->Write("Warning: Source %d. Planned time %d. Ignoring timeMin and timeMax (in case they are specified)", id, time);
}
if (agent_id >= 0){ if (agent_id >= 0){
agents_max = 1; agents_max = 1;
frequency = 1; frequency = 1;
}
if(percent > 1)
{
Log->Write("Warning: Source %d. Passed erronuous percent <%.2f>. Set percent=1", id, percent);
percent = 1.0;
}
else if(percent < 0)
{
Log->Write("Warning: Source %d. Passed erronuous percent <%.2f>. Set percent=0 (this source is kinda inactive)", id, percent);
percent = 0.0;
} }
auto source = std::shared_ptr<AgentsSource>( auto source = std::shared_ptr<AgentsSource>(
new AgentsSource(id, caption, agents_max, group_id, new AgentsSource(id,
frequency, greedy, time, agent_id, startx, starty)); caption,
agents_max,
group_id,
frequency,
greedy,
time,
agent_id,
startx,
starty,
percent,
rate,
chunkAgents,
boundaries,
lifeSpan));
startDisSources.push_back(source); startDisSources.push_back(source);
Log->Write("INFO:\tSource with id %d will be parsed (greedy = %d)!", id, greedy); Log->Write("INFO:\tSource with id %d will be parsed (greedy = %d)!", id, greedy);
} }
} }
......
...@@ -112,7 +112,7 @@ bool Simulation::InitArgs() ...@@ -112,7 +112,7 @@ bool Simulation::InitArgs()
case FORMAT_XML_PLAIN: { case FORMAT_XML_PLAIN: {
OutputHandler* travisto = new SocketHandler(_config->GetHostname(), OutputHandler* travisto = new SocketHandler(_config->GetHostname(),
_config->GetPort()); _config->GetPort());
Trajectories* output = new TrajectoriesJPSV06(); Trajectories* output = new TrajectoriesJPSV05();
output->SetOutputHandler(travisto); output->SetOutputHandler(travisto);
_iod->AddIO(output); _iod->AddIO(output);
break; break;
...@@ -338,6 +338,9 @@ void Simulation::UpdateRoutesAndLocations() ...@@ -338,6 +338,9 @@ void Simulation::UpdateRoutesAndLocations()
} }
} }
// actualize routes for sources
if(_gotSources)
ped->FindRoute();
//finally actualize the route //finally actualize the route
if ( !_gotSources && ped->FindRoute() == -1) { if ( !_gotSources && ped->FindRoute() == -1) {
//a destination could not be found for that pedestrian //a destination could not be found for that pedestrian
...@@ -419,6 +422,8 @@ void Simulation::RunHeader(long nPed) ...@@ -419,6 +422,8 @@ void Simulation::RunHeader(long nPed)
if (nPed==-1) nPed = _nPeds; if (nPed==-1) nPed = _nPeds;
_iod->WriteHeader(nPed, _fps, _building.get(), _seed); _iod->WriteHeader(nPed, _fps, _building.get(), _seed);
_iod->WriteGeometry(_building.get()); _iod->WriteGeometry(_building.get());
if( _gotSources)
_iod->WriteSources( GetAgentSrcManager().GetSources());
int writeInterval = (int) ((1./_fps)/_deltaT+0.5); int writeInterval = (int) ((1./_fps)/_deltaT+0.5);
writeInterval = (writeInterval<=0) ? 1 : writeInterval; // mustn't be <= 0 writeInterval = (writeInterval<=0) ? 1 : writeInterval; // mustn't be <= 0
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<max_sim_time>5000</max_sim_time> <max_sim_time>5000</max_sim_time>
<!-- trajectories file and format --> <!-- trajectories file and format -->
<trajectories format="xml-plain" fps="16" color_mode="final_goal"> <trajectories format="xml-plain" fps="16" color_mode="group">
<file location="trajectories.xml" /> <file location="trajectories.xml" />
<!-- <socket_ hostname="127.0.0.1" port="8989" /> --> <!-- <socket_ hostname="127.0.0.1" port="8989" /> -->
</trajectories> </trajectories>
...@@ -69,16 +69,32 @@ ...@@ -69,16 +69,32 @@
<!--persons information and distribution --> <!--persons information and distribution -->
<agents operational_model_id="3"> <agents operational_model_id="3">
<agents_distribution> <agents_distribution>
<group group_id="0" room_id="0" subroom_id="0" number="20" router_id="1" agent_parameter_id="1" x_min="3" x_max="5" y_min="3" y_max="5" /> <group group_id="5" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" x_min="3" x_max="5" y_min="3" y_max="5" />
<group group_id="0" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="1" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="2" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="3" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
<group group_id="4" room_id="0" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" />
</agents_distribution> </agents_distribution>
<agents_sources><!-- frequency in persons/seconds --> <agents_sources><!-- frequency in persons/seconds -->
<source id="1" frequency="2" agents_max="5" group_id="0" caption="source 1" /> <!-- <source id="1" frequency="2" agents_max="5" group_id="0" caption="source 1" /> -->
<source id="2" agent_id="3" time="5" group_id="0" caption="source 2" /> <!-- <source id="2" agent_id="3" time="5" group_id="0" caption="source 2" /> -->
<source id="3" agent_id="2" time="3" group_id="0" caption="source 3" /> <!-- <source id="3" agent_id="2" time="3" group_id="0" caption="source 3" /> -->
<source id="4" agent_id="8" time="7" group_id="0" caption="source 4" /> <!-- <source id="4" agent_id="8" time="7" group_id="0" caption="source 4" /> -->
<source id="5" agent_id="9" time="7" group_id="0" caption="source 5" startX="8" startY="5.4" /> <!-- <source id="5" agent_id="9" time="7" group_id="0" caption="source 5" startX="8" startY="5.4" /> -->
<source id="6" agent_id="10" time="7" group_id="0" caption="source 6" startX="13" startY="5" /> <!-- <source id="6" agent_id="10" time="7" group_id="0" caption="source 6" startX="13" startY="5" /> -->
<source id="10" caption="new-source" time_min="5" time_max="30" frequency="5" N_create="10" agents_max="300"
group_id="0" x_min="0" x_max="3" y_min="0" y_max="3" percent="0.5" rate="2" greedy="true"/>
<source id="11" caption="new-source 2" time_min="5" time_max="30" frequency="7" N_create="10" agents_max="300"
group_id="1" x_min="6" x_max="9" y_min="6" y_max="9" percent="0.5" rate="2" greedy="true"/>
<source id="12" caption="new-source 3" time_min="5" time_max="30" frequency="9" N_create="10" agents_max="300"
group_id="2" x_min="6" x_max="9" y_min="0" y_max="3" percent="0.5" rate="2" greedy="true"/>
<source id="13" caption="new-source 4" time_min="5" time_max="30" frequency="11" N_create="10" agents_max="300"
group_id="3" x_min="0" x_max="3" y_min="6" y_max="9" percent="0.5" rate="2" greedy="true"/>
<source id="14" caption="nlow-source 5" time_min="5" time_max="30" frequency="11" N_create="10" agents_max="300"
group_id="4" x_min="3.5" x_max="5.5" y_min="3.5" y_max="5.5" percent="0.5" rate="2" greedy="true"/>
</agents_sources> </agents_sources>
</agents> </agents>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="boost" version="1.68.0.0" targetFramework="native" /> <package id="boost" version="1.68.0.0" targetFramework="native" />
<package id="boost_filesystem-vc141" version="1.68.0.0" targetFramework="native" /> </packages>
<package id="boost_system-vc141" version="1.68.0.0" targetFramework="native" />
</packages>
\ No newline at end of file
...@@ -30,15 +30,27 @@ ...@@ -30,15 +30,27 @@
#include "AgentsSource.h" #include "AgentsSource.h"
#include "Pedestrian.h" #include "Pedestrian.h"
AgentsSource::AgentsSource(int id, const std::string& caption,int max_agents,int group_id,int frequency, bool greedy, double time, int agent_id, float startx, float starty): AgentsSource::AgentsSource(int id,
_id(id), _frequency(frequency), _maxAgents(max_agents), _groupID(group_id), _caption(caption), _greedy(greedy), _agent_id(agent_id), _time(time), _startx(startx), _starty(starty) const std::string& caption,
int max_agents,
int group_id,
int frequency,
bool greedy,
double time,
int agent_id,
float startx,
float starty,
float percent,
float rate,
int chunkAgents,
std::vector<float> boundaries,
std::vector<int> lifeSpan):
_id(id), _frequency(frequency), _maxAgents(max_agents), _groupID(group_id), _caption(caption), _greedy(greedy), _agent_id(agent_id), _time(time), _startx(startx), _starty(starty), _chunkAgents(chunkAgents), _percent(percent), _rate(rate)
{ {
_remainingAgents = _chunkAgents;
_agentsGenerated=0; _agentsGenerated=0;
_boundaries[0] = 0; _boundaries = boundaries;
_boundaries[1] = 0; _lifeSpan = lifeSpan;
_boundaries[2] = 0;
_boundaries[3] = 0;
_agents.clear(); _agents.clear();
} }
...@@ -97,17 +109,14 @@ void AgentsSource::SetAgentsGenerated(int agentsGenerated) ...@@ -97,17 +109,14 @@ void AgentsSource::SetAgentsGenerated(int agentsGenerated)
_agentsGenerated = agentsGenerated; _agentsGenerated = agentsGenerated;
} }
const double* AgentsSource::GetBoundaries() const const std::vector<float> AgentsSource::GetBoundaries() const
{ {
return _boundaries; return _boundaries;
} }
void AgentsSource::Setboundaries(double * bounds) void AgentsSource::Setboundaries(std::vector<float> bounds)
{ {
_boundaries[0]=bounds[0]; _boundaries=bounds;
_boundaries[1]=bounds[1];
_boundaries[2]=bounds[2];
_boundaries[3]=bounds[3];
} }
const std::string& AgentsSource::GetCaption() const const std::string& AgentsSource::GetCaption() const
...@@ -146,6 +155,38 @@ int AgentsSource::GetMaxAgents() const ...@@ -146,6 +155,38 @@ int AgentsSource::GetMaxAgents() const
return _maxAgents; return _maxAgents;
} }
int AgentsSource::GetChunkAgents() const
{
return _chunkAgents;
}
int AgentsSource::GetRemainingAgents() const
{
return _remainingAgents;
}
int AgentsSource::ResetRemainingAgents()
{
_remainingAgents = _chunkAgents;
}
void AgentsSource::UpdateRemainingAgents(int remaining)
{
_remainingAgents = (remaining < _remainingAgents)? _remainingAgents - remaining:0;
}
float AgentsSource::GetPercent() const
{
return _percent;
}
float AgentsSource::GetRate() const
{
return _rate;
}
std::vector<int> AgentsSource::GetLifeSpan() const
{
return _lifeSpan;
}
float AgentsSource::GetStartX() const float AgentsSource::GetStartX() const
{ {
return _startx; return _startx;
...@@ -195,7 +236,7 @@ void AgentsSource::GenerateAgents(std::vector<Pedestrian*>& peds, int count, Bui ...@@ -195,7 +236,7 @@ void AgentsSource::GenerateAgents(std::vector<Pedestrian*>& peds, int count, Bui
//std::cout << "AgentsSource::GenerateAgents Generates an Agent\n"; //std::cout << "AgentsSource::GenerateAgents Generates an Agent\n";
auto ped = GetStartDistribution()->GenerateAgent(building, &pid,emptyPositions); auto ped = GetStartDistribution()->GenerateAgent(building, &pid,emptyPositions);
if(ped->FindRoute()==-1) { if(ped->FindRoute()==-1) {
Log->Write("WARNING: Can not set destination for source agent %d", ped->GetID()); // Log->Write("WARNING: Can not set destination for source agent %d", ped->GetID());
// Sometimes the router can not find a target for ped // Sometimes the router can not find a target for ped
auto transitions = building->GetAllTransitions(); auto transitions = building->GetAllTransitions();
auto transition = transitions[0]; //dummy auto transition = transitions[0]; //dummy
...@@ -223,14 +264,24 @@ void AgentsSource::Dump() const ...@@ -223,14 +264,24 @@ 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(">> Caption : %s", this->GetCaption().c_str());
Log->Write("ID: %d", _id); Log->Write(">> Source 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(">> Agent id : %d", this->GetAgentId());
Log->Write("Time: %f", this->GetPlanTime()); Log->Write(">> Time : %.2f", this->GetPlanTime());
Log->Write(">> StartX : %.2f", this->GetStartX());
Log->Write(">> StartY : %.2f", this->GetStartY());
Log->Write(">> Percent : %.2f", this->GetPercent());
Log->Write(">> Rate : %.2f", this->GetRate());
Log->Write(">> N_create : %d", this->GetChunkAgents());
auto tmpB = this->GetBoundaries();
Log->Write(">> Boundaries : X-axis [%.4f -- %.4f]", tmpB[0], tmpB[1]) ;
Log->Write(" Y-axis [%.4f -- %.4f]", tmpB[2], tmpB[3]);
auto tmpL = this->GetLifeSpan();
Log->Write(">> LifeSpan : [%d -- %d]", tmpL[0], tmpL[1]);
Log->Write("\n--------------------------\n"); Log->Write("\n--------------------------\n");
//getc(stdin); //getc(stdin);
......
...@@ -49,7 +49,21 @@ public: ...@@ -49,7 +49,21 @@ public:
/** /**
* Constructor * Constructor
*/ */
AgentsSource(int id, const std::string& caption,int max_agents,int group_id,int frequency, bool greedy, double time, int agent_id, float startx, float starty); AgentsSource(int id,
const std::string& caption,
int max_agents,
int group_id,
int frequency,
bool greedy,
double time,
int agent_id,
float startx,
float starty,
float percent,
float rate,
int chunkAgents,
std::vector<float> boundaries,
std::vector<int> lifeSpan);
/** /**
* Destructor * Destructor
...@@ -64,7 +78,7 @@ public: ...@@ -64,7 +78,7 @@ public:
/** /**