AGX Dynamics  2.38.0.2
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 #pragma once
18 
19 #include <agxModel/export.h>
20 
21 #include <agxStream/Serializable.h>
22 #include <agx/List.h>
23 #include <agx/Vector.h>
24 #include <agxUtil/agxUtil.h>
26 #include <agx/LookupTables.h>
27 
28 
29 namespace agxPowerLine
30 {
31  namespace detail
32  {
33  class ConnectionOperations;
34  }
35 
36 }
37 
38 
39 namespace agxPowerLine
40 {
41  class Unit;
42  class PowerLine;
43  class PhysicalDimensionMultiBodyConstraintImplementation;
44 
48 
50  const std::string& dimensionName);
51 
67  class AGXMODEL_EXPORT LookupTable : virtual public agx::LookupTable // virtual inheritance due to diamond
68  {
69  public:
75 
79  void setDimension( agxPowerLine::PhysicalDimension* dimension );
80 
84  agx::Real lookupCurrent() const;
85 
90  virtual agx::Real variableLookupFunction() const;
91 
95  virtual bool store(agxStream::StorageStream& str) const;
96 
100  virtual bool restore(agxStream::StorageStream& str);
101 
102 
103  virtual void store( agxStream::OutputArchive& out ) const override;
104  virtual void restore( agxStream::InputArchive& in ) override;
105 
107  protected:
108  LookupTable();
109  virtual ~LookupTable();
111  };
112 
113 
119  {
120  public:
125 
129  virtual agx::Real lookup( const agx::Real x ) const override;
130 
134  virtual bool store(agxStream::StorageStream& str) const override;
135 
139  virtual bool restore(agxStream::StorageStream& str) override;
140 
142  protected:
144  virtual ~LinearLookupTable();
145  };
147 
148 
153  {
154  public:
161 
165  virtual bool store(agxStream::StorageStream& str) const override;
166 
170  virtual bool restore(agxStream::StorageStream& str) override;
171 
173 
174  protected:
175  virtual ~PowerTimeIntegralLookupTable();
178 
179  };
181 
182 
187  {
188  public:
194 
198  void setPowerTimeIntegralLookupTable( agxPowerLine::PowerTimeIntegralLookupTable* table );
199 
203  agxPowerLine::PowerTimeIntegralLookupTable* getPowerTimeIntegralLookupTable() const;
204 
208  virtual agx::Real getCurrentPowerTimeIntegral() const;
209 
214  virtual void applyPower() = 0;
215 
219  virtual agx::Real variableLookupFunction( ) const = 0;
220 
224  virtual agx::Real resultScalerFunction( ) const = 0;
225 
229  void clear();
230 
234  virtual bool store(agxStream::StorageStream& str) const;
235 
239  virtual bool restore(agxStream::StorageStream& str);
240 
241  virtual void store( agxStream::OutputArchive& out ) const override;
242  virtual void restore( agxStream::InputArchive& in ) override;
243 
245 
246  protected:
247  PowerGenerator();
248  virtual ~PowerGenerator();
249 
251  };
252 
253 
254  /*
255  A Connection can link one physical dimension to another.
256  */
258  {
259  public:
265 
269  bool isValid() const;
270 
274  const agxPowerLine::Connector* getConnector() const;
275 
279  agxPowerLine::Connector* getConnector();
280 
285  bool setConnector( agxPowerLine::Connector* connector );
286 
290  const agxPowerLine::PhysicalDimension* getDimension() const;
291 
295  agxPowerLine::PhysicalDimension* getDimension();
296 
300  virtual void clear();
301 
305  virtual bool store(agxStream::StorageStream& str) const;
306 
310  virtual bool restore(agxStream::StorageStream& str);
311 
312  //Will use the efficiency of the output connection
314 
315  protected:
316  Connection();
317  virtual ~Connection();
318 
319  protected:
322  };
323 
324 }
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:118
agx::Real
double Real
Definition: Real.h:42
agxPowerLine::PowerTimeIntegralLookupTable::m_generator
PowerGeneratorObserver m_generator
Definition: PowerLineUtils.h:177
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:321
agxPowerLine::PhysicalDimension
Pure virtual class.
Definition: PhysicalDimension.h:92
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:95
agxPowerLine::LookupTable::m_dimension
agx::observer_ptr< PhysicalDimension > m_dimension
Definition: PowerLineUtils.h:110
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:180
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:399
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:250
agxPowerLine::UnitRef
agx::ref_ptr< Unit > UnitRef
Definition: Connector.h:45
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:67
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:50
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:119
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:52
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:47
agxPowerLine::Connection
Definition: PowerLineUtils.h:257
agxPowerLine::UnitObserver
agx::observer_ptr< Unit > UnitObserver
Definition: PowerLineUtils.h:46
agxPowerLine::Connection::m_connector
Connector * m_connector
Definition: PowerLineUtils.h:320
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:152
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:146
agxPowerLine::PowerGenerator
Will generate power by adding a load to a physical dimension.
Definition: PowerLineUtils.h:186
List.h
agxUtil.h
PhysicalDimension.h