Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Emmert
committed
Feb 8, 2015
1 parent
9f8ca77
commit 8f6f0d1
Showing
24 changed files
with
822 additions
and
553 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,8 @@ Visual Micro/ | |
*.orig | ||
.directory | ||
|
||
*.o | ||
*.d | ||
|
||
/.project | ||
/Logs |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,67 @@ | ||
#include "cBoiler.h" | ||
|
||
cBoiler::cBoiler(cRooms* Rooms_,cWarmWater* WarmWater_) | ||
:Valve(PinValveBoilerOpen,PinValveBoilerClose), | ||
pid( 1.05, 0.0, 10.5, REVERSE), //I= 0.063 | ||
TempCharge((&MPNumSys[0]),(&MPChanSys[idxTempBoilerCharge]),(&SysTempOffset[idxTempBoilerCharge])), | ||
TempReserve1((&MPNumSys[0]),(&MPChanSys[idxTempBoilerReserve1]),(&SysTempOffset[idxTempBoilerReserve1])), | ||
TempReserve2((&MPNumSys[0]),(&MPChanSys[idxTempBoilerReserve2]),(&SysTempOffset[idxTempBoilerReserve2])), | ||
TempHead((&MPNumSys[0]),&MPChanSys[idxTempBoilerHead],(&SysTempOffset[idxTempBoilerHead])), | ||
TempTop((&MPNumSys[0]),&MPChanSys[idxTempBoilerTop],(&SysTempOffset[idxTempBoilerTop])), | ||
Pump(PinPumpBoiler) | ||
{ | ||
Rooms = Rooms_; | ||
WarmWater = WarmWater_; | ||
ChargeMargin = DefaultChargeMargin; | ||
// Set minimal Pump Power to 10% | ||
pid.SetOutputLimits(0.1, 1); | ||
} | ||
|
||
void cBoiler::getSP( JsonObject& root ) | ||
{ | ||
root["BoilerChargeMargin"] = ChargeMargin; | ||
//char p_buffer[80]; | ||
//root[P("Bcm")] = ChargeMargin; | ||
root["Bcm"] = ChargeMargin; | ||
} | ||
|
||
int cBoiler::setSP( JsonObject& root ) | ||
{ | ||
int fail = 0; | ||
int posReturn =0; | ||
|
||
if(root.containsKey("BoilerChargeMargin")) { | ||
if(root["BoilerChargeMargin"].is<double>()) { | ||
ChargeMargin = root["BoilerChargeMargin"].as<double>(); | ||
if(root.containsKey("Bcm")) { | ||
if(root["Bcm"].is<double>()) { | ||
ChargeMargin = root["Bcm"].as<double>(); | ||
posReturn++; | ||
} | ||
else fail=1; | ||
} | ||
else fail=1; | ||
|
||
if (fail == 0) // If all three parameter objects were successfully filled | ||
return posReturn; | ||
return posReturn; | ||
else | ||
return 0; | ||
return 0; | ||
} | ||
|
||
void cBoiler::getData( JsonObject& root ) | ||
{ | ||
root["BoilerValve"] = static_cast<int>( Valve.get()); | ||
//char buffer[30]; | ||
//PROGMEM prog_char BoilerValve[] = "BoilerValve"; | ||
//strcpy_P(buffer, (char*)pgm_read_word(&(sBoilerValve))); | ||
root["BV"] = static_cast<int>( Valve.get()); | ||
|
||
root["BoilerTempCharge"] = TempCharge.get(); | ||
root["BoilerTempTop"] = TempTop.get(); | ||
root["BoilerTempHead"] = TempHead.get(); | ||
root["BoilerTempReserve1"] = TempReserve1.get(); | ||
root["BoilerTempReserve2"] = TempReserve2.get(); | ||
root["BT0"] = TempCharge.get(); | ||
root["BT1"] = TempTop.get(); | ||
root["BT2"] = TempHead.get(); | ||
root["BT3"] = TempReserve1.get(); | ||
root["BT4"] = TempReserve2.get(); | ||
|
||
root["BoilerPumpBoilerCharge"] = PumpBoilerCharge.getPower(); | ||
root["BoilerneedChargeWarmWater"] = static_cast<int>( bneedChargeWarmWater); | ||
root["BoilerneedChargeHeating"] = static_cast<int>( bneedChargeHeating); | ||
root["BoilerbDischarging"] = static_cast<int>( bDischarging); | ||
root["BoilerbCharging"] = static_cast<int>( bCharging); | ||
root["BoilerSpTempWarmWater"] = WarmWater->SpTemp(); | ||
root["BoilerSpTempCharge"] = getSpTempCharge(); | ||
} | ||
root["BP"] = pid.get(); | ||
root["BncW"] = static_cast<int>( bneedChargeWarmWater); | ||
root["BncH"] = static_cast<int>( bneedChargeHeating); | ||
root["Bdisc"] = static_cast<int>( bDischarging); | ||
root["Bc"] = static_cast<int>( bCharging); | ||
root["BTsW"] = WarmWater->SpTemp(); | ||
root["BTsc"] = getSpTempCharge(); | ||
} |
Oops, something went wrong.