thermferm/thermferm.c

changeset 494
092b45686a75
parent 492
750f2468dec5
child 496
5cf6f099c897
equal deleted inserted replaced
493:04d726035afe 494:092b45686a75
1375 if ((run_hours >= time_until_now) && (run_hours < (time_until_now + step->steptime + step->resttime))) { 1375 if ((run_hours >= time_until_now) && (run_hours < (time_until_now + step->steptime + step->resttime))) {
1376 /* 1376 /*
1377 * This is our current step 1377 * This is our current step
1378 */ 1378 */
1379 valid_step = TRUE; 1379 valid_step = TRUE;
1380 // unit->prof_fridge_mode = step->fridge_mode;
1381 if (debug) 1380 if (debug)
1382 fprintf(stdout, "step=%d step_pos=%d step=%d/%d target=%.1f..%.1f ", 1381 fprintf(stdout, "step=%d step_pos=%d step=%d/%d target=%.1f..%.1f ",
1383 current_step, run_hours - time_until_now, 1382 current_step, run_hours - time_until_now,
1384 step->steptime, step->resttime, step->target_lo, step->target_hi); 1383 step->steptime, step->resttime, step->target_lo, step->target_hi);
1385 if ((run_hours - time_until_now) < step->steptime) { 1384 if ((run_hours - time_until_now) < step->steptime) {
1562 unit->PID_heat->SetP, unit->PID_heat->Input, unit->PID_heat->iState, unit->PID_heat->Err, unit->PID_heat->OutP); 1561 unit->PID_heat->SetP, unit->PID_heat->Input, unit->PID_heat->iState, unit->PID_heat->Err, unit->PID_heat->OutP);
1563 if (seconds == 60) { 1562 if (seconds == 60) {
1564 syslog(LOG_NOTICE, "Heat: sp=%.2f Input=%.2f iState=%.2f Err=%.2f Out=%.2f", 1563 syslog(LOG_NOTICE, "Heat: sp=%.2f Input=%.2f iState=%.2f Err=%.2f Out=%.2f",
1565 unit->PID_heat->SetP, unit->PID_heat->Input, unit->PID_heat->iState, unit->PID_heat->Err, unit->PID_heat->OutP); 1564 unit->PID_heat->SetP, unit->PID_heat->Input, unit->PID_heat->iState, unit->PID_heat->Err, unit->PID_heat->OutP);
1566 } 1565 }
1566 } else {
1567 unit->PID_heat->OutP = 0.0;
1567 } 1568 }
1568 if (unit->cooler_address) { 1569 if (unit->cooler_address) {
1569 /* 1570 /*
1570 * Prevent extreme cooling 1571 * Prevent extreme cooling
1571 */ 1572 */
1577 unit->PID_cool->SetP, unit->PID_cool->Input, unit->PID_cool->iState, unit->PID_cool->Err, unit->PID_cool->OutP); 1578 unit->PID_cool->SetP, unit->PID_cool->Input, unit->PID_cool->iState, unit->PID_cool->Err, unit->PID_cool->OutP);
1578 if (seconds == 60) { 1579 if (seconds == 60) {
1579 syslog(LOG_NOTICE, "Cool: sp=%.2f Input=%.2f iState=%.2f Err=%.2f Out=%.2f", 1580 syslog(LOG_NOTICE, "Cool: sp=%.2f Input=%.2f iState=%.2f Err=%.2f Out=%.2f",
1580 unit->PID_cool->SetP, unit->PID_cool->Input, unit->PID_cool->iState, unit->PID_cool->Err, unit->PID_cool->OutP); 1581 unit->PID_cool->SetP, unit->PID_cool->Input, unit->PID_cool->iState, unit->PID_cool->Err, unit->PID_cool->OutP);
1581 } 1582 }
1583 } else {
1584 unit->PID_cool->OutP = 0.0;
1582 } 1585 }
1583 1586
1584 /* 1587 /*
1585 * Deadlock 1588 * Deadlock, kill lowest value.
1586 */ 1589 */
1587 if (unit->PID_cool->OutP && unit->PID_heat->OutP) { 1590 if (unit->PID_cool->OutP && unit->PID_heat->OutP) {
1588 syslog(LOG_NOTICE, "Heat and Cool lockdown");
1589 if (unit->PID_cool->OutP > unit->PID_heat->OutP) 1591 if (unit->PID_cool->OutP > unit->PID_heat->OutP)
1590 unit->PID_heat->OutP = 0.0; 1592 unit->PID_heat->OutP = 0.0;
1591 else 1593 else
1592 unit->PID_cool->OutP = 0.0; 1594 unit->PID_cool->OutP = 0.0;
1593 // unit->PID_cool->OutP = unit->PID_heat->OutP = 0.0;
1594 } 1595 }
1595 1596
1596 if (unit->heater_address && ! unit->cooler_state) { 1597 if (unit->heater_address && ! unit->cooler_state) {
1597 if (unit->PID_heat->OutP >= 50) { 1598 if (unit->PID_heat->OutP >= 50) {
1598 if (unit->heater_wait < unit->heater_delay) { 1599 if (unit->heater_wait < unit->heater_delay) {

mercurial