MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/processing/FieldCalculation.hh

78 lines
1.7 KiB
C++

/*
* FieldCalculation.hh
*
* Created on: 16 ìàð. 2021 ã.
* Author: titov
*/
#ifndef UMLIBRARY_PROCESSING_FIELDCALCULATION_HH_
#define UMLIBRARY_PROCESSING_FIELDCALCULATION_HH_
#include "../systemic/ISignal.hh"
#include "../systemic/IProcess.hh"
#include "../units/LogicalEntities.hpp"
#include "../units/PhysicalQuantities.hpp"
#include "../math/math_inc.hh"
namespace processing {
//!Ìîäóëü îñóùåñòâëÿåò âû÷èñëåíèå ïîçèöèè ïîëÿ èç ïîçèöèè ðîòîðà.
class FieldCalculation : public systemic::IProcess {
float _Np;
float _ThetaZero;
systemic::ISignal & position;
systemic::ISignal & speed;
float est_theta;
float est_omega;
public:
//vector::ITechValue & getThetaNull();
FieldCalculation( systemic::ISignal & position, systemic::ISignal & speed );
struct Setting {
units::Quantity Np; //!<Êîëè÷åñòâî ïàð ïîëþñîâ.
units::ElectricalAngle ThetaZero; //!<Ïîçèöèÿ ýëåêòðè÷åñêîãî íóëÿ.
Setting() : Np(0), ThetaZero(-11.0f) {}
bool isValid() {
using namespace std;
Setting non_valid;
if( not Np or Np > 128 )
Np = non_valid.Np;
if(
not isfinite(ThetaZero)
or ThetaZero <= - math::constants::pi2
or ThetaZero >= math::constants::pi2
)
ThetaZero = non_valid.ThetaZero;
return Np != non_valid.Np
and ThetaZero != non_valid.ThetaZero;
}
};
void configure( const Setting & config );
const float & theta() const;
const float & omega() const;
void process();
};
}
#endif /* UMLIBRARY_PROCESSING_FIELDCALCULATION_HH_ */