Commit f81b790a authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Improved "JsonTransformationV1_3ToV1_4" to rename "footStepsToStore" also...

Improved "JsonTransformationV1_3ToV1_4" to rename "footStepsToStore" also under "attributesCar" node
parent fb5b5929
......@@ -24,16 +24,25 @@ public class JsonTransformationV1_3ToV1_4 extends SimpleJsonTransformation {
String oldName = "footStepsToStore";
String newName = "footstepHistorySize";
renameInTopography(node, oldName, newName);
renameInTopographyUnderAttributesPedestrian(node, oldName, newName);
renameInTopographyUnderAttributesCar(node, oldName, newName);
renameInMainModel(node, oldName, newName);
renameInDynamicElements(node, oldName, newName);
return node;
}
private void renameInTopography(JsonNode node, String oldName, String newName) throws MigrationException {
private void renameInTopographyUnderAttributesPedestrian(JsonNode node, String oldName, String newName) throws MigrationException {
JsonNode attributesPedestrianNode = pathMustExist(node, "scenario/topography/attributesPedestrian");
renameField((ObjectNode)attributesPedestrianNode, oldName, newName);
renameInDynamicElements(node, oldName, newName);
}
private void renameInTopographyUnderAttributesCar(JsonNode node, String oldName, String newName) throws MigrationException {
JsonNode attributesPedestrianNode = pathMustExist(node, "scenario/topography/attributesCar");
if (attributesPedestrianNode.asText() != "null") {
renameField((ObjectNode) attributesPedestrianNode, oldName, newName);
}
}
private void renameInMainModel(JsonNode node, String oldName, String newName) throws MigrationException {
......
{
"name" : "footStepsToStoreInTopographyUnderAttributesPedestrian",
"description" : "",
"release" : "1.3",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
"processors" : [ 3 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.NoDataKeyOutputFile",
"filename" : "overlapCount.txt",
"processors" : [ 4 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTargetIdProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"id" : 3
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.NumberOverlapsProcessor",
"id" : 4,
"attributesType" : "org.vadere.state.attributes.processor.AttributesNumberOverlapsProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 3
}
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
"attributesModel" : {
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036,
"movementThreshold" : 0.0,
"minStepLength" : 0.1,
"minimumStepLength" : true,
"maxStepDuration" : 1.7976931348623157E308,
"dynamicStepLength" : true,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
"submodels" : [ ]
},
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
},
"org.vadere.state.attributes.models.AttributesFloorField" : {
"createMethod" : "HIGH_ACCURACY_FAST_MARCHING",
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "CSV_CACHE",
"cacheDir" : "s002",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
"obstacleDensityWeight" : 3.5,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT",
"width" : 0.2,
"height" : 1.0
}
}
},
"attributesSimulation" : {
"finishTime" : 50.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 183115877309837713,
"simulationSeed" : 0,
"useSalientBehavior" : false
},
"topography" : {
"attributes" : {
"bounds" : {
"x" : 0.0,
"y" : 0.0,
"width" : 10.0,
"height" : 10.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true
},
"obstacles" : [ {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 4.038095238095238,
"y" : 3.0
}, {
"x" : 4.038095238095238,
"y" : 3.6
}, {
"x" : 0.5,
"y" : 3.6
}, {
"x" : 0.5,
"y" : 3.0
} ]
},
"id" : 4
}, {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 9.5,
"y" : 3.0
}, {
"x" : 9.5,
"y" : 3.6
}, {
"x" : 5.961904761904762,
"y" : 3.6
}, {
"x" : 5.961904761904762,
"y" : 3.0
} ]
},
"id" : 5
}, {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 8.4196748078264,
"y" : 6.990370356126214
}, {
"x" : 5.178391040736634,
"y" : 6.990370356126214
}, {
"x" : 5.178391040736634,
"y" : 7.010726909982895
}, {
"x" : 4.614300219392282,
"y" : 7.010726909982895
}, {
"x" : 4.614300219392282,
"y" : 6.990370356126215
}, {
"x" : 1.4356932102296667,
"y" : 6.990370356126215
}, {
"x" : 1.4356932102296667,
"y" : 6.332264397891138
}, {
"x" : 4.614300219392282,
"y" : 6.332264397891138
}, {
"x" : 4.614300219392282,
"y" : 0.5033259106661707
}, {
"x" : 5.178391040736634,
"y" : 0.5033259106661707
}, {
"x" : 5.178391040736634,
"y" : 6.4262795347818615
}, {
"x" : 8.4196748078264,
"y" : 6.426279534781862
} ]
},
"id" : 6
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 2,
"absorbing" : true,
"shape" : {
"x" : 7.542857142857143,
"y" : 0.7,
"width" : 1.757142857142858,
"height" : 1.0142857142857136,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
"waitingTimeYellowPhase" : 0.0,
"parallelWaiters" : 0,
"individualWaiting" : true,
"deletionDistance" : 0.1,
"startingWithRedLight" : false,
"nextSpeed" : -1.0
}, {
"id" : 3,
"absorbing" : true,
"shape" : {
"x" : 0.742857142857142,
"y" : 0.7,
"width" : 1.757142857142858,
"height" : 1.0142857142857136,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
"waitingTimeYellowPhase" : 0.0,
"parallelWaiters" : 0,
"individualWaiting" : true,
"deletionDistance" : 0.1,
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : 1,
"shape" : {
"x" : 4.2,
"y" : 8.457142857142857,
"width" : 2.0095238095238095,
"height" : 0.9428571428571431,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 20.0 ],
"spawnNumber" : 4,
"maxSpawnNumberTotal" : 4,
"startTime" : 0.0,
"endTime" : 50.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footStepsToStore" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
......@@ -16,8 +16,8 @@ public class JsonTransformationV1_3ToV1_4Test extends JsonTransformationTest {
}
@Test
public void assertThatJsonTransformationV1_3ToV1_4RenamesFootStepsToStoreInTopography() throws MigrationException {
String scenarioFileAsString = getTestFileAsString("footStepsToStoreInTopography.scenario");
public void assertThatJsonTransformationV1_3ToV1_4RenamesFootStepsToStoreInTopographyUnderAttributesPedestrian() throws MigrationException {
String scenarioFileAsString = getTestFileAsString("footStepsToStoreInTopographyUnderAttributesPedestrian.scenario");
JsonNode oldScenarioAsJson = getJsonFromString(scenarioFileAsString);
String oldJsonPath = "scenario/topography/attributesPedestrian/footStepsToStore";
......@@ -33,6 +33,24 @@ public class JsonTransformationV1_3ToV1_4Test extends JsonTransformationTest {
pathMustExist(newScenarioAsJson, newJsonPath);
}
@Test
public void assertThatJsonTransformationV1_3ToV1_4RenamesFootStepsToStoreInTopographyUnderAttributesCar() throws MigrationException {
String scenarioFileAsString = getTestFileAsString("footStepsToStoreInTopographyUnderAttributesCar.scenario");
JsonNode oldScenarioAsJson = getJsonFromString(scenarioFileAsString);
String oldJsonPath = "scenario/topography/attributesCar/footStepsToStore";
String newJsonPath = "scenario/topography/attributesCar/footstepHistorySize";
pathMustExist(oldScenarioAsJson, oldJsonPath);
pathMustNotExist(oldScenarioAsJson, newJsonPath);
JsonTransformationV1_3ToV1_4 transform = factory.getJsonTransformationV1_3ToV1_4();
JsonNode newScenarioAsJson = transform.applyAll(oldScenarioAsJson);
pathMustNotExist(newScenarioAsJson, oldJsonPath);
pathMustExist(newScenarioAsJson, newJsonPath);
}
@Test
public void assertThatJsonTransformationV1_3ToV1_4RenamesFootStepsToStoreInMainModel() throws MigrationException {
String scenarioFileAsString = getTestFileAsString("footStepsToStoreInMainModel.scenario");
......
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