AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agxHydraulics::FlowUnit Class Reference

FlowUnit is the base class for Units that contains a FlowDimension. More...

#include <FlowUnit.h>

+ Inheritance diagram for agxHydraulics::FlowUnit:

Public Member Functions

 FlowUnit (agx::Real inertia)
 Create a FlowUnit with the given inertia.
 
 FlowUnit (agx::Real length, agx::Real area, agx::Real fluidDensity)
 Create a FlowUnit with inertia calculated from the given parameters.
 
void addPressure (agx::Real pressure, agxPowerLine::Side side)
 Add extra pressure to the FlowUnit at the given side.
 
agx::Real getArea () const
 
virtual agxHydraulics::FlowConnectorgetFlowConnector (agxPowerLine::Side side)
 
virtual const agxHydraulics::FlowConnectorgetFlowConnector (agxPowerLine::Side side) const
 
agxHydraulics::FlowDimensiongetFlowDimension ()
 
const agxHydraulics::FlowDimensiongetFlowDimension () const
 
agx::Real getFlowRate () const
 
agx::Real getFluidDensity () const
 
agx::Real getFluidViscosity () const
 
agx::Real getInletPressure () const
 
agxHydraulics::FlowConnectorgetInputFlowConnector ()
 
const agxHydraulics::FlowConnectorgetInputFlowConnector () const
 
agx::Real getInputPressure () const
 Measure the pressure at the inlet of the FlowUnit.
 
agx::Real getLength () const
 
agx::Real getOutletPressure () const
 
agxHydraulics::FlowConnectorgetOutputFlowConnector ()
 
const agxHydraulics::FlowConnectorgetOutputFlowConnector () const
 
agx::Real getOutputPressure () const
 Measure the pressure at the outlet of the FlowUnit.
 
agx::Real getPressure (agxPowerLine::Side side) const
 Measure the pressure at the given side of the FlowUnit.
 
bool isConnected (agxPowerLine::Side end) const
 
bool setArea (agx::Real area)
 Set the area of the FlowUnit.
 
void setFluidDensity (agx::Real density)
 Set the density of the fluid.
 
void setFluidViscosity (agx::Real viscosity)
 The viscosity specified here is the kinematic viscosity, measured in area per time.
 
void setLength (agx::Real length)
 Set the length of the FlowUnit.
 
- Public Member Functions inherited from agxPowerLine::Unit
 Unit ()
 Constructor.
 
void addNotification (agxPowerLine::PowerLine *powerLine)
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxPowerLine::Unit)
 
void attach (agx::RigidBody *body)
 Define which body in the simulation this Unit is attached to.
 
agx::String buildDimensionsName () const
 
virtual bool connect (agxPowerLine::Connector *connector)
 Connect the unit to a connector.
 
virtual bool connect (agxPowerLine::Side mySide, agxPowerLine::Side connectorSide, agxPowerLine::Connector *connector)
 Connect the unit to a connector, specifying the side of each.
 
virtual bool connect (agxPowerLine::Side mySide, agxPowerLine::Side otherSide, agxPowerLine::Unit *other)
 
virtual bool connect (agxPowerLine::Unit *otherUnit)
 Connect the unit to another unit.
 
virtual bool disconnect (agxPowerLine::Unit *unit)
 
void disconnectAll ()
 
agxPowerLine::PhysicalDimensiongetActiveDimension (size_t index)
 
const agxPowerLine::PhysicalDimensiongetActiveDimension (size_t index) const
 
virtual agxPowerLine::DimensionAndSide getConnectableDimension (agxPowerLine::PhysicalDimension::Type type, agxPowerLine::Side side)
 
virtual void getConnectableDimensionTypes (agxPowerLine::PhysicalDimension::TypeVector &types, agxPowerLine::Side side) const
 
agxPowerLine::PhysicalDimensiongetConnectableInputDimension (agxPowerLine::PhysicalDimension::Type type)
 
agxPowerLine::PhysicalDimensiongetConnectableOutputDimension (agxPowerLine::PhysicalDimension::Type type)
 
