Commit 5de7f7a5 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

update VadereConsole: delete unused arguements and add an output-dir...

update VadereConsole: delete unused arguements and add an output-dir arguement, maven will now generate a vadere-console.jar which can be executed via console.
parent b1f4c42f
......@@ -73,6 +73,25 @@
<id>build-vadere-console</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<id>build-vadere</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
......@@ -14,12 +14,14 @@ public class ScenarioFactory {
* to the directory of the project and the filename of the scenario.
* @param projectdirectory directory to the addressed project
* @param name name of the new scenario
* @param fileName filename of the addressed scenario
public static Scenario createVadereWithProjectDirectory(final String projectdirectory,
final String fileName, final String name) throws IOException {
public static Scenario createVadereWithProjectDirectory(
final String projectdirectory,
final String fileName) throws IOException {
String scenarioDir = IOUtils.SCENARIO_DIR;
if (projectdirectory.endsWith(IOUtils.SCENARIO_DIR))
scenarioDir = "";
......@@ -41,38 +41,34 @@ public class VadereConsole {
String pathToScenarioFile = ns.getString("scenario-file");
String outputDir = ns.get("output-dir");
String scenarioFilePath = Paths.get(ns.getString("scenario-file")).toString();
String vadereName = Paths.get(ns.getString("scenario-file")).getFileName().toString().replace(".scenario", "");
String projectDirectory = ns.getString("out_path");
String outputFile = ns.getString("output-file");
String lockDirectory = ns.getString("lock-folder");
String timeStepFile = ns.getString("time-step-file");
Boolean outputAll = ns.getBoolean("all");
if ((lockDirectory == null || outputFile == null || timeStepFile == null) && projectDirectory == null) {
if (pathToScenarioFile == null) {
System.err.println("Too few arguments. Exiting.");
if (lockDirectory != null && outputFile != null && projectDirectory == null) {
if (!Files.exists(Paths.get(outputFile))) {
try {
} catch (IOException e) {
String scenarioFilePath = Paths.get(pathToScenarioFile).toString();
String scenarioFile = Paths.get(pathToScenarioFile).getFileName().toString();
String projectDirectory = Paths.get(ns.getString("scenario-file")).getParent().toString();
if(!Files.exists(Paths.get(projectDirectory, scenarioFile))) {
System.err.println("The file " + Paths.get(projectDirectory, scenarioFile) + " does not exist");
}"Running VADERE on %s...", scenarioFilePath));
try {
Scenario scenario = ScenarioFactory.createVadereWithProjectDirectory(projectDirectory,
vadereName + IOUtils.SCENARIO_FILE_EXTENSION, vadereName);
new ScenarioRun(scenario, null).run();
Scenario scenario = ScenarioFactory.createVadereWithProjectDirectory(projectDirectory,scenarioFile);
if(outputDir != null) {
new ScenarioRun(scenario, outputDir,null).run();
else {
new ScenarioRun(scenario, null).run();
} catch (IOException e) {
......@@ -84,54 +80,8 @@ public class VadereConsole {
.description("Runs the VADERE pedestrian simulator.");
.help("Path to the scenario file.");
.help("Path to the folder containing lock.lck files.");
.help("Path to the time step file.");
.help("Path to the output file.");
MutuallyExclusiveGroup modesGroup = parser.addMutuallyExclusiveGroup("running mode").required(true);
"Starts VADERE in [normal] or [lock] mode.\nIn [normal] mode, it runs the given scenario-file" +
" once and then exits.\nIn [lock] mode, it creates a lock.lck file in the given lock-folder and then waits."
" After the lock.lck is deleted, the scenario is simulated until the finish time is reached. The lock.lck file is created"
" and Vadere waits for its deletion again.");
modesGroup.addArgument("-op", "--out-path")
.help("NOT in [lock] mode! Path to the output folder where VADERE store additional results of the simulation.");
.help("Initializes the [lock] mode. Needs three strings: 1. path to folder where the lock.lck file is created, 2. path to time step file, 3. path to output file.");
// modesGroup.addArgument("-of", "--out-file")
// .help("Path to the output file where VADERE appends results of the simulation.");
// parser.addArgument("-tsf", "--time-step-file")
// .help("Path to the time step file where VADERE store and reads intermediate results.");
// parser.addArgument("-l","--lock")
// .help("Path to the .lock files folder.");
.help("Output all computed positions, not just the ones after the time step.");
ArgumentGroup formatgroup = parser.addArgumentGroup("format");
formatgroup.addArgument("-outformat", "--output-format")
.help("Format used in the output file.")
formatgroup.addArgument("-outvars", "--output-variables")
.help("Variables used in the output file, separated by comma, no spaces. The --output-format must define the format in the same order.")
formatgroup.addArgument("-tsfformat", "--tsf-format")
.help("Format used in the time step file.")
formatgroup.addArgument("-tsfvars", "--tsf-variables")
.help("Variables used in the output file, separated by comma, no spaces. The --tsf-format must define the format in the same order.")
.help("Path to the directory of the output. By default this is ./output of the directory of the executable.");
return parser;
......@@ -46,10 +46,14 @@ public class ScenarioRun implements Runnable {
private final RunnableFinishedListener finishedListener;
public ScenarioRun(final Scenario scenario, RunnableFinishedListener scenarioFinishedListener) {
this(scenario, IOUtils.OUTPUT_DIR, scenarioFinishedListener);
public ScenarioRun(final Scenario scenario, final String outputDir, final RunnableFinishedListener scenarioFinishedListener) {
this.scenario = scenario;
this.scenarioStore = scenario.getScenarioStore();
this.dataProcessingJsonManager = scenario.getDataProcessingJsonManager();
this.setOutputPaths(Paths.get(IOUtils.OUTPUT_DIR)); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/output
this.setOutputPaths(Paths.get(outputDir)); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/output
this.finishedListener = scenarioFinishedListener;
Supports Markdown
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