Commit 05e16522 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

Merge branch 'artery_upstream' into 'master'

Artery upstream

See merge request !159
parents 80b09f17 1cb2f9fc
Pipeline #532965 passed with stages
in 131 minutes and 17 seconds
......@@ -482,6 +482,11 @@ public class TestClient extends org.vadere.manager.client.AbstractTestClient imp
System.out.println(res.toString());
}
@Override
public void simulationapi_getTimeMs(String[] args) throws IOException {
}
@Override
public void simulationapi_getSimSte(String[] args) throws IOException {
......
......@@ -153,6 +153,21 @@ public class SimulationCommandHandler extends CommandHandler<SimulationVar> {
return cmd;
}
@SimulationHandler(cmd = TraCICmd.GET_SIMULATION_VALUE, var = SimulationVar.TIME_MS,
name = "getTimeMs", ignoreElementId = true)
public TraCICommand process_getSimTimeMs(TraCIGetCommand cmd, RemoteManager remoteManager) {
// default to 0 ms in case simulation is not started jet
cmd.setResponse(responseOK(SimulationVar.TIME_MS.type, 0));
boolean ret = remoteManager.accessState((manager, state) -> {
// BigDecimal to ensure correct comparison in omentpp
int timeInMilliSeconds = (int)state.getSimTimeInSec() * 1000;
cmd.setResponse(responseOK(SimulationVar.TIME_MS.type, timeInMilliSeconds));
});
return cmd;
}
@SimulationHandler(cmd = TraCICmd.GET_SIMULATION_VALUE, var = SimulationVar.DELTA_T,
name = "getSimSte", ignoreElementId = true)
public TraCICommand process_getSimStep(TraCIGetCommand cmd, RemoteManager remoteManager) {
......
......@@ -7,6 +7,7 @@ import org.vadere.state.traci.TraCIDataType;
public enum SimulationVar {
TIME(0x66, TraCIDataType.DOUBLE),
TIME_MS(0x70, TraCIDataType.INTEGER),
DELTA_T(0x7b, TraCIDataType.DOUBLE), //step length
NUM_LOADED_VEHICLES(0x71, TraCIDataType.INTEGER),
LOADED_VEHICLES_IDS(0x72, TraCIDataType.STRING_LIST),
......
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