AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
VariableDisplacementPumpConstraints.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#ifndef AGXHYDRAULICS_DETAIL_VARIABLE_DISPLACEMENT_PUMP_CONSTRAINTS_H
18#define AGXHYDRAULICS_DETAIL_VARIABLE_DISPLACEMENT_PUMP_CONSTRAINTS_H
19
22
23
24
25/*
26This file contains a bunch of constraints used by the VariableDisplacementPump.
27Some of the classes are used to relate the rotation of the pump shaft to the
28rest of the pump, which other constraints dictate the allowed motions of the
29VariableDisplacementPump's poppet. These are called spring constraints.
30*/
31
32
33
34namespace agxPowerLine
35{
36 class TranslationalDimension;
37}
38
39
40
41namespace agxHydraulics
42{
43
44 class VariableDisplacementPump;
45
47 namespace detail
48 {
54 {
55 public:
60 ElementaryVariablePumpConstraint(agx::Real deadheadPressure, agx::Real internalLeakage);
61
62 virtual size_t getJacobian(
64 const agxPowerLine::RigidBodyPtrIntHashVector& bodyToIndexTable,
67 const agx::Real timeStep) override;
68
69 VariableDisplacementPump* getPumpConnector();
70
71 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::ElementaryVariablePumpConstraint);
72
73 protected:
74 ElementaryVariablePumpConstraint();
75 virtual ~ElementaryVariablePumpConstraint() {}
76
77 using ElementaryPhysicalDimensionMultiBodyConstraint::getJacobian;
78 };
79
80
81
89 class AGXHYDRAULICS_EXPORT VariablePumpConstraintImplementation : public agxPowerLine::PhysicalDimensionMultiBodyConstraintImplementation
90 {
91 public:
96 VariablePumpConstraintImplementation(agx::Real deadheadPressure, agx::Real internalLeakage);
97 virtual void addNotification() override;
98
99 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::VariablePumpConstraintImplementation);
100
101 protected:
102 VariablePumpConstraintImplementation();
103 virtual ~VariablePumpConstraintImplementation() {}
104
105 private:
106 agxHydraulics::detail::ElementaryVariablePumpConstraint* m_pumpConstraint;
107 };
108
109
110
111
112
119 class SpringData : public agx::ElementaryConstraintData
120 {
121 public:
127 SpringData(const agx::Vec3& direction, const agx::Real& displacement);
128 SpringData(const SpringData& other);
129 SpringData();
130
131 void reconfigure(const agx::Vec3& direction, const agx::Real& displacement);
132
133 agx::Vec3 getDirection() const;
134 agx::Real getDisplacement() const;
135
136
137 protected:
138 SpringData& operator=(const SpringData&)
139 {
140 agxAbort1("Should never get here");
141 return *this;
142 }
143 private:
144 const agx::Vec3* m_direction;
145 const agx::Real* m_displacement;
146 };
147
148
153 class ElementarySpringStopper : public agx::ElementaryConstraintNData<1, SpringData>
154 {
155 public:
163 ElementarySpringStopper(const SpringData& data, agx::Real limit, agx::Real allowedSide);
164
168 agx::Real getLimit() const;
169
173 virtual agx::UInt getViolation(agx::Real* g, agx::UInt row) override;
174
175 virtual agx::UInt getJacobian(
177 agx::UInt row, agx::GWriteState::Enum writeState) override;
178
179
180 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::ElementarySpringStopper);
181
182 protected:
183 ElementarySpringStopper();
184 virtual ~ElementarySpringStopper() {}
185
186 private:
187 agx::Real m_limit;
188 agx::Real m_allowedSide;
189 };
190
191
195 class ElementarySpringForce : public agx::ElementaryConstraintNData<1, SpringData>
196 {
197 public:
210 ElementarySpringForce(const SpringData& data, agx::Real zeroPoint, agx::Real springConstant);
211
212 virtual agx::UInt getJacobian(
214 agx::UInt row, agx::GWriteState::Enum writeState) override;
215
216 virtual agx::UInt getViolation(agx::Real* g, agx::UInt row) override;
217
218 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::ElementarySpringForce);
219
220 protected:
221 ElementarySpringForce();
222 virtual ~ElementarySpringForce() {}
223
224 private:
225 agx::Real m_zeroPoint;
226 };
227
228
233 class SpringImplementation : public agx::ConstraintImplementation, public agxStream::Serializable
234 {
235 public:
241 SpringImplementation(agxPowerLine::TranslationalDimension* dimension, agx::Real zeroPoint, agx::Real springConstant);
242
246 virtual void prepare() override;
247
248 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::SpringImplementation);
249
250 protected:
251 SpringImplementation();
252 virtual ~SpringImplementation() {}
253
254 private:
255 agxPowerLine::TranslationalDimension* m_dimension;
256 ElementarySpringForce* m_spring;
257 ElementarySpringStopper* m_upperStopper;
258 ElementarySpringStopper* m_lowerStopper;
259
260 agx::Vec3 m_direction; // The elementary constraints have pointers
261 agx::Real m_displacement; // to these two members, which hold the state
262 }; // of the poppet.
263
264
265
266
274 class SpringConstraint : public agx::Constraint
275 {
276 public:
282 SpringConstraint(agxPowerLine::TranslationalDimension* dimension, agx::Real zeroPoint, agx::Real springConstant);
283 virtual void render(agxRender::RenderManager* /*canvas*/, float /*scale*/) const override {}
284
285 AGXSTREAM_DECLARE_SERIALIZABLE(agxHydraulics::detail::SpringConstraint);
286
287 protected:
288 SpringConstraint();
289 virtual ~SpringConstraint();
290 virtual int getNumDOF() const override;
291
292 private:
293 SpringImplementation* m_springImplementation;
294 };
295 }
297}
298
299#endif
#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
Elementary constraint for constraining an arbitrary number of ONE specific PhysicalDimension::Type.
Constraint implementation for constraining a number of physical dimensions of the same type.
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.
#define agxAbort1(msg)
Definition debug.h:165
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
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42