Physiolibrary.SteadyStates.Interfaces

Information

Extends from Modelica.Icons.InterfacesPackage (Icon for packages containing interfaces).

Package Content

Name Description
SteadyState Abstract class for any dynamic state calculation (for any derivation), which is driven by SimulationType option.
SteadyStates Abstract class for any dynamic states calculation (for any derivations), which is driven by SimulationType option.
SteadyStateSystem Global abstract class, for additional global state equations

Physiolibrary.SteadyStates.Interfaces.SteadyState

Abstract class for any dynamic state calculation (for any derivation), which is driven by SimulationType option.

Parameters

TypeNameDefaultDescription
IO
Functions to read or store
replaceable package UtilitiesTypes.FilesUtilities (direct...How to store or load the values
Initialization
Realstate_start State start or init value
Value I/O
StringstoreUnit""Unit in Utilities input/output function
StringstateNamegetInstanceName()Name in Utilities input/output function
BooleanLOAD_STARTSfalseLoad start value of state
BooleanSAVE_RESULTSfalseSave final state values
BooleanSAVE_COMPARISONfalseCompare final state values with original values
Equilibrium
Simulation
SimulationTypeSimulationTypes.SimulationType.NormalI...Dynamic with Initialization or Steady State
BooleanisDependentfalse=true, If zero flow is propagated in eqiulibrium through resistors, impedances, reactions, etc.

Connectors

TypeNameDescription
IO
Functions to read or store
replaceable package UtilitiesHow to store or load the values

Modelica definition

partial model SteadyState "Abstract class for any dynamic state calculation (for any derivation), which is driven by SimulationType option." //allow to switch between dynamic mode 'der(y)=x' and steady-state mode 'der(y)=0' replaceable package Utilities = Types.FilesUtilities(directoryName=dirName) constrainedby Types.Utilities "How to store or load the values"; parameter Types.SimulationType Simulation=Types.SimulationType.NormalInit "Dynamic with Initialization or Steady State"; parameter Boolean isDependent = false "=true, If zero flow is propagated in eqiulibrium through resistors, impedances, reactions, etc."; parameter Real state_start "State start or init value"; Real state(start=if LOAD_STARTS then Utilities.readReal(stateName, storeUnit) else state_start, stateSelect=StateSelect.prefer) "This state must be connected in inherited class definition"; Real change "Dynamic change of state value per minute"; constant String dirName = "io" "Directory name to save and load values"; parameter String storeUnit="" "Unit in Utilities input/output function"; parameter String stateName=getInstanceName() "Name in Utilities input/output function"; parameter Boolean LOAD_STARTS = false "Load start value of state"; parameter Boolean SAVE_RESULTS = false "Save final state values"; parameter Boolean SAVE_COMPARISON = false "Compare final state values with original values"; protected parameter Real defaultValue(fixed=false) "Default value of state."; parameter Real initialValue(fixed=false) "Initial value of state."; initial equation if Simulation == Types.SimulationType.NormalInit then state = state_start; elseif Simulation == Types.SimulationType.ReadInit then state = Utilities.readReal(stateName, storeUnit); elseif Simulation == Types.SimulationType.InitSteadyState and not isDependent then der(state)=0; //here it have the same meaning as "change = 0", because of equation "der(state) = change" end if; initialValue = state; //in causality such as initialValue:=state if SAVE_COMPARISON then defaultValue = Utilities.readReal(stateName, storeUnit); else defaultValue = Modelica.Constants.N_A; end if; equation when terminal() then if SAVE_RESULTS then Utilities.writeReal( stateName, state, storeUnit); end if; if SAVE_COMPARISON then Utilities.writeComparison( stateName, defaultValue, initialValue, state, storeUnit); end if; end when; if Simulation <> Types.SimulationType.SteadyState then der(state) = change; elseif not isDependent then /*** this test and equation exclusion could be done automatically, if the solver will be so smart that it removes all this dependent equations from the total equilibrated system. The most probable form of this dependent equation in equilibrium setting is (0 = 0). ***/ change = 0; end if; end SteadyState;

Physiolibrary.SteadyStates.Interfaces.SteadyStates

Abstract class for any dynamic states calculation (for any derivations), which is driven by SimulationType option.

Parameters

TypeNameDefaultDescription
Simulation
Integern Number of states
IO
Functions to read or store
replaceable package UtilitiesTypes.FilesUtilitiesHow to store or load the values
Initialization
Realstate_start[n] State start or init value
Value I/O
BooleanSAVE_RESULTSfalsesave and test final state values with original values
BooleanSAVE_COMPARISONfalseCompare final state values with original values
StringstoreUnit[n]fill("", n)Unit in Utilities input/output function
StringstateName[n]fill(getInstanceName(), n)Name in Utilities input/output function
Equilibrium
Simulation
SimulationTypeSimulationTypes.SimulationType.NormalI...Dynamic with Initialization or Steady State
BooleanisDependent[n]fill(false, n)=true, If zero flow is propagated in eqiulibrium through resistors, impedances, reactions, etc.

Connectors

TypeNameDescription
IO
Functions to read or store
replaceable package UtilitiesHow to store or load the values

Modelica definition

partial model SteadyStates "Abstract class for any dynamic states calculation (for any derivations), which is driven by SimulationType option." //allow to switch between dynamic mode 'der(y)=x' and steady-state mode 'der(y)=0' replaceable package Utilities = Types.FilesUtilities constrainedby Types.Utilities "How to store or load the values"; parameter Integer n "Number of states"; Real state[n](start=state_start, stateSelect=StateSelect.prefer) "This state must be connected in inherited class definition"; Real change[n] "Dynamic change of state value per minute"; parameter Real state_start[n] "State start or init value"; parameter Types.SimulationType Simulation=Types.SimulationType.NormalInit "Dynamic with Initialization or Steady State"; constant String dirName = "io" "Directory name to save and load values"; parameter Boolean SAVE_RESULTS = false "save and test final state values with original values"; parameter Boolean SAVE_COMPARISON = false "Compare final state values with original values"; parameter String storeUnit[n]=fill("",n) "Unit in Utilities input/output function"; parameter String stateName[n]=fill(getInstanceName(),n) "Name in Utilities input/output function"; parameter Boolean isDependent[n]= fill(false,n) "=true, If zero flow is propagated in eqiulibrium through resistors, impedances, reactions, etc."; protected parameter Real defaultValue[n](fixed=false) "Default value of state."; parameter Real initialValue[n](fixed=false) "Initial value of state."; initial equation for i in 1:n loop if Simulation == Types.SimulationType.NormalInit then state[i] = state_start[i]; elseif Simulation == Types.SimulationType.ReadInit then state[i] = Utilities.readReal(stateName[i] + "[" +String(i)+"]", storeUnit[i]); elseif Simulation == Types.SimulationType.InitSteadyState and not isDependent[i] then der(state[i])=0; //here it have the same meaning as "change = 0", because of equation "der(state) = change" end if; initialValue = state; //in causality such as initialValue:=state if SAVE_COMPARISON then defaultValue[i] = Utilities.readReal(stateName[i]+ "[" +String(i)+"]", storeUnit[i]); else defaultValue[i] = Modelica.Constants.N_A; end if; end for; equation when terminal() then if SAVE_RESULTS then for i in 1:n loop Utilities.writeReal( stateName[i]+ "[" +String(i)+"]", state[i], storeUnit[i]); end for; end if; if SAVE_COMPARISON then for i in 1:n loop Utilities.writeComparison( stateName[i]+ "[" +String(i)+"]", defaultValue[i], initialValue[i], state[i], storeUnit[i]); end for; end if; end when; if Simulation <> Types.SimulationType.SteadyState then der(state) = change; else for i in 1:n loop if not isDependent[n] then /*** this test and equation exclusion could be done automatically, if the solver will be so smart that it removes all this dependent equations from the total equilibrated system. The most probable form of this dependent equation in equilibrium setting is (0 = 0). ***/ change[i] = 0; end if; end for; end if; end SteadyStates;

Physiolibrary.SteadyStates.Interfaces.SteadyStateSystem

Global abstract class, for additional global state equations

Parameters

TypeNameDefaultDescription
Simulation
Simulation type
SimulationTypeSimulation Dynamic with Initialization or Steady State
Equilibrium
IntegerNumberOfDependentStates1Number of additional steady state equation of the system

Modelica definition

partial class SteadyStateSystem "Global abstract class, for additional global state equations" parameter Types.SimulationType Simulation(start=Types.SimulationType.NormalInit) "Dynamic with Initialization or Steady State"; parameter Integer NumberOfDependentStates=1 "Number of additional steady state equation of the system"; Real normalizedState[NumberOfDependentStates] "Normalized independent masses of the system/Normalized independent energies of the system/... This variables must always equals to ones."; protected Real state[NumberOfDependentStates](each start=1) "In differential systems has the same meaning as the normalizedState. In steady state has no meaning."; initial equation if (Simulation == Types.SimulationType.SteadyState) or (Simulation == Types.SimulationType.InitSteadyState) then state=ones(NumberOfDependentStates); end if; equation if Simulation == Types.SimulationType.SteadyState then normalizedState = ones(NumberOfDependentStates); //add additional global steady-state equations der(state)=zeros(NumberOfDependentStates); //remove 'state' from system calculations else normalizedState = state; //nothing special, just definition of 'state' variable //Correct definition of normalizedState should fulfill the equation 'normalizedState=ones(NumberOfDependentStates)' during simulation. //The difference from vector 'ones(NumberOfDependentStates)' could be used as the solver calculation error vector. end if; end SteadyStateSystem;

Automatically generated Tue Sep 15 22:54:24 2015.