void getConnectedUnits (UnitPtrSetVector &result, agxPowerLine::Side side)
 
size_t getConnectors (agxPowerLine::ConnectorPtrVector &result) const
 
size_t getConnectors (const agxPowerLine::Unit *unit, agxPowerLine::ConnectorPtrVector &result)
 Append all connectors connecting this Unit to the given Unit to the 'result' Vector.
 
agxPowerLine::PhysicalDimensiongetDimension (agxPowerLine::PhysicalDimension::Type type)
 
const agxPowerLine::PhysicalDimensiongetDimension (agxPowerLine::PhysicalDimension::Type type) const
 
agxPowerLine::PhysicalDimensionRefVectorgetDimensions ()
 
const agxPowerLine::PhysicalDimensionRefVectorgetDimensions () const
 
ConnectorgetFirstInputConnector (const agxPowerLine::Unit *unit) const
 
ConnectorgetFirstOutputConnector (const agxPowerLine::Unit *unit) const
 
bool getIgnoreForStoreRestoreStream () const
 
size_t getInputConnectors (agxPowerLine::ConnectorPtrVector &result) const
 
size_t getInputConnectors (const agxPowerLine::Unit *unit, agxPowerLine::ConnectorPtrVector &result)
 
size_t getNumActiveDimensions () const
 The number of non-null PhysicalDimension in this Unit, not including internal Units.
 
virtual size_t getNumConnectableDimensions (Side side) const
 
size_t getNumConnections () const
 
size_t getOutputConnectors (agxPowerLine::ConnectorPtrVector &result) const
 
size_t getOutputConnectors (const agxPowerLine::Unit *unit, agxPowerLine::ConnectorPtrVector &result)
 
void getOwnConnectedUnits (UnitPtrSetVector &unitSet, agxPowerLine::Side side, bool startFromCleanUnitSet=true) const
 
void getOwnConnectedUnits (UnitPtrSetVector &unitSet, bool startFromCleanUnitSet=true) const
 Constructs the set of Units connected to this Unit's own dimensions.
 
agxPowerLine::PowerLinegetPowerLine () const
 
agxPowerLine::UnitgetRoot () const
 
agxPowerLine::Side getSide (const Connector *connector) const
 
bool hasConnector (const Connector *connector) const
 
virtual bool isConnected (agxPowerLine::Unit *otherUnit) const
 
virtual bool isValid () const
 
virtual bool postRestore (agxStream::StorageStream &str)
 
virtual bool postStore (agxStream::StorageStream &str) const
 
void removeNotification (agxPowerLine::PowerLine *powerLine)
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual bool restore (agxStream::StorageStream &str) override
 Restores internal data from stream.
 
void setRoot (agxPowerLine::Unit *root)
 
void spreadRootToGraph ()
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual bool store (agxStream::StorageStream &str) const override
 Stores internal data into stream.
 
virtual bool vetoConnect (agxPowerLine::Connector *connector) const
 
- Public Member Functions inherited from agxPowerLine::SubGraph
 SubGraph ()
 
virtual bool addNotification (agxSDK::Simulation *simulation)=0
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxPowerLine::SubGraph)
 
virtual void getConnectorsRecursive (ConnectorPtrVector &connectors)
 Fill the given vector with the Connectors that are held by this SubGraph.
 
ConnectorgetEnclosingConnector ()
 
const ConnectorgetEnclosingConnector () const
 
SubGraphgetEnclosingGraph ()
 
const SubGraphgetEnclosingGraph () const
 
UnitgetEnclosingUnit ()
 
const UnitgetEnclosingUnit () const
 
const agxPowerLine::ConnectorRefVectorgetInternalConnectors () const
 
const agxPowerLine::UnitRefVectorgetInternalUnits () const
 
const agx::NamegetName () const
 
SubGraphgetRootEnclosingGraph ()
 
const SubGraphgetRootEnclosingGraph () const
 
virtual void getUnitsRecursive (UnitPtrVector &units)
 Fill the given vector with the Units that are held by this SubGraph.
 
