Open GabrielKS opened 3 weeks ago
We've resolved to not make any backwards-incompatible changes due to this right now, but for the next major version, here is my proposal:
Currently we have this type hierarchy:
AbstractDeterministic
|- Deterministic # this one is a "real" forecast
|- DeterministicSingleTimeSeries # this one is a "fake" forecast
and these behaviors:
AbstractDeterministic
doesn't ever get referred to by the userDeterministic
, it means the Deterministic
time series of that name, if there is none then the DeterministicSingleTimeSeries
of that name, if there is none then errorI propose to make the following renames:
AbstractDeterministic RENAME TO Deterministic
|- Deterministic RENAME TO DeterministicTrueForecast # or something else, not wedded to this
|- DeterministicSingleTimeSeries NO RENAME
and have the following behaviors:
Deterministic
, which is now an abstract type. Queries on Deterministic
return the DeterministicTrueForecast
or DeterministicSingleTimeSeries
with that name if there is only one, error if there are both, in which case the user has to specify a subtype to clear up the ambiguity.
Forecast
return the Forecast
with that name no matter its concrete type if there is only one, error if there are multipleDeterministicTrueForecast
constructor called Deterministic
. I would prefer my proposal without this, but I think my proposal with this is still better than the status quoThis proposal ends the abuse of the type hierarchy and the hard-coding that requires. The cost in change to the user interface is either practically zero, if the constructor alias is created, or small if it is not. The benefit is in more elegant and maintainable code and an intuitive connection between the type hierarchy and the time series query matching spec.
I don't love how we special-case that
Deterministic
, a concrete type, sometimes also refers toDeterministicSingleTimeSeries
, a different concrete type. I don't know about the typical user, but this definitely confused me before it was explained to me. We would have to think about how to resolve this without breaking existing code. For now we'll keep it as-is but at some point restore the behavior that you can pass abstract types toget_time_series
; when that is done, there is a change that can be reverted in PSY. See https://github.com/NREL-Sienna/InfrastructureSystems.jl/pull/349#discussion_r1581220010. Broken out of https://github.com/NREL-Sienna/InfrastructureSystems.jl/issues/356.