Quick question here. Is there a way to automate some of the operations in Automation Studio?
I’m looking for a similar thing of SIEMENS TIA Openness that allows a way to perform some tasks with an application via the API, so we don’t need to manually do it.
This will be very useful when it comes to update multiple PLC programs for sites.
As the project files are text files you can use external scripts (batch, python…) to modify the project pretty much as you wish.
Combine the project modifications with the command line interfaces of Automation Studio to build and RUC to transfer and you should be good to go. Automation Help: Build project using command line
Using these it is possible to create a complete CI/CD pipeline, BnR-DevOps-Package can help with this.
Thank you for pointing me to the information, it was very helpful.
Is it possible to include unit test? It seems we need to run a ARSim instance that hosts the unit test. Can you point me to some information about how to integrate the unit test in the pipeline, please?
You are correct that an ARSim instance is needed. RUC can spin this up for you.
I have used a separate “UnitTesting” configuration in Automation Studio for this and I first build a RUC package for this unit testing configuration, then i use RUC to start the ARSim instance and then it is possible to run the unit tests with HTTP requests. I used a powershell script to run the tests and parse the results so that I could return either a pass or fail value.
Here are some commands, which might be helpful. (I have used these with GitHub actions). Replace the <> parts with relevant informations for your project.
Create RUC Package for Unit Test configuration, force simulation
Create a instruction list(PIL file) for PVITransfer (RUC)
Write-Output 'CreateARsimStructure "<PathTo>\RUCPackage.zip", "<Path to where you want to create the simulation>", "Start=1"' | Out-File <Path where you want to create the pil file>\CreateUniteTestArsim.pil -Encoding ASCII
Create and start ArSim
Start-Process -FilePath 'C:\BRAutomation\PVI\V4.12\PVI\Tools\PVITransfer\PVITransfer.exe' -ArgumentList '-silent -<Path to PIL File here> -<Path to log file>'