Engineers-Excel.com

Simulation of a PLC

Description| Examples| How it works



This app is a simulation of a Programmable Logic Controller (PLC). It allows the user to write programs in ladder logic and run them in the simulated PLC. This tool is intended to help beginners learn the basics of PLC programming using ladder logic.

PLC Simulator in Excel

The animated picture below shows "Seal-in" logic implemented in this PLC (see the  Examples page).

Seal in circuit

Download

.xlsm file (76 KB)
 

I would like to thank Joshua Dring for pointing out a bug in the original version of this tool.

Excel files with sample ladder logic can be downloaded from the Examples page.

A description of the tool follows, but it may be easier to learn about the tool through the video below.

Description

The different parts of the PLC Simulator are shown below.

PLC Simulator


The various parts of the simulator are:

1. The Ladder Editor: This is where the ladder logic is built. Use the drop down boxes in the grey areas for building the ladder and the drop down boxes on the top row to enter tag names. See animated picture below.

Ladder

2. The Input/Output (I/O) Builder: The PLC supports 8 digital inputs of which the first four are push buttons and the rest are swiches. In addition, there are 8 digital outputs, a timer and 16 internal coils.

3. I/O Operations area: Use the check boxes in this area to switch inputs. Note that the pushbuttons (X1 to X4) only work when the PLC is running.

4. PLC Download and Run button: Once the logic is completed, use this button to download it to the PLC and run it.
 

Ladder logic rules and Limitations of the Simulator

The following rules apply to the ladder builder:

1. The Outputs can only be specified in the last column.

2. Each rung can only have one output connection. The following logic will not work. Y1 and Y2 must be on separate rungs.

Multiple output

3. The red power rail on the left cannot be used as a start of a branch. In other words, the following logic is not allowed. This will cause a run time error.

Incorrect Logic

To work around this, change the logic as follows:

Correct logic

Now the power rail is not a part of the branch.


4. A limitation of this simulator is that it does not support branches more than one rung deep. Therefore, nested branches are not allowed. The following code will not run on the PLC.

Nested

Also See:

PID Loop Simulator

Alarm Circuit with Timer

Binary Coded Decimal (BCD) to 7 segment display circuit

Little Man Computer

Simulation of Pendulum Waves