Commit 1a169597 authored by Ulrich Kemloh's avatar Ulrich Kemloh

Cmakefile and futher cleanings

parent 35cd4dbf
......@@ -191,6 +191,12 @@ set ( source_files
voronoi/VoronoiDiagramGenerator.cpp
matsim/HybridSimulationManager.cpp
matsim/JPSserver.cpp
matsim/JPSclient.cpp
matsim/MATSimInterface.pb.cc
matsim/MATSimInterface.grpc.pb.cc
routing/AccessPoint.cpp
routing/DirectionStrategy.cpp
routing/DummyRouter.cpp
......@@ -267,6 +273,12 @@ set ( header_files
routing/cognitive_map/fire_mesh/Knot.h
routing/cognitive_map/fire_mesh/FireMeshStorage.h
matsim/JPSclient.h
matsim/MATSimInterface.grpc.pb.h
matsim/MATSimInterface.proto
matsim/HybridSimulationManager.h
matsim/JPSserver.h
matsim/MATSimInterface.pb.h
pedestrian/Pedestrian.h
pedestrian/PedDistributor.h
......@@ -332,7 +344,7 @@ add_executable(
jpscore main.cpp
)
target_link_libraries(jpscore core)
target_link_libraries(jpscore core grpc++_unsecure grpc gpr protobuf dl)
if(WIN32)
target_link_libraries (jpscore core wsock32)
......
......@@ -303,11 +303,6 @@ int Simulation::RunSimulation(double maxSimTime)
//time_t starttime, endtime;
//time(&starttime);
cout<<"nPeds: "<<_nPeds<<endl;
cout<<"manager: "<<_agentSrcManager.IsCompleted()<<endl;
cout<<"tmax: "<<maxSimTime<<endl;
cout<<"t: "<<t<<endl;
// main program loop
while ( (_nPeds || !_agentSrcManager.IsCompleted() ) && t < maxSimTime)
{
......@@ -465,7 +460,7 @@ void Simulation::UpdateRoutesAndLocations()
#pragma omp critical
pedsToRemove.push_back(ped);
//the agent left the old room
//actualize the egress time for that room
//actualize the eggress time for that room
allRooms.at(ped->GetRoomID())->SetEgressTime(ped->GetGlobalTime());
}
......
......@@ -2,8 +2,8 @@
<geometry version="0.5" caption="hybrid test" unit="m" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xsd.jupedsim.org/0.6/jps_geometry.xsd">
<rooms>
<room id="0" caption="hall">
<subroom id="0" closed="0" class="subroom">
<room id="0" caption="hall0">
<subroom id="0" closed="0" class="floor">
<polygon caption="wall">
<vertex px="0.0" py="2.8" />
<vertex px="0.0" py="0.0" />
......@@ -26,8 +26,8 @@
</polygon>
</subroom>
</room>
<room id="1" caption="hall">
<subroom id="0" closed="0" class="subroom">
<room id="1" caption="hall1">
<subroom id="0" closed="0" class="floor">
<polygon caption="wall">
<vertex px="3.6" py="-2.0" />
<vertex px="3.6" py="0.0" />
......@@ -38,8 +38,8 @@
</polygon>
</subroom>
</room>
<room id="2" caption="hall">
<subroom id="0" closed="0" class="subroom">
<room id="2" caption="hall2">
<subroom id="0" closed="0" class="floor">
<polygon caption="wall">
<vertex px="9.2" py="2.8" />
<vertex px="11.2" py="2.8" />
......@@ -50,8 +50,8 @@
</polygon>
</subroom>
</room>
<room id="3" caption="hall">
<subroom id="0" closed="0" class="subroom">
<room id="3" caption="hall3">
<subroom id="0" closed="0" class="floor">
<polygon caption="wall">
<vertex px="3.2" py="9.2" />
<vertex px="3.2" py="11.2" />
......@@ -62,8 +62,8 @@
</polygon>
</subroom>
</room>
<room id="4" caption="hall">
<subroom id="0" closed="0" class="subroom">
<room id="4" caption="hall4">
<subroom id="0" closed="0" class="floor">
<polygon caption="wall">
<vertex px="0.0" py="2.8" />
<vertex px="-2.0" py="2.8" />
......
......@@ -15,7 +15,7 @@
</trajectories>
<!-- Parameters for the hybrid (matsim) server mode -->
<hybrid_simulation server="localhost" port="9999" />
<hybrid_simulation server="zam597" port="9999" />
<!-- where to store the logs -->
<!--<logfile>outputfiles/log.txt</logfile> -->
......@@ -79,6 +79,7 @@
<!-- real start group -->
<group group_id="5" room_id="1" subroom_id="0" number="0" router_id="1" agent_parameter_id="1" goal_id="3" />
<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" />
</agents_distribution>
<agents_sources><!-- frequency in persons/seconds -->
......
......@@ -123,7 +123,8 @@ bool HybridSimulationManager::Run(Simulation& sim)
Log->Write("INFO:\tJuPedSim is up and running on " + jupedsim_service_address);
Log->Write("INFO:\tNotifying Matsim at " + extern_service_address);
if(false==_rpcClient->NotifyExternalService(_internalServerName,_internalServerPort))
//if(false==_rpcClient->NotifyExternalService(_exinternalServerName,_internalServerPort))
if(false==_rpcClient->NotifyExternalService("zam763",_internalServerPort))
{
Log->Write("ERROR:\tNotification failed");
}
......
......@@ -67,7 +67,7 @@ private:
int _externalServerPort=9999;
int _internalServerPort=9998;
std::string _externalServerName="localhost";
std::string _internalServerName="localhost";
std::string _internalServerName="zam763";
Building* _building=nullptr;
//TODO: the method should be passed bz reference in the main function
//std::unique_ptr<grpc::Server> _rpcServer;
......
......@@ -120,7 +120,7 @@ void AgentsSourcesManager::Run()
//std::this_thread::sleep_for(std::chrono::milliseconds(1));
} while (!finished);
Log->Write("INFO:\tTerminating agent manager thread");
_isCompleted = true;exit(0);
_isCompleted = true;//exit(0);
}
bool AgentsSourcesManager::ProcessAllSources() const
......
......@@ -246,10 +246,11 @@ Pedestrian* StartDistribution::GenerateAgent(Building* building, int* pid, vecto
start_pos) == false)
{
Log->Write(
"ERROR: \t cannot distribute pedestrian %d in Room %d at fixed position %s",
*pid, GetRoomId(), start_pos.toString().c_str());
"ERROR: \tStartDistribution::GenerateAgent cannot distribute pedestrian %d in Room %d /Subroom %d at fixed position %s",
*pid, GetRoomId(), GetSubroomID(), start_pos.toString().c_str());
Log->Write(
"ERROR: \t Make sure that the position is inside the geometry and belongs to the specified room / subroom");
"ERROR: \t Make sure that the position is inside the geometry "
"and belongs to the specified room %d/subroom %d",ped->GetRoomID(),ped->GetSubRoomID());
exit(EXIT_FAILURE);
}
......
......@@ -482,12 +482,12 @@ bool GlobalRouter::Init(Building* building)
}
//dumping the complete system
//DumpAccessPoints(-1); //exit(0);
//DumpAccessPoints(20); //exit(0);
//DumpAccessPoints(-1); exit(0);
//vector<string> rooms;
//rooms.push_back("hall");
//rooms.push_back("hall1");
//WriteGraphGV("routing_graph.gv",FINAL_DEST_OUT,rooms); exit(0);
//WriteGraphGV("routing_graph.gv",1,rooms);
//WriteGraphGV("routing_graph.gv",4,rooms);exit(0);
Log->Write("INFO:\tDone with the Global Router Engine!");
return true;
}
......@@ -760,7 +760,7 @@ int GlobalRouter::FindExit(Pedestrian* ped)
}
// else proceed as usual and return the closest navigation line
//ped->Dump(9);//ped->Dump(9);
//ped->Dump(1);//ped->Dump(9);
int nextDestination = ped->GetNextDestination();
// if(ped->GetGlobalTime()>80){
// ped->Dump(2);
......@@ -916,11 +916,14 @@ int GlobalRouter::GetBestDefaultRandomExit(Pedestrian* ped)
}
}
if (bestAPsID != -1) {
if (bestAPsID != -1)
{
ped->SetExitIndex(bestAPsID);
ped->SetExitLine(_accessPoints[bestAPsID]->GetNavLine());
return bestAPsID;
} else {
}
else
{
if (_building->GetRoom(ped->GetRoomID())->GetCaption() != "outside")
Log->Write(
"ERROR:\t GetBestDefaultRandomExit() \nCannot find valid destination for ped [%d] "
......@@ -1020,12 +1023,12 @@ void GlobalRouter::GetRelevantRoutesTofinalDestination(Pedestrian *ped, vector<A
}
}
}
// if(relevantAPS.size()==2){
// cout<<"alternative wege: "<<relevantAPS.size()<<endl;
// cout<<"ap1: "<<relevantAPS[0]->GetID()<<endl;
// cout<<"ap2: "<<relevantAPS[1]->GetID()<<endl;
// getc(stdin);
// }
// if(relevantAPS.size()==2){
// cout<<"alternative wege: "<<relevantAPS.size()<<endl;
// cout<<"ap1: "<<relevantAPS[0]->GetID()<<endl;
// cout<<"ap2: "<<relevantAPS[1]->GetID()<<endl;
// getc(stdin);
// }
}
SubRoom* GlobalRouter::GetCommonSubRoom(Crossing* c1, Crossing* c2)
......@@ -1092,22 +1095,7 @@ void GlobalRouter::WriteGraphGV(string filename, int finalDestination,
int from_door = from_AP->GetID();
// check for valid room
NavLine* nav = from_AP->GetNavLine();
int room_id = -1;
if (dynamic_cast<Crossing*>(nav) != NULL) {
room_id = ((Crossing*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Hline*>(nav) != NULL) {
room_id = ((Hline*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Transition*>(nav) != NULL) {
room_id = ((Transition*) (nav))->GetRoom1()->GetID();
} else {
cout << "WARNING: Unkown navigation line type" << endl;
continue;
}
int room_id = from_AP->GetConnectingRoom1();
if (IsElementInVector(rooms_ids, room_id) == false)
continue;
......@@ -1137,25 +1125,11 @@ void GlobalRouter::WriteGraphGV(string filename, int finalDestination,
// check that all connecting aps are contained in the room_ids list
// if not marked as sink.
bool isSink = true;
for (unsigned int j = 0; j < from_aps.size(); j++) {
NavLine* nav = from_aps[j]->GetNavLine();
int room_id = -1;
if (dynamic_cast<Crossing*>(nav) != NULL) {
room_id = ((Crossing*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Hline*>(nav) != NULL) {
room_id = ((Hline*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Transition*>(nav) != NULL) {
room_id = ((Transition*) (nav))->GetRoom1()->GetID();
} else {
cout << "WARNING: Unkown navigation line type" << endl;
continue;
}
if (IsElementInVector(rooms_ids, room_id) == true) {
for (unsigned int j = 0; j < from_aps.size(); j++)
{
int room_id = from_aps[j]->GetConnectingRoom1();
if (IsElementInVector(rooms_ids, room_id) == true)
{
isSink = false;
break;
}
......@@ -1182,24 +1156,7 @@ void GlobalRouter::WriteGraphGV(string filename, int finalDestination,
AccessPoint* from_AP = itr.second;
int from_door = from_AP->GetID();
NavLine* nav = from_AP->GetNavLine();
int room_id = -1;
if (dynamic_cast<Crossing*>(nav) != NULL) {
room_id = ((Crossing*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Hline*>(nav) != NULL) {
room_id = ((Hline*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Transition*>(nav) != NULL) {
room_id = ((Transition*) (nav))->GetRoom1()->GetID();
} else {
cout << "WARNING: Unkown navigation line type" << endl;
continue;
}
int room_id = from_AP->GetConnectingRoom1();
if (IsElementInVector(rooms_ids, room_id) == false)
continue;
......@@ -1212,22 +1169,7 @@ void GlobalRouter::WriteGraphGV(string filename, int finalDestination,
{
int to_door = to_AP->GetID();
NavLine* nav = to_AP->GetNavLine();
int room_id = -1;
if (dynamic_cast<Crossing*>(nav) != NULL) {
room_id = ((Crossing*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Hline*>(nav) != NULL) {
room_id = ((Hline*) (nav))->GetRoom1()->GetID();
} else if (dynamic_cast<Transition*>(nav) != NULL) {
room_id = ((Transition*) (nav))->GetRoom1()->GetID();
} else {
cout << "WARNING: Unkown navigation line type" << endl;
continue;
}
int room_id = to_AP->GetConnectingRoom1();
if (IsElementInVector(rooms_ids, room_id) == false)
continue;
......
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