Skip to content

Commit

Permalink
fixing insertion if it fails for several steps #13491
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jun 28, 2023
1 parent f50be05 commit bb3a7d0
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 9 deletions.
9 changes: 3 additions & 6 deletions src/microsim/transportables/MSPModel_JuPedSim.cpp
Expand Up @@ -99,9 +99,7 @@ MSPModel_JuPedSim::tryInsertion(PState* state) {
JPS_ErrorMessage message = nullptr;
JPS_AgentId agentId = JPS_Simulation_AddVelocityModelAgent(myJPSSimulation, agent_parameters, &message);
if (message != nullptr) {
std::ostringstream oss;
oss << "Error while adding an agent: " << JPS_ErrorMessage_GetMessage(message);
WRITE_WARNING(oss.str());
WRITE_WARNINGF(TL("Error while adding an agent: %"), JPS_ErrorMessage_GetMessage(message));
JPS_ErrorMessage_Free(message);
} else {
state->setAgentId(agentId);
Expand Down Expand Up @@ -157,9 +155,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
// Perform one JuPedSim iteration.
bool ok = JPS_Simulation_Iterate(myJPSSimulation, &message);
if (!ok) {
std::ostringstream oss;
oss << "Error during iteration " << i << ": " << JPS_ErrorMessage_GetMessage(message);
WRITE_ERROR(oss.str());
WRITE_ERRORF(TL("Error during iteration %: %"), i, JPS_ErrorMessage_GetMessage(message));
}
}

Expand All @@ -170,6 +166,7 @@ MSPModel_JuPedSim::execute(SUMOTime time) {
PState* const state = *stateIt;
if (state->isWaitingToEnter()) {
tryInsertion(state);
++stateIt;
continue;
}
// Updates the agent position.
Expand Down
@@ -1 +1,8 @@
Warning: Error while adding an agent: Model constraint violation: Agent 2 too close to agent 1
Warning: Error while adding an agent: Model constraint violation: Agent 3 too close to agent 1
Warning: Error while adding an agent: Model constraint violation: Agent 4 too close to agent 1
Warning: Error while adding an agent: Model constraint violation: Agent 6 too close to agent 5
Warning: Error while adding an agent: Model constraint violation: Agent 7 too close to agent 5
Warning: Error while adding an agent: Model constraint violation: Agent 8 too close to agent 5
Warning: Error while adding an agent: Model constraint violation: Agent 9 too close to agent 5
Warning: Error while adding an agent: Model constraint violation: Agent 11 too close to agent 10

0 comments on commit bb3a7d0

Please sign in to comment.