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)

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)

Init function, part specifically for compressible fluids.

Parameters:

self – FreeActuator object

Returns:

None

fonsim.components.actuators.freeactuator_incompressible(self: FreeActuator)

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)

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)

Init function, part specifically for compressible fluids.

Parameters:

self – CircularTube object

Returns:

None

fonsim.components.circulartube_autodiff.circulartube_incompressible(self: CircularTube_autodiff)

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)

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.container_compressible(self: Container)

Init function, part specifically for compressible fluids.

Parameters:

self – Container object

Returns:

None

fonsim.components.containers.container_incompressible(self: Container)

Init function, part specifically for incompressible fluids.

Parameters:

self – Container object

Returns:

None

fonsim.components.containers_autodiff module

2020, July 21

class fonsim.components.containers_autodiff.Container_autodiff(label=None, fluid=None, volume=None)

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)

Init function, part specifically for compressible fluids.

Parameters:

self – Container object

Returns:

None

fonsim.components.containers_autodiff.container_incompressible(self: Container_autodiff)

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)

Bases: Component

evaluate(values, jacobian_state, jacobian_arguments, state, arguments, elapsed_time)

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)

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

class fonsim.components.restrictors.FlowRestrictor(label=None, fluid=None, diameter=0.002, k=0.6)

Bases: Component

Flow restrictor modeled as an orifice with a K-factor. Terminals are named ‘a’ and ‘b’. It is stateless.

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)

Init function, part specifically for compressible fluids.

Parameters:

self – CircularTube object

Returns:

None

fonsim.components.restrictors.circulartube_incompressible(self: CircularTube)

Init function, part specifically for incompressible fluids.

Parameters:

self – CircularTube object

Returns:

None

fonsim.components.restrictors.flowrestrictor_compressible(self: FlowRestrictor)

Init function, part specifically for compressible fluids.

Parameters:

self – FlowRestrictor object

Returns:

None

fonsim.components.restrictors.flowrestrictor_incompressible(self: FlowRestrictor)

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)

Bases: Component

Ideal massflow source. The massflow exactly equals the desired massflow. The pressure is limited to positive values. 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)

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)

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.

TODO
  • Limit pressure to positive values.

Parameters:
  • label – label

  • fluid – fluid

  • pressure – desired pressure

evaluate(values, jacobian_state, jacobian_arguments, state, arguments, elapsed_time)

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.VolumeflowSource(label=None, fluid=None, volumeflow=None)

Bases: Component

Ideal volumeflow source. The volumeflow exactly equals the desired volume flow. The pressure is limited to positive values. 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.

TODO
  • Limit pressure to positive values.

Parameters:
  • label – label

  • fluid – fluid

  • volumeflow – desired volumeflow

fonsim.components.sources.volumeflowsource_compressible(self: VolumeflowSource)

Init function, part specifically for compressible fluids.

Parameters:

self – VolumeflowSource object

Returns:

None

fonsim.components.sources.volumeflowsource_incompressible(self: VolumeflowSource)

Init function, part specifically for incompressible fluids.

Parameters:

self – VolumeflowSource object

Returns:

None

Module contents

2020, September 9