private void initSimTimer() { QSimConfigGroup qSimConfigGroup = this.scenario.getConfig().qsim(); Double configuredStartTime = qSimConfigGroup.getStartTime(); this.stopTime = qSimConfigGroup.getEndTime(); if (configuredStartTime == Time.UNDEFINED_TIME) { configuredStartTime = 0.0; } if ((this.stopTime == Time.UNDEFINED_TIME) || (this.stopTime == 0)) { this.stopTime = Double.MAX_VALUE; } double simStartTime; if (QSimConfigGroup.StarttimeInterpretation.maxOfStarttimeAndEarliestActivityEnd.equals(qSimConfigGroup.getSimStarttimeInterpretation())) { double firstAgentStartTime = calculateFirstAgentStartTime(); simStartTime = Math.floor(Math.max(configuredStartTime, firstAgentStartTime)); } else if (QSimConfigGroup.StarttimeInterpretation.onlyUseStarttime.equals(qSimConfigGroup.getSimStarttimeInterpretation())) { simStartTime = configuredStartTime; } else { throw new RuntimeException("unkonwn starttimeInterpretation; aborting ..."); } this.simTimer.setSimStartTime(simStartTime); this.simTimer.setTime(simStartTime); }
|| qsim.getScenario().getConfig().qsim().getSimStarttimeInterpretation()==StarttimeInterpretation.onlyUseStarttime) { this.engines.get(i).registerLinkAsActive(qLink);
@Override public void checkConsistency(Config config) { new BeanValidationConfigConsistencyChecker().checkConsistency(config); if (config.qsim().getStartTime() != 0 && !Time.isUndefinedTime(config.qsim().getStartTime())) { // If properly handled this should not be a concern log.warn("QSim.startTime should be 0:00:00 (or 0). This is what typically DynAgents assume"); } if (config.qsim().getTimeStepSize() != 1) { // If properly handled this should not be a concern log.warn("QSim.timeStepSize should be 1. This is what typically DynAgents assume"); } if (config.qsim().getSimStarttimeInterpretation() != StarttimeInterpretation.onlyUseStarttime) { throw new RuntimeException("DynAgents require simulation to start from the very beginning" + " Set 'QSim.simStarttimeInterpretation' to " + StarttimeInterpretation.onlyUseStarttime); } } }