TIA Portal - Programming - PLCsim simulator


We will now take a first look at PLC programming, focusing on the virtual controller, the PLC SIM program. Here we will carry out the programming of the previously prepared default hardware configuration and an empty program. Currently there is no code in it yet - we will deal with this later.

Launching the simulator

Now, we need to start up our virtual controller. Compared to the real controller, where you have to connect the power supply, here, in the case of the SIM virtual PLC, you simply have to start it up.

03d FirstProgramming image2

We see the next two steps: selecting in the project tree that we want to start the virtual driver, and going to the section marked with a red box, where we click on the icon resembling a blue TV, which results in the virtual driver being turned on. Tia Portal is configured in such a way that enabling this driver is simultaneous with performing a download, i.e. uploading all the data from the project to this device.

Permission to simulate

We also have simulation permission beforehand - this is key. The project must include a suitable PLC (S7-1200 with firmware at least v4.0) and the simulation permission ticked, which is one of the steps of the

03d FirstProgramming image3

These are the steps we need to follow to initialise the simulation on the virtual PLC.

Deactivation of interfaces

Moving on, remember that we are either working on the real driver or the virtual driver. We cannot use both at the same time, as indicated by our pop-up window with the options 'Enable Simulation Support'

03d FirstProgramming image4

. We have to agree to this - this is our tenth step. We click on the 'OK' button, thereby accepting that all other interfaces on our computer will be unavailable at this time while we are working with the virtual driver.


If we already have permission to work with the virtual driver, another window appears with the 'Load Preview' option, summarising what will be uploaded to our driver. This includes running the virtual driver itself.

03d FirstProgramming image6

We can see a description of the various components, such as the tights diode, which tells us whether the controller is working and executing the programme. If the diode is orange, it means that it is not performing any actions. In addition, we have a column with a summary error status and buttons to stop or resume the execution of the programme. The whole procedure of starting the programme starts after pressing the blue TV we have previously selected. In the 'Load Preview' window, we click 'Load', and before that we can read the information appearing in the 'Target' and Message' columns. After this step, the upload procedure is complete.

PLC commissioning

The twelfth point is the decision to start the driver, where we have to select 'Start Module', as the default is set to 'No Action'.

03d FirstProgramming image7

This means that everything will be uploaded to the controller, but the controller itself will remain in RUN mode, i.e. it will not execute our program. Remember to change this setting by clicking the black triangle, as indicated by the red arrow, and selecting 'Start Module' from the list. We then click the button marked as point thirteen, or 'Finish', to complete the upload procedure.

Virtual PLC

After this operation, the controller enters RUN mode, which is confirmed by the green icon (virtual LED) next to the 'Run/Stop' caption on the controller image.

03d FirstProgramming image8

In this way, our virtual driver is configured with the previously prepared programme code.

Switching to online

The next step, as point fourteen, is to go online, i.e. to view the current state of the controller. In this mode, we can observe the operation of the program code and analyse the memory contents. This is important because once a programme has been written, it often needs tweaking, and this is best done by observing the current operation of the logic.

03d FirstProgramming image9

To go online, we need to select the driver again in the project tree, which is step fifteen, and use the 'Online' option, numbered sixteen in the icon bar. Once we have ensured that the virtual driver is enabled, we can connect to it online.

Online preview

This will result in a view where the orange elements indicate that the controller is connected.

03d FirstProgramming image10

The highlighted balls in the project tree indicate that the programme section is ready for interaction. It is worth mentioning that the green colour indicates that the program section in the controller is working correctly. If you see anything other than a green circle, as we see with the currently marked plc_one driver, which is now marked in blue with a white bird in a green square, it means that the status of that device is OK. This is the kind of summary that tells us that everything is OK with a particular device.

Disconnection from the PLC (OFFLINE)

We are now online with this driver, but in some situations it may be necessary to return to the offline mode we were in before the online connection.

03d FirstProgramming image11

In order to go back to offline mode, we have to follow the steps as described in point sixteen. We select the driver, which is necessary because, when performing different operations in the project, we click in different places. If we want to perform the step of going offline, disconnecting from the driver, then we have to first select the driver, which is step sixteen, and then use the icon numbered seventeen. That's the whole procedure, which is to click the appropriate buttons.

View after disconnection from PLC (OFFLINE)

After this step, we see the view of the project after disconnection,

03d FirstProgramming image12

That is, we are back to a situation where we are only in the project with no connection to the actual controller

Project record

Saving the project in Tia Portal is also an important step in working with the project. The development environment runs on the computer and sometimes crashes occur. It is therefore a good idea to get into the habit of saving your project regularly.

03d FirstProgramming image13

I would suggest that you always save your project before uploading it to the controller, i.e. before the download procedure. This is important because once you save your project you can be sure that you will not lose the progress of your work. It is important to remember that unfortunately the Ctrl+Z (undo) shortcut does not work in Tia Portal, so saving the project status is a key practice to focus on when working with the project and the driver.

Recommended course!
Until 20.09.2022 rebate -15% on:

SIMATIC S7 in action

Sign up for the newsletter!
Author of entries
Tomasz Gilewski

Hello, my name is Tomasz Gilewski. I am the author of books on the S7-1200 controller and HMI panels (i.e. Siemens hardware). I have been programming exclusively on Siemens hardware and engineering tools for several years.

Leave a Comment

Select currency
Scroll to Top

Search on