-
Notifications
You must be signed in to change notification settings - Fork 167
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
MSL 4.1.0 Regressions - Electrical and ComplexBlocks #4333
Comments
@AHaumer The LTX run actually shows a correctness failure in |
@maltelenz @GallLeo |
Regressions not mentioned in this ticket:
Should they also get new references @AHaumer ? Current comparison report: |
This model was already reported in #4363 |
OUTDATED see below |
@GallLeo |
@GallLeo Regarding the timeout of Modelica.Electrical.Machines.Examples.InductionMachines.IMC_YD: |
I tried to analyze the problem a little bit: |
Another quick solution: |
I am in favor of keeping the original simulation tolerances and switch paramerers. If switching the simulation algorithm to cvode solves the issue, this is my preferred the way to go. If we would reduce simulation tolerances and switch parameters instead, the following question arises: Why not change these tolerances and paramerers throughout the entire MSL, if we can live with less accuracy... |
I'm also definitely in favour of updating the parameters. We should not include in the MSL examples that are numerically challenged. Regarding switching the simulation algorithm, unfortunately we don't have the standardized annotations to do so, only vendor-specific annotations. This should probably be discussed at some point, as there are some models that need certain kind of solvers to be simulated efficiently. For example, flexible multibody models have very fast and very poorly damped eigenvalues, which don't work well with the stability region of BDF codes like DASSL, which is horribly slow as it needs to take very small steps to avoid going unstable. Implicit Runge-Kutta algorithms such as RADAU instead work very well. The question is, do we standardize individual solvers? Categories of solvers, such as implicit/explicit, single-step, multi-step? That's still unclear to me. Anyway, topic for another ticket 😃 |
Status: |
How do you know that for the Modelica model? After investigation: in Dymola it depends on how smooth is handled. Importantly it is not an error in the automatic handling of smooth since:
With events you also get two events very close together; which might indicate another numerical issue. The reason to have smooth in the model is that in some other operating mode the OpAmp might change back and forth a lot, and you don't want events for that. My estimate is that in reality such a model has some extra part (capacitance, inductance) that is missing from this model - and that extra part avoids the issue. |
For me it seems that the parameter {opAmp1, opAmp2}.strict (on the Advanced tab) has a great influence.
|
The problem seems to be the state That signal looks like a very small sine-signal with period 0.02 s (or 50 Hz), as if it is caused by some residual current. I have not analyzed that further. |
|
I don't know it from the Modelica. I know that from the physics: this circuit has +/- 15 V supply, so the output voltage of the op-amp shall be within that range. Whether this is a tool issue or a modelling issue I also don't know, but for certain resolving the issue (whatever it is) by removing the signal from the set of references is a classical dirt-under-the-carpet action I wouldn't recommend 😃 |
Now, disregarding homotopy, which only matters for initialization, the current opAmp model has two modes of operation
In the first case, events are explicitly verboten, in the second case, tools may try play some tricks with if-expressions and event-handling in the (vain) attempt of making the simulation faster but, as we've seen, the results are not necessarily successful. I tried again Toni's new implementation in OpenModelica, by switching off all the advanced flags for both opAmps, so that the plain equation v_out = (if V0*v_in>vps then vps else if V0*v_in<vns then vns else V0*v_in) is used in both, with event generation. In order to avoid the ambiguity of the initial solution, I simply set the initial voltage of the capacitor to 10 V, which corresponds to a single solution of the initial equations. Using OpenModelica with tolerance = 1e-6, the simulation fails numerically for amplification factors V0 > 2000 (Toni set V0 = 15000 in his model). However, if I set Tolerance = 1e-7, 1e-8, 1e-9, or even 1e-10, and change the length of the Interval betweeen 0.001 and 0.0001, the simulation always runs successfully with V0 = 15000, and always produces the correct results: The frequency 10 Hz of the square wave is reproduced with very high accuracy already at Tolerance = 1e-7. The fact that a tight tolerance is necessary to get through this simulation is understandable, given the high nonlinearity of the system. At each switching, opAmp1 enters and leaves the saturation region in a very short time interval (of the order of the microsecond), due to its very high gain. So, I'm not surprised that a too sloppy tolerance causes solver failure. The important thing is that tightening it does not make things worse. Regarding the initial conditions, I think setting I believe that the behaviour of examples in the MSL should be non-ambiguous and do not depend on the choice of tearing variables and their start attribute, so a configuration that unambiguously determines the initial conditions only based on the initial state values should be preferred. If one wanted to simulate what happens when you turn the circuit on, one could also set, say, Maybe we could keep both examples in the MSL, one as SignalGeneratorPeriodic and the other as SignalGeneratorStartUp. |
Summing up, my proposal for MSL 4.1.0 at the moment is the following:
Here is Toni's package with the modified SignalGenerator example case. OpAmps.mo |
The following models fail in result comparison.
Tested revision: f9bddf8 (2024-02-16)
Changed models, need reference update after library officer check:
- Reason: Erroneous initialization of armatureInverter.iDCFilter has been fixed.
@GallLeo pls. create new reference results.
- Updated reference files?
- Reason: Erroneous initialization of armatureInverter.iDCFilter has been fixed.
@GallLeo pls. create new reference results.
- Updated reference files?
- Reason: Erroneous initialization of armatureInverter.iDCFilter has been fixed.
@GallLeo pls. create new reference results.
- Updated reference files?
- Reason: Bugfix in Modelica.Electrical.PowerConverters.DCAC.Control.SVPWM
@GallLeo pls. create new reference results.
- Updated reference files?
- Note: does not fail in csv-compare, but in integral check for inverter.ac.v
- Reason: Changed formulation of comparison in Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM
@GallLeo pls. create new reference results.
- Updated reference files?
- Reason: Changed formulation of comparison in Modelica.Electrical.PowerConverters.DCDC.Control.SignalPWM
@GallLeo pls. create new reference results.
- Updated reference files?
- Reason: Model has not been touched for ages, differences are neglectible.
@GallLeo pls. create new reference results.
- Updated reference files?
- Reason: Changed the parameters of the example to get more eye-catching results.
@GallLeo pls. create new reference results.
- Updated reference files?
Not classified yet, needs library officer check:
Modelica.Electrical.Machines.Examples.InductionMachines.IMC_InverterDrive
- Reason: Bugfix in Modelica.Electrical.PowerConverters.DCAC.Control.SVPWM
@GallLeo pls. create new reference results.
- Updated reference files?
@GallLeo please note: We have improved the comparisonSignals.txt in PR comparisonSignals of PowerConverters #4353 of Modelica.Electrical.PowerConverters.Examples.DCDC.HBridge.{HBridge_R, HBridge_RL, HBridge_DC_Drive}, also back-ported to maint/4.1.x in comparisonSignals of PowerConverters #4372.
Please create new reference results for all three examples.
Release notes check: Are all classes mentioned which could lead to result changes in user models?
Useful Links
Current comparison report:
https://www.ltx.de/download/MA/Compare_MSL_v4.1.0/comparison_report_overview.html
-> Reference result test -> Comparison
Comparison signal definitions:
https://github.com/modelica/ModelicaStandardLibrary/tree/master/Modelica/Resources/Reference/Modelica
https://github.com/modelica/ModelicaStandardLibrary/tree/master/ModelicaTest/Resources/Reference/ModelicaTest
Reference results:
https://github.com/modelica/MAP-LIB_ReferenceResults
The text was updated successfully, but these errors were encountered: