Transition
This commit is contained in:
parent
88db78fed9
commit
37b540fd48
@ -1385,6 +1385,7 @@ void ThermalController::ctrlComponentTemperature(heater::Switchers switchNr,
|
||||
}
|
||||
}
|
||||
}
|
||||
heaterTransitionControl();
|
||||
resetSensorsArray();
|
||||
}
|
||||
bool ThermalController::selectAndReadSensorTemp() {
|
||||
@ -1429,21 +1430,17 @@ void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers
|
||||
struct TempLimits& tempLimit) {
|
||||
componentAboveCutOffLimit = false;
|
||||
// if Heater off
|
||||
if (not heaterStates[switchNr].switchOnTransition and
|
||||
not heaterStates[switchNr].switchOffTransition) {
|
||||
if (not heaterHandler.checkSwitchState(switchNr) and
|
||||
not thermalStates[thermalComponent].heating) {
|
||||
if (not heaterStates[switchNr].switchTransition) {
|
||||
if (not heaterHandler.checkSwitchState(switchNr)) {
|
||||
if (sensorTemp < tempLimit.opLowerLimit) {
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::ON);
|
||||
heaterStates[switchNr].switchOnTransition = true;
|
||||
sif::info << "ThermalController::ctrlHeater: Heater " << thermalComponent << " ON"
|
||||
<< std::endl;
|
||||
heaterStates[switchNr].switchTransition = true;
|
||||
thermalStates[thermalComponent].heating = true;
|
||||
// TODO: EVENT; aber heaterHandler erstellt schon event
|
||||
// TODO: merken wenn an oder ausgeschaltet und erst nach drei zyklen wieder checken? wenn in
|
||||
// transition dann paar mal skippen; bool switchOnTransition und bool
|
||||
// switchOffTasnition, counter 3 zyklen dabei checken ob tansition erfolgreich, bool
|
||||
// clearen, falls drei erreicht heaterControlErrorCounter global zählen
|
||||
}else{
|
||||
thermalStates[thermalComponent].heating = false;
|
||||
}
|
||||
|
||||
// if Heater on
|
||||
@ -1453,7 +1450,7 @@ void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
sif::info << "ThermalController::ctrlHeater: Heater " << thermalComponent << " OFF"
|
||||
<< std::endl;
|
||||
heaterStates[switchNr].switchOffTransition = true;
|
||||
heaterStates[switchNr].switchTransition = true;
|
||||
thermalStates[thermalComponent].heating = false;
|
||||
}
|
||||
} else {
|
||||
@ -1462,12 +1459,12 @@ void ThermalController::ctrlHeater(heater::Switchers switchNr, heater::Switchers
|
||||
heaterHandler.switchHeater(switchNr, HeaterHandler::SwitchState::OFF);
|
||||
sif::info << "ThermalController::ctrlHeater: Reached CutOffLimit: Heater "
|
||||
<< thermalComponent << " OFF" << std::endl;
|
||||
heaterStates[switchNr].switchOffTransition = true;
|
||||
heaterStates[switchNr].switchTransition = true;
|
||||
if (heaterHandler.checkSwitchState(redSwitchNr)) {
|
||||
heaterHandler.switchHeater(redSwitchNr, HeaterHandler::SwitchState::OFF);
|
||||
sif::info << "ThermalController::ctrlHeater: Reached CutOffLimit: RedundantHeater "
|
||||
<< thermalComponent << " OFF" << std::endl;
|
||||
heaterStates[redSwitchNr].switchOffTransition = true;
|
||||
heaterStates[redSwitchNr].switchTransition = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1483,20 +1480,12 @@ void ThermalController::resetSensorsArray() {
|
||||
}
|
||||
void ThermalController::heaterTransitionControl() {
|
||||
for (unsigned i = 0; i < 7; i++) {
|
||||
if (heaterStates[i].switchOffTransition) {
|
||||
if (heaterStates[i].heaterSwitchOffControlErrorCounter > 3) {
|
||||
heaterStates[i].switchOffTransition = false;
|
||||
heaterStates[i].heaterSwitchOffControlErrorCounter = 0;
|
||||
if (heaterStates[i].switchTransition) {
|
||||
if (heaterStates[i].heaterSwitchControlErrorCounter > 3) {
|
||||
heaterStates[i].switchTransition = false;
|
||||
heaterStates[i].heaterSwitchControlErrorCounter = 0;
|
||||
}
|
||||
heaterStates[i].heaterSwitchOffControlErrorCounter++;
|
||||
}
|
||||
|
||||
if (heaterStates[i].switchOnTransition) {
|
||||
if (heaterStates[i].heaterSwitchOnControlErrorCounter > 3) {
|
||||
heaterStates[i].switchOnTransition = false;
|
||||
heaterStates[i].heaterSwitchOnControlErrorCounter = 0;
|
||||
}
|
||||
heaterStates[i].heaterSwitchOnControlErrorCounter++;
|
||||
heaterStates[i].heaterSwitchControlErrorCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,14 +43,11 @@ struct ThermalState {
|
||||
};
|
||||
|
||||
struct HeaterState {
|
||||
bool switchOnTransition;
|
||||
bool switchOffTransition;
|
||||
uint8_t heaterSwitchOnControlErrorCounter;
|
||||
uint8_t heaterSwitchOffControlErrorCounter;
|
||||
bool switchTransition;
|
||||
uint8_t heaterSwitchControlErrorCounter;
|
||||
};
|
||||
|
||||
enum ThermalComponents : uint8_t {
|
||||
// TODO: Großbuchstaben
|
||||
NONE = 0,
|
||||
ACS_BOARD = 1,
|
||||
MGT = 2,
|
||||
|
Loading…
Reference in New Issue
Block a user