-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It is possible to designate non-default types for variables, which are then ignored. #2589
Comments
For state values, yes. We should probably validate those. |
What should the behavior be here? I assume each type of system should just do its own validation? Should all the following error?
Is the internal conversion when the type does make sense (as in the |
For an ODESystem/SDESystem, if it's an Integer it should error. Note that integer and non-number are fine for parameters and discrete variables, so this is only for things that are meant to be continuous variables. |
Got it, what about the |
Well the other check should be that all of the variable types should be the same, so it should validate that and error otherwise. If you set a specific floating point type? That's really weird since that isn't part of the structure, so I cannot see why we'd want to support that, so I'd also just error if someone chooses concrete float types |
Should it actually error if all the variable types are not the same? There are some MTK test cases where this is the case, like this one ModelingToolkit.jl/test/if_lifting.jl Line 41 in 5cdb4ba
|
In that case |
Currently, it is possible to designate a non-default type for variables:
In this case,
Int64
does not make sense for an ODE variable. While it is internally converted to aFloat64
, there should be an error instead. Here, it is actually possible to setu0 = [X => 1.5]
, and things proceed as ifX(t)::Int64
was not the case.This is even the case if a type which does make sense in the context of ODEs is give. I.e. here we use a
Float32
, but internal conversion toInt64
is still a thing.While there are cases where integer variables make sense (e.g. Jump simulations), these are already handled internally (i.e. integer initial conditions are interpreted as giving integers throughout a jump simulation).
The easiest would be to throw an error when a user tries
However, if this is not possible (because there are circumstances when one use variables for other stuff), then at least one should be thrown when the
ODESystem
(or another system) is created.The text was updated successfully, but these errors were encountered: