MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/processing/FieldCalculation.cpp
2024-06-07 11:12:56 +03:00

41 lines
912 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* FieldCalculation.cpp
*
* Created on: 16 мар. 2021 г.
* Author: titov
*/
#include "FieldCalculation.hh"
processing::FieldCalculation::FieldCalculation(systemic::ISignal & position,
systemic::ISignal & speed ) : position(position), speed(speed),
est_theta(0.f), est_omega(0.f), _Np(NAN), _ThetaZero(0.f) {}
void processing::FieldCalculation::configure( const Setting & config ) {
_ThetaZero = config.ThetaZero;
_Np = config.Np;
}
const float & processing::FieldCalculation::theta() const {
return est_theta;
}
const float & processing::FieldCalculation::omega() const {
return est_omega;
}
void processing::FieldCalculation::process() {
using namespace std;
est_theta = fmodf( position * _Np + _ThetaZero, math::constants::pi2 );
est_omega = speed * _Np;
}