Skip to content

Commit

Permalink
using period instead of frequency to make it more consistent with the…
Browse files Browse the repository at this point in the history
… rest #12
  • Loading branch information
behrisch committed Feb 8, 2024
1 parent af8430a commit 142c170
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/microsim/transportables/MSPModel_JuPedSim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
if (elapsedTime >= vanishingArea.second.period) {
const JPS_AgentId agentID = JPS_AgentIdIterator_Next(agentsInVanishingAreaIterator);
if (agentID != 0) {
auto lambda = [agentID](PState* p) { return p->getAgentId() == agentID; };
auto lambda = [agentID](PState * p) {
return p->getAgentId() == agentID;
};
std::vector<PState*>::const_iterator iterator = std::find_if(myPedestrianStates.begin(), myPedestrianStates.end(), lambda);
PState* state = *iterator;
MSPerson* person = state->getPerson();
Expand Down Expand Up @@ -824,7 +826,7 @@ MSPModel_JuPedSim::initialize() {
for (const auto& polygonWithID : myNetwork->getShapeContainer().getPolygons()) {
if (polygonWithID.second->getShapeType() == "jupedsim.vanishing_area") {
std::vector<JPS_Point> vanishingAreaBoundary = convertToJPSPoints(polygonWithID.second->getShape());
SUMOTime period = (SUMOTime)(1.0 / std::stod(polygonWithID.second->getParameter("frequency", "1.0"))) * 1000; // SUMOTime is in ms.
SUMOTime period = string2time(polygonWithID.second->getParameter("period", "1"));
myVanishingAreas.insert(std::make_pair(polygonWithID.second->getID(), VanishingAreaData{vanishingAreaBoundary, period}));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<additional xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/additional_file.xsd">
<!-- Shapes -->
<poly id="jupedsim.vanishing_area_1" type="jupedsim.vanishing_area" color="green" fill="1" layer="3.00" shape="1712.012992,2043.376863 1710.643636,2048.207646 1723.234102,2051.897299 1724.755608,2046.952403 1712.012992,2043.376863">
<param key="frequency" value="0.33"/>
<param key="period" value="3"/>
</poly>
<!-- JuPedSim elements -->
<poly id="jps.walkable_area_0" type="jupedsim.walkable_area" color="179,217,255" fill="1" layer="1.00" shape="1709.216847,2047.782243 1707.204938,2054.823926 1722.042769,2058.879180 1724.086114,2052.026114 1709.216847,2047.782243"/>
Expand Down

0 comments on commit 142c170

Please sign in to comment.