1522 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_BOO; |
1522 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_BOO; |
1523 } else if (unit->mode == UNITMODE_BEER) { |
1523 } else if (unit->mode == UNITMODE_BEER) { |
1524 unit->PID_cool->SetP = unit->beer_set; |
1524 unit->PID_cool->SetP = unit->beer_set; |
1525 unit->PID_heat->SetP = unit->beer_set; |
1525 unit->PID_heat->SetP = unit->beer_set; |
1526 unit->PID_cool->Input = unit->PID_heat->Input = unit->beer_temperature / 1000.0; |
1526 unit->PID_cool->Input = unit->PID_heat->Input = unit->beer_temperature / 1000.0; |
1527 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO; |
1527 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_BOO; |
1528 } else if (unit->mode == UNITMODE_PROFILE) { |
1528 } else if (unit->mode == UNITMODE_PROFILE) { |
1529 double usetemp; |
1529 double usetemp; |
1530 unit->PID_cool->SetP = unit->prof_target_hi; |
1530 unit->PID_cool->SetP = unit->prof_target_hi; |
1531 unit->PID_heat->SetP = unit->prof_target_lo; |
1531 unit->PID_heat->SetP = unit->prof_target_lo; |
1532 /* |
1532 /* |
1536 ((100 - unit->prof_fridge_mode) * (unit->beer_temperature / 1000.0))) / 100.0; |
1536 ((100 - unit->prof_fridge_mode) * (unit->beer_temperature / 1000.0))) / 100.0; |
1537 if (debug) |
1537 if (debug) |
1538 fprintf(stdout, " fridge_mode=%d measured=%.3f %.3f => %.3f\n", unit->prof_fridge_mode, |
1538 fprintf(stdout, " fridge_mode=%d measured=%.3f %.3f => %.3f\n", unit->prof_fridge_mode, |
1539 unit->air_temperature / 1000.0, unit->beer_temperature / 1000.0, usetemp); |
1539 unit->air_temperature / 1000.0, unit->beer_temperature / 1000.0, usetemp); |
1540 unit->PID_cool->Input = unit->PID_heat->Input = usetemp; |
1540 unit->PID_cool->Input = unit->PID_heat->Input = usetemp; |
1541 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_AUTO; |
1541 unit->PID_cool->Mode = unit->PID_heat->Mode = PID_MODE_BOO; |
1542 } |
1542 } |
1543 |
1543 |
1544 /* |
1544 /* |
1545 * PID controller compute |
1545 * PID controller compute |
1546 */ |
1546 */ |