UserwithnoUsername opened a new issue, #2173: URL: https://github.com/apache/plc4x/issues/2173
### What happened? Setup or own a Beckhoff/BSD SPS Download .iso from Official Beckhoff Website. Setup in Combination with VirtualBox and the following Script. Load a sample Beckhoff Project. ``` param( [Parameter(Mandatory=$true, HelpMessage="Name your VM")] $vmname, [Parameter(Mandatory=$false, HelpMessage="Select your TCBSD image")] $tcbsdimagefile="TCBSD-x64-12-40411.iso", [Parameter(Mandatory=$false, HelpMessage="Where is your VirtualBox installation?")] $virtualBoxPath = 'C:\Program Files\Oracle\VirtualBox' ) $workingDirectory=pwd if(!(Test-Path $virtualBoxPath)) { Write-Warning 'You do not have the VirtualBox installed at' $virtualBoxPath $answer = Read-Host 'Would you like me to download the VirtualBox and install it [Y]es [N]o?' if($answer.ToUpperInvariant() -eq 'Y') { Invoke-WebRequest https://download.virtualbox.org/virtualbox/6.1.30/VirtualBox-6.1.30-148432-Win.exe -OutFile VirtualBoxInstall.exe .\VirtualBoxInstall.exe } else { Write-Warning "Installation of VirtualBox not found. Install it manually or if you have it installed on other location than $virtualBoxPath pass the path as parameter of this script and run it again." exit } } if (!(Test-Path $tcbsdimagefile)) { Write-Warning "You will need to login into Beckhoff site to dowload TCBSD image requeste image is: $tcbsdimagefile" Write-Warning "Download the $tcbsdimagefile to $workingDirectory. Then run the script again" Write-Warning "Presse any key to go download page" Read-Host Start https://www.beckhoff.com/en-en/products/ipc/software-and-tools/operating-systems/c9900-s60x-cxxxxx-0185.html exit } cd $virtualBoxPath Write-Output "Creating Virtual Machine TwinCAT 3 BSD" .\VBoxManage createvm --name $vmname --basefolder $workingDirectory --ostype FreeBSD_64 --register > $null .\VBoxManage modifyvm $vmname --memory 1024 --vram 128 --acpi on --hpet on --graphicscontroller vmsvga --firmware efi64 > $null $installer_image="TcBSD_installer.vdi" $runtime_image="TcBSD.vhd" $vmdirectory= Join-Path $workingDirectory $vmname $sink=Join-Path $vmdirectory $installer_image $source=Join-Path $workingDirectory $tcbsdimagefile Write-Output "converting img image to virtualbox bootable HDD image" $output = .\VBoxManage convertfromraw --format VDI $source $sink 2>&1 Write-Output "Creating SATA storage Controller" .\VBoxManage storagectl $vmname --name SATA --add sata --controller IntelAhci --hostiocache on --bootable on > $null Write-Output "attaching to installation HDD to Sata Port 1" .\VBoxManage storageattach $vmname --storagectl "SATA" --device 0 --port 1 --type hdd --medium $sink > $null Write-Output "creating empty HDD" $runtime_hdd=Join-Path $vmdirectory $runtime_image $output = .\VBoxManage createmedium --filename $runtime_hdd --size 4096 --format VHD 2>&1 Write-Output "attaching created HDD to Sata Port 0 where we will install TwinCAT BSD" .\VBoxManage storageattach $vmname --storagectl "SATA" --device 0 --port 0 --type hdd --medium $runtime_hdd > $null $vmpath = Join-Path $workingDirectory $vmname $vmpath = Join-Path $vmpath "$vmname.vbox" Start $vmpath Write-Host "Continue the installation of TCBSD in the VirtualBox" cd $workingDirectory ``` Run Example Code: ``` import org.apache.plc4x.java.api.PlcConnection; import org.apache.plc4x.java.api.PlcDriverManager; import org.apache.plc4x.java.api.authentication.PlcUsernamePasswordAuthentication; import org.apache.plc4x.java.api.messages.PlcReadRequest; import org.apache.plc4x.java.api.messages.PlcReadResponse; import java.util.concurrent.TimeUnit; public class AdsDemo { public static void main(String[] args) throws Exception { String connectionString = "ads:tcp://192.168.1.120:8016?" + "target-ams-net-id=192.168.1.120.1.1&target-ams-port=851&" + "source-ams-net-id=192.168.1.233.1.1&source-ams-port=32905"; PlcUsernamePasswordAuthentication authentication = new PlcUsernamePasswordAuthentication("Administrator", "2"); try (PlcConnection plcConnection = PlcDriverManager.getDefault().getConnectionManager().getConnection(connectionString, authentication)) { // Build a read request (PLC4J-0.12 uses addTag; addItem also works) PlcReadRequest readReq = plcConnection.readRequestBuilder() .addTagAddress("nbool", "MAIN.nbool") // or %MX0.0:BOOL .addTagAddress("nint", "MAIN.nCounter") .build(); PlcReadResponse resp = readReq.execute().get(3, TimeUnit.SECONDS); boolean flag = resp.getBoolean("nbool"); System.out.println("MAIN.nbool = " + flag); int counter = resp.getInteger("nint"); System.out.println("MAIN.nCounter = " + counter); } } } ``` Route gets Created: <img width="789" height="579" alt="Image" src="https://github.com/user-attachments/assets/5b83272a-9c87-4f63-bf53-a5a0128e07ff" /> Error During Runtime if unsecure Port is disabled in firewall like its default for the BSD version of Twincat. <img width="1578" height="778" alt="Image" src="https://github.com/user-attachments/assets/0292b55b-74a3-4e32-9365-124555f897d9" /> For further Information simply Ask. with regards ### Version v0.12.0 ### Programming Languages - [ ] plc4c - [ ] plc4go - [x] plc4j - [ ] plc4net - [ ] plc4py ### Protocols - [ ] AB-Ethernet - [x] ADS /AMS - [ ] BACnet/IP - [ ] C-Bus - [ ] CANopen - [ ] EtherNet/IP - [ ] Firmata - [ ] IEC-69870 - [ ] KNXnet/IP - [ ] Modbus - [ ] OPC-UA - [ ] Profinet - [ ] S7 - [ ] S7-light -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@plc4x.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org