Open andrewlee94 opened 3 years ago
@blnicho have there been any updates regarding this issue? For flowsheets where units are assigned to both the DerivativeVar and the differentiated variable, the ContinuousSet can be assigned appropriate units in the discretization method. Thanks!
Unfortunately, I have once again rediscovered this issue.
We are started to incorporate dynamics in WaterTAP and this issue occurs while attempting to make our reverse osmosis model. In our tests, I threw in an assert_units_consistent
before and after transformation, and this issue arises after transformation.
Here is the PR on WaterTAP: https://github.com/watertap-org/watertap/pull/1471
When using pyomo.dae in a model with units, there is a potential issue with unit consistency as the
ContinuousSet
does not have units. Consider the following case:If the
DerivativeVar
is defined such that it has the correct units (m/s), there ends up being a unit consistency issue in the discretization equations as Pyomo does not realize that the time domain has units, thus the "delta_t" term in the discretization is unitless.Whilst there are ways around this (e.g. using normalized domains), I think it would make more sense (and be more obvious to the user) if the
ContinuousSet
were to have units and the numerical discretization to account for this.