bool isEnclosedWithin (const SubGraph *component) const
 
virtual bool postUpdate (agx::Real timeStep)
 
virtual void prepareForRestore ()
 
virtual void prepareForStore ()
 
virtual bool preUpdate (agx::Real timeStep)
 
virtual bool removeNotification (agxUtil::ConstraintHolder *holder, agxSDK::Simulation *simulation)=0
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual bool restore (agxStream::StorageStream &str)
 Restores internal data from stream.
 
void setName (const agx::Name &name)
 Set the name of this power line component.
 
void spreadPowerLineToGraph ()
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual bool store (agxStream::StorageStream &str) const
 Stores internal data into stream.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static FlowConnectorfindInCommonFlowConnector (FlowUnit *a, FlowUnit *b)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Protected Member Functions

virtual ~FlowUnit ()
 
agx::Real computeFrictionFactor () const
 
agx::Real computeLaminarFrictionalLoss (agx::Real flowRate) const
 
agx::Real computeQuadraticFrictionalLoss (agx::Real flowCoefficient) const
 
agx::Real computeReynoldsNumber () const
 
void init ()
 
void updateBodyMass ()
 
agx::Real updateFrictionLoss ()
 
- Protected Member Functions inherited from agxPowerLine::Unit
virtual ~Unit ()
 
bool activateDimension (PhysicalDimension *dimension)
 
virtual bool hasValidInputConnection () const
 returns if it is possible to connect to this unit
 
void restorePre46 (agxStream::InputArchive &in)
 
void setPowerLine (PowerLine *powerLine)
 Point to the power line the unit is a part of.
 
- Protected Member Functions inherited from agxPowerLine::SubGraph
virtual ~SubGraph ()
 
void addInternalConnector (agxPowerLine::Connector *connector)
 
void addInternalUnit (agxPowerLine::Unit *unit)
 
void removeInternalConnector (agxPowerLine::Connector *connector)
 
void removeInternalUnit (agxPowerLine::Unit *unit)
 
agx::Bool replaceInternalUnit (agxPowerLine::Unit *oldUnit, agxPowerLine::Unit *newUnit)
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Static Protected Member Functions

static agx::Real computeReynoldsNumber (agx::Real area, agx::Real flowRate, agx::Real viscosity)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Protected Attributes

agxHydraulics::FlowDimensionRef m_flowDimension
 
- Protected Attributes inherited from agxPowerLine::Unit
agx::observer_ptr< agx::RigidBodym_attachBody
 
PhysicalDimensionRefVector m_dimensions
 
bool m_ignoreMeForStoreRestoreStream
 
agxPowerLine::Unitm_rootUnit
 
- Protected Attributes inherited from agxPowerLine::SubGraph
SubGraphObserver m_enclosingGraph
 
ConnectorRefVector m_internalConnectors
 
UnitRefVector m_internalUnits
 
agx::Name m_name
 
PowerLinem_powerLine
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

FlowUnit is the base class for Units that contains a FlowDimension.

It is tightly coupled with the FlowConnector, which is used to connect FlowUnits together.

A FlowUnit has a single input end and a single output end. A single FlowConnector can be connected to each end. An end that isn't attached to anything is assumed to be attached to the tank. Other PressureConnectors, the Pump for example, does not consume an end.

FlowUnits have inertia and flow resistance that is calculated from the pipe geometry and fluid properties. The inertia is a measure of how hard it is to produce flow through the FlowUnit, while flow resistance is a measure of how hard it is to maintain the flow rate. The flow resistance increases with flow rate.

Definition at line 66 of file FlowUnit.h.

Constructor & Destructor Documentation

◆ FlowUnit() [1/2]

agxHydraulics::FlowUnit::FlowUnit ( agx::Real  length,
agx::Real  area,
agx::Real  fluidDensity 
)

Create a FlowUnit with inertia calculated from the given parameters.

Parameters
length- Length of the FlowUnit
area- Area of the flow unity
fluidDensity- Density of the fluid

