ModelingToolkitStandardLibrary.jl icon indicating copy to clipboard operation
ModelingToolkitStandardLibrary.jl copied to clipboard

Adds hydraulic library

Open ValentinKaisermayer opened this issue 2 years ago • 5 comments

There seems to be still an issue, maybe with the solver, I'm not sure. The mass flow rate should get to zero when the pressure of the volume is equal to the pressure of the source.

Rodas4

hydraulic

Tsit5

hydraulic

Since many components need some sort of media properties, I used the variable scope to lift them into the overall model where they can be centrally defined. Maybe there is a better way to do this. Modelica and Simscape do this via a special block that is present in the model.

ValentinKaisermayer avatar Jun 15 '22 15:06 ValentinKaisermayer

Codecov Report

Merging #78 (0efd202) into main (70ff6ab) will decrease coverage by 0.08%. The diff coverage is 74.07%.

:exclamation: Current head 0efd202 differs from pull request most recent head eb22c76. Consider uploading reports for the commit eb22c76 to get more accurate results

@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
- Coverage   69.42%   69.34%   -0.09%     
==========================================
  Files          23       26       +3     
  Lines         942      985      +43     
==========================================
+ Hits          654      683      +29     
- Misses        288      302      +14     
Impacted Files Coverage Δ
src/Hydraulic/sources.jl 0.00% <0.00%> (ø)
src/Hydraulic/utils.jl 81.81% <81.81%> (ø)
src/Hydraulic/components.jl 100.00% <100.00%> (ø)
src/Thermal/utils.jl 90.00% <0.00%> (ø)
src/Blocks/continuous.jl 98.17% <0.00%> (ø)
src/Thermal/HeatTransfer/sensors.jl 100.00% <0.00%> (ø)
src/Thermal/HeatTransfer/sources.jl 100.00% <0.00%> (ø)
src/Thermal/HeatTransfer/ideal_components.jl 100.00% <0.00%> (ø)

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov[bot] avatar Jun 19 '22 15:06 codecov[bot]

Works fine with smaller solver tolerance: hydraulic

ValentinKaisermayer avatar Jun 19 '22 15:06 ValentinKaisermayer

Conflicts.

Yes. looks like a standard numerical instability due to large dts.

ChrisRackauckas avatar Jun 19 '22 16:06 ChrisRackauckas

@ValentinKaisermayer just curious: why are you modeling changes in density due to pressure but ignore temperature entirely? E.g. for water, 10K change in temperature is more significant than 10MPa change in pressure.

dodoplus avatar Jul 02 '22 13:07 dodoplus

Because this library is supposed to model fluid systems where the change in temperature is negligible. This allows to avoid stream connectors all together. However, if this is an insufficient assumption for the modeling needs at hand, a ThermoFluid domain is needed, i.e. #87.

WSM and Simscape have such a library.

ValentinKaisermayer avatar Jul 02 '22 18:07 ValentinKaisermayer

I guess this is obsolete with #159

ValentinKaisermayer avatar Apr 28 '23 20:04 ValentinKaisermayer