This example shows how to model a controller for a single-car elevator in Simulink® by using ladder logic. The elevator system is modeled as a MATLAB Function Block. The example also showcases ladder code generation.
Open the plcdemo_ladder_elevator by using:
>> plcdemo_ladder_elevator
When the model is opened, it sets the initial values of different parameters used in elevator controller from theplcdemo_ladder_elevator_init.mfile.
Floor Requests
Floor Requests
are a group of constant blocks. It specifies the indoor and outdoor floor requests to the controller. By default all the constant blocks are set to zero.
电梯控制器l System
电梯控制器l System
is a subsystem which consists of Digital Input modules(DI), Digital Output modules(DO) and a PLC Controller. DI modules preprocess floor request input and other sensor inputs. Similarly, DO modules preprocess output of PLC controller and sets output contactors. PLC controller is the brain of the system. It performs all the calculations and control action.
Elevator
Elevator
is a MATLAB function block which show cases mathematical model of a single car elevator system.
ClickRun
button to start simulation. OpenHMI
and use the following controls:
Exterior Buttons:Represents the exterior floor request buttons.
Interior Buttons:Represents the interior floor request buttons.
Photocell:Represents the door sensor.
Open elevator control model:
>> plcdemo_ladder_elevator
Select theplcdemo_ladder_elevator/Elevator Control System/Elevator PLC Ladder Diagram System/Elevator Controller
block and right-clickPLC Coder->Generate Code
for Subsystem to generate ladder code.