◆ FlowUnit() [2/2]

agxHydraulics::FlowUnit::FlowUnit ( agx::Real  inertia)
explicit

Create a FlowUnit with the given inertia.

The length, area, and density attributes will be chosen so that the requested inertia is produced.

◆ ~FlowUnit()

virtual agxHydraulics::FlowUnit::~FlowUnit ( )
inlineprotectedvirtual

Definition at line 313 of file FlowUnit.h.

Member Function Documentation

◆ addPressure()

void agxHydraulics::FlowUnit::addPressure ( agx::Real  pressure,
agxPowerLine::Side  side 
)

Add extra pressure to the FlowUnit at the given side.

A high pressure at the input side will act to generate positive flow through the FlowUnit, while pressure at the output side will act to generate negative flow.

The added pressure is active for the next time step only.

Parameters
pressure- The pressure to add.
side- The side of the FlowUnit where the pressure should be applied.

◆ computeFrictionFactor()

agx::Real agxHydraulics::FlowUnit::computeFrictionFactor ( ) const
protected

◆ computeLaminarFrictionalLoss()

agx::Real agxHydraulics::FlowUnit::computeLaminarFrictionalLoss ( agx::Real  flowRate) const
protected

◆ computeQuadraticFrictionalLoss()

agx::Real agxHydraulics::FlowUnit::computeQuadraticFrictionalLoss ( agx::Real  flowCoefficient) const
protected

◆ computeReynoldsNumber() [1/2]

agx::Real agxHydraulics::FlowUnit::computeReynoldsNumber ( ) const
protected

◆ computeReynoldsNumber() [2/2]

static agx::Real agxHydraulics::FlowUnit::computeReynoldsNumber ( agx::Real  area,
agx::Real  flowRate,
agx::Real  viscosity 
)
staticprotected

◆ findInCommonFlowConnector()

static FlowConnector * agxHydraulics::FlowUnit::findInCommonFlowConnector ( FlowUnit a,
FlowUnit b 
)
static
Returns
The FlowConnector that connects the two FlowUnits. Returns nullptr if there is none.

◆ getArea()

agx::Real agxHydraulics::FlowUnit::getArea ( ) const
Returns
The area of the FlowUnit

◆ getFlowConnector() [1/2]

virtual agxHydraulics::FlowConnector * agxHydraulics::FlowUnit::getFlowConnector ( agxPowerLine::Side  side)
virtual
Returns
the FlowConnector that the given pipe end is attached to. Will be nullptr if that end is not yet connected to another FlowUnit.

◆ getFlowConnector() [2/2]

virtual const agxHydraulics::FlowConnector * agxHydraulics::FlowUnit::getFlowConnector ( agxPowerLine::Side  side) const
virtual
Returns
the FlowConnector that the given pipe end is attached to. Will be nullptr if that end is not yet connected to another FlowUnit.

◆ getFlowDimension() [1/2]

agxHydraulics::FlowDimension * agxHydraulics::FlowUnit::getFlowDimension ( )
Returns
The FlowDimension held by this FlowUnit.

◆ getFlowDimension() [2/2]

const agxHydraulics::FlowDimension * agxHydraulics::FlowUnit::getFlowDimension ( ) const
Returns
The FlowDimension held by this FlowUnit.

◆ getFlowRate()

agx::Real agxHydraulics::FlowUnit::getFlowRate ( ) const
Returns
The current flow rate through the FlowUnit, measured in units of volume per time.

◆ getFluidDensity()

agx::Real agxHydraulics::FlowUnit::getFluidDensity ( ) const
Returns
the fluid density used in the FlowUnit

◆ getFluidViscosity()

agx::Real agxHydraulics::FlowUnit::getFluidViscosity ( ) const
Returns
the viscosity used in the FlowUnit

◆ getInletPressure()

agx::Real agxHydraulics::FlowUnit::getInletPressure ( ) const
Deprecated:
Use getInputPressure instead.
See also
getInputPressure.

◆ getInputFlowConnector() [1/2]

