/* * 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_ */