AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
PowerLineUtils.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. 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#pragma once
18
19#include <agxModel/export.h>
20
22#include <agx/List.h>
23#include <agx/Vector.h>
24#include <agxUtil/agxUtil.h>
26#include <agx/LookupTables.h>
27
28
29namespace agxPowerLine
30{
31 namespace detail
32 {
33 class ConnectionOperations;
34 }
35
36}
37
38
39namespace 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
80
85
91
95 virtual bool store(agxStream::StorageStream& str) const;
96
101
102
103 virtual void store( agxStream::OutputArchive& out ) const override;
104 virtual void restore( agxStream::InputArchive& in ) override;
105
107 protected:
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:
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:
178
179 };
181
182
187 {
188 public:
194
199
204
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
240
241 virtual void store( agxStream::OutputArchive& out ) const override;
242 virtual void restore( agxStream::InputArchive& in ) override;
243
245
246 protected:
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
275
280
286
291
296
300 virtual void clear();
301
305 virtual bool store(agxStream::StorageStream& str) const;
306
311
312 //Will use the efficiency of the output connection
314
315 protected:
317 virtual ~Connection();
318
319 protected:
322 };
323
324}
#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
#define AGXMODEL_EXPORT
agxPowerLine::Connector * getConnector()
bool setConnector(agxPowerLine::Connector *connector)
agxPowerLine::PhysicalDimension * getDimension()
virtual void clear()
clear all reference pointers
virtual bool store(agxStream::StorageStream &str) const
Stores internal data into stream.
virtual bool restore(agxStream::StorageStream &str)
Restores internal data from stream.
PhysicalDimension * m_dimension
const agxPowerLine::Connector * getConnector() const
Connection(agxPowerLine::PhysicalDimension *dimension, agxPowerLine::Connector *connector)
Create a connection in or out of a physical dimension.
const agxPowerLine::PhysicalDimension * getDimension() const
Links two connections together.
Definition: Connector.h:53
Linear interpolation between the inserted variable/value pairs.
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
virtual agx::Real lookup(const agx::Real x) const override
Lookup a specific value.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
LinearLookupTable(agxPowerLine::PhysicalDimension *dimension)
Constructor.
Return a value of y given any value of x.
virtual void store(agxStream::OutputArchive &out) const override
virtual agx::Real variableLookupFunction() const
Implement this in any child class to define the lookup variable.
virtual bool restore(agxStream::StorageStream &str)
Restores internal data from stream.
agx::Real lookupCurrent() const
Lookup the current value (given the dimension set.)
virtual bool store(agxStream::StorageStream &str) const
Stores internal data into stream.
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxPowerLine::LookupTable)
LookupTable(agxPowerLine::PhysicalDimension *dimension)
Create a lookup table.
virtual void restore(agxStream::InputArchive &in) override
agx::observer_ptr< PhysicalDimension > m_dimension
void setDimension(agxPowerLine::PhysicalDimension *dimension)
change dependent physical dimension
Will generate power by adding a load to a physical dimension.
virtual agx::Real getCurrentPowerTimeIntegral() const
return how big load that is added to the simulation through the physical dimension at the moment
virtual agx::Real variableLookupFunction() const =0
Implement this to scale lookups accordingly.
virtual void store(agxStream::OutputArchive &out) const override
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxPowerLine::PowerGenerator)
virtual agx::Real resultScalerFunction() const =0
Implement this to scale lookups accordingly.
virtual void restore(agxStream::InputArchive &in) override
virtual bool restore(agxStream::StorageStream &str)
Restores internal data from stream.
void clear()
clear all reference pointers
agxPowerLine::PowerTimeIntegralLookupTable * getPowerTimeIntegralLookupTable() const
virtual void applyPower()=0
Implement this to apply power each timestep.
PowerTimeIntegralLookupTableRef m_timeIntegralLookupTable
void setPowerTimeIntegralLookupTable(agxPowerLine::PowerTimeIntegralLookupTable *table)
Set the time integral table.
PowerGenerator(agxPowerLine::PhysicalDimension *dimension)
Create a power generator.
virtual bool store(agxStream::StorageStream &str) const
Stores internal data into stream.
A lookup table used for power time integral (torque for rotational power, force for translational pow...
PowerTimeIntegralLookupTable(agxPowerLine::PhysicalDimension *dimension, agxPowerLine::PowerGenerator *generator)
The time integral is the one of the power lookup table in the power generator.
virtual bool restore(agxStream::StorageStream &str) override
Restores internal data from stream.
virtual bool store(agxStream::StorageStream &str) const override
Stores internal data into stream.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:41
Linear interpolation between the inserted variable/value pairs.
Definition: LookupTables.h:108
Return a value of y given any value of x.
Definition: LookupTables.h:41
Base class providing referencing counted objects.
Definition: Referenced.h:120
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:61
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
agx::observer_ptr< Unit > UnitObserver
agx::ref_ptr< LinearLookupTable > LinearLookupTableRef
agx::HashVector< UnitRef, bool > UnitRefBoolHashVector
agx::ref_ptr< Unit > UnitRef
Definition: Connector.h:45
agx::ref_ptr< PowerTimeIntegralLookupTable > PowerTimeIntegralLookupTableRef
AGXMODEL_EXPORT agxPowerLine::PhysicalDimension::Type getDimensionType(const std::string &dimensionName)
double Real
Definition: Real.h:41