CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Thu Jan 23, 2020 12:16 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jul 28, 2017 12:38 pm 
Offline

Joined: Fri Jun 09, 2017 4:37 pm
Posts: 3
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)


Top
   
PostPosted: Tue Aug 15, 2017 4:25 pm 
Offline
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 312
A late answer, but here is a basic FB that will do it (assumes your command is 0 to 100):

Code:
FUNCTION_BLOCK HeatControl
VAR_INPUT
   CmdSignal : INT := 0;
END_VAR
VAR_OUTPUT
   Heat7KwA : BOOL := FALSE;
   Heat7KwB : BOOL := FALSE;
   Heat14Kw : BOOL := FALSE;
   Heat27Kw : BOOL := FALSE;
   Heat55Kw : BOOL := FALSE;
END_VAR
VAR
END_VAR

(*
0% = 0kW
25% = 27kW (only 27kW aktice)
50% = 55kW (Only 55kW active)
75% = 82kW (Only 55kW + 27kW) active
100% = 110kW (all active)
*)

//turn all off first
Heat7KwA := FALSE;
Heat7KwB := FALSE;
Heat14Kw := FALSE;
Heat27Kw := FALSE;
Heat55Kw := FALSE;

//now see which should be on
IF CmdSignal >= 100 THEN
   Heat7KwA := TRUE;
   Heat7KwB := TRUE;
   Heat14Kw := TRUE;
   Heat27Kw := TRUE;
   Heat55Kw := TRUE;
ELSIF CmdSignal >= 75 THEN
   Heat27Kw := TRUE;
   Heat55Kw := TRUE;
ELSIF CmdSignal >= 50 THEN
   Heat55Kw := TRUE;
ELSIF CmdSignal >= 25 THEN
   Heat27Kw := TRUE;
ELSE
   ; //none
END_IF
 

_________________
Scott Cunningham
KEB America, Inc.
www.kebblog.com
www.kebamerica.com


Top
   
PostPosted: Thu Aug 24, 2017 7:43 am 
Offline

Joined: Fri Jun 09, 2017 4:37 pm
Posts: 3
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?


Top
   
PostPosted: Sat Aug 26, 2017 4:59 pm 
Offline
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 312
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.

_________________
Scott Cunningham
KEB America, Inc.
www.kebblog.com
www.kebamerica.com


Top
   
PostPosted: Fri Sep 15, 2017 6:17 pm 
Offline

Joined: Fri Jun 09, 2017 4:37 pm
Posts: 3
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.

Code:
FUNCTION_BLOCK HeatControl
VAR_INPUT
   CmdSignal : INT := 0;
END_VAR
VAR_OUTPUT
   Heat7KwA : BOOL := FALSE;
   Heat7KwB : BOOL := FALSE;
   Heat14Kw : BOOL := FALSE;
   Heat27Kw : BOOL := FALSE;
   Heat55Kw : BOOL := FALSE;
  Triacscaled: INT := 0;
END_VAR
VAR
   Triac : INT := 0;
END_VAR


Code:
Triacscaled := (CmdSignal - Triac) * 100 / 7;
IF CmdSignal >= 103 THEN
   Heat7KwB := TRUE;
   Heat14Kw := TRUE;
   Heat27Kw := TRUE;
   Heat55Kw := TRUE;
   Triac := 103;
ELSIF CmdSignal >= 96 THEN
   Heat14Kw := TRUE;
   Heat27Kw := TRUE;
   Heat55Kw := TRUE;
   Triac := 96;
ELSIF CmdSignal >= 89 THEN
   Heat7KwB := TRUE;
   Heat27Kw := TRUE;
   Heat55Kw := TRUE;
   Triac := 89;
ELSIF CmdSignal >= 82 THEN
   Heat27Kw := TRUE;
   Heat55Kw := TRUE;
   Triac := 82;
ELSIF CmdSignal >= 76 THEN
   Heat7KwB := TRUE;
   Heat14Kw := TRUE;
   Heat55Kw := TRUE;
   Triac := 76;
ELSIF CmdSignal >= 69 THEN
   Heat14Kw := TRUE;
   Heat55Kw := TRUE;
   Triac := 69;
ELSIF CmdSignal >= 62 THEN
   Heat7KwB := TRUE;
   Heat55Kw := TRUE;
   Triac := 62;
ELSIF CmdSignal >= 55 THEN
   Heat55Kw := TRUE;
   Triac := 55;
ELSIF CmdSignal >= 48 THEN
   Heat7KwB := TRUE;
   Heat14Kw := TRUE;
   Heat27Kw := TRUE;
   Triac := 48;
ELSIF CmdSignal >= 41 THEN
   Heat14Kw := TRUE;
   Heat27Kw := TRUE;
   Triac := 41;
ELSIF CmdSignal >= 34 THEN
   Heat7KwB := TRUE;
   Heat27Kw := TRUE;
   Triac := 34;
ELSIF CmdSignal >= 27 THEN
   Heat27Kw := TRUE;
   Triac := 27;
ELSIF CmdSignal >= 21 THEN
   Heat7KwB := TRUE;
   Heat14Kw := TRUE;
   Triac := 21;
ELSIF CmdSignal >= 14 THEN
   Heat14Kw := TRUE;
   Triac := 14;
ELSIF CmdSignal >= 7 THEN
   Heat7KwB := TRUE;
   Triac := 7;
END_IF


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited