The topic of this Master Thesis is simulation and control of a virtual machine with PLC-code for the machine control system. The main purpose of the simulation is to discover problems preferably in the mechanics and with the geometry, i.e. collisions. When the virtual machine is verified, the PLC-code can be post processed and downloaded to a real PLC.
Today the development of the mechanics and the control system of a machine is separated. Different software used might not be used together and this cause problems because several prototypes must be built and errors are not discovered until the real prototypes are built.
The project includes defining requirements of simulation software and a market survey of the simulation software market, decision of a simulation software and practical evaluation of the selected software. In the selected simulation software the geometries were imported from existing CAD-software and then the logics and kinematics were added.

A conclusion of this project is that it is possible to control a virtual machine with a virtual PLC. The virtual PLC is controlled by a virtual human-machine interface (HMI).