If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-08-15
Originally created by: scott_cunningham
A late answer, but here is a basic FB that will do it (assumes your command is 0 to 100):
FUNCTION_BLOCKHeatControlVAR_INPUT
  CmdSignal : INT :=0;END_VARVAR_OUTPUT
  Heat7KwA : BOOL :=FALSE;
  Heat7KwB : BOOL :=FALSE;
  Heat14Kw : BOOL :=FALSE;
  Heat27Kw : BOOL :=FALSE;
  Heat55Kw : BOOL :=FALSE;END_VARVAREND_VAR(*0%=0kW25%=27kW(only27kWaktice)50%=55kW(Only55kWactive)75%=82kW(Only55kW+27kW)active100%=110kW(allactive)*)//turnallofffirstHeat7KwA :=FALSE;Heat7KwB :=FALSE;Heat14Kw :=FALSE;Heat27Kw :=FALSE;Heat55Kw :=FALSE;//nowseewhichshouldbeonIFCmdSignal>=100THEN
  Heat7KwA :=TRUE;
  Heat7KwB :=TRUE;
  Heat14Kw :=TRUE;
  Heat27Kw :=TRUE;
  Heat55Kw :=TRUE;ELSIFCmdSignal>=75THEN
  Heat27Kw :=TRUE;
  Heat55Kw :=TRUE;ELSIFCmdSignal>=50THEN
  Heat55Kw :=TRUE;ELSIFCmdSignal>=25THEN
  Heat27Kw :=TRUE;ELSE
  ; //noneEND_IF
Â
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like a function that calculate all the time and then find the nearest combination to match the requested input.
Is there any pre-made function for this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-08-26
Originally created by: scott_cunningham
That is what my function block will do based on your information. Call it every scan with your input and it will turn on or off whatever heaters you need.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is the solution i came up with, in case someone else need this.
This function calculates the remaining kW wich are given by Heat7KwA with TRIAC.
FUNCTION_BLOCKHeatControlVAR_INPUTÂ Â CmdSignal:INT:=0;END_VARVAR_OUTPUTÂ Â Heat7KwA:BOOL:=FALSE;Â Â Heat7KwB:BOOL:=FALSE;Â Â Heat14Kw:BOOL:=FALSE;Â Â Heat27Kw:BOOL:=FALSE;Â Â Heat55Kw:BOOL:=FALSE;Â Triacscaled:INT:=0;END_VARVARÂ Â Triac:INT:=0;END_VAR
Triacscaled :=(CmdSignal-Triac)*100/7;IFCmdSignal>=103THEN
  Heat7KwB :=TRUE;
  Heat14Kw :=TRUE;
  Heat27Kw :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=103;ELSIFCmdSignal>=96THEN
  Heat14Kw :=TRUE;
  Heat27Kw :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=96;ELSIFCmdSignal>=89THEN
  Heat7KwB :=TRUE;
  Heat27Kw :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=89;ELSIFCmdSignal>=82THEN
  Heat27Kw :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=82;ELSIFCmdSignal>=76THEN
  Heat7KwB :=TRUE;
  Heat14Kw :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=76;ELSIFCmdSignal>=69THEN
  Heat14Kw :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=69;ELSIFCmdSignal>=62THEN
  Heat7KwB :=TRUE;
  Heat55Kw :=TRUE;
  Triac :=62;ELSIFCmdSignal>=55THEN
  Heat55Kw :=TRUE;
  Triac :=55;ELSIFCmdSignal>=48THEN
  Heat7KwB :=TRUE;
  Heat14Kw :=TRUE;
  Heat27Kw :=TRUE;
  Triac :=48;ELSIFCmdSignal>=41THEN
  Heat14Kw :=TRUE;
  Heat27Kw :=TRUE;
  Triac :=41;ELSIFCmdSignal>=34THEN
  Heat7KwB :=TRUE;
  Heat27Kw :=TRUE;
  Triac :=34;ELSIFCmdSignal>=27THEN
  Heat27Kw :=TRUE;
  Triac :=27;ELSIFCmdSignal>=21THEN
  Heat7KwB :=TRUE;
  Heat14Kw :=TRUE;
  Triac :=21;ELSIFCmdSignal>=14THEN
  Heat14Kw :=TRUE;
  Triac :=14;ELSIFCmdSignal>=7THEN
  Heat7KwB :=TRUE;
  Triac :=7;END_IF
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Im upgrading a HVAC control system, i found a decent macro but the macro is for liquid heat battery, and this application has electrical.
I would like to use the % output from the valve controller to trigger the heat elemets. Total heat is 110kw (2 x 7kW + 1x14kW + 1x27kW + 1x55kW)
All 5 heat elemets ar triggered by DO, what function could i use to calculate wich outputs at a given time will give the most correct DO to activate?
Example:
0% = 0kW
25% = 27kW (only 27kW aktice)
50% = 55kW (Only 55kW active)
75% = 82kW (Only 55kW + 27kW) active
100% = 110kW (all active)
Originally created by: scott_cunningham
A late answer, but here is a basic FB that will do it (assumes your command is 0 to 100):
Thanks for your reply.
Im sorry if my question wasn't crystal clear.
I would like a function that calculate all the time and then find the nearest combination to match the requested input.
Is there any pre-made function for this?
Originally created by: scott_cunningham
That is what my function block will do based on your information. Call it every scan with your input and it will turn on or off whatever heaters you need.
This is the solution i came up with, in case someone else need this.
This function calculates the remaining kW wich are given by Heat7KwA with TRIAC.