Question

I want to simulate a model in Dymola in real-time for HiL use. In the results I see that the Simulation is advancing about 5% too fast.

Integration terminated successfully at T = 691200

CPU-time for integration : 6.57e+005 seconds

CPU-time for one GRID interval: 951 milli-seconds

I already tried to increase the grid interval to reduce the relativ error, but still the simulation is advancing too fast. I only read about aproaches to reduce model complexity to allow simulation within the defined time steps.

Note, that the Simulation does keep up with real-time and is even faster. How can I ín this case match simulated time and real time?

Edit 1:

I used Lsodar solver with checked "Synchronize with realtime option" in Realtime tab. I have the realtime simulation licence option. I use Dymola 2013 on Windows 7. Here the result for a stepsize of 15s:

Integration terminated successfully at T = 691200

CPU-time for integration : 6.6e+005 seconds

CPU-time for one GRID interval : 1.43e+004 milli-seconds

The deviation still is roughly about 4.5%.

I did however not use inline integration.

Do I need hard realtime or inline integration to improve those results? It should be possible to get a deviation lower than 4.5% using soft realtime or not?

Edit 2:relative difference between real time and Simulation advance in %

I took the Python27 block from the Berkeley Buildings library to read the System time and compare it with the Simulation advance. The result shows that 36 hours after Simulation start, the Simulation slows down slightly (compared to real time). About 72 hours after the start of the simulation it starts getting about 10% faster than real time. In addition, the jitter in the result increases after those 72 hours.

Any explanations?

Next steps will be: -changing to fixed step solver (Might well be this is a big part of the solution) -Changing from DDE Server to OPC Server, which at the Moment doesn't not seem to be possible in Dymola 2013 however.

Edit 3: Relative Simulation time deviation with fixed step solver

Nope... using a fixed step solver does seem to solve the problem. In the first 48 hours of simulation time the deviation seems to be equal to the deviation using a solver with variable step size. In this example I used the Rkfix 3 solver with an integrator step of 0.1.

Nobody knows how to get rid of those huge deviations?

Was it helpful?

Solution 3

I solved the problem switching to an embedded OPC-Server. Error between real time and simulation time in this case is shown below. Timing error for Simulation with embedded OPC-Server

Compiling Dymola Problems with an embedded OPC-Server requires administrator rights (which I did not have before). The active folder of Dymola must not be write protected.

OTHER TIPS

If I recall correctly, Dymola has a special compilation option for real-time performance. However, I think it is a licensed option (not sure).

I suspect that Dymola is picking up the wrong clock speed.

You could use the "Slowdown factor" that is in the Simulation Setup, on the Realtime tab just below "Synchronize with realtime". Set this to 1/0.95.

There is a parameter in Dymola that you can use to set the CPU speed but I could not find this now, I will have a look for this again later.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top