AGX Dynamics 2.41.0.0
Loading...
Searching...
No Matches
FlowUnit.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGXHYDRAULICS_FLOW_UNIT_H
18#define AGXHYDRAULICS_FLOW_UNIT_H
19
22
23#include <agxPowerLine/Unit.h>
24#include <agxPowerLine/Sides.h>
25
26namespace agx
27{
28 class Constraint;
29}
30
31namespace agxSDK
32{
33 class Simulation;
34}
35
36namespace agxHydraulics
37{
40
41
59 {
60 public:
67 FlowUnit(agx::Real length, agx::Real area, agx::Real fluidDensity);
68
70 FlowUnit(agx::Real length, agx::Real area, agx::Real fluidDensity,
71 agx::RigidBody* body, agx::UInt8 elementIndex);
72
74
79 explicit FlowUnit(agx::Real inertia);
80
85 void setLength(agx::Real length);
86
90 agx::Real getLength() const;
91
97 bool setArea(agx::Real area);
98
102 agx::Real getArea() const;
103
108 void setFluidDensity(agx::Real density);
109
113 agx::Real getFluidDensity() const;
114
122 void setFluidViscosity(agx::Real viscosity);
123
127 agx::Real getFluidViscosity() const;
128
133 agx::Real getFlowRate() const;
134
145 void addPressure(agx::Real pressure, agxPowerLine::Side side);
146
158 agx::Real getPressure(agxPowerLine::Side side) const;
159
165 agx::Real getInputPressure() const;
166
171 agx::Real getInletPressure() const;
172
178 agx::Real getOutputPressure() const;
179
184 agx::Real getOutletPressure() const;
185
189 agxHydraulics::FlowDimension* getFlowDimension();
190
194 const agxHydraulics::FlowDimension* getFlowDimension() const;
195
196
201 virtual agxHydraulics::FlowConnector* getFlowConnector(agxPowerLine::Side side);
202
207 virtual const agxHydraulics::FlowConnector* getFlowConnector(agxPowerLine::Side side) const;
208
213 agxHydraulics::FlowConnector* getInputFlowConnector();
214
219 const agxHydraulics::FlowConnector* getInputFlowConnector() const;
220
225 agxHydraulics::FlowConnector* getOutputFlowConnector();
226
231 const agxHydraulics::FlowConnector* getOutputFlowConnector() const;
232
237 bool isConnected(agxPowerLine::Side end) const;
238
239 using Unit::isConnected;
240
245 static FlowConnector* findInCommonFlowConnector(FlowUnit* a, FlowUnit* b);
246
247
248 // Methods called by the rest of the PowerLine/Hydraulics frame work.
249 public:
256 virtual agx::Real computeFrictionLoss(agx::Real flowRate);
257
264 virtual void addTankPressure();
265
266#ifndef SWIG
270 virtual bool preUpdate(agx::Real timeStep) override;
271
275 virtual bool store(agxStream::StorageStream& str) const override;
276
280 virtual bool restore(agxStream::StorageStream& str) override;
281
283#endif
284
285 protected:
289 FlowUnit();
291
292 protected:
293 void init();
294
295 void updateBodyMass();
296
297 agx::Real computeReynoldsNumber() const;
298 static agx::Real computeReynoldsNumber(agx::Real area, agx::Real flowRate, agx::Real viscosity);
299 agx::Real computeFrictionFactor() const;
300 agx::Real computeLaminarFrictionalLoss(agx::Real flowRate) const;
301 agx::Real computeQuadraticFrictionalLoss(agx::Real flowCoefficient) const;
302 agx::Real updateFrictionLoss();
303
304 protected:
305 virtual ~FlowUnit() {}
306
307 protected:
309
310 private:
311 agx::Real m_length;
312 agx::Real m_area;
313
315 agx::Real m_fluidDensity;
316
318 agx::Real m_viscosity;
319 };
320
321}
322
323#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXHYDRAULICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
A FlowConnector is a junction of a set of FlowUnits.
Definition: FlowConnector.h:40
A FlowDimension represents the flow of fluid through a FlowUnit.
Definition: FlowDimension.h:54
FlowUnit is the base class for Units that contains a FlowDimension.
Definition: FlowUnit.h:59
agxHydraulics::FlowDimensionRef m_flowDimension
Definition: FlowUnit.h:308
FlowUnit(agx::Real length, agx::Real area, agx::Real fluidDensity)
Create a FlowUnit with inertia calculated from the given parameters.
Pure virtual class.
Definition: Unit.h:72
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
The agxHydraulics namespace contains classes for modeling hydraulic circuits within the power line fr...
Definition: Accumulator.h:28
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41