-
Notifications
You must be signed in to change notification settings - Fork 171
Use eps in a proper way in ComplexRampPhasor; it's relative. #4156
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@AHaumer and @christiankral can you please review the initial changes and give your opinion , Thanks |
As far as I remember, the intention was to avoid a step in the ramp block. For this purpose, in all calculations I see two additional solutions here:
|
There is certainly no need for assert(not useLogRamp or (magnitude1>0 and magnitude2>0),
"ComplexRampPhasor: magnitude1 and magnitude2 have to be greater than zero, if useLogRamp = true"); |
Ah, yes. That could be handled using something like
That seems like the simplest solution. I tried running the model with that change, and it just worked.
That doesn't work well, if startTime is 1000s and duration is zero the eps will be lost in under-flow (as if the guard didn't exist). Having it as a non-final parameter would require people to set it that wouldn't be nice either. |
Oh, looking at the documentation for duration it already says that duration=0 gives a step. |
However, the example Modelica.Magnetic.QuasiStatic.FluxTubes.Examples.BasicExamples will have infinite derivatives if:
So, we might as well skip the guard. |
Just have a look at the amount of discussion in #4121 to see how problematic such a simple statement could be. There's a clear risk that the author of the documented behavior didn't realize what sort of complexity this brings to the model. Maybe it is time to also stop misusing ramps in the complex for steps? |
MAP-LIB Group during monthly meeting: #4239 is the cleaner proposal (without eps). |
Related PR with discussion about continuity of the |
c8d3500
to
d1abddd
Compare
Since #4239 is merged we should skip this one. |
Based on #4042 (comment)
Note
duration>=eps*abs(startTime)
.