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

Modelica.Fluid.Examples.TraceSubstances.RoomCO2WithControls is problematic because of chattering #4312

Open
casella opened this issue Feb 13, 2024 · 10 comments · Fixed by #4522 · May be fixed by #4533
Open

Modelica.Fluid.Examples.TraceSubstances.RoomCO2WithControls is problematic because of chattering #4312

casella opened this issue Feb 13, 2024 · 10 comments · Fixed by #4522 · May be fixed by #4533
Assignees
Labels
bug Critical/severe issue example Issue only addresses example(s) L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)
Milestone

Comments

@casella
Copy link
Contributor

casella commented Feb 13, 2024

As reported in #4305, Modelica.Fluid.Examples.TraceSubstances.RoomCO2WithControls is problematic: Dymola 2024x fails with it and so does OpenModelica. Apparently there are some reasons to generate chattering.

This should be investigated before the 4.1.0 release.

@casella casella added bug Critical/severe issue L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) labels Feb 13, 2024
@casella casella added this to the MSL4.1.0 milestone Feb 13, 2024
@casella casella self-assigned this Feb 13, 2024
@beutlich beutlich added the example Issue only addresses example(s) label Feb 13, 2024
@maltelenz
Copy link
Contributor

We also see chattering around the same time in System Modeler.

@casella
Copy link
Contributor Author

casella commented Oct 24, 2024

I'll have a closer look ASAP

@MatthiasBSchaefer
Copy link
Contributor

This is the commit, causing the chattering according to my tests in Dymola:
930456a

@HansOlsson
Copy link
Contributor

I tried to debug it and preliminarily it seems that the linear part makes sense, but needed to be applied in additional cases.

Specifically the code has:

      if  xi1 < x0 or xi2>x1 then
        // The limits don't make sense, just use linear interpolation
        y := (y1-y0)*(x-x0)/(x1-x0) + y0;
      else

And what happens here is that xi1 and xi2 are practically identical, but x0 and x1 are different.
Adding or abs(xi2-xi1)<100*Modelica.Constants.eps fixes this specific case, but it should be investigated a bit more.

@HansOlsson
Copy link
Contributor

I tried to apply the above and run all the Fluid-tests (without looking at the results) (on maint/4.1.x since I needed MSL-binaries).

In Dymola 2025x (updated) with Advanced.Translation.PlaceDymolaSourceFirst = 2; all fluid examples ran.
I'll make a proper PR of this.

@HansOlsson HansOlsson mentioned this issue Jan 21, 2025
@HansOlsson HansOlsson linked a pull request Jan 21, 2025 that will close this issue
@casella
Copy link
Contributor Author

casella commented Feb 9, 2025

It seems that @HansOlsson managed to fix the remaining issues with regfun3 in PR #4522. When that is merged on master we can check if there are any issues popping up with other models and if we have no evidence of that we can back-port it to 4.1.0.

@casella
Copy link
Contributor Author

casella commented Feb 9, 2025

As already noted in #3758, some of these issues are popping up because we are using flow models that are meant to handle static head in the trivial cases where the pipe is exactly horizontal. As I understand, this makes the numerical behaviour of regfun3 tricky. As suggested by @sielemann in #3758, we should probably fix Modelica.Fluid.Pipes.BaseClasses.FlowModels.PartialGenericPipeFlow so that it completely skips the part that accounts for static head if max(abs(dheights)) < eps.

Given the quite complex structure of the pipe model, this is not completely trivial, so I'd keep this as an improvement for MSL 4.2.0, see #4525.

casella pushed a commit that referenced this issue Feb 9, 2025
* Avoid chattering in Modelica.Fluid.Examples.TraceSubstances.RoomCO2WithControls

* Better way of avoiding ill-posed problem.
@casella
Copy link
Contributor Author

casella commented Feb 9, 2025

Reopen until back-ported to maint/4.1.x

@casella casella reopened this Feb 9, 2025
@casella
Copy link
Contributor Author

casella commented Feb 11, 2025

@Esther-Devakirubai please back-port #4522 to maint/v4.1.x.

We are only closing this ticket for good after we check that there are no regressions on 4.1.0 on the LTX serves

beutlich pushed a commit to beutlich/ModelicaStandardLibrary that referenced this issue Feb 12, 2025
* Avoid chattering in Modelica.Fluid.Examples.TraceSubstances.RoomCO2WithControls

* Better way of avoiding ill-posed problem.
@beutlich
Copy link
Member

please back-port #4522 to maint/v4.1.x.

Done by #4533.

@beutlich beutlich linked a pull request Feb 12, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue example Issue only addresses example(s) L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants