AGXDynamics  2.31.1.0
MeasurementSensor.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 {
40  {
41  public:
42 
47  {
48  MASS = 1,
49  MASSFLOW = 2,
50  VOLUME = 4,
51  ALL = MASS | MASSFLOW | VOLUME
52  };
53 
54  typedef agx::BitState<MeasurementState, agx::Int32> MeasurementBitState;
55 
58 
63  MeasurementSensor(int priority);
64 
70 
76  MeasurementSensor(agxCollide::Geometry * geom, int priority);
77 
82  void setMeasurementState(MeasurementState state);
83 
87  MeasurementState getMeasurementState() const;
88 
90  agx::Real getTotalParticleMassFlow() const;
91 
93  agx::Real getTotalParticleMass() const;
94 
96  agx::Real getTotalParticleVolume() const;
97 
99  agx::Real getParticlePackingFraction() const;
100 
102  agx::Real getTotalRigidBodyMass() const;
103 
105  agx::Real getTotalRigidBodyMassFlow() const;
106 
108  agx::Real getTotalRigidBodyVolume() const;
109 
111  agx::Real getTotalRigidBodyPackingFraction() const;
112 
114  void setEnableDataFilter(bool enable);
115 
117  bool getEnableDataFilter() const;
118 
120  void setFilterPeriodTime(agx::Real periodTime);
121 
123  agx::Real getFilterPeriodTime() const;
124 
126  void setFilterSamplingTime(agx::Real samplingTime);
127 
129  agx::Real getFilterSamplingTime() const;
130 
132 
133  protected:
135  virtual ~MeasurementSensor();
136 
138  void initOperations();
139 
141  void initFilters();
142 
143  void updateMeasurementOperationsFromBitState();
144 
146  agx::Real getValue(const agx::Name& operationIdentifier, bool useFiltered) const;
147 
148  private:
151  MeasurementSensor& operator=(const MeasurementSensor&);
152 
154  // Variables
156  protected:
157 
158  MeasurementBitState m_measurementState;
159 
160  // Direct reference to the measurement operations
167 
168  // MeasurementSensor operation map
173  };
174 
175  AGX_FORCE_INLINE bool MeasurementSensor::getEnableDataFilter() const { return m_useDataFilters; }
176 
177  AGX_FORCE_INLINE void MeasurementSensor::setEnableDataFilter(bool enable) { m_useDataFilters = enable; }
178 
180  {
181  return static_cast<MeasurementSensor::MeasurementState>((agx::Int32)lhs | (agx::Int32)rhs);
182  }
183 }
184 
185 #endif
186 
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:248
agxControl::CalculateTotalMassRef m_totalMassOperation
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:63
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:88
This file defines a set of operations used internally by the measurement sensor to calculate differen...
Definition: EventSensor.h:33
#define CALLABLE
Definition: Object.h:77
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:206
agxControl::CalculateTotalMassFlowRef m_totalMassFlowOperation
double Real
Definition: Real.h:42
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