ModelicaStandardLibrary
ModelicaStandardLibrary copied to clipboard
Fixed Wb_flows discretization terms for DynamicPipe
- Fixes made for all structure cases: av_b, a_vb, a_v_b, and av_vb
- The updated discretization terms give more accurate derivatives associated with the volumes
- Energy is now properly conserved (previously av_b, a_vb, and a_v_b had conservation errors)
@mestinso Thank you for you valuable effort!
What I'd like to have are test models (covering all the branches) where the current imlementation raises an assert, but with your fix results in succeeding models. This way we can easily see what the expected purpose of the changes are. Thanks again.
@mestinso Thank you for you valuable effort!
What I'd like to have are test models (covering all the branches) where the current imlementation raises an assert, but with your fix results in succeeding models. This way we can easily see what the expected purpose of the changes are. Thanks again.
@beutlich Sure. Do you suggest I add these test models into ModelicaTest as part of this PR?
Do you suggest I add these test models into ModelicaTest as part of this PR?
Exactly.
@mestinso did you ever get around to adding those tests to ModelicaTest?
@mestinso did you ever get around to adding those tests to ModelicaTest?
@bilderbuchi Unfortunately no, but thanks for the prompt here. I expect to get a little time here in the coming weeks, so, hopefully, I'll push an update soon.
@mestinso Did you got time to add the test to Modelica Test?
@bilderbuchi @TManikantan @hubertus65 @beutlich Two new tester models have been added. The first tester checks for energy conservation for water flow without the kinetic energy term and the second tester checks for energy conservation for airflow with the kinetic energy term. Note that for the previous version of the DynamicPipe model, 6/12 asserts passed in the first tester and 1/4 asserts passed in the second tester.
Nice work! It's kinda surprising that in DynamicPipeEnergyConservationCheck.mo
you don't need an epsilon on the isEqual
-- do you think that could be fragile w.r.t. floating-point comparison issues?
@bilderbuchi @hubertus65 I went ahead and adjusted those tolerances as recommended.
@casella @rfranke a reminder would you please review this fix?
Had email with Francesco, and he will review