/*
 * alg_simple_scalar.h
 *
 *  Created on: 26 θών. 2020 γ.
 *      Author: Vladislav
 */

#ifndef SRC_MAIN_ALG_SIMPLE_SCALAR_H_
#define SRC_MAIN_ALG_SIMPLE_SCALAR_H_

#include "IQmathLib.h"
#include "pid_reg3.h"

typedef struct  {   PIDREG3 pidIm1;
                    PIDREG3 pidF;
                    PIDREG3 pidPower;

                    _iq mzz_add_1;
                    _iq mzz_add_2;
                    _iq poluses;
                    _iq fzad_add_max;
                    _iq fzad_dec;

                    _iq powerzad_add;
                    _iq powerzad_dec;
                    _iq min_bpsi;
                    _iq koef_Uz_t_filter;
                    _iq iq_spad_k;

                    _iq iq_mzz_max_for_fzad;
                    _iq k_freq_for_pid;
                    _iq iq_add_kp_df;
                    _iq iq_add_ki_df;
                    _iq min_mzz_for_df;

                    _iq pidF_Kp;
                    _iq pidF_Ki;
                    int UpravIm1;
                    int UpravIm2;
                    _iq pidIm_Ki;

                    _iq mzz_zad_in1;
                    _iq mzz_zad_in2;

                    _iq mzz_zad_int;
                    _iq Im_regul;
                    _iq Izad;
                    _iq Izad_from_master;
                    _iq bpsi_curent;
                    _iq Uze_t1;

                    _iq iqKoefOgran;
                    _iq Fz;
                    int direction;
                    _iq fzad_int;

                    _iq add_bpsi;
                    _iq max_bpsi;

                    _iq mzz_add_3;

                    _iq k_ogr_n;
                    _iq iq_decr_mzz_power;
                    _iq iq_decr_mzz_power_filter;
                    int flag_decr_mzz_power;

                    _iq iqKoefOgranIzad;
                    int disable_KoefOgranIzad;
                    _iq add_power_limit;
                    _iq sdvig_power_limit;

                    int cmd_new_calc_p_limit;


} ALG_SIMPLE_SCALAR;

#define  ALG_SIMPLE_SCALAR_DEFAULT {PIDREG3_DEFAULTS,PIDREG3_DEFAULTS,PIDREG3_DEFAULTS,\
                                      0,0,0,0,0,\
                                      0,0,0,0,0,\
                                      0,0,0,0,0,\
                                      0,0,0,0,0,\
                                      0,0,0,0,0,0,0, \
                                      0,0, 0,0,0, 0,0, 0, 0, 0,0,0,0,0,0, 0,0  \
}


extern ALG_SIMPLE_SCALAR simple_scalar1;



void simple_scalar(int n_alg, int n_wind_pump, int direction,
                   _iq Frot_pid, _iq Frot,_iq fzad,_iq mzz_zad, _iq bpsi_const,
                   _iq iqKoefOgran,
                    _iq iqIm, _iq iqUin, _iq Iin, _iq powerzad, _iq power_pid,
                    _iq power_limit, int mode_oborots_power,
                    _iq Izad_from_master, int master, int count_bs_work,
                     _iq *Fz, _iq *Uz1, _iq *Uz2, _iq *Izad);

void init_simple_scalar(void);

#endif /* SRC_MAIN_ALG_SIMPLE_SCALAR_H_ */
