AGX Dynamics  2.37.2.0
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 
181  MeasurementBitState m_measurementState;
182 
183  // Direct reference to the measurement operations
190 
191  // MeasurementSensor operation map
196  };
197 
198  AGX_FORCE_INLINE bool MeasurementSensor::getEnableDataFilter() const { return m_useDataFilters; }
199 
200  AGX_FORCE_INLINE void MeasurementSensor::setEnableDataFilter(bool enable) { m_useDataFilters = enable; }
201 
203  {
204  return static_cast<MeasurementSensor::MeasurementState>((agx::Int32)lhs | (agx::Int32)rhs);
205  }
206 }
207 
208 #endif
209 
MeasurementBitState m_measurementState
agxControl::CalculateTotalRigidBodyDEMMassFlowRef m_totalRigidBodyMassFlow
MeasurementSensor::MeasurementState operator|(MeasurementSensor::MeasurementState lhs, MeasurementSensor::MeasurementState rhs)
agx::BitState< MeasurementState, agx::Int32 > MeasurementBitState
agx::QuadraticProbingHashTable< agx::Name, agxControl::MeasurementSensorOperation * > OperationMap
int32_t Int32
Definition: Integer.h:45
void setEnableDataFilter(bool enable)
Set if the measurement sensor should use exponential filters to smooth data from the measurements...
#define AGXPHYSICS_EXPORT
agxControl::RigidBodyDEMVolumeCalculatorRef m_totalRigidBodyVolume
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agxControl::CalculateTotalMassRef m_totalMassOperation
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:59
This is a sensor class that can be attached to an geometry in the simulation.
Definition: EventSensor.h:47
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
#define CALLABLE
Definition: Object.h:73
MeasurementState
Enumeration specifying what should be recorded in a measurement sensor, expressed as a bit field...
#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
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
agxControl::CalculateTotalMassFlowRef m_totalMassFlowOperation
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
bool getEnableDataFilter() const
Get if the measurement sensor should use exponential filters to smooth data from the measurements...
agxControl::CalculateTotalRigidBodyDEMMassRef m_totalRigidBodyMass
agxControl::VolumeCalculatorRef m_totalVolumeOperation