acdt/users/Inc/provalctrl.h

54 lines
1.1 KiB
C

#ifndef _PROVALCTRL_H_
#define _PROVALCTRL_H_
extern float ao_dwq; //AO输出电流值(定位器)
extern float ao_blf1; //AO输出电流值(比例阀)
extern float ao_blf2; //AO输出电流值(比例阀)
typedef struct
{
float current_pressure;
float current_percent;
float target_pressure;
float target_percent;
float current_input;
float input_max;
float input_min;
float bias;
float bias_previous;
float bias_area; //bias permitted [-a, a]%
float Kp; //used for pid control
float Ti;
float Ing;
float Ing_max;
float Ing_min;
float Td;
float pidout;
float pidout_max;
float pidout_min;
float cstep_gasin; // tinny step adjust
float cstep_gasout;
float cstep_max;
float cstep_min;
unsigned char cstep_wait;
void (*pvout)(float pout); //dac out
}propotion_valve; //propotion valve
extern propotion_valve pv_one;
extern propotion_valve pv_two;
void prov_init(void);
void prov_ctrl(float target_p, propotion_valve *pvx);
void prov_calibrate_pid(propotion_valve *pvx);
void prov_calibrate_step(propotion_valve *pvx);
void analog_ctrl(void);
float abs_bias(float bias);
#define CSTEP_WAIT_MAX 0
#define BIAS_MAX 10
#endif