Closed nreinicke closed 6 months ago
Another thing to note is that the "traversal_summary"
key in the result doesn't capture the summary but rather just shows the state model like this:
{
"battery_state": {
"feature": {
"format": {
"floating_point": {
"initial": 100.0
}
},
"name": "soc",
"unit": "percent"
},
"index": 4
},
"distance": {
"feature": {
"distance_unit": "kilometers",
"initial": 0.0
},
"index": 0
},
"energy": {
"feature": {
"energy_unit": "kilowatt_hours",
"initial": 0.0
},
"index": 2
},
"energy_electric": {
"feature": {
"energy_unit": "kilowatt_hours",
"initial": 0.0
},
"index": 3
},
"time": {
"feature": {
"initial": 0.0,
"time_unit": "minutes"
},
"index": 1
}
}
Okay, sorry for the noise but the traversal summary serialization issue should be a simple fix, looks like this function is just over ridding the existing keys from the state model. We could just add a new key like "state_model"
into the summary where we dump that info (or maybe we clean it up a bit to pair the state with the units and omit things like "index"
).
If I only serialize the state for the most recent query I get a summary that looks like this:
{
"battery_state": 75.83717311517294,
"distance": 0.0,
"energy": 0.0,
"energy_electric": 14.497696130896356,
"time": 28.422520259397157
}
So, the "energy_electric" state var is being added properly, it's just the mixing with the cost model where we have an issue.
right. related to this: i didn't set up state model deserialization correctly. i have it expecting a JSON array"
[
{ "distance_unit": "kilometers", "initial": 0.0 },
{ "time_unit": "minutes", "initial": 0.0 },
{ "energy_unit": "minutes", "initial": 0.0 }
]
but then when building the hashmap for the state model, it just uses the unit type as the feature name, so we get:
HashMap::from({
("distance", StateFeature::Distance(...)),
("time", StateFeature::Time(...)),
("energy", StateFeature::Energy(...)),
})
but the keys for a PHEV should be "energy_electric" and "energy_liquid". StateModel deserialization should accept a JSON object with names as keys, not an array.
created issues in this milestone addressing the different problems listed here
I'm putting together some end-to-end tests and wanted to note a couple of things that have come up when testing the latest state model updates.
I'm hard time specifying the energy state variables. If I add the following to my config:
When running a query for a battery electric vehicle that looks like this:
I get an error:
failure building search algorithm: failed to build cost model: invalid cost model configuration: coefficient for energy not provided
. It seems like the energy state variable from the toml file is being read as the nameenergy
but if I switch the query to look like this (and give an explicit vehicle state variable rate for `energy):The model runs but the cost summary looks like this:
So, all this to say it looks like the mapping between the energy state variables and the cost model is a little bit out of whack.