Skip to content

Commit

Permalink
Completed JSON Schema for scenario_config.json (#47)
Browse files Browse the repository at this point in the history
* completed scheme for scenario_config.json

Signed-off-by: Karl Schrab <[email protected]>

* define config file in separate file (website) rather than in the title of the Scheme

Signed-off-by: Karl Schrab <[email protected]>
  • Loading branch information
kschrab authored Feb 24, 2021
1 parent ac0462b commit 327f98f
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 75 deletions.
2 changes: 1 addition & 1 deletion fed/mosaic-cell/src/main/resources/CCellScheme.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CCellScheme",
"title": "Cell",
"description": "This schema describes the JSON file structure for the cell configuration, which provides general configuration for the ambassador, such as paths to the regions and network configuration files.",
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-cell/src/main/resources/CNetworkScheme.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CNetworkScheme",
"title": "Network",
"description": "Schema describing the JSON file structure for the network configuration. It is is used to define the properties of the global network. If defined as a number, then the default unit is Gb. Alternatively this can be defined as a string to specify the unit of measurement (e.g. '3 MB').",
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-cell/src/main/resources/CRegionScheme.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CRegionSchema",
"title": "Regions",
"description": "Schema describing the JSON file structure for the regional networks configuration. It is is used to extend the network with regional information, which enables the emulation of mobile networks. If configured very granular, these regions can reflect cells as used in the real world. Though for most use-cases it is sufficient to approximate the behaviour by defining larger regions.",
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CEnvironmentScheme",
"title": "Environment Events",
"description": "Schema describing the JSON file structure for the environment configuration. It is is used to define which events are evaluated by the simulator. Entities entering the areas of the events, are notified by the 'EnvironmentSensorUpdates' interaction",
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CMappingAmbassadorScheme",
"title": "Mapping",
"description": "This schema describes the JSON file structure for the mapping configuration, which is used to define simulation entities.",
"type": "object",
"properties": {
"config": {
"description": "Object to deifne additional configuration options for the mapping.",
"description": "Object to define additional configuration options for the mapping.",
"$ref": "#/definitions/config"
},
"prototypes": {
Expand Down Expand Up @@ -529,7 +529,7 @@
"required": [ "radius", "center" ]
},
"geoPoint": {
"title": "geoPoint",
"title": "GeoPoint",
"description": "Object to define geographical point coordinates.",
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-sns/src/main/resources/CSnsScheme.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "CSnsScheme",
"title": "SNS",
"description": "Schema describing the JSON file structure for the sns configuration.",
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion fed/mosaic-sumo/src/main/resources/CSumoScheme.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "CSumoScheme",
"title": "SUMO",
"description": "Schema describing the JSON file structure for the SUMO configuration.",
"properties": {
"updateInterval": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public void runSimulation() throws InternalFederateException, IllegalValueExcept
while (this.time < getEndTime()) {

// sync with real time
realtimeSync.sync(this.time);
if (this.time > 0) {
realtimeSync.sync(this.time);
}

// remove all events at the head of the queue that are created by the same federate
synchronized (this.events) {
Expand Down
186 changes: 121 additions & 65 deletions rti/mosaic-starter/src/main/resources/CScenarioScheme.json
Original file line number Diff line number Diff line change
@@ -1,102 +1,158 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"title": "Scenario",
"description": "Schema describing the JSON file structure for the main scenario configuration.",
"type": "object",
"required": [
"simulation",
"federates"
],
"properties": {
"simulation": {
"$ref": "#/definitions/simulation"
},
"federates": {
"description": "Defines the list of ambassadors/simulators which are used by the simulation. For each simulator (referenced by its id) a boolean value must be given, which enables or disables the simulator.",
"type": "object",
"additionalProperties": {
"type": "boolean"
}
}
},
"definitions": {
"simulation": {
"type": "object",
"title": "simulation",
"description": "Basic properties of the simulation scenario.",
"required": [
"id",
"duration",
"projection"
],
"properties": {
"id": {
"description": "The id or name of the simulation scenario.",
"type": "string"
},
"duration": {
"description": "The duration of the simulation. If defined as a number, then the unit to be applied is ns. Alternatively this can be defined as a string to include the unit of measurement (e.g. '300 s')",
"anyOf": [
{ "type": "string", "maxLength": 20 },
{ "type": "number", "minimum": 0 }
]
},
"randomSeed": {
"type": "integer"
"type": "integer",
"description": "The random seed to apply. This influences the application mapping, the communication models, and any use of randomness inside of applications. If not set, the random number generator will be initialized without a seed resulting in different results for each run. Note that several other simulators (e.g. SUMO) come with their own random number generators which are not affected by this property."
},
"projection": {
"type": "object",
"required": [
"centerCoordinates",
"cartesianOffset"
],
"properties": {
"centerCoordinates": {
"type": "object",
"required": [
"latitude",
"longitude"
],
"properties": {
"latitude": { "type": "number" },
"longitude": { "type": "number" }
}
},
"cartesianOffset": {
"type": "object",
"required": [
"x",
"y"
],
"properties": {
"x": { "type": "number" },
"y": { "type": "number" }
}
}
}
"$ref": "#/definitions/projection"
},
"network": {
"title": "The network schema",
"properties": {
"netMask": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"vehicleNet": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"rsuNet": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"tlNet": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"csNet": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"serverNet": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"tmcNet": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$"
}
}
"$ref": "#/definitions/network"
}
}
},
"federates": {
"projection" : {
"type": "object",
"title": "Projection",
"description": "Configures the projection used to transform geographical coordinates (WGS84) to local cartesian coordinates used by various simulators (e.g. SUMO, or OMNeT++). The projection is based on UTM and must be adapted to the used traffic network.",
"required": [
"centerCoordinates",
"cartesianOffset"
],
"properties": {
"centerCoordinates": {
"description": "Geographic coordinates of the rough center of the map / playground used in this scenario. This is just used to determine the UTM zone used for any further projection.",
"$ref": "#/definitions/geoPoint"
},
"cartesianOffset": {
"description": "A cartesian offset which is added to the UTM transformation. In most cases, this must be the exact offset which can be found in the `location.netOffset` of the `*.net.xml` of the scenario.",
"$ref": "#/definitions/cartesianOffset"
}
}
},
"network" : {
"title": "Network Addressing",
"type": "object",
"default": "default network",
"description": "Defines the subnets (e.g. 10.0.0.0) used for generating IP addresses for each unit in the simulation. Each type of unit is configured with its own subnet. A default configuration is used, when left out from the configuration.",
"properties": {
"netMask": {
"description": "The net mask used for IP generation.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "255.0.0.0"
},
"vehicleNet": {
"description": "The subnet used for assigning IPs to vehicles.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "10.0.0.0"
},
"rsuNet": {
"description": "The subnet used for assigning IPs to road side units.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "11.0.0.0"
},
"tlNet": {
"description": "The subnet used for assigning IPs to traffic lights.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "12.0.0.0"
},
"csNet": {
"description": "The subnet used for assigning IPs to charging stations.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "13.0.0.0"
},
"serverNet": {
"description": "The subnet used for assigning IPs to servers.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "14.0.0.0"
},
"tmcNet": {
"description": "The subnet used for assigning IPs to traffic management centers.",
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$",
"default": "15.0.0.0"
}
}
},
"geoPoint": {
"title": "GeoPoint",
"description": "Geographic coordinates of the rough center of the map / playground used in this scenario. This is just used to determine the UTM zone used for any further projection.",
"type": "object",
"additionalProperties" : {
"type" : "boolean"
"properties": {
"longitude": {
"description":"East-west position of a point on earth.",
"type": "number",
"maximum": 180,
"minimum": -180
},
"latitude": {
"description":"North-south position of a point on earth.",
"type": "number",
"maximum": 90,
"minimum": -90
}
},
"required": [ "longitude", "latitude" ]
},
"cartesianOffset": {
"title": "CartesianOffset",
"description": "A cartesian offset which is added to the UTM transformation. In most cases, this must be the exact offset which can be found in the `location.netOffset` of the `*.net.xml` of the scenario.",
"type": "object",
"required": [
"x",
"y"
],
"properties": {
"x": { "type": "number", "description": "The value to add to the X coordinate after UTM transformation" },
"y": { "type": "number", "description": "The value to add to the Y coordinate after UTM transformation" }
}
}
}
Expand Down

0 comments on commit 327f98f

Please sign in to comment.