Last active
September 23, 2015 08:14
-
-
Save Wurstnase/50e10248218fd5b1eaac to your computer and use it in GitHub Desktop.
dead_timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int dt_1 = HEATER_CHECK_INTERVAL; // letztes Zeititervall | |
unsigned int temp_m1 = 0; // Temperatur bei letzter Messung | |
float m_1; // aktuelle Steigung | |
float m_4; // mittlere Steigung in den letzten Zeitintervallen | |
unsigned int temp_prog; // Temperaturprognose | |
int t_tot = 10000; // Totzeit in ms | |
... | |
void manage_heater() | |
{ | |
dt_1 = millis() - previous_millis_heater; // letztes Zeitintervall merken | |
... | |
if (temp_m1 == 0) { // wird am Anfang 1x durchlaufen | |
temp_m1 = current_raw; // Startwert | |
temp_prog = current_raw; // Startwert | |
m_4 = 0.0; // Startwert | |
} else { | |
m_1 = (float)((float)current_raw - (float)temp_m1) / dt_1; // Steigung dT/dt | |
m_4 = 0.25 * (3.0 * m_4 + m_1); // Steigungsänderung dämpfen | |
temp_m1 = current_raw; // für's nächste mal merken | |
temp_prog = (float)((float)current_raw + m_4 * t_tot); // prognostizierte Temp. nach der Totzeit | |
// Serial.print("Steigung "); Serial.println(m_1); | |
} | |
if (temp_prog >= target_raw) | |
// if (current_raw >= target_raw) // dies ist der Original-Code, ab hier ist nix geändert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment