AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
AccumulatorConstraints.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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
18#ifndef AGXHYDRAULICS_DETAIL_ACCUMULATOR_CONSTRAINTS_H
19#define AGXHYDRAULICS_DETAIL_ACCUMULATOR_CONSTRAINTS_H
20
21
23
24#include <agx/Constraint.h>
26
27
28
29namespace agxHydraulics
30{
31 class Accumulator;
32
34 namespace detail
35 {
36
37 /*
38 A set of non-PowerLine constraints used by the Accumulator. Acts to keep
39 the volume inside a given bound and provides a resisting pressure that
40 increases with the contained volume.
41 */
42
43
49 class AGXHYDRAULICS_EXPORT ElementaryAccumulatorConstraintData : public agx::ElementaryConstraintData
50 {
51 public:
52 ElementaryAccumulatorConstraintData();
53
60 ElementaryAccumulatorConstraintData(
61 const agx::Real& length, const agx::Real& area,
62 const agx::Real& fluidVolume,
63 const agx::UInt8& accumulatorElementIndex);
64
65
70 void reconfigure(
71 const agx::Real& length, const agx::Real& area,
72 const agx::Real& fluidVolume,
73 const agx::UInt8& accumulatorElementIndex);
74
75 agx::Real length() const;
76 agx::Real area() const;
77 agx::Real maxVolume() const;
78 agx::Real fluidVolume() const;
79 agx::UInt8 accumulatorElementIndex() const;
80
91 agx::Real overrun() const;
92
98 agx::Real springCompression() const;
99
100 ElementaryAccumulatorConstraintData& operator=(const ElementaryAccumulatorConstraintData&) = delete;
101
102 private:
103 const agx::Real* m_length;
104 const agx::Real* m_area;
105 const agx::Real* m_fluidVolume;
106 const agx::UInt8* m_accumulatorElementIndex;
107
108 };
109
110
111
117 class AGXHYDRAULICS_EXPORT ElementarySpringConstraint : public agx::ElementaryConstraintNData<1, ElementaryAccumulatorConstraintData>
118 {
119 public:
132 ElementarySpringConstraint(const ElementaryAccumulatorConstraintData& data, agx::Real springConstant);
133
134 virtual agx::UInt getJacobian(
136 agx::UInt row, agx::GWriteState::Enum writeState) override;
137
138 virtual agx::UInt getViolation(agx::Real* g, agx::UInt row) override;
139
140 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::ElementarySpringConstraint);
141
142 protected:
143 ElementarySpringConstraint();
144 virtual ~ElementarySpringConstraint() {}
145 };
146
147
153 class AGXHYDRAULICS_EXPORT ElementaryVolumeConstraint : public agx::ElementaryConstraintNData<1, ElementaryAccumulatorConstraintData>
154 {
155 public:
156 ElementaryVolumeConstraint(const ElementaryAccumulatorConstraintData& data);
157
158 virtual agx::UInt getJacobian(
160 agx::UInt row, agx::GWriteState::Enum writeState) override;
161
162 virtual agx::UInt getViolation(agx::Real* g, agx::UInt row) override;
163
164 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::ElementaryVolumeConstraint);
165
166 protected:
167 ElementaryVolumeConstraint();
168 virtual ~ElementaryVolumeConstraint() {}
169 };
170
171
172
173
174
180 class AGXHYDRAULICS_EXPORT AccumulatorConstraintImplementation : public agx::ConstraintImplementation, public agxStream::Serializable
181 {
182 public:
183 AccumulatorConstraintImplementation(agxHydraulics::Accumulator* accumulator);
184
185 virtual void prepare() override;
186
187 ElementarySpringConstraint* getSpringConstraint();
188 ElementaryVolumeConstraint* getVolumeConstraint();
189
190 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::AccumulatorConstraintImplementation);
191
192 protected:
193 AccumulatorConstraintImplementation();
194 virtual ~AccumulatorConstraintImplementation() {}
195
196 private:
197 agxHydraulics::Accumulator* m_accumulator;
198 agx::Real m_length;
199 agx::Real m_area;
200 agx::Real m_fluidVolume;
201 agx::UInt8 m_accumulatorElementIndex;
202 };
203
204
205
206 AGX_DECLARE_POINTER_TYPES(AccumulatorConstraint);
207
214 class AGXHYDRAULICS_EXPORT AccumulatorConstraint : public agx::Constraint
215 {
216 public:
217 AccumulatorConstraint(Accumulator* accumulator);
218
223 const ElementarySpringConstraint* getSpringConstraint() const;
224
228 const ElementaryVolumeConstraint* getVolumeConstraint() const;
229
230 virtual void render(agxRender::RenderManager* canvas, float scale) const override;
231
232 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::AccumulatorConstraint);
233
234 protected:
235 AccumulatorConstraint();
236 virtual ~AccumulatorConstraint();
237 virtual int getNumDOF() const override;
238
239 private:
240 AccumulatorConstraintImplementation* m_accumulatorConstraintImplementation;
241 };
242 }
244}
245
246#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...
#define AGXHYDRAULICS_EXPORT
An accumulator is a component that stores fluid and pressure.
Definition Accumulator.h:44
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
The base class for a constraint.
Definition Constraint.h:89
Class to hold data for elementary constraints.
The agxHydraulics namespace contains classes for modeling hydraulic circuits within the power line fr...
Definition Accumulator.h:28
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
uint8_t UInt8
Definition Integer.h:30