Commit f68a5a85 authored by Mohcine Chraibi's avatar Mohcine Chraibi

fix inifile demo sources

group_id of source should be the same as group_id of agents
parent 7c4f1061
...@@ -51,7 +51,7 @@ bool GeoFileParser::LoadGeometry(Building* building) ...@@ -51,7 +51,7 @@ bool GeoFileParser::LoadGeometry(Building* building)
{ {
std::string geoFilenameWithPath = _configuration->GetProjectRootDir()+_configuration->GetGeometryFile(); std::string geoFilenameWithPath = _configuration->GetProjectRootDir()+_configuration->GetGeometryFile();
std::cout << "LodGeometry: file: " << geoFilenameWithPath << "\n"; std::cout << "\nLoadGeometry: file: " << geoFilenameWithPath << "\n";
TiXmlDocument docGeo(geoFilenameWithPath); TiXmlDocument docGeo(geoFilenameWithPath);
if (!docGeo.LoadFile()) { if (!docGeo.LoadFile()) {
......
...@@ -222,7 +222,7 @@ bool Simulation::InitArgs() ...@@ -222,7 +222,7 @@ bool Simulation::InitArgs()
_agentSrcManager.SetBuilding(_building.get()); _agentSrcManager.SetBuilding(_building.get());
_agentSrcManager.SetMaxSimTime(GetMaxSimTime()); _agentSrcManager.SetMaxSimTime(GetMaxSimTime());
_gotSources = (bool) distributor->GetAgentsSources().size(); // did we have any sources? false if no sources _gotSources = (bool) distributor->GetAgentsSources().size(); // did we have any sources? false if no sources
std::cout << " Got sources: " << _gotSources; std::cout << "\nGot " << _gotSources << " sources"<< std::endl ;
for (const auto& src: distributor->GetAgentsSources()) { for (const auto& src: distributor->GetAgentsSources()) {
_agentSrcManager.AddSource(src); _agentSrcManager.AddSource(src);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<!-- 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="final_goal">
<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>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<traffic_constraints> <traffic_constraints>
<!-- doors states are: close or open --> <!-- doors states are: close or open -->
<doors> <doors>
<!-- <door trans_id="1" caption="exit" state="open" /> --> <!-- <door trans_id="1" caption="exit" state="open" /> -->
</doors> </doors>
</traffic_constraints> </traffic_constraints>
...@@ -73,10 +73,12 @@ ...@@ -73,10 +73,12 @@
</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="6" 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="5" 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="5" 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="5" 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="6" agent_id="10" time="7" group_id="0" caption="source 6" startX="13" startY="5" />
</agents_sources> </agents_sources>
</agents> </agents>
......
...@@ -89,7 +89,7 @@ int main(int argc, char** argv) ...@@ -89,7 +89,7 @@ int main(int argc, char** argv)
std::thread t1(&AgentsSourcesManager::Run, &sim.GetAgentSrcManager()); std::thread t1(&AgentsSourcesManager::Run, &sim.GetAgentSrcManager());
while(!sim.GetAgentSrcManager().IsRunning()) while(!sim.GetAgentSrcManager().IsRunning())
{ {
// std::cout << "waiting...\n"; //std::cout << "waiting...\n";
} }
//main thread for the simulation //main thread for the simulation
evacTime = sim.RunStandardSimulation(simMaxTime); evacTime = sim.RunStandardSimulation(simMaxTime);
......
...@@ -57,13 +57,13 @@ void AgentsSourcesManager::Run() ...@@ -57,13 +57,13 @@ void AgentsSourcesManager::Run()
{ {
SetRunning(true); SetRunning(true);
Log->Write("INFO:\tStarting agent manager thread"); Log->Write("INFO:\tStarting agent manager thread");
/* std::cout<< KGRN << "\n Starting agent manager thread\n" << "\n>> time: " << Pedestrian::GetGlobalTime() << RESET << "\n"; */ std::cout<< KRED << "\n Starting agent manager thread\n" << ">> time: " << Pedestrian::GetGlobalTime() << RESET << "\n";
//Generate all agents required for the complete simulation //Generate all agents required for the complete simulation
//It might be more efficient to generate at each frequency step //It might be more efficient to generate at each frequency step
//TODO this loop is exactly GenerateAgents( --> REFACTOR) //TODO this loop is exactly GenerateAgents( --> REFACTOR)
for (const auto& src : _sources) for (const auto& src : _sources)
{ {
/* std::cout << "Generate AgentsAndAddToPool src: " << src->GetId() << "\n" ; */ std::cout << "Generate src: " << src->GetId() << "\n" ;
src->GenerateAgentsAndAddToPool(src->GetMaxAgents(), _building); src->GenerateAgentsAndAddToPool(src->GetMaxAgents(), _building);
} }
......
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