This document explains how to create a virtual machine running on a VMware ESXi Hypervisor containing Beckhoff TwinCAT/BSD.
It is assumed the reader has basic knowledge of both TwinCAT and VMware ESXi, and knows how to access the VMware ESXi shell using SSH.
For testing, it is useful to have TwinCAT 3 XAE (the Visual Studio programming environment) at hand on your system. It is not required for the installation itself.
Tested with:
- TwinCAT/BSD version 13.0.11.3, build 55702
- TwinCAT 3 XAE v3.1.4024.29
- VMware ESXi 6.7
-
Download and unzip the TwinCAT/BSD ISO file, e.g.,
TCBSD-x64-13-55702.iso
-
VMware will not recognize this ISO file as bootable media. Therefore, we have to convert the ISO to a bootable VMware disk image using VirtualBox. Download and install VirtualBox (tested with 6.1.38).
-
Convert the ISO to a VMware VMDK disk image (replace paths where needed):
D:\Downloads>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" convertfromraw --format VMDK TCBSD-x64-13-55702.iso TCBSD.vmdk Converting from raw image file="TCBSD-x64-13-55702.iso" to file="TCBSD.vmdk"... Creating dynamic image with size 643713536 bytes (614MB)...
When the conversion has finished, VirtualBox is no longer needed and can be uninstalled.
-
The resulting file can be used by VMware Workstation, but not by ESXi. Therefore, we have to convert it to a ESXi compatible disk image.
UploadTCBSD.vmdk
to the ESXi datastore. -
Open up a ESXi SSH shell terminal, and convert the image using
vmkfstools
(replace paths where needed):[root@192:~] vmkfstools -i /vmfs/volumes/datastore1/TCBSD.vmdk /vmfs/volumes/datastore1/TCBSD_installer.vmdk Destination disk format: VMFS zeroedthick Cloning disk '/vmfs/volumes/datastore1/TCBSD.vmdk'... Clone: 100% done.
This creates 2 new files:
TCBSD_installer.vmdk
andTCBSD_installer-flat.vmdk
.
- Create a new ESXi VM. For the OS, select "Other" and "FreeBSD 12 or later versions (64-bit)"
- Add an existing harddrive. When prompted, select
TCBSD_installer.vmdk
The end result should look something like this: - In the boot options, select EFI as the firmware. Otherwise the installer will not boot!
- Finish the VM, and start it.
- After a while, the Beckhoff TC/BSD Installer welcome screen should appear.
TIP Write down the IP address shown in the welcome screen.
- Select
TC/BSD Install
, and select the first disk. - Enter an administrator password in the next screen, and wait for the installation to finish.
Press Enter to return to the main menu, and select
Shutdown
. Wait for the system to power off. - Open the VM options, and remove the TC/BSD installer hard disk. The files can be deleted safely.
- Power on the VM. After a while, the TC/BSD login screen appears. You have now successfully installed TC/BSD and should be able to open the PLC web interface by browsing to
https://<PLC IP address>/
It is now time to see if we can create a route to the TwinCAT/BSD VM.
- Open the Edit Routes windows from the Windows taskbar:
- Click Add to open the Add Route Dialog. Click Broadcast Search. Assuming the VM has an IP in the same range as your PC, the VM should be detected:
- Select the VM, check Advanced Settings, make sure the IP Address radio button is selected (we have experienced connection issues when using the Host Name).
\ - Click Add Route, check Secure ADS and enter the administrator password. Click OK to add the route.
TIP If you want to use the simple insecure login (unencrypted ADS communication), be sure to add the corresponding firewall rule on the VM. Instructions can be found in the Beckhoff TwinCAT/BSD manual, chapter 4.3. - If the route has been added succesfully, a lock icon appears in the Connected column:
Click OK, and OK again in the Choose Target System windows (which now shows the VM)
You have now successfully created a route to the VM, and it is ready for use!
This is a good time to make a snapshot of the VM. Open up a terminal to the VM's IP and login with name Administrator
and the password provided earlier. Enter doas shutdown -p now
to shutdown the VM. Take a snapshot with ESXi.
Check out the Beckhoff TwinCAT/BSD manual for useful tips on setting up the system and upgrading to newer versions.
Want real-time performance? then check out this article by VMware, explaining how to minimize latency (jitter) by exclusively assigning physical CPU cores to a VM.
Suggestions and feedback are always welcome! preferably by creating an issue or a pull request.
Thanks to r9guy for providing instructions on how to convert the ISO using VirtualBox.
Detailed installation instructions for VirtualBox and VMware Workstation can be found on Roald87's website Cook & Code. Be sure to check out his repos and website for more TwinCAT tips & tricks!
And a must-read is Jakob Sagatowski's excellent blog AllTwinCAT, its packed with useful information.