agxHydraulics::FlowConnector * agxHydraulics::FlowUnit::getInputFlowConnector ( )
Returns
the FlowConnector that the input side is attached to. Will be nullptr if the input is not yet connected to another FlowUnit.

◆ getInputFlowConnector() [2/2]

const agxHydraulics::FlowConnector * agxHydraulics::FlowUnit::getInputFlowConnector ( ) const
Returns
the FlowConnector that the input side is attached to. Will be nullptr if the input is not yet connected to another FlowUnit.

◆ getInputPressure()

agx::Real agxHydraulics::FlowUnit::getInputPressure ( ) const

Measure the pressure at the inlet of the FlowUnit.

See also
getPressure
Returns
The pressure at the input FlowConnector, or tank pressure.

◆ getLength()

agx::Real agxHydraulics::FlowUnit::getLength ( ) const
Returns
the length of the FlowUnit

◆ getOutletPressure()

agx::Real agxHydraulics::FlowUnit::getOutletPressure ( ) const
Deprecated:
Use getOutputPressure instead.
See also
getOutputPressure

◆ getOutputFlowConnector() [1/2]

agxHydraulics::FlowConnector * agxHydraulics::FlowUnit::getOutputFlowConnector ( )
Returns
the FlowConnector that the output side is attached to. Will be nullptr if the output is not yet connected to another FlowUnit.

◆ getOutputFlowConnector() [2/2]

const agxHydraulics::FlowConnector * agxHydraulics::FlowUnit::getOutputFlowConnector ( ) const
Returns
the FlowConnector that the output side is attached to. Will be nullptr if the output is not yet connected to another FlowUnit.

◆ getOutputPressure()

agx::Real agxHydraulics::FlowUnit::getOutputPressure ( ) const

Measure the pressure at the outlet of the FlowUnit.

See also
getPressure
Returns
The pressure at the outlet FlowConnector, or tank pressure.

◆ getPressure()

agx::Real agxHydraulics::FlowUnit::getPressure ( agxPowerLine::Side  side) const

Measure the pressure at the given side of the FlowUnit.

Will only include pressure from a FlowConnector, so pressure added by other Connectors (e.g. pump/motor) or FlowUnit::addPressure will not be included.

If the side is unconnected then the tank pressure will be returned.

Parameters
sideThe side to measure pressure at.
Returns
The pressure at the given side.

◆ init()

void agxHydraulics::FlowUnit::init ( )
protected

◆ isConnected()

bool agxHydraulics::FlowUnit::isConnected ( agxPowerLine::Side  end) const
Returns
true if there is a FlowConnector attached at the given end. False otherwise.

◆ setArea()

bool agxHydraulics::FlowUnit::setArea ( agx::Real  area)

Set the area of the FlowUnit.

Increasing the area will decrease both the inertia and the flow resistance.

Returns
false if area is <= 0

◆ setFluidDensity()

void agxHydraulics::FlowUnit::setFluidDensity ( agx::Real  density)

Set the density of the fluid.

Increasing the density will increase both the inertia and the flow resistance.

◆ setFluidViscosity()

void agxHydraulics::FlowUnit::setFluidViscosity ( agx::Real  viscosity)

The viscosity specified here is the kinematic viscosity, measured in area per time.

The default viscosity is 1e-5.

Increasing the viscosity increases the flow resistance. Zero viscosity produces zero flow resistance.

◆ setLength()

void agxHydraulics::FlowUnit::setLength ( agx::Real  length)

Set the length of the FlowUnit.

Increasing the length will increase both the inertia and flow resistance.

◆ updateBodyMass()

void agxHydraulics::FlowUnit::updateBodyMass ( )
protected

◆ updateFrictionLoss()

agx::Real agxHydraulics::FlowUnit::updateFrictionLoss ( )
protected

Member Data Documentation

◆ m_flowDimension

agxHydraulics::FlowDimensionRef agxHydraulics::FlowUnit::m_flowDimension
protected

Definition at line 316 of file FlowUnit.h.


The documentation for this class was generated from the following file: