MULTI-PHASE MIXTURE MEDIA
Johan Windahl1, Katrin Prölss1, Maarten Bosmans2,
Hubertus Tummescheit1, Eli van Es2, Awin Sewgobind2
1Modelon, 2Vortech
• MODELICAPROP - CleanSky SGO project
 In collaboration with Modelon and Vortech
• Objectives
 Add support for mixtures with multiple phases
 Analyze Modelica.Media structure
 Interface external property databases
BACKGROUND
• Meeting in Delft - 17 people
 Academia, Industry, Modelica design group, CO-Lan
• Conclusion
 Performance important (framework should support caching)
 Challenge: Not possible to share interface
BACKGROUND
model Example
replaceable package Medium=MyMedium;
Medium.MyExternalObject eo;
Modelica.SIunits.Density d;
equation
d=Medium.density_pT(1e5,300,eo);
end Example;
• Thermal separation
 Distillation processes
MOTIVATION – NEW APPLICATIONS
• Thermodynamic cycle
– Temperature glide
• Transport of flows
– Compositional pipe network
– CPU expensive
• Modelica.Media interface
• Limitations
 Single substance medium with two phases (liquid and vapor)
 Designed for power/energy applications (mass-based)
 Different ways of usage – confusing
 Relies on common subexpression elimination
• Find a new structure!
MODELICA MEDIA
1. Structure and user-friendliness
A. Share interface
- Native Modelica media and external C-code based media
B. Easy to use, understand and implement.
- Details should be hidden from the user
2. Multi-component multi-phase (new functionality)
 Phase equilibrium
 Properties for a specified present phase
Identification of phases and compounds
 Mole and mass based properties
Chemical industry works in mole while energy in mass
GENERAL REQUIREMENTS
Function based Model based
INTERFACE STRUCTURE
Record based
INTERFACE: FUNCTION VS MODEL
• Advantages model based interface
• Share interface between external and native Modelica media
• Hide implementation details (external object)
• Equation based implementation
• Tool solve flash calculations
• User friendly - work graphically
• Minimalistic interface
• Avoid new functions for new input combinations
• Avoid dependency on special trick as common-sub expression
elimination
• Drawbacks
• No usage inside functions
• User unfriendly to calculate parameter
• Not calculate property on demand
MULTI-PHASE MIXTURE
• Package with models and helper functions
• ThermoProperties - similar to
BaseProperties in MSL
• parameters: inputs.pTX, init, optimization
• variables: p,T, d, … (mass and mole based)
• MultiPhaseProperties
• Overall (_overall) and single phase (_1ph)[nP]
properties
• phaseComposition, phaseFraction
EXAMPLE – THERMO-PROPERTIES
• C/C++ Modelica property interface
 Backends to CAPE-OPEN, RefProp, FluidProp
EXTERNAL MULTI-PHASE MIXTURE MEDIA
• A few similar functions (calcThermoProperties_XXX)
 Combines flash and property calculation
C-INTERFACE
• External property code
 Not designed for dynamic simulation
 Error when calling outside validity area
 Non-converging region
 Limited support for partial derivatives
 No support for providing iteration start values
• General no support for overall derivatives
 One-phase region: analytical calculation
 When multiple phases exist: calculated numerically (Modelica side)
EXTERNAL INTERFACE - CHALLENGES
• Modelica tool
 Not possible to calculate iteration start values from a property model
• Modelica specification
 Inconvenient to use a model/block based structure to calculate
parameters
LIMITATIONS
• Case 1: Native Modelica Air media
 3 component simple media, incompressible liquid phase and ideal gas
assumptions
 VLE, fugacities polyniominal adapted to data- solved by tool
 Simulate fast (Initialization is a challenge)
TEST CASE 1 - AIR SEPARATION UNIT
0 4000 8000
0
4
8
Simulation time (s)
CPUtime
• Case 2: Refprop Air media
 3 component air media, mixture of multi-parameter eos
 Different state selections and media inputs tested
 Solver getting stuck or failure when calling outside validity region
 Needs to be analyzed further
TEST CASE 2 - AIR SEPARATION UNIT
• New framework for multi-component multi-phase
 Open up new areas where the Modelica technology can be used
 New model based media
Support both native Modelica and external media
 Finding a structure more challenging than expected
Due to Modelica restrictions, combination of pure and differentiable
functions
CONCLUSION
• More testing and evaluation of concept
 New use cases
• Infrastructure for native Modelica implementations
 Equation of state, mixing rules
 Initialization part (homotopy?)
• Extend the C-interface backend
 More property packages: e.g. MultiFlash
 New functionality
• We encourage you to take part in continuing the
development!
 Open-source GitHub Repository
• Thanks EU for the financial support!
FUTURE WORK

