In the control program below, draft of an automatic control of an elevator within building with 3 floors.
plcThree_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.)
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 (immedbuttonEmergency) {
operateimmedalarmeEmergency;
}
if (notimmedPhotocellorimmedweightExceededorimmedobstacleDoororimmedbuttonEmergency)
{
operateproblemCloseCabin; // Indicates anything wrong that impedes the closing of the cabin
}
while (immedweightExceeded)
{
if (notimmedalarmWeight) // Actuates immediately the alarm, and hold it, while the weight excess subsists
{
operateimmedalarmWeight;
}
}
if (notVarAux)
{
operateInício; // Generates the pulse in the variable Start on beginning of the operation (1st cycle) or (VarAux)
{
operateVarAux;
}
}
if (Início)
{
turn_onwaitingLower; // 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
sequencewaitingLower
network 2 // Unlatches door of the lower floor to permit that the users enter into elevator.
if (notimmedunlockDoorLower) {
turn_onimmedunlockDoorLower;
resettimeMinOpenLower;
}
when (unlockDoorLower) temporizetimeMinOpenLower 3 s;
if (immeddoorOpenLowerornotimmedPhotocellorimmedobstacleDoor) { // The cabin only is closed after to remain the minimal time with its door open and, if somebody entered, after the ingress of last user, or, if obstructed, after it is unobstructed. resettimeMinOpenLower;
}
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 the minimal time with its door open after the last user has entered.
if (immedbuttonCab1stFloororimmedbuttonCab2ndFloororimmedcallUp1stFloororimmedcallDown1stFloororimmedcall2ndFloor)
{
turn_onimmedcabinIsGoingUp;
turn_onimmedVentilaIllumina;
}
if (cabinIsGoingUpandnotimmeddoorOpenLowerandtimeMinOpenLowerandnotproblemCloseCabin)
{
turn_offimmedunlockDoorLower; // Unlocks the door of the cabin transfer_sequenceclosingLower;
}
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
sequencewaiting1stFloor
network 6 // Unlocks door of 1st floor to permit users enter into cabin.
if (notimmedunlockDoor1stFloor) {
turn_onimmedunlockDoor1stFloor;
resettimeMinOpen1stFloor;
}
when (unlockDoor1stFloor) temporizetimeMinOpen1stFloor 3 s;
if (immeddoorOpen1stFloorornotimmedPhotocellorimmedobstacleDoor) {
resettimeMinOpen1stFloor;
}
end_circuit_sequence
network 7
if (notimmedcabinIsGoingDownand (immedbuttonCab2ndFloororimmedcall2ndFloor))
{
turn_onimmedcabinIsGoingUp;
turn_onimmedVentilaIllumina;
}
if (notimmedcabinIsGoingUpand (immedbuttonCabLowerorimmedcallLower))
{
turn_onimmedcabinIsGoingDown;
turn_onimmedVentilaIllumina;
}
if (notimmedbuttonCab2ndFloorandnotimmedcall2ndFloorandnotimmedbuttonCabLowerandnotimmedcallLower)
{
turn_offimmedcabinIsGoingUp;
turn_offimmedcabinIsGoingDown;
turn_offimmedVentilaIllumina;
}
if ((cabinIsGoingUporcabinIsGoingDown) andnotimmeddoorOpen1stFloorandtimeMinOpen1stFloorandnotproblemCloseCabin)
{
turn_offimmedunlockDoor1stFloor;
transfer_sequenceclosing1stFloor;
}
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
sequencewaiting2ndFloor
network 10
if (notimmedunlockDoor2ndFloor) {
turn_onimmedunlockDoor2ndFloor;
resettimeMinOpen2ndFloor;
}
when (unlockDoor2ndFloor) temporizetimeMinOpen2ndFloor 3 s;
if (immeddoorOpen2ndFloorornotimmedPhotocellorimmedobstacleDoor)
{
resettimeMinOpen2ndFloor;
}
end_circuit_sequence
network 11
if (immedbuttonCabLowerorimmedbuttonCab1stFloororimmedcallUp1stFloororimmedcallDown1stFloororimmedcallLower)
{
turn_onimmedcabinIsGoingDown;
turn_onimmedVentilaIllumina;
}
if (cabinIsGoingDownandnotimmeddoorOpen2ndFloorandtimeMinOpen2ndFloorandnotproblemCloseCabin)
{
turn_offimmedunlockDoor2ndFloor;
transfer_sequenceclosing2ndFloor;
}
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
sequenceclosingLower
network 14
if (notimmedmotorCloseCabin) {
turn_onimmedmotorCloseCabin;
}
end_circuit_sequence
network 15
if (immeddoorOpenLowerornotimmedPhotocellorimmedbuttonEmergencyorimmedobstacleDoor)
{
turn_offimmedmotorCloseCabin;
transfer_sequenceopeningLower;
}
else
{
if (immedcabinClosed)
{
turn_offimmedmotorCloseCabin;
transfer_sequencegoingUpLower;
}
}
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
sequenceclosing1stFloor
network 18
if (notimmedmotorCloseCabin) {
turn_onimmedmotorCloseCabin;
}
end_circuit_sequence
network 19
if (immeddoorOpen1stFloorornotimmedPhotocellorimmedobstacleDoororimmedbuttonEmergency)
{
turn_offimmedmotorCloseCabin;
transfer_sequenceopening1stFloor;
}
else
{
if (immedcabinClosed)
{
turn_offimmedmotorCloseCabin;
if (cabinIsGoingUp)
{
transfer_sequencegoingUp1stFloor;
}
if (cabinIsGoingDown)
{
transfer_sequencegoingDown1stFloor;
}
}
}
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
sequenceclosing2ndFloor
network 22
if (notimmedmotorCloseCabin) {
turn_onimmedmotorCloseCabin;
}
end_circuit_sequence
network 23
if (immeddoorOpen2ndFloorornotimmedPhotocellorimmedobstacleDoororimmedbuttonEmergency)
{
turn_offimmedmotorCloseCabin;
transfer_sequenceopening2ndFloor;
}
else
{
if (immedcabinClosed)
{
turn_offimmedmotorCloseCabin;
transfer_sequencegoingDown2ndFloor;
}
}
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
sequenceopeningLower
network 26
if (notimmedmotorOpenCabin) {
turn_onimmedmotorOpenCabin;
}
end_circuit_sequence
network 27 // When the cabin is open, it stays waiting calls or users.
if (immedcabinOpen) {
turn_offimmedmotorOpenCabin;
turn_offimmedcabinIsGoingDown;
turn_offimmedVentilaIllumina;
transfer_sequencewaitingLower;
}
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
sequenceopening1stFloor
network 30 // Turn on opening of the door of the cabin.
if (notimmedmotorOpenCabin) {
turn_onimmedmotorOpenCabin;
}
end_circuit_sequence
network 31 // When the cabin is open, it stays waiting calls or users.
if (immedcabinOpen)
{
turn_offimmedmotorOpenCabin;
transfer_sequencewaiting1stFloor;
}
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
sequenceopening2ndFloor
network 34 // Turn on opening of the door of the cabin.
if (notimmedmotorOpenCabin)
{
turn_onimmedmotorOpenCabin;
}
end_circuit_sequence
network 35 // When the cabin is open, it stays waiting calls or users.
if (immedcabinOpen)
{
turn_offimmedmotorOpenCabin;
turn_offimmedcabinIsGoingUp;
turn_offimmedVentilaIllumina;
transfer_sequencewaiting2ndFloor;
}
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.
sequencegoingUpLower
network 38 // Liga motor para subida of the cabin.
if (notimmedmotorUpCabin) {
turn_onimmedmotorUpCabin;
}
end_circuit_sequence
network 39 // When the cabin comes to the first floor, this net verifies if it must stop or continue.
if (immedcabinIs1stFloorandnotimmedbuttonCab2ndFloorandnotimmedcall2ndFloor)
{
turn_offimmedcabinIsGoingUp;
turn_offimmedVentilaIllumina;
}
if (immedcabinIs1stFloorand (immedbuttonCab1stFloororimmedcallUp1stFloor or (immedcallDown1stFloorandnotimmedcabinIsGoingUp) )
orimmedbuttonEmergency)
{
turn_offimmedmotorUpCabin;
transfer_sequenceopening1stFloor;
}
else
{
if (immedcabinIs1stFloor)
{
transfer_sequencegoingUp1stFloor;
}
}
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.
sequencegoingUp1stFloor
network 42 // Liga motor para subida of the cabin.
if (notimmedmotorUpCabin) {
turn_onimmedmotorUpCabin;
}
end_circuit_sequence
network 43 // When the cabin arrives at the 2nd floor, turn off the motor.
if (immedcabinIs2ndFloor)
{
turn_offimmedmotorUpCabin;
turn_offimmedcabinIsGoingUp;
turn_offimmedVentilaIllumina;
transfer_sequenceopening2ndFloor;
}
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.
sequencegoingDown1stFloor
network 46 // Liga motor para descida of the cabin.
if (notimmedmotorDownCabin) {
turn_onimmedmotorDownCabin;
}
end_circuit_sequence
network 47 // When the cabin arrives at the Lower, turn off the motor.
if (immedcabinIsLower)
{
turn_offimmedmotorDownCabin;
turn_offimmedcabinIsGoingDown;
turn_offimmedVentilaIllumina;
transfer_sequenceopeningLower;
}
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.
sequencegoingDown2ndFloor
network 50
if (notimmedmotorDownCabin) {
turn_onimmedmotorDownCabin;
}
end_circuit_sequence
network 51 // When the cabin comes to the first floor, this net verifies if it must stop or continue.
if (immedcabinIs1stFloorandnotimmedbuttonCabLowerandnotimmedcallLower)
{
turn_offimmedcabinIsGoingDown;
turn_offimmedVentilaIllumina;
}
if (immedcabinIs1stFloorand (immedbuttonCab1stFloororimmedcallDown1stFloor or (immedcallUp1stFloorandnotimmedcabinIsGoingDown) )
orimmedbuttonEmergency)
{
turn_offimmedmotorDownCabin;
transfer_sequenceopening1stFloor;
}
else
{
if (immedcabinIs1stFloor)
{
transfer_sequencegoingDown1stFloor;
}
}
network 52 // End of the sequence goingDown2ndFloor
end_sequence;
//**************** End sequence goingDown2ndFloor ****************
end
Como result of the compilation of the program Three_Floor_Elevator above, the SimuPLC 4.0.0 gerou, exatamente, the following code, in Lista of Instruções - IL:
// CLP 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.)
NETWORK0// 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).
LDII2.1 =IQ1.0
LDNII1.7 OII2.2 OII2.0 OII2.1 =M0.0 // Indicates anything wrong that impedes the closing of the cabin
LBLENQ1
LDII2.2 NOT JMPENQ2
LDNIQ1.1 // Actuates immediately the alarm, and hold it, while the weight excess subsists =IQ1.1
LDNV_0 JMPENQ1
LBLENQ2
LDNVarAux =Início // Generates the pulse in the variable Start on beginning of the operation (1st cycle) OVarAux =VarAux
LDInício SwaitingLower, 1 // Activates the initial sequence when at beginning of the operation //**************** Begin sequence waitingLower ****************
NETWORK1// Seq. waitingLower: cabin stopped in the lower floor waiting calls/users
LSCRwaitingLower
NETWORK2// Unlatches door of the lower floor to permit that the users enter into elevator.
LDNIQ0.6 SIQ0.6, 1 RT0, 1
LDQ0.6 TONT0, 3000
LDII0.6 ONII1.7 OII2.0 // The cabin only is closed after to remain the minimal time with its door open and, if somebody entered, after the ingress of last user, or, if obstructed, after it is unobstructed. RT0, 1
NETWORK3// 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 the minimal time with its door open after the last user has entered.