AGX Dynamics  2.38.0.2
MeasurementSensor.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 AGXCONTROL_MEASUREMENTSENSOR_H
18 #define AGXCONTROL_MEASUREMENTSENSOR_H
19 
20 #include <agx/agx.h>
21 #include <agx/BitState.h>
22 #include <agxControl/EventSensor.h>
24 
26 
27 namespace agxControl
28 {
30 }
31 
32 namespace agxControl
33 {
41  {
42  public:
43 
48  {
49  MASS = 1,
50  MASSFLOW = 2,
51  VOLUME = 4,
52  ALL = MASS | MASSFLOW | VOLUME
53  };
54 
55  typedef agx::BitState<MeasurementState, agx::Int32> MeasurementBitState;
56 
59 
64  MeasurementSensor(int priority);
65 
71 
77  MeasurementSensor(agxCollide::Geometry * geom, int priority);
78 
83  void setMeasurementState(MeasurementState state);
84 
90  static MeasurementSensor* find( const agxSDK::Simulation* simulation, const agx::Name& name );
91 
98  static MeasurementSensorPtrVector findAll( const agxSDK::Simulation* simulation, const agx::Name& name );
99 
105  static MeasurementSensorPtrVector findAll( const agxSDK::Simulation* simulation );
106 
110  MeasurementState getMeasurementState() const;
111 
113  agx::Real getTotalParticleMassFlow() const;
114 
116  agx::Real getTotalParticleMass() const;
117 
119  agx::Real getTotalParticleVolume() const;
120 
122  agx::Real getParticlePackingFraction() const;
123 
125  agx::Real getTotalRigidBodyMass() const;
126 
128  agx::Real getTotalRigidBodyMassFlow() const;
129 
131  agx::Real getTotalRigidBodyVolume() const;
132 
134  agx::Real getTotalRigidBodyPackingFraction() const;
135 
137  void setEnableDataFilter(bool enable);
138 
140  bool getEnableDataFilter() const;
141 
143  void setFilterPeriodTime(agx::Real periodTime);
144 
146  agx::Real getFilterPeriodTime() const;
147 
149  void setFilterSamplingTime(agx::Real samplingTime);
150 
152  agx::Real getFilterSamplingTime() const;
153 
155 
156  protected:
158  virtual ~MeasurementSensor();
159 
161  void initOperations();
162 
164  void initFilters();
165 
166  void updateMeasurementOperationsFromBitState();
167 
169  agx::Real getValue(const agx::Name& operationIdentifier, bool useFiltered) const;
170 
171  private:
174  MeasurementSensor& operator=(const MeasurementSensor&);
175 
177  // Variables
179  protected:
180 
182 
183  // Direct reference to the measurement operations
190 
191  // MeasurementSensor operation map
196  };
197 
199 
201 
203  {
204  return static_cast<MeasurementSensor::MeasurementState>((agx::Int32)lhs | (agx::Int32)rhs);
205  }
206 }
207 
208 #endif
209 
agxControl::operator|
MeasurementSensor::MeasurementState operator|(MeasurementSensor::MeasurementState lhs, MeasurementSensor::MeasurementState rhs)
Definition: MeasurementSensor.h:202
agxControl::OperationMap
agx::QuadraticProbingHashTable< agx::Name, agxControl::MeasurementSensorOperation * > OperationMap
Definition: MeasurementSensor.h:29
agxControl::MeasurementSensor::m_totalRigidBodyMassFlow
agxControl::CalculateTotalRigidBodyDEMMassFlowRef m_totalRigidBodyMassFlow
Definition: MeasurementSensor.h:188
agxControl::MeasurementSensor::m_totalRigidBodyMass
agxControl::CalculateTotalRigidBodyDEMMassRef m_totalRigidBodyMass
Definition: MeasurementSensor.h:187
agx::Real
double Real
Definition: Real.h:42
agxControl::MeasurementSensor::m_totalMassFlowOperation
agxControl::CalculateTotalMassFlowRef m_totalMassFlowOperation
Definition: MeasurementSensor.h:185
agxControl
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
BitState.h
CALLABLE
#define CALLABLE
Definition: macros.h:72
agxControl::MeasurementSensor::getEnableDataFilter
bool getEnableDataFilter() const
Get if the measurement sensor should use exponential filters to smooth data from the measurements.
Definition: MeasurementSensor.h:198
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
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agxControl::MeasurementSensor::m_totalMassOperation
agxControl::CalculateTotalMassRef m_totalMassOperation
Definition: MeasurementSensor.h:184
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
MeasurementOperations.h
agxControl::EventSensor
This is a sensor class that can be attached to an geometry in the simulation.
Definition: EventSensor.h:47
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
agxControl::MeasurementSensor::m_totalRigidBodyVolume
agxControl::RigidBodyDEMVolumeCalculatorRef m_totalRigidBodyVolume
Definition: MeasurementSensor.h:189
agxControl::MeasurementSensor::MeasurementState
MeasurementState
Enumeration specifying what should be recorded in a measurement sensor, expressed as a bit field.
Definition: MeasurementSensor.h:47
agx::ref_ptr< CalculateTotalMass >
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:125
agxControl::MeasurementSensor::setEnableDataFilter
void setEnableDataFilter(bool enable)
Set if the measurement sensor should use exponential filters to smooth data from the measurements.
Definition: MeasurementSensor.h:200
agxControl::MeasurementSensor::m_operationMap
OperationMap m_operationMap
Definition: MeasurementSensor.h:192
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
agx::Name
Representation of a name string.
Definition: Name.h:32
agxControl::MeasurementSensor::m_filterSamplingTime
agx::Real m_filterSamplingTime
Definition: MeasurementSensor.h:195
agx.h
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agxControl::MeasurementSensor::m_filterPeriodTime
agx::Real m_filterPeriodTime
Definition: MeasurementSensor.h:194
agxControl::MeasurementSensor::m_useDataFilters
bool m_useDataFilters
Definition: MeasurementSensor.h:193
agx::QuadraticProbingHashTable< agx::Name, agxControl::MeasurementSensorOperation * >
QuadraticProbingHashTable.h
agxControl::MeasurementSensor::m_totalVolumeOperation
agxControl::VolumeCalculatorRef m_totalVolumeOperation
Definition: MeasurementSensor.h:186
agxControl::MeasurementSensor::m_measurementState
MeasurementBitState m_measurementState
Definition: MeasurementSensor.h:181
EventSensor.h
agxControl::MeasurementSensor
Definition: MeasurementSensor.h:40
agx::Int32
int32_t Int32
Definition: Integer.h:37
agxControl::MeasurementSensor::MeasurementBitState
agx::BitState< MeasurementState, agx::Int32 > MeasurementBitState
Definition: MeasurementSensor.h:55
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58