-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AER-2554 Fix serialization to/from json for cold start stuff (#259)
Using 2 different names for the same source class is problematic. Reading is fine, but writing will always use 1 of the names (could maybe do something with another subtype defintion in a class between EmissionSource and ColdStartEmissionSource and then looking at the vehicleBasedCharacteristics value, but that's rather ugly and not even sure if that'd work). Better to use 1 name. Deprecated the existing values while we fix this, and added a new one that should be used instead. Also using a json annotation to specify a different name for vehicle type: vehicleType is already used for the distinction between standard, specific and custom, so can't use that again. Also added 2 json round trip cases for cold start.
- Loading branch information
1 parent
7bdfd1d
commit 8d85a71
Showing
6 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
source/imaer-shared/src/test/resources/json/ColdStartEmissionSourceOther.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"type" : "Feature", | ||
"id" : "1", | ||
"geometry" : { | ||
"type" : "Point", | ||
"coordinates" : [ 130.12, -123.99 ] | ||
}, | ||
"properties" : { | ||
"emissionSourceType" : "COLD_START", | ||
"sectorId" : 3160, | ||
"label" : "Label 3160", | ||
"emissions" : { | ||
"NH3" : 10.0, | ||
"NOX" : 11.0 | ||
}, | ||
"subSources" : [ { | ||
"vehicleType" : "STANDARD_CS", | ||
"timeUnit" : "DAY", | ||
"valuesPerVehicleTypes" : { | ||
"LIGHT_TRAFFIC" : 101.1, | ||
"HEAVY_FREIGHT" : 54.7 | ||
} | ||
}, { | ||
"vehicleType" : "CUSTOM", | ||
"timeUnit" : "YEAR", | ||
"vehiclesPerTimeUnit" : 2000.0, | ||
"description" : "Oude eenden", | ||
"emissionFactors" : { | ||
"NOX" : 1.5, | ||
"NH3" : 0.6 | ||
}, | ||
"vehicleCode" : "HEAVY_FREIGHT" | ||
}, { | ||
"vehicleType" : "SPECIFIC", | ||
"timeUnit" : "MONTH", | ||
"vehiclesPerTimeUnit" : 300.0, | ||
"vehicleCode" : "BA-B-E3" | ||
} ], | ||
"vehicleBasedCharacteristics" : true | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
source/imaer-shared/src/test/resources/json/ColdStartEmissionSourceParkingGarage.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"type" : "Feature", | ||
"id" : "1", | ||
"geometry" : { | ||
"type" : "Point", | ||
"coordinates" : [ 130.12, -123.99 ] | ||
}, | ||
"properties" : { | ||
"emissionSourceType" : "COLD_START", | ||
"sectorId" : 3150, | ||
"label" : "Label 3150", | ||
"characteristics" : { | ||
"type" : "OPS", | ||
"heatContent" : 123.45, | ||
"emissionHeight" : 5.0 | ||
}, | ||
"emissions" : { | ||
"NH3" : 10.0, | ||
"NOX" : 11.0 | ||
}, | ||
"subSources" : [ { | ||
"vehicleType" : "STANDARD_CS", | ||
"timeUnit" : "DAY", | ||
"valuesPerVehicleTypes" : { | ||
"LIGHT_TRAFFIC" : 101.1, | ||
"HEAVY_FREIGHT" : 54.7 | ||
} | ||
}, { | ||
"vehicleType" : "CUSTOM", | ||
"timeUnit" : "YEAR", | ||
"vehiclesPerTimeUnit" : 2000.0, | ||
"description" : "Oude eenden", | ||
"emissionFactors" : { | ||
"NOX" : 1.5, | ||
"NH3" : 0.6 | ||
} | ||
}, { | ||
"vehicleType" : "SPECIFIC", | ||
"timeUnit" : "MONTH", | ||
"vehiclesPerTimeUnit" : 300.0, | ||
"vehicleCode" : "BA-B-E3" | ||
} ], | ||
"vehicleBasedCharacteristics" : false | ||
} | ||
} |