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

Avoid the tank to ever become completely empty - fixes #4526 #4527

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

casella
Copy link
Contributor

@casella casella commented Feb 9, 2025

This fixes #4526 by:

  • adding an assert that prevents the tank to ever become completely empty, a condition in which the energy balance equation becomes singular
  • putting the height of the bottom port 1 mm above the bottom of the tank, to avoid it getting completely empty
  • initializing the tank level at 1 mm, not 0, which is singular and no longer allowed.

With the following prescribed incoming flow (which is unchanged w.r.t. MSL 4.0.0)
immagine
OMC can now simulate the system successfully and produces the following transient for the level
immagine

As expected, the tank starts near empty at 1 mm level and the check-valve behaviour on the bottom port prevents the fluid from going down the drain. When providing 40 kg/s of incoming flow rate ,which is more than the out-going pipe can drain, the level goes up; however, when that flow rate is reduced to 10 kg/s, the level goes down, until it settles to a value very close to the level of the outlet port, which swallows the incoming flow while keeping the level constant. When the flow rate is reduced to zero, the level settles down to 1 mm, i.e., the port level. And so on and so forth...

As expected, since the tank fluid is initialized at ambient temperature and the fed fluid is also at ambient temperature, the fluid temperature is always well defined and always equal to ambient temperature, i.e., 20 degC
immagine

Copy link
Collaborator

@arunkumar-narasimhan arunkumar-narasimhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

As discussed at the meeting
Removed explicit reference to value in assert string

Co-authored-by: Thomas Beutlich <[email protected]>
@casella casella enabled auto-merge (squash) February 24, 2025 18:33
@casella
Copy link
Contributor Author

casella commented Feb 24, 2025

Waiting for one more review to be merged and back-ported to maint/4.1.0

Copy link
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense.

@casella casella merged commit 7c4858b into modelica:master Feb 25, 2025
11 checks passed
Esther-Devakirubai pushed a commit that referenced this pull request Feb 25, 2025
* Avoid the tank to ever become completely empty

* Update Modelica/Fluid/Vessels.mo

As discussed at the meeting

* Update Modelica/Fluid/Vessels.mo

Removed explicit reference to value in assert string

Co-authored-by: Thomas Beutlich <[email protected]>

---------

Co-authored-by: Hans Olsson <[email protected]>
Co-authored-by: Thomas Beutlich <[email protected]>
@Esther-Devakirubai
Copy link
Contributor

Backporting by #4545

casella added a commit that referenced this pull request Feb 25, 2025
…4545)

* Avoid the tank to ever become completely empty

* Update Modelica/Fluid/Vessels.mo

As discussed at the meeting

* Update Modelica/Fluid/Vessels.mo

Removed explicit reference to value in assert string



---------

Co-authored-by: Francesco Casella <[email protected]>
Co-authored-by: Hans Olsson <[email protected]>
Co-authored-by: Thomas Beutlich <[email protected]>
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

Successfully merging this pull request may close these issues.

Problems with ModelicaTest.Fluid.TestComponents.Vessels.TestSimpleTank
5 participants