acdt/users/Inc/provalctrl.h

49 lines
1.0 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_area; //bias permitted [-a, a]%
// float Kp; //used for pid control
// float Ki;
// float Ing;
// float Ing_max;
// float Ing_min;
// float Kd;
// float pidout;
float cstep; // tinny step adjust
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(void);
void prov_calibrate_step(propotion_valve *pvx);
void analog_ctrl(void);
#define CSTEP_WAIT_MAX 0
#define BIAS_MAX 10
#endif