AGX Dynamics  2.35.0.1
MeasurementSensor.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 
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 
106 
111 
114 
117 
120 
123 
126 
129 
132 
135 
137  void setEnableDataFilter(bool enable);
138 
140  bool getEnableDataFilter() const;
141 
143  void setFilterPeriodTime(agx::Real periodTime);
144 
147 
149  void setFilterSamplingTime(agx::Real samplingTime);
150 
153 
155 
156  protected:
159 
162 
164  void initFilters();
165 
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 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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 AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
This is a sensor class that can be attached to an geometry in the simulation.
Definition: EventSensor.h:48
agx::Real getTotalRigidBodyPackingFraction() const
Returns the total RigidBody volume inside the sensor volume.
agxControl::CalculateTotalRigidBodyDEMMassRef m_totalRigidBodyMass
void setMeasurementState(MeasurementState state)
Sets the MeasurementState which determines what should be recorded in the MeasurementSensor.
agx::Real getTotalRigidBodyMass() const
Returns the total RigidBody mass inside the sensor volume.
agx::Real getParticlePackingFraction() const
Returns the total particle volume inside the sensor volume.
MeasurementState getMeasurementState() const
Returns the MeasurementState that determines what should be recorded in the MeasurementSensor.
agx::Real getTotalParticleMassFlow() const
Returns the total particle mass flow inside the sensor volume.
void setEnableDataFilter(bool enable)
Set if the measurement sensor should use exponential filters to smooth data from the measurements.
agx::Real getTotalParticleVolume() const
Returns the total particle volume inside the sensor volume.
agxControl::CalculateTotalRigidBodyDEMMassFlowRef m_totalRigidBodyMassFlow
agx::Real getTotalRigidBodyMassFlow() const
Returns the total RigidBody mass flow inside the sensor volume.
agx::Real getTotalParticleMass() const
Returns the total particle mass inside the sensor volume.
static MeasurementSensorPtrVector findAll(const agxSDK::Simulation *simulation, const agx::Name &name)
Find all MeasurementSensors with given name.
agx::Real getValue(const agx::Name &operationIdentifier, bool useFiltered) const
Returns a value from a measurement operations with specified name identifier. Will return a filtered ...
agx::Real getTotalRigidBodyVolume() const
Returns the total RigidBody volume inside the sensor volume.
static MeasurementSensorPtrVector findAll(const agxSDK::Simulation *simulation)
Finds all MeasurementSensors in the given simulation.
MeasurementSensor(agxCollide::Geometry *geom, int priority)
Constructor that takes the geometry to couple the sensor too.
virtual ~MeasurementSensor()
Default destructor.
void initOperations()
Initializes and adds the internal operations to the simulation that the sensor is added to.
agx::Real getFilterSamplingTime() const
Get the discrete sampling time for the internal exponential filters.
agx::BitState< MeasurementState, agx::Int32 > MeasurementBitState
MeasurementBitState m_measurementState
MeasurementSensor(agxCollide::Geometry *geom)
Constructor that takes the geometry to couple the sensor too.
agxControl::VolumeCalculatorRef m_totalVolumeOperation
MeasurementState
Enumeration specifying what should be recorded in a measurement sensor, expressed as a bit field.
bool getEnableDataFilter() const
Get if the measurement sensor should use exponential filters to smooth data from the measurements.
static MeasurementSensor * find(const agxSDK::Simulation *simulation, const agx::Name &name)
void setFilterSamplingTime(agx::Real samplingTime)
Set the discrete sampling time for the internal exponential filters.
agxControl::RigidBodyDEMVolumeCalculatorRef m_totalRigidBodyVolume
void initFilters()
Initializes the value filters in the measurement operations.
void setFilterPeriodTime(agx::Real periodTime)
Set the period time for the internal exponential filters.
MeasurementSensor()
Default constructor.
MeasurementSensor(int priority)
Constructor that takes the priority of the internal contact sensors.
agx::Real getFilterPeriodTime() const
Returns the period time for the internal exponential filters.
agxControl::CalculateTotalMassFlowRef m_totalMassFlowOperation
agxControl::CalculateTotalMassRef m_totalMassOperation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Representation of a name string.
Definition: Name.h:33
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define CALLABLE
Definition: macros.h:72
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
MeasurementSensor::MeasurementState operator|(MeasurementSensor::MeasurementState lhs, MeasurementSensor::MeasurementState rhs)
agx::QuadraticProbingHashTable< agx::Name, agxControl::MeasurementSensorOperation * > OperationMap
int32_t Int32
Definition: Integer.h:45
double Real
Definition: Real.h:42