-
Notifications
You must be signed in to change notification settings - Fork 167
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
Open
casella
wants to merge
2
commits into
modelica:master
Choose a base branch
from
casella:fix-SimpleTank
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arunkumar-narasimhan
approved these changes
Feb 11, 2025
There was a problem hiding this 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
HansOlsson
reviewed
Feb 11, 2025
As discussed at the meeting
beutlich
reviewed
Feb 12, 2025
@@ -307,7 +307,7 @@ of the modeller. Increase nPorts to add an additional port. | |||
end for; | |||
// Check for correct solution | |||
assert(fluidLevel <= fluidLevel_max, "Vessel is overflowing (fluidLevel > fluidLevel_max = " + String(fluidLevel) + ")"); | |||
assert(fluidLevel > -1e-6*fluidLevel_max, "Fluid level (= " + String(fluidLevel) + ") is below zero meaning that the solution failed."); | |||
assert(fluidLevel > 0, "Fluid level (= " + String(fluidLevel) + ") is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
assert(fluidLevel > 0, "Fluid level (= " + String(fluidLevel) + ") is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular."); | |
assert(fluidLevel > 0, "Fluid level is too small, the tank cannot be completely empty otherwise the energy balance equation becomes singular."); |
Might be advisable to remove the value directly here (and in the assert message above) to follow #4399 (see also #4519).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #4526 by:
With the following prescribed incoming flow (which is unchanged w.r.t. MSL 4.0.0)
![immagine](https://private-user-images.githubusercontent.com/4233148/411364612-d7f5efac-9651-4cd5-acde-40804ecf1ba2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTM1NTgsIm5iZiI6MTczOTY5MzI1OCwicGF0aCI6Ii80MjMzMTQ4LzQxMTM2NDYxMi1kN2Y1ZWZhYy05NjUxLTRjZDUtYWNkZS00MDgwNGVjZjFiYTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDgwNzM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmI4NTU5ZTNjM2M2N2JmMDBiNzk4YmU0YjVhY2FhYjAzOWE0ZTk1MmRjYzcwY2ZmNmVkYTdhZWY3ODNiY2RlZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.A-nridO6Es4llMCmSe-dr7hBenQA66pkrRWwV7cguPI)
![immagine](https://private-user-images.githubusercontent.com/4233148/411364671-345342d8-e03d-4780-bb53-412e4ad86b49.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTM1NTgsIm5iZiI6MTczOTY5MzI1OCwicGF0aCI6Ii80MjMzMTQ4LzQxMTM2NDY3MS0zNDUzNDJkOC1lMDNkLTQ3ODAtYmI1My00MTJlNGFkODZiNDkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDgwNzM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmMyZjJlMWNmMjBlODM1ZmQ0YWU5YTYxOTJhNzkyY2FkYWM0M2E3Zjk2YzEyOGZhZmEwMzk4MjYyOGUxNzI2ZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ed1JXUovaAajqimjGJdI9AMTQxKc-_-wnHpCRuPNuN8)
OMC can now simulate the system successfully and produces the following transient for the level
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](https://private-user-images.githubusercontent.com/4233148/411365069-7089fd23-7f39-4b5d-ac08-ac1a9bcc8fa8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2OTM1NTgsIm5iZiI6MTczOTY5MzI1OCwicGF0aCI6Ii80MjMzMTQ4LzQxMTM2NTA2OS03MDg5ZmQyMy03ZjM5LTRiNWQtYWMwOC1hYzFhOWJjYzhmYTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTZUMDgwNzM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmE0ZDFlZGRjOWI4MGJlNTgwOTE2NDlhYjU3MTQ1NThhMjVkZjM3YjhhZDJiYzYwOWMwMzRhOTU2NTc1YjUxMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.dYugfujMMsumodArIWvIfwVSTasr9AyFjSAUiWak_68)