The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit 4fa1c70a authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

Merge remote-tracking branch 'origin/develop' into develop

parents 9e3edb92 5de7f7a5
......@@ -6,5 +6,6 @@ unit_tests_with_coverage:
# Here you can execute arbitrate terminal commands.
# If any of the commands returns a non zero exit code the job fails.
script:
- mvn clean
- mvn test
\ No newline at end of file
......@@ -73,6 +73,25 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>build-vadere-console</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>org.vadere.simulator.entrypoints.VadereConsole</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>vadere-console</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
<execution>
<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 {
}
Locale.setDefault(Locale.ENGLISH);
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.");
parser.printHelp();
System.exit(1);
}
if (lockDirectory != null && outputFile != null && projectDirectory == null) {
if (!Files.exists(Paths.get(outputFile))) {
try {
Files.createFile(Paths.get(outputFile));
} catch (IOException e) {
logger.error(e);
System.exit(1);
}
}
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");
}
logger.info(String.format("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) {
logger.error(e);
}
......@@ -84,54 +80,8 @@ public class VadereConsole {
.description("Runs the VADERE pedestrian simulator.");
parser.addArgument("scenario-file").required(true)
.help("Path to the scenario file.");
parser.addArgument("lock-folder")
.help("Path to the folder containing lock.lck files.");
parser.addArgument("time-step-file")
.help("Path to the time step file.");
parser.addArgument("output-file")
.help("Path to the output file.");
MutuallyExclusiveGroup modesGroup = parser.addMutuallyExclusiveGroup("running mode").required(true);
modesGroup.description(
"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.");
modesGroup.addArgument("-mtv").type(Boolean.class).action(Arguments.storeTrue())
.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.");
parser.addArgument("-all").type(Boolean.class).action(Arguments.storeTrue())
.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.")
.setDefault("%d;%f;%f;%f;%f;%d;%d;%f;");
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.")
.setDefault("id,lastX,lastY,lastVX,lastVY,targetId,sourceId,desiredSpeed");
formatgroup.addArgument("-tsfformat", "--tsf-format")
.help("Format used in the time step file.")
.setDefault("%d;%f;%f;%f;%f;%d;%d;%f");
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.")
.setDefault("id,lastX,lastY,lastVX,lastVY,targetId,sourceId,desiredSpeed");
parser.addArgument("output-dir").required(false)
.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;
}
......
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