Using IEC timers in Siemens SCL source files

p17061

Member
Join Date
Sep 2009
Location
Aberham
Posts
23
Hello,

I want to create a FC function that uses SCL code that checks deviation of a controllers actual measured value from its setpoint and then gives an alarm if the actual measured value is above or below the setpoint by a certain %. The alarm should be delayed by 15 seconds. I have some code that I am trying to use but I am not sure how to incorporate an SFB4 TON into the SCL source code. Can someone help me to understand how to use the SFB4 so I can trigger it within the function and give the alarm after 15 seconds?

VAR_INPUT
nFlowSetpointNs: INT; // Flow Nominal Setpoint
nFlowMe: DINT; // Flow Actual Measurement
nFlowDevUpPercentNs: DINT; // Flow Deviation Setpoint Upper Percentage
nFlowDevLowPercentNs: DINT; // Flow Deviation Setpoint Lower Percentage
tFlowDevTimeDly: TIME; // Flow Deviation Time Delay Nominal Setpoint
END_VAR

Var_OUTPUT
bFlowDeviationAlarmSt :BOOL; // Flow Deviation Alarm Status

END_VAR


BEGIN

IF nFlowMe < nFlowSetpointNs * nFlowDevUpPercentNs OR nFlowMe > nFlowSetpointNs / nFlowDevLowPercentNs
THEN bFlowDeviationAlarmSt := True;
ELSE bFlowDeviationAlarmSt := False;
END_IF;

Thanks
Peter
 
Last edited:
Is this the best way when I need to create alarms for about 30 different devices? I wanted to use an FC so I could call the FC in a function block and just insert the flow setpoints, actual flows, and alarm status' PLC tags into the FC IN and OUT variables and let the FC handle the comparing of setpoint vs. flow, count the 15 seconds and trigger the alarm.
 
If you are calling the FC 30 times then you cannot use an FB/SFB inside as the IDB would be fixed.

You can call the FB 30 times from within a main FB and make the called FB a multiple instance.
 

Similar Topics

Hello, I have a small programming task that I need help solving. I have to: * Create an analog input (4-20v)and a digital output * The analog...
Replies
45
Views
25,134
Dear All As I mentioned in the subject I want to know what is required on the PCS 7 both hardware and software aspects also for S7 300/S7 1200...
Replies
0
Views
2,912
I have 3 year experience in Schneider System,But i dont have any experience in RTU systems.For my new project we are using Schneider M340 with...
Replies
0
Views
3,585
Can Anybody please help me with the settings required to cofigure a Mitsubishi QJ71E71-100 Ethernet Module to communicate with a host System . I...
Replies
3
Views
2,848
Easy it may sound to some people but im completely confused. basically i would like to know what the function would be for hex to ascii using...
Replies
0
Views
3,701
Back
Top Bottom