Commit 9181a3b8 authored by João Lino's avatar João Lino

wattage logging

wattage logging
parent e9dd297a
...@@ -260,6 +260,7 @@ void setup() { ...@@ -260,6 +260,7 @@ void setup() {
bStatusElement = false; bStatusElement = false;
windowStartTime = millis(); windowStartTime = millis();
dWattPerPulse = HEATING_ELEMENT_MAX_WATTAGE / HEATING_ELEMENT_AC_FREQUENCY_HZ; dWattPerPulse = HEATING_ELEMENT_MAX_WATTAGE / HEATING_ELEMENT_AC_FREQUENCY_HZ;
dWattage = 0.0;
// ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++ // ++++++++++++++++++++++++ Mixer ++++++++++++++++++++++++
...@@ -439,7 +440,7 @@ double ulWattToWindowTime( double ulAppliedWatts ) { ...@@ -439,7 +440,7 @@ double ulWattToWindowTime( double ulAppliedWatts ) {
bool xRegulateTemperature( boolean bMaximumOfUpDown ) { bool xRegulateTemperature( boolean bMaximumOfUpDown ) {
double difference = 0; double difference = 0;
bool overTemperature = false; bool overTemperature = false;
double wattage = 0.0; dWattage = 0.0;
float tup = upPT100.getCurrentTemperature(); float tup = upPT100.getCurrentTemperature();
float tdown = downPT100.getCurrentTemperature(); float tdown = downPT100.getCurrentTemperature();
...@@ -472,37 +473,37 @@ bool xRegulateTemperature( boolean bMaximumOfUpDown ) { ...@@ -472,37 +473,37 @@ bool xRegulateTemperature( boolean bMaximumOfUpDown ) {
// Calculate applied wattage, based on the distance from the target temperature // Calculate applied wattage, based on the distance from the target temperature
if ( overTemperature ) { if ( overTemperature ) {
wattage = 0.0; // turn it off dWattage = 0.0; // turn it off
} }
else { else {
if ( difference <= 0.5 ) { if ( difference <= 0.5 ) {
if ( cookTemperature > 99.0 ) { if ( cookTemperature > 99.0 ) {
wattage = 2000.0; // pulse hardly at 2000 watt dWattage = 2000.0; // pulse hardly at 2000 watt
} }
else { else {
if ( cookTemperature > 70.0 ) { if ( cookTemperature > 70.0 ) {
wattage = 1000.0; // pulse moderately at 1000 watt dWattage = 1000.0; // pulse moderately at 1000 watt
} }
else { else {
wattage = 500.0; // pulse lightly at 500 watt dWattage = 500.0; // pulse lightly at 500 watt
} }
} }
} }
else { else {
if ( difference <= 1.0 ) { if ( difference <= 1.0 ) {
if ( cookTemperature > 99.0 ) { if ( cookTemperature > 99.0 ) {
wattage = 2000.0; // pulse hardly at 2000 watt dWattage = 2000.0; // pulse hardly at 2000 watt
} }
else { else {
wattage = 1000.0; // pulse moderately at 1000 watt dWattage = 1000.0; // pulse moderately at 1000 watt
} }
} }
else { else {
if ( difference <= 3.0 ) { if ( difference <= 3.0 ) {
wattage = 2000.0; // pulse hardly at 2000 watt dWattage = 2000.0; // pulse hardly at 2000 watt
} }
else { else {
wattage = HEATING_ELEMENT_MAX_WATTAGE; // pulse constantly at HEATING_ELEMENT_MAX_WATTAGE watt dWattage = HEATING_ELEMENT_MAX_WATTAGE; // pulse constantly at HEATING_ELEMENT_MAX_WATTAGE watt
} }
} }
} }
...@@ -514,7 +515,7 @@ bool xRegulateTemperature( boolean bMaximumOfUpDown ) { ...@@ -514,7 +515,7 @@ bool xRegulateTemperature( boolean bMaximumOfUpDown ) {
} }
// Apply wattage to the element at the right time // Apply wattage to the element at the right time
if ( ulWattToWindowTime( wattage ) > (millis() - windowStartTime) ) { if ( ulWattToWindowTime( dWattage ) > (millis() - windowStartTime) ) {
digitalWrite(HEATING_ELEMENT_OUTPUT_PIN, HIGH); digitalWrite(HEATING_ELEMENT_OUTPUT_PIN, HIGH);
bStatusElement = true; bStatusElement = true;
} else { } else {
...@@ -526,11 +527,11 @@ bool xRegulateTemperature( boolean bMaximumOfUpDown ) { ...@@ -526,11 +527,11 @@ bool xRegulateTemperature( boolean bMaximumOfUpDown ) {
//debugPrintFunction("xRegulateTemperature"); //debugPrintFunction("xRegulateTemperature");
debugPrintVar("difference", difference); debugPrintVar("difference", difference);
//debugPrintVar("overTemperature", overTemperature); //debugPrintVar("overTemperature", overTemperature);
debugPrintVar("wattage", wattage); debugPrintVar("dWattage", dWattage);
//debugPrintVar("ulWattToWindowTime( wattage )", ulWattToWindowTime( wattage ) ); //debugPrintVar("ulWattToWindowTime( dWattage )", ulWattToWindowTime( dWattage ) );
//debugPrintVar("millis()", millis()); //debugPrintVar("millis()", millis());
//debugPrintVar("windowStartTime", windowStartTime); //debugPrintVar("windowStartTime", windowStartTime);
//debugPrintVar("test", ulWattToWindowTime( wattage ) > (millis() - windowStartTime) ); //debugPrintVar("test", ulWattToWindowTime( dWattage ) > (millis() - windowStartTime) );
#endif #endif
} }
...@@ -866,6 +867,8 @@ void xManageMachineSystems() { ...@@ -866,6 +867,8 @@ void xManageMachineSystems() {
Serial.print("|"); Serial.print("|");
Serial.print(downPT100.getCurrentTemperature()); Serial.print(downPT100.getCurrentTemperature());
Serial.print("|"); Serial.print("|");
Serial.print(dWattage);
Serial.print("|");
if (bStatusElement) { if (bStatusElement) {
Serial.print("1"); Serial.print("1");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment