-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
[RFC] Remove more unnecessary defaults #306
Conversation
@avinashresearch1 @baggepinnen @bradcarman these are all of the @ven-k @AayushSabharwal I think we need a feature where a default |
If a default is provided in this library, how does a user indicate that they want to make this a free variable during initialization, should they want to? Is this the |
All I'm going to schedule a workshop for us to sort this out. I've tried and failed to get a proper initialization working and I'd like us all to go thru this together to sort out how it's all supposed to work. |
Yes. But I think in general we shouldn't add any defaults where it would be common to do that override. |
A somewhat common usecase where the default is unwanted is when trying to initialize a model such that some derivatives are zero. For example,
Sensor outputs should typically start at exactly the same value as the thing they are measuring, not 0? |
Oh true. |
Would you argue the default should still be a 0 on the integrator, and someone should flip that to nothing, or should a user always have to provide it? |
I'm torn, I could argue both ways. I'm leaning slightly towards letting the default be 0 to improve ergonomics in the most common use case, and let the more advanced use case require the extra step. The question then is, how do we make sure that the user understands that a default provided in the library is adding a perhaps unwanted equation? Could the error message/warning for over-constrained initialization systems include a hint at removing defaults with |
It could, yes. It think it's hard to point to which equations the issue might be though, you can just say that someone likely put an initial condition that shouldn't be there, and at most we could print out the full list of initial conditions... but that could be long. |
Just to build on what @baggepinnen said. There are use cases like wanting to start a system in equilibrium where the integrator state may need to start in a non-zero value. But there are, of course, cases where you just want to start the integrator start at zero. The solution that Modelica uses, which I quite like, is to have the component enumerate the different initialization schemes. Modelica doesn't have a good enum type. The JSML
This
This is more aligned with what we discussed with Gary which is to note have super complicated component models that generate super complicated code but rather to specifically use the integrator we really need. If you create a system this way, you can do this:
@baggepinnen what do you think of these options. Similar, I wonder if @bradcarman has any comments on this? |
I much favor the different initialization options over the different components. How to initialize an integrator typically depends on the particular scenario is being simulated, it's not a fundamental property of the system being modeled. The same model may thus need different initialization strategies for different simulation runs. Also, if I have a PI controller in a model library, I don't want to maintain different versions of this depending on how one of the internal state variables should be initialized, neither do I want to mess with "replace" functionality just because I want a state variable to start at a non-zero value. Lastly, the integrator is the same component in all these cases, having variants of it that only differs in initialization seems confusing to be an leads to a proliferation of component variations. |
This is how the Modelica Standard Library addressed this. Ultimately, we can do it either way and any user can do it either way. So for our JSML standard library, we can do it with the enum based approach. I completely agree with you about the flexibility although ultimately it is probably more a UI/UX related issue because doing a replace and changing the value of a parameter isn't going to be that different for the user. But for the creator and maintainer of the component, yes, using parameters to capture the variations seems better. |
|
No description provided.