Example of Control Program Coded Into LCE

Home Page SimuPLC SimuPLC Help

Download

Comments Em Português

 

Example of control program coded into Linguagem de Comandos Elétricos - LCE (Electric Commands Language):

 

plc Three_Floor_Elevator // Draft of automatic control of an elevator within building with 3 floors. (Attention: controls that concern directly to human life, like into elevators, boilers, oil pipelines, vehicles, etc., that can take it in risk in the case of bad operation, should be implemented in the real world with special rigor, beyond to have that to attend specific legislation, very rigorous tests, sanction by certificating departments, etc. Normally they are acquired into software package embedded in the controlled equipments. The present control here sketchy has features merely of exemplification and introduction to the study of the interesting and complex field of the elevators controls and related PLC-based ones.)

var I0.0 call2ndFloor,

I0.1 callUp1stFloor,

I0.2 callDown1stFloor,

I0.3 callLower,

I0.4 doorOpen2ndFloor,

I0.5 doorOpen1stFloor,

I0.6 doorOpenLower,

I0.7 cabinClosed,

I1.0 cabinOpen,

T0 timeMinOpenLower,

T1 timeMinOpen1stFloor,

T2 timeMinOpen2ndFloor,

I1.1 buttonCab2ndFloor,

I1.2 buttonCab1stFloor,

I1.3 buttonCabLower,

I1.4 cabinIs2ndFloor,

I1.5 cabinIs1stFloor,

I1.6 cabinIsLower,

I1.7 Photocell,

I2.0 obstacleDoor,

Q0.0 motorUpCabin,

Q0.1 motorDownCabin,

Q0.2 motorOpenCabin,

Q0.3 motorCloseCabin,

Q0.4 unlockDoor2ndFloor,

Q0.5 unlockDoor1stFloor,

Q0.6 unlockDoorLower,

Q0.7 VentilaIllumina,

I2.1 buttonEmergency,

Q1.0 alarmeEmergency,

I2.2 weightExceeded,

Q1.1 alarmWeight,

Q1.2 cabinIsGoingUp,

Q1.3 cabinIsGoingDown,

M0.0 problemCloseCabin;

network 0 // Begins the control in the sequence waitingLowerFloor (note that the system must be always initiated with the elevator in the LowerFloor and with its door open, by way of manual actuation of the motors after electrical energy failure or maintenance).

if (immed buttonEmergency) {

operate immed alarmeEmergency;

}

if (not immed Photocell or immed weightExceeded or immed obstacleDoor or immed buttonEmergency)

{

operate problemCloseCabin; // Indicates anything wrong that impedes the closing of the cabin

}

while (immed weightExceeded)

{

if (not immed alarmWeight) // Actuates immediately the alarm, and hold it, while the weight excess subsists

{

operate immed alarmWeight;

}

}

if (not VarAux)

{

operate Início; // Generates a pulse in the variable Start on beginning of the operation (1st cycle)

or (VarAux)

{

operate VarAux;

}

}

if (Início)

{

turn_on waitingLower; // Activates the initial sequence when at beginning of the operation

}

//**************** Begin sequence waitingLower ****************

network 1 // Seq. waitingLower: cabin stopped in the lower floor waiting calls/users

sequence waitingLower

network 2 // Unlatches door of the lower floor to permit that the users enter into elevator.

if (not immed unlockDoorLower) {

turn_on immed unlockDoorLower;

reset timeMinOpenLower;

}

when (unlockDoorLower) temporize timeMinOpenLower 3 s;

if (immed doorOpenLower or not immed Photocell or immed obstacleDoor) { // The cabin only is closed after to remain a minimal time with its door open and, if somebody entered, after the ingress of last user, or, if obstructed, after it is unobstructed.

reset timeMinOpenLower;

}

end_circuit_sequence

