Sensor

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sensor

Mr.Happy
I want to track down the displacement, force, velocity and acceleration of a particle. So in the Plugin_initSensor.cpp file, I have the following line of code:

void
PlugIn_InitSensor::Run()
{  
Core::SetOf<DEM::ElementT<Shape::Polyhedron>>& leftSet = Core::SetOf<DEM::ElementT<Shape::Polyhedron>>::Get("Reading");
auto& el =leftSet(0);
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Position, "Position");
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Force, "Force");
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Quaternion, "Rotation");

}

What line of code should I add to get the velocity and acceleration of the particle? I get the Position, Force and the rotation of the particle in a .txt file.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Sensor

Damien André
Administrator
Hello, you can try (no tested) :

void
PlugIn_InitSensor::Run()
{  
Core::SetOf<DEM::ElementT<Shape::Polyhedron>>& leftSet = Core::SetOf<DEM::ElementT<Shape::Polyhedron>>::Get("Reading");
auto& el =leftSet(0);
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Position, "Position");
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Force, "Force");
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Quaternion, "Rotation");

Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::LinearVelocity, "Velocity");
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::LinearAcceleration, "Acc");
Util::Sensor::New(el, &DEM::ElementT<Shape::Polyhedron>::Force, "Force");
} 

see : "granoo/tags/2.0/Lib/GranOO/libPhysic/Particle.hpp" file
TP
Reply | Threaded
Open this post in threaded view
|

Re: Sensor

TP
Excuse me Damien,

I got Velocity, force, average position with this way in a discrete element

 Util::Sensor::New(*x_, &ExtSet::AverageLinearVelocity, "Velocity");
Util::Sensor::New(*x_, &ExtSet::ResultantForce, "Force");
 Util::Sensor::New(*x_, &ExtSet::AveragePosition<Geom::X>, "AvePos_x");
  Util::Sensor::New(*x_, &ExtSet::StdDevPosition<Geom::X> , "StdPos_x");

but to show the Angular velocity in a body, what Sensor could be or how would write it?

regards
TP
Reply | Threaded
Open this post in threaded view
|

Re: Sensor

Damien André
Administrator
Hello, you can use the methods "UpdateAngularVelocity()" and "GetAngularVelocity()" of the discrete element class. You can use these methods to implement your own sensor.