ibpsa / project1

Project 1
48 stars 39 forks source link

WP3 Network: Results vary with different solvers #29

Open MichaMans opened 5 years ago

MichaMans commented 5 years ago

@FelixBue @bramvdh91 and me did some simulations for the network of the DESTEST with Modelica. As a reference we simulated the system with the euler solver and 1s timestep. Afterwards we changed to cvode and dassl because the system simulation time is not feasible with the euler solver (2h (euler) --> 2 min (cvode) Simulation time). Now we are running into huge deviations in the results. An example for the injected heat into the system is shown below.

Do you have any hints what this error could base on? We are using CombiTimeTables to load the heat demand for the substations, could this maybe throw the error? Are there some known workarounds? In addition i can say, that this case is not 100% reproducible but on the other hand we cannot simulate every system with the euler as a reference to check if the results are correct or not. So we are trying to track the error down to a small example, but at the moment we don't have one.

Does anybody, maybe @Mathadon @mwetter has any hints were we should look to find the error? Could it be the CombiTimeTable? Is this the right place for discussion?

Thank you all very much in advance for helping us 😃

image

mwetter commented 5 years ago

I don't know what the cause is, but are you using a high accuracy for Cvode and dassl, and do you use

Advanced.EfficientMinorEvents = false "More efficient handling of events";
Mathadon commented 5 years ago

@MichaMans Is this a very simple example? I.e. just a pipe and a data reader? In such cases there is so little dynamics (state variables) that the error control on these state variables allows implicit solvers to take large time steps, which may explain your results. So somehow you'd want the implicit solver to take smaller steps. This can be by increasing the tolerance, or by adding more dynamics the model (making the model larger). You can also force the solver to take smaller time steps by configuring the CombiTimeTable such that it throws time events every time that its output changes. By default the CombiTimeTable uses linear interpolation, which results in a smooth output, and therefore the MSL does not throw time events in this case. You can configure it using smoothness=ConstantSegments to reduce the smoothness and then it will throw a time event every time its output change. This will of course slow down the simulation a bit if you have many changes in your data.

MichaMans commented 5 years ago

Thank you both very much! I think your suggestions are very good and I'm going to test it in the near future. I optimistic because currently both your suggestions are not used.