1

I am doing an assignment where I need to create an office management system that takes care of security, lighting, and heating on its own. It is required for us to make it in the sequential function chart logic from ladder logic, but I don't understand how to make it since we never took it. I tried to research it, but I still don't know how to convert it from ladder logic to SFC.

Please need help

The program functionality should be as follows:

• All counters/timers must be reset when entering "run" mode for the first time (use the first scan bit).

• Only during the day should the current number of occupants be counted by incrementing/decrementing as they enter or leave. Counting should not be done in the middle of the night. The count should be shown on the BCD display.

• The thermostat must control the heating during the day. At night, the heating is turned off.

• The main light system must activate as follows when the office is occupied during the day (using a LIM or Compare function). Daylight switch 1 should be used to control the first row of the main lighting. Daylight switches 1 and 2 will control main lighting row 2. No daylight switch should be used to control main lighting row 3. Unless an intruder triggers the main lighting, it is turned off at night. When the office is not in use, all the lights should be turned off.

• The night lighting should only be turned on at night.

• When a presence is detected at night, the external alarm should activate (70 percent duty cycle for 3 seconds) and latch, the internal alarm should start (30 percent duty cycle for 1 second) and latch, and the main lighting should activate after a time delay of 6 seconds and remain on for 20 seconds.

• When activated, all intruder alarms latch and can only be reset by pressing the reset button.

• In the event of a mains failure (from on to off the mains power switch), the emergency lighting should turn on immediately (day or night) and latch on the external alarm after a 6-second delay. The external alarm should have a duty cycle of 60% and a duration of 2 seconds. When the mains power is restored, the external alarm should be reset.

This is my ladder logic using RSlogix5000: enter image description here enter image description here enter image description here

My Progress so far, I don't know if I did OSR correct and how to do BSL for the BCD also I am planning to put all these in a single function block:

Timer_1.Acc:=0;
Timer_2.Acc:=0;
Timer_3.Acc:=0;
Timer_4.Acc:=0;
Timer_5.Acc:=0;
Timer_6.Acc:=0;
Timer_7.Acc:=0;
Timer_8.Acc:=0;
BSL_Array[0]:=0;


CTUD(Counter);
Counter.CUEnable:= DNSwitch and PDEntry;
Counter.Reset := RSwitch;

CTUD(Counter);
Counter.CDEnable:= DNSwitch and PDExit;
Counter.Reset := RSwitch;

if DNSwitch and Thermostat
then 
Heating:=1;
else
Heating:=0;
end_if;

if DNSwitch and DLSwitch1 and (Counter.ACC >= 0)
then 
Row1:=1;
else
Row1:=0;
end_if;

if (DNSwitch and DLSwitch1 and DLSwitch2 and (Counter.ACC >= 0)) or Timer_2.TT
then 
Row2:=1;
else
Row2:=0;
end_if;

if (DNSwitch and DLSwitch1 and DLSwitch2 and (Counter.ACC >= 0)) or Timer_2.TT
then 
Row2:=1;
else
Row2:=0;
end_if;

if (DNSwitch and (Counter.ACC > 0)) or Timer_2.TT
then 
Row3:=1;
else
Row3:=0;
end_if;

if not DNSwitch
then 
NLight:=1;
else
NLight:=0;
end_if;

if not DNSwitch and (PDEntry or (Intruder and not RSwitch))
then 
Intruder:=1;
else
Intruder:=0;
end_if;

RTOR(Timer_1);
Timer_1.PRE:= 6000;
Timer_1.TimerEnable:= Intruder;
Timer_1.Reset:= RSwitch;

RTOR(Timer_2);
Timer_2.PRE:= 20000;
Timer_2.TimerEnable:= Intruder and Timer_1.DN;
Timer_2.Reset:= RSwitch;

RTOR(Timer_3);
Timer_3.PRE:= 3000;
Timer_3.TimerEnable:= Intruder;
Timer_3.Reset:= RSwitch;

if (Intruder and (Timer_3.ACC <= 2100)) or (MPFail and Timer_5.DN and (Timer_6.ACC <= 1200))
then
ExtAlarm:= 1;
else
ExtAlarm:= 0;
end_if;

RTOR(Timer_4);
Timer_4.PRE:= 1000;
Timer_4.TimerEnable:= Intruder;
Timer_4.Reset:= RSwitch;

if (Intruder and (Timer_4.ACC <= 300))
then
IntAlarm:= 1;
else
IntAlarm:= 0;
end_if;

If MPFail
then
Elight:= 1;
else
Elight:= 0;
end_if;

RTOR(Timer_5);
Timer_5.PRE:= 2000;
Timer_5.TimerEnable:= MPFail;
Timer_5.Reset:= RSwitch;

RTOR(Timer_6);
Timer_6.PRE:= 2000;
Timer_6.TimerEnable:= Timer_5.DN;
Timer_6.Reset:= RSwitch;

(*BCD*)
RTOR(Timer_7);
Timer_7.PRE:= 25;
Timer_7.TimerEnable:= DNSwitch and not Timer_8.DN;
Timer_7.Reset:= RSwitch;

RTOR(Timer_8);
Timer_8.PRE:= 25;
Timer_8.TimerEnable:= DNSwitch and not Timer_8.DN and Timer_7.DN;
Timer_8.Reset:= RSwitch;

OSRI_Fn.InputBit := Timer_7.DN;
OSRI(OSRI_Fn);
OSR_1 := OSRI_Fn.OutputBit;
  • Hi, SFC is Sequential Function Chart not Sequential Flow Chart. Your post has been edited. – vu2nan May 24 '22 at 17:47
  • You just have to work out what each step of the sequence is and what the transition condition is to move from one step to another. Add your attempt into the question. – Transistor May 24 '22 at 21:47
  • @Transistor I'll do that and add it later – Sabretooth 2438 May 25 '22 at 04:33
  • @Transistor I uploaded my progress – Sabretooth 2438 May 26 '22 at 18:27
  • That's not SFC. You've converted ladder to STL (STatement List). See https://assets.omron.eu/downloads/manual/en/r149_sfc_getting_started_guide_en.pdf for example. **Step** and **Conditions** = **Sequence**. – Transistor May 26 '22 at 19:09
  • @Transistor so I can't put everything in a single block? – Sabretooth 2438 May 27 '22 at 08:18
  • What do you mean by a 'block'? – Transistor May 27 '22 at 13:27
  • @Transistor I don't have access to the software right now to show you what I did, I meant this [box](https://imgur.com/a/v0gV3O3). put the statement I wrote in this single block – Sabretooth 2438 May 27 '22 at 15:34
  • I've spent a little time looking at the ladder logic but there isn't really a sequence in it. It's more just parallel logic circuits so SFC wouldn't be much use. Can you edit your question to include the actual user requirement specifications that you used to generate your ladder logic? – Transistor May 27 '22 at 21:24
  • @Transistor added the requirements – Sabretooth 2438 May 29 '22 at 04:16
  • @Transistor can you tell me how to do Structured Text from rung 16? – Sabretooth 2438 May 29 '22 at 08:41
  • Why are you asking about structured text? Your question title says you're supposed to generate SFC. Which is it. As commented above, this application doesn't really suit SFC as it is more combinational logic best suited to ladder or ST. Are you absolutely sure they're looking for SFC? – Transistor May 29 '22 at 09:14
  • @Transistor we are doing a group project and everyone is assigned to a language. I got to convert ladder to SFC – Sabretooth 2438 May 29 '22 at 12:03

0 Answers0