Skip to content

Commit

Permalink
Swiss code cutout (#240)
Browse files Browse the repository at this point in the history
* adding configuration to prevent vehicles waiting to enter traffic

Basically telling qsim to put vehicles directly on the link and not to
wait for space in the buffer to enter traffic

* update changelog
  • Loading branch information
balacmi committed Aug 6, 2024
1 parent 464df6c commit ef86b74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ included in the (note yet determined) next version number.

- Emissions tools have been moved to core package (from ile_de_france)
- Switched to MATSim 2025 (PR)
- In switzerland one can now switch off vehicles waiting to enter traffic

**1.5.0**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@
import org.matsim.core.config.CommandLine.ConfigurationException;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.QSimConfigGroup;
import org.matsim.core.controler.Controler;
import org.matsim.core.scenario.ScenarioUtils;

public class RunSimulation {
static public void main(String[] args) throws ConfigurationException {
// set preventwaitingtoentertraffic to y if you want to to prevent that waiting traffic has to wait for space in the link buffer
// this is especially important to avoid high waiting times when we cutout scenarios from a larger scenario.
CommandLine cmd = new CommandLine.Builder(args) //
.requireOptions("config-path") //
.allowPrefixes("mode-parameter", "cost-parameter") //
.allowPrefixes("mode-parameter", "cost-parameter", "preventwaitingtoentertraffic") //
.build();

SwitzerlandConfigurator configurator = new SwitzerlandConfigurator();
Config config = ConfigUtils.loadConfig(cmd.getOptionStrict("config-path"), configurator.getConfigGroups());
configurator.addOptionalConfigGroups(config);
cmd.applyConfiguration(config);

if (cmd.hasOption("preventwaitingtoentertraffic")) {
if (cmd.getOption("preventwaitingtoentertraffic").get().equals("y")) {
((QSimConfigGroup) config.getModules().get(QSimConfigGroup.GROUP_NAME))
.setPcuThresholdForFlowCapacityEasing(1.0);
}
}

Scenario scenario = ScenarioUtils.createScenario(config);

configurator.configureScenario(scenario);
Expand Down

0 comments on commit ef86b74

Please sign in to comment.