Now that PiecewiseStepData HDF-serializes to an array that includes NaN, we need to allow NaN to be equal to itself when checking whether two things are the same — this is accomplished by changing == to isequal.
The new PowerSystems ThermalGenerationCost has a field of type Union{StartUpStages, Float64}, where StartUpStages is a NamedTuple. We didn't have code to deserialize that, but we did have code to deserialize Union{NamedTuple, Nothing}, so I generalized it.
I would have liked to have done most of the logic involved in (2) using the type system, but I did not seem to be able to do so without angering detect_unbound_args. For instance, this method solves the problem (though less generally) but is said to have unbound type parameters:
deserialize(::Type{Union{A, B}}, data::Dict) where {A <: _NOT_FROM_DICT, B <: NamedTuple} = deserialize(B, data)
I'm not sure I believe detect_unbound_args that there are unbound type parameters here, but I have opted for a more manual, less elegant, possibly more flexible approach.
This solves two issues:
PiecewiseStepData
HDF-serializes to an array that includesNaN
, we need to allowNaN
to be equal to itself when checking whether two things are the same — this is accomplished by changing==
toisequal
.ThermalGenerationCost
has a field of typeUnion{StartUpStages, Float64}
, whereStartUpStages
is aNamedTuple
. We didn't have code to deserialize that, but we did have code to deserializeUnion{NamedTuple, Nothing}
, so I generalized it.I would have liked to have done most of the logic involved in (2) using the type system, but I did not seem to be able to do so without angering
detect_unbound_args
. For instance, this method solves the problem (though less generally) but is said to have unbound type parameters:I'm not sure I believe
detect_unbound_args
that there are unbound type parameters here, but I have opted for a more manual, less elegant, possibly more flexible approach.