Skip to content
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

Nominal values for mixing volume #629

Closed
mwetter opened this issue Jan 20, 2017 · 6 comments
Closed

Nominal values for mixing volume #629

mwetter opened this issue Jan 20, 2017 · 6 comments
Assignees

Comments

@mwetter
Copy link
Member

mwetter commented Jan 20, 2017

Setting proper nominal values for the states in the mixing volume is difficult because the volume is a non-literal parameter for some models. This issue is to look into scaling the state variables (U, m, mXi and mC) so that they are around unity, regardless of the size of the volume. Once they are unity, a possible reason (bad scaling of states) can be ruled out when looking at simulation performance issues.

@Mathadon : This is FYI. I will look into it for Buildings because I like to have larger test problems before moving it into the Annex 60 library.

@mwetter mwetter self-assigned this Jan 20, 2017
mwetter added a commit that referenced this issue Jan 20, 2017
mwetter added a commit that referenced this issue Jan 21, 2017
@Mathadon
Copy link
Contributor

It could be interesting to run also IDEAS.Examples.PPD12.Ventilation. This is a 9 zone model of a terraced house with a ventilation system and a heating system.

I think the overhead for normalising U, m, and mXi may be larger than the possible gains. I'm also wondering in what algorithms or solver parts it actually matters? For sequential equations I don't think it matters. For explicit Euler I also don't think it matters and for implicit integrators I guess it could matter.
From what I recall from numerical math I also think that normalising by computing U/U_nominal will have a smaller impact than computing U-U_nominal. We already do this by setting T_ref = 273.15 in the computation of the enthalpy, but performance could possibly be improved further by setting T_ref=293.15?

@mwetter
Copy link
Member Author

mwetter commented Jan 25, 2017

The nominal value is used for scaling when the state is close to zero. Below are CPU time comparisons for 4 large test problems:
buildings examples chillerplant datacentercontinuoustimecontrol
buildings examples chillerplant datacenterdiscretetimecontrol
buildings examples dualfandualduct closedloop
buildings examples hydronicheating tworoomswithstorage
buildings examples vavreheat closedloop

Performance is slightly better, except for DualFanDualDuct where the solver runs at one point into numerical issues. These were eventually resolved and I believe could as well have happened with the master as the new formulation gives better scaling, not worse scaling.

@Mathadon I think we should use this change and will propose it for the Annex60 library. Can you run the test case?

The test cases were run with the following script:
scripts_to_run_benchmark.zip

@Mathadon
Copy link
Contributor

Mathadon commented Jan 31, 2017

In the script I see that you used Radau integration. I'm not a big fan of Radau since it does not obtain the promised tolerance in our Modelica speed increase paper.

I also compared Lsodar and Dassl for ����Buildings.Examples.ChillerPlant.DataCenterContinuousTimeControl. In this example Dassl is slower after adding scaling and LSodar is faster:

screen shot 2017-01-31 at 09 17 54

Fyi Buildings.Examples.DualFanDualDuct.ClosedLoop does not run with Evaluate=true.

I also ran IDEAS.Examples.PPD12.Ventilation using Dassl:

screen shot 2017-01-31 at 09 32 26
The same model using Euler results in +- identical computation times.

I.e. the results are not consistents, the change adds equations/complexity and it's not yet clear for me either why it should help (e.g. what operations (solving linear system, etc) benefit from this and in what integrators are they used).
I think we should look into this further if we want to put it into Annex 60?

@mwetter
Copy link
Member Author

mwetter commented May 17, 2017

On the master (commit e74f3a1), in ConservationEquation.mo, the following (hack) is made to set the nominal value, then

  Modelica.SIunits.Mass[Medium.nXi] mXi(nominal=1E-6)
    "Masses of independent components in the fluid";

then

simulateModel("Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedMassFlow", stopTime=3600, method="dassl", tolerance=1e-04, resultFile="WetCoilDiscretizedMassFlow");

works in Dymola 2017 FD01. However, without a nominal value set, which is what is on the master, the model fails for tolerance = 1E-4, 1E-5 and 1E-6. It works with 1E-7 (but the verification with JModelica fails.)
Hence we should scale these states.

@mwetter
Copy link
Member Author

mwetter commented Feb 22, 2021

I will close this as state selection and scaling will be addressed through ibpsa/modelica-ibpsa#1412

@mwetter mwetter closed this as completed Feb 22, 2021
@mwetter
Copy link
Member Author

mwetter commented Feb 22, 2021

Branch was issue629_states_scaling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants