AGXDynamics  2.35.0.2
PowerLineUtils.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 
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::LinearLookupTable
Linear interpolation between the inserted variable/value pairs.
Definition: LookupTables.h:107
agxPowerLine::LinearLookupTable
Linear interpolation between the inserted variable/value pairs.
Definition: PowerLineUtils.h:119
agx::Real
double Real
Definition: Real.h:42
agxPowerLine::PowerTimeIntegralLookupTable::m_generator
PowerGeneratorObserver m_generator
Definition: PowerLineUtils.h:178
Vector.h
agxStream::out
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.
Definition: OutputArchive.h:412
agxStream::Serializable
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
export.h
LookupTables.h
agxStream::StorageStream
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE
#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
agxPowerLine::Connection::m_dimension
PhysicalDimension * m_dimension
Definition: PowerLineUtils.h:322
agxPowerLine::PhysicalDimension
Pure virtual class.
Definition: PhysicalDimension.h:93
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agxPowerLine::PhysicalDimension::Type
int Type
Definition: PhysicalDimension.h:96
agxPowerLine::LookupTable::m_dimension
agx::observer_ptr< PhysicalDimension > m_dimension
Definition: PowerLineUtils.h:111
agx::observer_ptr
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:60
agxPowerLine::PowerTimeIntegralLookupTableRef
agx::ref_ptr< PowerTimeIntegralLookupTable > PowerTimeIntegralLookupTableRef
Definition: PowerLineUtils.h:181
agxStream::in
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
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agx::LookupTable
Return a value of y given any value of x.
Definition: LookupTables.h:40
agxPowerLine::PowerGenerator::m_timeIntegralLookupTable
PowerTimeIntegralLookupTableRef m_timeIntegralLookupTable
Definition: PowerLineUtils.h:251
agxPowerLine::UnitRef
agx::ref_ptr< Unit > UnitRef
Definition: InverseDynamics.h:63
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
Serializable.h
agxPowerLine::LookupTable
Return a value of y given any value of x.
Definition: PowerLineUtils.h:68
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
agxPowerLine
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:23
agxPowerLine::Connector
Links two connections together.
Definition: Connector.h:53
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agxPowerLine::getDimensionType
AGXMODEL_EXPORT agxPowerLine::PhysicalDimension::Type getDimensionType(const std::string &dimensionName)
agxPowerLine::UnitRefBoolHashVector
agx::HashVector< UnitRef, bool > UnitRefBoolHashVector
Definition: PowerLineUtils.h:48
agxPowerLine::Connection
Definition: PowerLineUtils.h:258
agxPowerLine::UnitObserver
agx::observer_ptr< Unit > UnitObserver
Definition: PowerLineUtils.h:47
agxPowerLine::Connection::m_connector
Connector * m_connector
Definition: PowerLineUtils.h:321
agxTerrain::Profiler::clear
AGXTERRAIN_EXPORT void clear()
agxPowerLine::PowerTimeIntegralLookupTable
A lookup table used for power time integral (torque for rotational power, force for translational pow...
Definition: PowerLineUtils.h:153
agx::HashVector
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:40
agxPowerLine::LinearLookupTableRef
agx::ref_ptr< LinearLookupTable > LinearLookupTableRef
Definition: PowerLineUtils.h:147
agxPowerLine::PowerGenerator
Will generate power by adding a load to a physical dimension.
Definition: PowerLineUtils.h:187
List.h
agxUtil.h
PhysicalDimension.h