network 3 // When someone enters and operates the push button to up, or an user call the elevator at superior floor, the PLC latches the door of the lower floor and transfers to sequence closingLower, since the door of the elevator isn't open, the "Emergency" button wasn't pressed, there isn't weight exceeded neither someone at line of the door of the cabin, which is indicated by absence of light on the photocell, and there isn't obstruction impeding its closing. The elevator only is closed after to remain a minimal time with its door open after the last user has entered.

if (immed buttonCab1stFloor or immed buttonCab2ndFloor or immed callUp1stFloor or immed callDown1stFloor or immed call2ndFloor)

{

turn_on immed cabinIsGoingUp;

turn_on immed VentilaIllumina;

}

if (cabinIsGoingUp and not immed doorOpenLower and timeMinOpenLower and not problemCloseCabin)

{

turn_off immed unlockDoorLower; // Unlocks the door of the cabin

transfer_sequence closingLower;

}

network 4 // End of the sequence waitingLower

end_sequence;

//**************** End sequence waitingLower *******************

//**************** Begin sequence waiting1stFloor ****************

network 5 // Seq. waiting1stFloor: cabin stopped in the 1st floor waiting calls/users

sequence waiting1stFloor

network 6 // Unlocks door of 1st floor to permit users enter into cabin.

if (not immed unlockDoor1stFloor) {

turn_on immed unlockDoor1stFloor;

reset timeMinOpen1stFloor;

}

when (unlockDoor1stFloor) temporize timeMinOpen1stFloor 3 s;

if (immed doorOpen1stFloor or not immed Photocell or immed obstacleDoor) {

reset timeMinOpen1stFloor;

}

end_circuit_sequence

network 7

if (not immed cabinIsGoingDown and (immed buttonCab2ndFloor or immed call2ndFloor))

{

turn_on immed cabinIsGoingUp;

turn_on immed VentilaIllumina;

}

if (not immed cabinIsGoingUp and (immed buttonCabLower or immed callLower))

{

turn_on immed cabinIsGoingDown;

turn_on immed VentilaIllumina;

}

if (not immed buttonCab2ndFloor and not immed call2ndFloor and not immed buttonCabLower and not immed callLower)

{

turn_off immed cabinIsGoingUp;

turn_off immed cabinIsGoingDown;

turn_off immed VentilaIllumina;

}

if ((cabinIsGoingUp or cabinIsGoingDown) and not immed doorOpen1stFloor and timeMinOpen1stFloor and not problemCloseCabin)

{

turn_off immed unlockDoor1stFloor;

transfer_sequence closing1stFloor;

}

network 8 // End of the sequence waiting1stFloor

end_sequence;

//**************** End sequence waiting1stFloor ****************

//**************** Begin sequence waiting2ndFloor ****************

network 9 // Seq. waiting2ndFloor: cabin stopped in the 2ndFloor waiting calls/users

sequence waiting2ndFloor

network 10

if (not immed unlockDoor2ndFloor) {

turn_on immed unlockDoor2ndFloor;

reset timeMinOpen2ndFloor;

}

when (unlockDoor2ndFloor) temporize timeMinOpen2ndFloor 3 s;

if (immed doorOpen2ndFloor or not immed Photocell or immed obstacleDoor)

{

reset timeMinOpen2ndFloor;

}

end_circuit_sequence

network 11

if (immed buttonCabLower or immed buttonCab1stFloor or immed callUp1stFloor or immed callDown1stFloor or immed callLower)

{

turn_on immed cabinIsGoingDown;

turn_on immed VentilaIllumina;

}

if (cabinIsGoingDown and not immed doorOpen2ndFloor and timeMinOpen2ndFloor and not problemCloseCabin)

{

turn_off immed unlockDoor2ndFloor;

transfer_sequence closing2ndFloor;

}

network 12 // End of the sequence waiting2ndFloor

end_sequence;

//**************** End sequence waiting2ndFloor ****************

//**************** Begin sequence closingLower ****************

network 13 // Seq. closingLower: cabin stopped in the lower floor and closing its door

sequence closingLower

network 14

if (not immed motorCloseCabin) {

turn_on immed motorCloseCabin;

}

