Configure a project in TIA Portal for emulation
Start by launching Siemens TIA Portal and creating a new project (or opening an existing one).

In this example, we choose a 1212C AC/DC/Rly.

Start by right-clicking on the project and going into Properties.

Then select the Protection tab, and fill in the checkbox next to Support simulation during block compilation. Click OK to accept the change.

Then right-click on the PLC and go to Properties and select Protection & Security. Make sure Full access is selected to allow the Gateway application to read and write.

Further down the same page, there is a check box for Permit access with PUT / GET communication from remote partner. Make sure it is filled.

Select the settings for Ethernet addresses in the list on the left and enter the IP address of the PLC to be connected.

Then click the Add new subnet button.

Navigate to I/O addresses under DI 8/DQ 6. Ensure that the Organization block has the value None under both inputs and outputs. The model can then read and write in memory without conflicts. This must be done under all addresses that will be used, for the analog signals the same setting is under AI 2 / I/O addresses in this case.

Click OK to accept the changes.
Simple test program
To test the connection, we write a simple program. Start by assigning a name to each input/output that will be used. Simumatik will read and write directly to the addresses, therefore any name can be used for any time.

Now we can create a simple network in OB1. In the example below, the address of the green button is directly linked to the red light.

Now all settings are configured, and we have a simple program to test the connection. The next step is to download the changes to the PLC. The next two parts of this tutorial show two different ways, the first is if you have access to a real physical PLC, and the second is if you want to connect using PLCsim.