-
Notifications
You must be signed in to change notification settings - Fork 169
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
Problem with CombiTimeTable #2080
Comments
Comment by christiankral on 14 Oct 2016 15:46 UTC |
Comment by beutlich on 14 Oct 2016 17:30 UTC |
Comment by hubertus on 14 Oct 2016 21:42 UTC |
Comment by beutlich on 16 Oct 2016 19:40 UTC I see (and already saw) that this case is urgent. There was a poll six months ago (http://doodle.com/poll/9s7zhtnmguev5c8m) where only a few people from MAP-Lib took part. Unfortunately, only Hubertus and I prefered option 3 or 4, but majority voted for alternative 2. For me, the design decision from 2013 seems wrong: It is not about simulation efficiency but simulation accuracy. Thus I am in dilemma right now, that the current workaround requires modified table data, the voted solution requires a modified model, but my preferred alternative is a fix of the ModelicaStandardTables. |
Modified by beutlich on 17 Oct 2016 06:54 UTC |
Comment by otter on 17 Oct 2016 08:20 UTC
This is a slightly different problem (and not a duplicate): When using periodic continuation, then in general the table output is discontinuous at the periodic continuation point. This means a time event should be generated at these points. Please, make a bug fix, so that time events are generated at periodic continuation points (note, this is completely independent from the solution used for #1627, and also independently from the utilized interpolation method).
This is a general problem, independent of the tables: Algebraic variables of Modelica models are usually not included in the step-size control of the integrator of the Modelica tools. This means that any algebraic variable that is quickly changing (it may also be a smooth, analytic curve; including a smoothly interpolated table) may result in a wrong simulation result because the integrator makes a too large step-size. The only clean way to fix this is to extend the Modelica tools so that all time varying variables in a model are utilized in the step-size control. To do this is most likely a large effort for tool vendors and could reduce the efficiency of simulations. I would suggest to implement option 2 (adding an option to the tables to define whether linearly interpolated points induce time events and keep the current default option to not generate time events). Independently of that, always generate time events at periodic continuation points. |
Comment by beutlich on 17 Oct 2016 09:00 UTC
There already always is a time event at the interval boundary. It is written in the article (subsection 2.1), commented in the code and can be seen with DEBUG_TIME_EVENTS. It is a duplicate of reopened #1627. Please run the model attachment:TestCombiTimeTable.mo with attachment:drivecycle.txt and with attachment:drivecycle_events.txt to see the difference. Still, my (and Hubertus') preferred solution is to fix it in the ModelicaStandardTables (alternative 4 from the poll). |
Comment by beutlich on 22 Oct 2016 12:20 UTC |
… for linear interpolation This is a straight-forward, purely pragmatic and productive short-term bug fix to re-establish the timing behaviour from the closed-source Dymola Tables implementation of MSL v3.2. It also reverts my design decision from 2013 to only generate time events at discontinuities, which was an optimization having unexpected side-effects on the simulation accuracy. Future work: More timing options can be added, e.g., never generate time events (same as CombiTable1D + Clock) or re-introduce current behaviour to only generate time events at discontinuities. Both options require an API change of the ModelicaStandardTables external function interface.
@PMehrfeld @christiankral @hubertus65 @wischhusen @MartinOtter @HansOlsson For now, I fixed it in a pretty pragmatic and straight-forward way by always generating time events in case of linear interpolation (analogously to constant segments), i.e., option 3 of http://doodle.com/poll/9s7zhtnmguev5c8m. Here are my reasons.
I'll keep #1627 open (as enhancement) to add the behaviour to only generate time events at discontinuities and interpolation w/o time events one day. I won't introduce a new choice for the Smoothness enumeration for these alternatives as the Smoothness enumeration also is used for CombiTable1D and CombiTable2D where the alternatives are not applicable. Instead a new parameter will be introduced which requires an API update of ModelicaStandardTable external functions. I did not run the regression on and I hope that @GallLeo can provide them for ModelicaTest.Tables.CombiTimeTable if required. |
… for linear interpolation This is a straight-forward, purely pragmatic and productive short-term bug fix to re-establish the timing behaviour from the closed-source Dymola Tables implementation of MSL v3.2. It also reverts my design decision from 2013 to only generate time events at discontinuities, which was an optimization having unexpected side-effects on the simulation accuracy. Future work: More timing options can be added, e.g., never generate time events (same as CombiTable1D + Clock) or re-introduce current behaviour to only generate time events at discontinuities. Both options require an API change of the ModelicaStandardTables external function interface. # Conflicts: # Modelica/Resources/C-Sources/ModelicaStandardTables.c
…Table * For interpolation by linear segments, the time event generation at interval boundaries can be selected from always, at discontinuities only (defined by replicated sample points) and never * For interpolation by constant segments, time events at interval boundaries are always generated * For smooth interpolation by cubic Hermite splines, time events at interval boundaries are not generated * See also 497480d
Reported by christiankral on 14 Oct 2016 15:38 UTC
Consider the attached example. A drive cycle (speed versus time) is read from an external file
drivecycle.txt
. The signal output of the used CombiTimeTable block is connected with a translational speed source. The simulation is performed for two entire drive cycles (= 2 * 600s = 1200s).In the vicinity of 800s the acceleration
speed.a
is calculated incorrectly even thoughspeed.v
is computed correctly; see attached PNG.The same issue occurred using Dymola 2017 and OpenModelica 1.11.0~dev-192-g1d441b1. I therefore conclude that is an issue of the CombiTimeTable and/or tables in general. Someone more familiar with the implementation of tables my assess whether is issue is related with #1627 or not.
Migrated-From: https://trac.modelica.org/Modelica/ticket/2080
The text was updated successfully, but these errors were encountered: