After you're done with the logic, as a PLC programmer the first thing that you need to
do is to test the logic using the simulator and make sure that it works exactly as expected,
before you download it to the PLC.
To run the PLC simulator in the STEP 7, I'll go back to the SIMATIC Manager and then on
the tool bar I'll click on this icon that says "simulation On/Off".
This little widow is the PLC simulator in STEP 7, which works exactly as an actual PLC.
This window here simulates the CPU module with all the main indicators that you would
see on a real CPU module.
Now, in addition to the CPU, I also have a digital input and a digital output card in
the hardware.
So to be able to test the PLC program I need to add these two cards in the simulator as
well.
To add an input in the simulator, from the insert menu, I'll select input variable.
This gives me one byte or 8 inputs.
The addresses that I have for my input card here start at byte 0 in the input addresses
and continue to byte 3.
This means I have 4 bytes of 0, 1, 2 and 3 as the addresses for this card which gives
me 32 inputs to use in my PLC program.
To be able to test all of these inputs in the simulator I can go ahead and add 3 additional
set of inputs.
The address for the first one is zero, I'll change the address for the second one to 1,
the next one to 2 and the last one to 3.
Now I have all the 32 inputs of the input card in the simulator but I have only used
2 inputs from byte zero for the start and the stop switches in my PLC program so having
this byte in the simulator is enough.
The same goes for the outputs.
I have 16 outputs which include bytes 4 and 5 from the output addresses but I have only
used some of the bits from byte 4 in the PLC program so I only need to add one output from
the insert menu and then change the address to 4.
To have the simulator always viewable on the screen, from the view menu I'll select "always
on top".
As you can see, the simulator is currently in the stop mode so I'll select RUN and P
here.
Now all I need to do is download the program to the simulator.
For that I'll select the PLC in the project tree and then click on the download icon in
the toolbar.
This will download both the hardware and the logic to the simulator.
Here it asks me if I want to replace the current system data in the hardware with the offline
version.
I'll click yes.
Now it gives me a warning that since what I'm downloading to the simulator includes
the hardware configuration, the CPU will go to the stop mode.
I'll click "OK" here and as you can see, it starts downloading the program to the simulator.
The CPU is now in the stop mode since I downloaded the hardware configuration along with the
logic.
Now it asks me if I want to RUN the CPU again.
I'll click "yes" and the CPU runs again.
OK now the whole project has been downloaded to the simulator successfully and now I can
start testing my PLC program.
One thing to take note of here is that if you're having problems connecting to the simulator,
you should check and see whether you have already told the software that you're going
to connect to the simulator or not.
What do I mean by that?
By that I mean, before connecting the software to the PLC or the simulator, you should always
specify what you're going to connect to and how.
For instance, if you're going to connect the software to the simulator, you should define
that in the software before connecting to the simulator.
Or if you're going to connect to a PLC through a PC adaptor, you need to do a very quick
configuration in the software and let it know where it should be expecting to connect.
Now how do you do that you ask?
It's very simple.
For that, in the option menu you should choose "set PG/PC interface" for this little window
to pop up.
Here in the "interface parameter assignment" you can see different methods of connecting
to the simulator or the PLC.
For connecting to the simulator, you should always choose "PLCSIM MPI" . By doing this,
the software already knows and expects to be connected to a simulator not a PLC.
There are also other options for connecting the software to another external software
or device.
But don't be scared.
Most of these options are rarely used and we usually use 2 or 3 of them here.
For instance, when you want to connect to a real PLC using the PC Adaptor, you need
to choose "PC Adaptor MPI" here.
So it's very simple and straight forward.
You should always let the software know where it's going to be connected so that it is able
to recognize the device or the software.
I've already selected "PLCSIM MPI" which tells the software that I'm going to connect to
the simulator, so I'll leave this as it is and click cancel.
In the next lesson I'm going to test the logic in the online mode to see if it works as I want it too.
Many of you have expressed that this is the easiest lesson learning environment that you have come across.
We’ve heard many of you expressing how much you are enjoying this content.
If this is your position, please communicate your appreciation of our videos with a like.
The more likes we get, the more enthusiastic we are to continue to provide this content in the future.
So show us your love now and like this video.
Also don't forget to subscribe to our YouTube channel if you haven't already done so.
That way each new video will be sent to you as it's published.
In addition to the likes and subscribes, make sure that you head over to realpars.com
to find even more training material for all of your PLC Programming needs.
We offer many videos to assist you in learning PLC programming and landing that job in the high paying,
highly sought after field of Automation and Controls Engineering.
Go to realpars.com and subscribe to our highly effective training series now.