fonsim.components package
Submodules
fonsim.components.actuators module
2020, July 21
- class fonsim.components.actuators.FreeActuator(label=None, fluid=None, curve=None, initial_volume=None)[source]
Bases:
Component
An actuator with a custom pressure-volume relationship specified as a pressure-volume curve or pv-curve. It is named ‘free’ because the actuator cannot drive anything, at least in this simulation. It has two terminals ‘a’ and ‘b’. It has one state ‘mass’ that represents the mass of fluid inside the actuator.
The argument fluid should be one of the fluids defined in the module
fluids
.The argument curve should point to a pressure-volume curve (pv-curve) that describes the pressure-volume relationship of the actuator. It can be:
a filename of a CSV file
a PVCurve object
an object that behaves sufficiently like a PVCurve object
Concerning the latter option, the object should provide the following methods:
get_initial_volume(p0)
fdf_volume(volume)
- Parameters
label – label
fluid – fluid
curve – pressure-volume curve (pv-curve)
- fonsim.components.actuators.freeactuator_compressible(self: FreeActuator)[source]
Init function, part specifically for compressible fluids.
- Parameters
self – FreeActuator object
- Returns
None
- fonsim.components.actuators.freeactuator_incompressible(self: FreeActuator)[source]
Init function, part specifically for incompressible fluids.
- Parameters
self – FreeActuator object
- Returns
None
fonsim.components.circulartube_autodiff module
2020, July 21
- class fonsim.components.circulartube_autodiff.CircularTube_autodiff(label=None, fluid=None, length=0.6, diameter=0.002, roughness=1.5e-06)[source]
Bases:
Component
Tube modeled as an elongated cylindrical shape. The terminal labels are ‘a’ and ‘b’. It is stateless (the kinetic energy of the fluid in the tube is neglected).
The fluid should be one of the fluids defined in the module
fluids
.- TODO:
include kinetic energy of fluid in tube
- Parameters
label – label
fluid – fluid
length – length in m
diameter – internal diameter in m
roughness – wall roughness in m
- fonsim.components.circulartube_autodiff.circulartube_compressible(self: CircularTube_autodiff)[source]
Init function, part specifically for compressible fluids.
- Parameters
self – CircularTube object
- Returns
None
- fonsim.components.circulartube_autodiff.circulartube_incompressible(self: CircularTube_autodiff)[source]
Init function, part specifically for incompressible fluids.
- Parameters
self – CircularTube object
- Returns
None
fonsim.components.containers module
2020, July 21
- class fonsim.components.containers.Container(label=None, fluid=None, volume=None)[source]
Bases:
Component
A Container object is a (by default, empty) container or tank. It has one terminal named ‘a’. It has one state named ‘mass’, which represents the mass of the fluid inside the container.
The fluid should be one of the fluids defined in the module
fluids
. A Container object is mostly useful with compressible fluids.- Parameters
label – label
fluid – fluid
volume – volume of the container in m^3.
- class fonsim.components.containers.LinearAccumulator(label=None, fluid=None, k=None, p0=101299.99999999999, v0=0)[source]
Bases:
Component
A LinearAccumulator object is a flexible reservoir of which the pressure varies linearly with its volume. It has one terminal named ‘a’. It has one state named ‘mass’, which represents the mass of the fluid inside the accumulator.
The pressure p relates to the volume v as follows:
p = k * (v - v0) + p0
.This component does not (yet) pose limits on the volume and the pressure having to be positive (doing so requires describing additional behaviour to handle these cases), so this should be checked manually in the simulation results.
The fluid should be one of the fluids defined in the module
fluids
. This component works well both with compressible and incompressible fluids.- Parameters
label – label
fluid – fluid
k – spring constant, expressed in Pa/m^3
p0 – pressure offset
v0 – volume offset
- fonsim.components.containers.accumulator_compressible(self: LinearAccumulator)[source]
Init function, part specifically for compressible fluids
- fonsim.components.containers.accumulator_incompressible(self: LinearAccumulator)[source]
Init function, part specifically for incompressible fluids
fonsim.components.containers_autodiff module
2020, July 21
- class fonsim.components.containers_autodiff.Container_autodiff(label=None, fluid=None, volume=None)[source]
Bases:
Component
A Container object is a (by default, empty) container or tank. It has one terminal named ‘a’. It has one state named ‘mass’, which represents the mass of the fluid inside the container.
The fluid should be one of the fluids defined in the module
fluids
. A Container object is mostly useful with compressible fluids.- Parameters
label – label
fluid – fluid
volume – volume of the container in m^3.
- fonsim.components.containers_autodiff.container_compressible(self: Container_autodiff)[source]
Init function, part specifically for compressible fluids.
- Parameters
self – Container object
- Returns
None
- fonsim.components.containers_autodiff.container_incompressible(self: Container_autodiff)[source]
Init function, part specifically for incompressible fluids.
- Parameters
self – Container object
- Returns
None
fonsim.components.dummy module
Dummy component for testing. Has one terminal such that system connectivity can be tested. 2022, May 06
- class fonsim.components.dummy.Dummy(label=None)[source]
Bases:
Component
- evaluate(values, jacobian_state, jacobian_arguments, state, arguments, elapsed_time)[source]
Evaluates the component internal equations. This method should be static.
Note: only evaluate left-hand side (LH) of equation, equation should be structured such that RH is always zero.
- Parameters
values – array where the equation residuals will be stored.
jacobian_state – array where the jacobian to the state will be stored.
jacobian_arguments – array where the jacobian to the arguments will be stored.
state – numerical values belonging to the state Variables.
arguments – numerical values belonging to the Variables.
elapsed_time – ? TODO.
- Returns
None
fonsim.components.restrictors module
2020, July 21
- class fonsim.components.restrictors.CircularTube(label=None, fluid=None, length=0.6, diameter=0.002, roughness=1.5e-06)[source]
Bases:
Component
Tube modeled as an elongated cylindrical shape. The terminal labels are ‘a’ and ‘b’. It is stateless (the kinetic energy of the fluid in the tube is neglected).
The pressure drop is only due to major losses, minor losses are neglected. In case of compressible flow, the major losses are calculated using the mean pressure of the two terminals. The fluid should be one of the fluids defined in the module
fluids
.- TODO:
include kinetic energy of fluid in tube
- Parameters
label – label
fluid – fluid
length – length in m
diameter – internal diameter in m
roughness – wall roughness in m
- class fonsim.components.restrictors.FlowRestrictor(label=None, fluid=None, diameter=0.002, k=0.6)[source]
Bases:
Component
Flow restrictor modeled as an orifice with a K-factor. Terminals are named ‘a’ and ‘b’. It is stateless.
In case of compressible flow, the minor losses are calculated using the mean pressure of the two terminals. Values for the K-factor (minor loss coefficient) can be found here. The fluid should be one of the fluids defined in the module
fluids
.- Parameters
label – label
fluid – fluid
diamter – diameter of orifice
k – K-factor
- fonsim.components.restrictors.circulartube_compressible(self: CircularTube)[source]
Init function, part specifically for compressible fluids.
- Parameters
self – CircularTube object
- Returns
None
- fonsim.components.restrictors.circulartube_incompressible(self: CircularTube)[source]
Init function, part specifically for incompressible fluids.
- Parameters
self – CircularTube object
- Returns
None
- fonsim.components.restrictors.flowrestrictor_compressible(self: FlowRestrictor)[source]
Init function, part specifically for compressible fluids.
- Parameters
self – FlowRestrictor object
- Returns
None
- fonsim.components.restrictors.flowrestrictor_incompressible(self: FlowRestrictor)[source]
Init function, part specifically for incompressible fluids.
- Parameters
self – FlowRestrictor object
- Returns
None
fonsim.components.sources module
2020, July 21
- class fonsim.components.sources.MassflowSource(label=None, fluid=None, massflow=None)[source]
Bases:
Component
Ideal massflow source
The massflow exactly equals the desired massflow. A positive* flow value means that fluid **exits the source. It has one terminal ‘a’ and is stateless.
The argument ‘massflow’ should be either a constant value or a callable method that takes a single argument, the argument being the elapsed time since the simulation start.
The argument fluid should be one of the fluids defined in the module
fluids
.- Parameters
label – label
fluid – fluid
massflow – desired massflow
- evaluate(values, jacobian_state, jacobian_arguments, state, arguments, elapsed_time)[source]
Evaluates the component internal equations. This method should be static.
Note: only evaluate left-hand side (LH) of equation, equation should be structured such that RH is always zero.
- Parameters
values – array where the equation residuals will be stored.
jacobian_state – array where the jacobian to the state will be stored.
jacobian_arguments – array where the jacobian to the arguments will be stored.
state – numerical values belonging to the state Variables.
arguments – numerical values belonging to the Variables.
elapsed_time – ? TODO.
- Returns
None
- class fonsim.components.sources.PressureSource(label=None, fluid=None, pressure=None)[source]
Bases:
Component
Ideal pressure source
The pressure exactly equals the desired pressure and the flow is unlimited. It has one terminal ‘a’ and is stateless.
The argument ‘pressure’ should be either a constant value or a callable method that takes a single argument, the argument being the elapsed time since the simulation start.
The argument fluid should be one of the fluids defined in the module
fluids
.- Parameters
label – label
fluid – fluid
pressure – desired pressure
- evaluate(values, jacobian_state, jacobian_arguments, state, arguments, elapsed_time)[source]
Evaluates the component internal equations. This method should be static.
Note: only evaluate left-hand side (LH) of equation, equation should be structured such that RH is always zero.
- Parameters
values – array where the equation residuals will be stored.
jacobian_state – array where the jacobian to the state will be stored.
jacobian_arguments – array where the jacobian to the arguments will be stored.
state – numerical values belonging to the state Variables.
arguments – numerical values belonging to the Variables.
elapsed_time – ? TODO.
- Returns
None
- class fonsim.components.sources.Sink(label=None, pressure=101299.99999999999)[source]
Bases:
PressureSource
Ideal pressure sink at atmospheric pressure
Wrapper of a
PressureSource
set to atmospheric pressure (1013 mBar).- Parameters
label – label
pressure – desired pressure
- class fonsim.components.sources.VolumeflowSource(label=None, fluid=None, volumeflow=None)[source]
Bases:
Component
Ideal volumeflow source
The volumeflow exactly equals the desired volume flow. A positive* flow value means that fluid **exits the source It has one terminal ‘a’ and is stateless.
The value ‘volumeflow’ should be either a constant value or a callable method that takes a single argument, the argument being the elapsed time since the simulation start.
The fluid should be one of the fluids defined in the module
fluids
.- Parameters
label – label
fluid – fluid
volumeflow – desired volumeflow
- fonsim.components.sources.volumeflowsource_compressible(self: VolumeflowSource)[source]
Init function, part specifically for compressible fluids
- Parameters
self – VolumeflowSource object
- Returns
None
- fonsim.components.sources.volumeflowsource_incompressible(self: VolumeflowSource)[source]
Init function, part specifically for incompressible fluids
- Parameters
self – VolumeflowSource object
- Returns
None
fonsim.components.terminals module
2022, May 12
fonsim.components.valves module
2023, April 28
- class fonsim.components.valves.CheckValve(label=None, pressure_threshold=0)[source]
Bases:
Component
Ideal check valve: allows fluid to flow in one direction
Also called: check valve, non-return valve, reflux valve, retention valve, foot valve, or one-way valve
This check valve has no hysteresis, which makes this component stateless. The parameter
pressure_threshold
allows to set a maximum pressure drop. The valve opens fully when the pressure difference equals this threshold, otherwise the valve remains closed and the pressure difference is smaller.- Parameters
label – label
pressure_threshold – maximum pressure drop over the valve
Module contents
2020, September 9