end_circuit_sequence

network 15

if (immed doorOpenLower or not immed Photocell or immed buttonEmergency or immed obstacleDoor)

{

turn_off immed motorCloseCabin;

transfer_sequence openingLower;

}

else

{

if (immed cabinClosed)

{

turn_off immed motorCloseCabin;

transfer_sequence goingUpLower;

}

}

network 16 // End of the sequence closingLower

end_sequence;

//**************** End sequence closingLower ****************

//**************** Begin sequence closing1stFloor ****************

network 17 // Seq. closing1stFloor: cabin stopped in the 1stFloor and closing its door

sequence closing1stFloor

network 18

if (not immed motorCloseCabin) {

turn_on immed motorCloseCabin;

}

end_circuit_sequence

network 19

if (immed doorOpen1stFloor or not immed Photocell or immed obstacleDoor or immed buttonEmergency)

{

turn_off immed motorCloseCabin;

transfer_sequence opening1stFloor;

}

else

{

if (immed cabinClosed)

{

turn_off immed motorCloseCabin;

if (cabinIsGoingUp)

{

transfer_sequence goingUp1stFloor;

}

if (cabinIsGoingDown)

{

transfer_sequence goingDown1stFloor;

}

}

}

network 20 // End of the sequence closing1stFloor

end_sequence;

//**************** End sequence closing1stFloor ****************

//**************** Begin sequence closing2ndFloor ****************

network 21 // Seq. closing2ndFloor: cabin stopped in the 2ndFloor and closing its door

sequence closing2ndFloor

network 22

if (not immed motorCloseCabin) {

turn_on immed motorCloseCabin;

}

end_circuit_sequence

network 23

if (immed doorOpen2ndFloor or not immed Photocell or immed obstacleDoor or immed buttonEmergency)

{

turn_off immed motorCloseCabin;

transfer_sequence opening2ndFloor;

}

else

{

if (immed cabinClosed)

{

turn_off immed motorCloseCabin;

transfer_sequence goingDown2ndFloor;

}

}

network 24 // End of the sequence closing2ndFloor

end_sequence;

//**************** End sequence closing2ndFloor ****************

//**************** Begin sequence openingLower****************

network 25 // Seq. openingLower: cabin stopped in the lower floor and opening its door

sequence openingLower

network 26

if (not immed motorOpenCabin) {

turn_on immed motorOpenCabin;

}

end_circuit_sequence

network 27 // When the cabin is open, it stays waiting calls or users.

if (immed cabinOpen) {

turn_off immed motorOpenCabin;

turn_off immed cabinIsGoingDown;

turn_off immed VentilaIllumina;

transfer_sequence waitingLower;

}

network 28 // End of the sequence openingLower

end_sequence;

//**************** End sequence openingLower****************

//**************** Begin sequence opening1stFloor ****************

network 29 // Seq. opening1stFloor: cabin stopped in the 1stFloor and opening its door

sequence opening1stFloor

network 30 // Turn on opening of the door of the cabin.

if (not immed motorOpenCabin) {

turn_on immed motorOpenCabin;

}

end_circuit_sequence

network 31 // When the cabin is open, it stays waiting calls or users.

if (immed cabinOpen)

{

turn_off immed motorOpenCabin;

transfer_sequence waiting1stFloor;

}

network 32 // End of the sequence opening1stFloor

end_sequence;

//**************** End sequence opening1stFloor ****************

//**************** Begin sequence opening2ndFloor ****************

network 33 // Seq. opening2ndFloor: cabin stopped in the 2ndFloor and opening its door

sequence opening2ndFloor

network 34 // Turn on opening of the door of the cabin.

if (not immed motorOpenCabin)

{

turn_on immed motorOpenCabin;

}

end_circuit_sequence

network 35 // When the cabin is open, it stays waiting calls or users.

if (immed cabinOpen)

{

turn_off immed motorOpenCabin;

turn_off immed cabinIsGoingUp;

turn_off immed VentilaIllumina;

transfer_sequence waiting2ndFloor;

}

