AGX Dynamics  2.37.2.0
PowerLineUtils.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXPOWERLINE_POWER_LINE_UTILS_H
18 #define AGXPOWERLINE_POWER_LINE_UTILS_H
19 
20 #include <agxModel/export.h>
21 
22 #include <agxStream/Serializable.h>
23 #include <agx/List.h>
24 #include <agx/Vector.h>
25 #include <agxUtil/agxUtil.h>
27 #include <agx/LookupTables.h>
28 
29 
30 namespace agxPowerLine
31 {
32  namespace detail
33  {
34  class ConnectionOperations;
35  }
36 
37 }
38 
39 
40 namespace agxPowerLine
41 {
42  class Unit;
43  class PowerLine;
44  class PhysicalDimensionMultiBodyConstraintImplementation;
45 
49 
51  const std::string& dimensionName);
52 
68  class AGXMODEL_EXPORT LookupTable : virtual public agx::LookupTable // virtual inheritance due to diamond
69  {
70  public:
76 
80  void setDimension( agxPowerLine::PhysicalDimension* dimension );
81 
85  agx::Real lookupCurrent() const;
86 
91  virtual agx::Real variableLookupFunction() const;
92 
96  virtual bool store(agxStream::StorageStream& str) const;
97 
101  virtual bool restore(agxStream::StorageStream& str);
102 
103 
104  virtual void store( agxStream::OutputArchive& out ) const override;
105  virtual void restore( agxStream::InputArchive& in ) override;
106 
108  protected:
109  LookupTable();
110  virtual ~LookupTable();
112  };
113 
114 
120  {
121  public:
126 
130  virtual agx::Real lookup( const agx::Real x ) const override;
131 
135  virtual bool store(agxStream::StorageStream& str) const override;
136 
140  virtual bool restore(agxStream::StorageStream& str) override;
141 
143  protected:
145  virtual ~LinearLookupTable();
146  };
148 
149 
154  {
155  public:
162 
166  virtual bool store(agxStream::StorageStream& str) const override;
167 
171  virtual bool restore(agxStream::StorageStream& str) override;
172 
174 
175  protected:
176  virtual ~PowerTimeIntegralLookupTable();
179 
180  };
182 
183 
188  {
189  public:
195 
199  void setPowerTimeIntegralLookupTable( agxPowerLine::PowerTimeIntegralLookupTable* table );
200 
204  agxPowerLine::PowerTimeIntegralLookupTable* getPowerTimeIntegralLookupTable() const;
205 
209  virtual agx::Real getCurrentPowerTimeIntegral() const;
210 
215  virtual void applyPower() = 0;
216 
220  virtual agx::Real variableLookupFunction( ) const = 0;
221 
225  virtual agx::Real resultScalerFunction( ) const = 0;
226 
230  void clear();
231 
235  virtual bool store(agxStream::StorageStream& str) const;
236 
240  virtual bool restore(agxStream::StorageStream& str);
241 
242  virtual void store( agxStream::OutputArchive& out ) const override;
243  virtual void restore( agxStream::InputArchive& in ) override;
244 
246 
247  protected:
248  PowerGenerator();
249  virtual ~PowerGenerator();
250 
251  PowerTimeIntegralLookupTableRef m_timeIntegralLookupTable;
252  };
253 
254 
255  /*
256  A Connection can link one physical dimension to another.
257  */
259  {
260  public:
266 
270  bool isValid() const;
271 
275  const agxPowerLine::Connector* getConnector() const;
276 
280  agxPowerLine::Connector* getConnector();
281 
286  bool setConnector( agxPowerLine::Connector* connector );
287 
291  const agxPowerLine::PhysicalDimension* getDimension() const;
292 
296  agxPowerLine::PhysicalDimension* getDimension();
297 
301  virtual void clear();
302 
306  virtual bool store(agxStream::StorageStream& str) const;
307 
311  virtual bool restore(agxStream::StorageStream& str);
312 
313  //Will use the efficiency of the output connection
315 
316  protected:
317  Connection();
318  virtual ~Connection();
319 
320  protected:
323  };
324 
325 }
326 
327 #endif // AGXMODEL_POWER_LINE_UTILS_H
agx::observer_ptr< Unit > UnitObserver
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
Links two connections together.
Definition: Connector.h:53
AGXTERRAIN_EXPORT void clear()
Linear interpolation between the inserted variable/value pairs.
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:60
Linear interpolation between the inserted variable/value pairs.
Definition: LookupTables.h:107
PowerTimeIntegralLookupTableRef m_timeIntegralLookupTable
agxPowerLine contains a collection of connected components that transport power across a system...
Definition: MotorUnit.h:23
Base class providing referencing counted objects.
Definition: Referenced.h:119
agx::observer_ptr< PhysicalDimension > m_dimension
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:40
A lookup table used for power time integral (torque for rotational power, force for translational pow...
agx::ref_ptr< Unit > UnitRef
Return a value of y given any value of x.
Definition: LookupTables.h:40
PhysicalDimension * m_dimension
agx::ref_ptr< PowerTimeIntegralLookupTable > PowerTimeIntegralLookupTableRef
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
AGXMODEL_EXPORT agxPowerLine::PhysicalDimension::Type getDimensionType(const std::string &dimensionName)
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
#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
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
Return a value of y given any value of x.
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:221
#define AGXMODEL_EXPORT
agx::HashVector< UnitRef, bool > UnitRefBoolHashVector
double Real
Definition: Real.h:42
agx::ref_ptr< LinearLookupTable > LinearLookupTableRef
Will generate power by adding a load to a physical dimension.