Multi phase mixture media

  • 1.
    MULTI-PHASE MIXTURE MEDIA JohanWindahl1, Katrin Prölss1, Maarten Bosmans2, Hubertus Tummescheit1, Eli van Es2, Awin Sewgobind2 1Modelon, 2Vortech
  • 2.
    • MODELICAPROP -CleanSky SGO project  In collaboration with Modelon and Vortech • Objectives  Add support for mixtures with multiple phases  Analyze Modelica.Media structure  Interface external property databases BACKGROUND
  • 3.
    • Meeting inDelft - 17 people  Academia, Industry, Modelica design group, CO-Lan • Conclusion  Performance important (framework should support caching)  Challenge: Not possible to share interface BACKGROUND model Example replaceable package Medium=MyMedium; Medium.MyExternalObject eo; Modelica.SIunits.Density d; equation d=Medium.density_pT(1e5,300,eo); end Example;
  • 4.
    • Thermal separation Distillation processes MOTIVATION – NEW APPLICATIONS • Thermodynamic cycle – Temperature glide • Transport of flows – Compositional pipe network – CPU expensive
  • 5.
    • Modelica.Media interface •Limitations  Single substance medium with two phases (liquid and vapor)  Designed for power/energy applications (mass-based)  Different ways of usage – confusing  Relies on common subexpression elimination • Find a new structure! MODELICA MEDIA
  • 6.
    1. Structure anduser-friendliness A. Share interface - Native Modelica media and external C-code based media B. Easy to use, understand and implement. - Details should be hidden from the user 2. Multi-component multi-phase (new functionality)  Phase equilibrium  Properties for a specified present phase Identification of phases and compounds  Mole and mass based properties Chemical industry works in mole while energy in mass GENERAL REQUIREMENTS
  • 7.
    Function based Modelbased INTERFACE STRUCTURE Record based
  • 8.
    INTERFACE: FUNCTION VSMODEL • Advantages model based interface • Share interface between external and native Modelica media • Hide implementation details (external object) • Equation based implementation • Tool solve flash calculations • User friendly - work graphically • Minimalistic interface • Avoid new functions for new input combinations • Avoid dependency on special trick as common-sub expression elimination • Drawbacks • No usage inside functions • User unfriendly to calculate parameter • Not calculate property on demand
  • 9.
    MULTI-PHASE MIXTURE • Packagewith models and helper functions • ThermoProperties - similar to BaseProperties in MSL • parameters: inputs.pTX, init, optimization • variables: p,T, d, … (mass and mole based) • MultiPhaseProperties • Overall (_overall) and single phase (_1ph)[nP] properties • phaseComposition, phaseFraction
  • 10.
  • 11.
    • C/C++ Modelicaproperty interface  Backends to CAPE-OPEN, RefProp, FluidProp EXTERNAL MULTI-PHASE MIXTURE MEDIA
  • 12.
    • A fewsimilar functions (calcThermoProperties_XXX)  Combines flash and property calculation C-INTERFACE
  • 13.
    • External propertycode  Not designed for dynamic simulation  Error when calling outside validity area  Non-converging region  Limited support for partial derivatives  No support for providing iteration start values • General no support for overall derivatives  One-phase region: analytical calculation  When multiple phases exist: calculated numerically (Modelica side) EXTERNAL INTERFACE - CHALLENGES
  • 14.
    • Modelica tool Not possible to calculate iteration start values from a property model • Modelica specification  Inconvenient to use a model/block based structure to calculate parameters LIMITATIONS
  • 15.
    • Case 1:Native Modelica Air media  3 component simple media, incompressible liquid phase and ideal gas assumptions  VLE, fugacities polyniominal adapted to data- solved by tool  Simulate fast (Initialization is a challenge) TEST CASE 1 - AIR SEPARATION UNIT 0 4000 8000 0 4 8 Simulation time (s) CPUtime
  • 16.
    • Case 2:Refprop Air media  3 component air media, mixture of multi-parameter eos  Different state selections and media inputs tested  Solver getting stuck or failure when calling outside validity region  Needs to be analyzed further TEST CASE 2 - AIR SEPARATION UNIT
  • 17.
    • New frameworkfor multi-component multi-phase  Open up new areas where the Modelica technology can be used  New model based media Support both native Modelica and external media  Finding a structure more challenging than expected Due to Modelica restrictions, combination of pure and differentiable functions CONCLUSION
  • 18.
    • More testingand evaluation of concept  New use cases • Infrastructure for native Modelica implementations  Equation of state, mixing rules  Initialization part (homotopy?) • Extend the C-interface backend  More property packages: e.g. MultiFlash  New functionality • We encourage you to take part in continuing the development!  Open-source GitHub Repository • Thanks EU for the financial support! FUTURE WORK