network 36 // End of the sequence opening2ndFloor

end_sequence;

//**************** End sequence opening2ndFloor ****************

//**************** Begin sequence goingUpLower****************

network 37 // Seq. goingUpLower: cabin goingUp from lower floor to the 1st floor.

sequence goingUpLower

network 38 // Liga motor para subida da cabin.

if (not immed motorUpCabin) {

turn_on immed motorUpCabin;

}

end_circuit_sequence

network 39 // When the cabin comes to the first floor, this net verifies if it must stop or continue.

if (immed cabinIs1stFloor and not immed buttonCab2ndFloor and not immed call2ndFloor)

{

turn_off immed cabinIsGoingUp;

turn_off immed VentilaIllumina;

}

if (immed cabinIs1stFloor and (immed buttonCab1stFloor or immed callUp1stFloor

or (immed callDown1stFloor and not immed cabinIsGoingUp) )

or immed buttonEmergency)

{

turn_off immed motorUpCabin;

transfer_sequence opening1stFloor;

}

else

{

if (immed cabinIs1stFloor)

{

transfer_sequence goingUp1stFloor;

}

}

network 40 // End of the sequence goingUpLower

end_sequence;

//**************** End sequence goingUpLower ****************

//**************** Begin sequence goingUp1stFloor ****************

network 41 // Seq. goingUp1stFloor: cabin goingUp from 1º to the 2nd floor.

sequence goingUp1stFloor

network 42 // Liga motor para subida da cabin.

if (not immed motorUpCabin) {

turn_on immed motorUpCabin;

}

end_circuit_sequence

network 43 // When the cabin arrives at the 2nd floor, turn off the motor.

if (immed cabinIs2ndFloor)

{

turn_off immed motorUpCabin;

turn_off immed cabinIsGoingUp;

turn_off immed VentilaIllumina;

transfer_sequence opening2ndFloor;

}

network 44 // End of the sequence goingUp1stFloor

end_sequence;

//**************** End sequence goingUp1stFloor ****************

//**************** Begin sequence goingDown1stFloor ****************

network 45 // Seq. goingDown1stFloor: cabin goingDown from 1st floor to the Lower.

sequence goingDown1stFloor

network 46 // Liga motor para descida da cabin.

if (not immed motorDownCabin) {

turn_on immed motorDownCabin;

}

end_circuit_sequence

network 47 // When the cabin arrives at the Lower, turn off the motor.

if (immed cabinIsLower)

{

turn_off immed motorDownCabin;

turn_off immed cabinIsGoingDown;

turn_off immed VentilaIllumina;

transfer_sequence openingLower;

}

network 48 // End of the sequence goingDown1stFloor

end_sequence;

//**************** End sequence goingDown1stFloor ****************

//**************** Begin sequence goingDown2ndFloor ****************

network 49 // Seq. goingDown2ndFloor: cabin goingDown from 2nd floor to the 1st floor.

sequence goingDown2ndFloor

network 50

if (not immed motorDownCabin) {

turn_on immed motorDownCabin;

}

end_circuit_sequence

network 51 // When the cabin comes to the first floor, this net verifies if it must stop or continue.

if (immed cabinIs1stFloor and not immed buttonCabLower and not immed callLower)

{

turn_off immed cabinIsGoingDown;

turn_off immed VentilaIllumina;

}

if (immed cabinIs1stFloor and (immed buttonCab1stFloor or immed callDown1stFloor

or (immed callUp1stFloor and not immed cabinIsGoingDown) )

or immed buttonEmergency)

{

turn_off immed motorDownCabin;

transfer_sequence opening1stFloor;

}

else

{

if (immed cabinIs1stFloor)

{

transfer_sequence goingDown1stFloor;

}

}

network 52 // End of the sequence goingDown2ndFloor

end_sequence;

//**************** End sequence goingDown2ndFloor ****************

end

 


Copyright © 2002   André Luiz Barbosa   All rights reserved.
Updated: 09-set-2004