将hp纳入out_tem的调节范围

check
Zeng wei (曾威) 2 years ago
parent 5f8477b1fb
commit a9c5531b1e

@ -60,7 +60,7 @@ void PID_Init()
pid.hd_h = 0; pid.hd_h = 0;
pid.h_base_h = 0; pid.h_base_h = 0;
pid.hp_l = 7.2; pid.hp_l = 6;
pid.hi_l = 0.04; pid.hi_l = 0.04;
pid.hd_l = 0; pid.hd_l = 0;
pid.h_base_l = 53; pid.h_base_l = 53;
@ -188,6 +188,7 @@ void PID_Calc() // pid calc
pid.hd = pid.hd_h; pid.hd = pid.hd_h;
pid.h_base = pid.h_base_h; pid.h_base = pid.h_base_h;
// if now temp is close to set temp, the heater will be less power // if now temp is close to set temp, the heater will be less power
if (pid.set_tem - pid.now_tem < 3) { if (pid.set_tem - pid.now_tem < 3) {
pid.hp = pid.hp_h * 0.6; pid.hp = pid.hp_h * 0.6;
@ -196,12 +197,25 @@ void PID_Calc() // pid calc
pid.hp = pid.hp_h * 0.3; pid.hp = pid.hp_h * 0.3;
} }
// l mode // l mode
if (pid.set_tem <= pid.max_compressor_tem) { if (pid.set_tem <= pid.max_compressor_tem) {
pid.hp = pid.hp_l; pid.hp = pid.hp_l;
pid.hi = pid.hi_l; pid.hi = pid.hi_l;
pid.hd = pid.hd_l; pid.hd = pid.hd_l;
pid.h_base = pid.h_base_l; pid.h_base = pid.h_base_l;
// if now temp is close to set temp, the heater will be less power
if (pid.set_tem - pid.now_tem < 3) {
pid.hp = pid.hp_h * 0.6;
}
if (pid.set_tem - pid.now_tem < 1) {
pid.hp = pid.hp_h * 0.3;
}
if (abs(pid.out_tem) > 1e-5) {
pid.hp = -0.1 * pid.hp_l * (pid.out_tem - pid.set_tem) + pid.hp_l;
}
} }
pid.Ek = pid.set_tem - pid.now_tem; pid.Ek = pid.set_tem - pid.now_tem;

@ -240,13 +240,13 @@ int hot = 0;
*/ */
void HotTestRequestTask(void *pvParameters) { void HotTestRequestTask(void *pvParameters) {
while (1) { while (1) {
if (!(T == 0 && H == 0)) { // if (!(T == 0 && H == 0)) {
// if (!(abs(pid.out_tem) < 1e-5 && abs(pid.out_humidity) < 1e-5)) { // // if (!(abs(pid.out_tem) < 1e-5 && abs(pid.out_humidity) < 1e-5)) {
// } // // }
PID_Calc(); // PID_Calc();
RS485_1_Upload_Params(); // RS485_1_Upload_Params();
} // }
vTaskDelay(5000); vTaskDelay(5000);
} }
} }
@ -345,6 +345,7 @@ void Sensor_Communication_task(void *pvParameters)
bufcut_Init(RS485_DATA_TMP + 8, RS485_SUFFIX, 6, 10); bufcut_Init(RS485_DATA_TMP + 8, RS485_SUFFIX, 6, 10);
RS485_1_Send_Data_1(RS485_DATA_TMP, 10); RS485_1_Send_Data_1(RS485_DATA_TMP, 10);
// delay_ms(10); // delay_ms(10);
PID_Calc();
RS485_1_Upload_Params(); // 上传参数 RS485_1_Upload_Params(); // 上传参数
RX_BUF_Transfer(0, 6); RX_BUF_Transfer(0, 6);
} }
@ -517,6 +518,7 @@ void process_inner_sensor_data(u8 *data) {
// HC595_Send_Byte(gpio_state); // HC595_Send_Byte(gpio_state);
PID_Calc();
RS485_1_Upload_Params(); // 上传参数 RS485_1_Upload_Params(); // 上传参数
// delay_xms(200); // delay_xms(200);
} }
@ -559,6 +561,7 @@ void process_hmi_btn_event(u8 page, u8 btn_index, u8 value) {
now_stage = target_stage; now_stage = target_stage;
store_stage = target_stage; store_stage = target_stage;
Write_Init(); Write_Init();
PID_Calc();
RS485_1_Upload_Params(); // 上传参数 RS485_1_Upload_Params(); // 上传参数
} }
break; break;

Loading…
Cancel
Save