I have a project where i need a PLC to be powerlink master and another to be the powerlink slave and communicate with each other. The reason for powerlink is that we need the nettime for precise synchronization.
The PLC for master and slave is the same type (x90Cp150) and they should contain the same program. So only one program, which based on an digital input should detect if its should reconfigure to Powerlink master or Powerlink slave. And then they start communication.
How can that be archived in runtime, if possible at all?
My work around is a bit nasty, which would consist of two programs one master and one slave.
Both will be put in the user partition. Both programs check the digital input value and if it true and the slave program is loaded then it will install the master program and the other way around.
since the powerlink interface configuration setting is part of the hardware tree, I think you could realize it with the common functionalities for changing hardware at runtime:
or by using AsIOMMan library functionalities to switch between “hardware trees” stored in the software (in that case, the “hardware trees” are more or less data modules containing the hardware tree XML definitions).
In both cases, after changing the hardware configuration the PLC needs to be rebooted (there’s also a function available for doing that by software in sys_lib called SYSreset()).
basically switching settings of hardware like the operating mode of PLK cannot be done without a reboot of the PLC.
Due to this your solution is probably already quite good as all other solutions would also need a restart of the PLC and therefor not save much time.
Furthermore there is no “easy” way to switch this and you would have to rewrite the ARconfig file (or switch predefined ones with the library AsIOMMan)
A reboot is okay, I will look a bit into the ArConfig exchange with AsIOMMan, to see it that is slighly better than simply installing a complete new program. This is lucklely only happing at the once or twice in the lifetime.
Right click on the CPU in the config view and go to tab “I/O”
You can check the “Generate AR configuration module”
→ this file can directly be used for the AsIOMMan library
This means you create 2 configs with the PLK settings you need and create 2 files
Enter the files in a third config and switch via library to the setting you need
just found again a sample of “how to use AsIoMMan” I did some years ago (Automation Studio 4.7, but I think nothing has changed since then), including documentation as word document (unfortunately in german only).
I’ll upload it here, maybe it supports you when testing the feature.