#ifndef _MATHLIB #define _MATHLIB #include "IQmathLib.h" /* real pi_regul(real Kp_regul, real Tintegral_regul, real Tperiod_regul, real Minimum, real Maximum, real InpVar, real *VarIntegral); real exp_regul(real Tperiod_regul, real Texp_regul, real InpVarCurr, real InpVarInstant); real zad_intensiv(real StepP, real StepN, real InpVarCurr, real InpVarInstant); real pid_regul2(real Kp_regul, real Tperiod_regul, real Minimum, real Maximum, real yk, real *uk1, real *yk1, real *yk2, real *yzad, real d0, real d1, real d2); real pid_regul(real Kp_regul, real Tperiod_regul, real Minimum, real Maximum, real yk, real *uk1, real *yk1, real *yzad, real *ek, real *ek1, real *ek2, real d0, real d1, real d2); real pi_regul3(real Kp_regul, real ki_regul, real Tperiod_regul, real Minimum, real Maximum, real InpVar, real *InpVarPrev, real *OutVarPrev); real pi_regul4(real Kp_regul, real ki_regul, real Tperiod_regul, real Minimum, real Maximum, real InpVar, real *InpVarPrev, real *OutVarPrev); */ _iq zad_intensiv_q(_iq StepP, _iq StepN, _iq InpVarCurr, _iq InpVarInstant); _iq im_calc( _iq ia, _iq ib, _iq ic); float exp_regul(float Tperiod_regul, float Texp_regul, float InpVarCurr, float InpVarInstant); float my_satur_float(float Input, float Positive, float Negative); int my_satur_int(int Input, int Positive, int Negative); long my_satur_long(long Input, long Positive, long Negative); #define exp_regul_fast(Tperiod_regul,Texp_regul,InpVarCurr,InpVarInstant) (InpVarCurr + Tperiod_regul*(InpVarInstant-InpVarCurr)/Texp_regul) typedef struct { _iq *data_array; int size_array; _iq (*calc)(); } RMS_CALC_ARRAY; #define RMS_CALC_DEFAULTS { 0,0, calc_rms_array_simple} _iq calc_rms_array_simple(RMS_CALC_ARRAY *v); typedef struct { _iq16 *data_array; int size_array; int last_elem_position; int signal_period; _iq Out_rms; _iq (*calc)(); } RMS_CALC_ARRAY_THINNING; #define RMS_CALC_THINNING_DEFAULTS { 0,0,0,0,0, calc_rms_array_var_period_IQ15} _iq calc_rms_array_var_period(RMS_CALC_ARRAY_THINNING *v); _iq calc_rms_array_var_period_IQ15(RMS_CALC_ARRAY_THINNING *v); float fast_round(float x); #endif