Groov PR1 running strategy for R-1

I am looking for help on the best way to manage a program with a stand alone controller (Groov PR1 with 0 chassis) connected to a R-1 snap rack with various I/O. I currently have the control engine turned off on the R-1 (Scanner Flags set to 00000008) and the strategy that is controlling the R-1 is loaded on the PR1. My specific questions right now are

  1. Is there a way programmatically to point the strategy to the IP address for the R-1 brain in an Optoscript code block, I will include a pseudo code below of what i was thinking of incorporating in my control system.

GetControlEngineAddress(pr1IpAddress); //This would get me the address for the PR1
if (pr1IpAddress == 172.20.1.100) then //I have multiple control engines on the same network
SetIOUnitsPrimaryIPAddress(172.20.1.101); /Is there a way to point my pr1 to the correct IP address of the R-1 for it to communicate to the correct I/O rack? I ask this because i have 2 control engines running on the same network with the same exact program just different IP addresses./
R1IpAddress = 172.20.1.101;
else if (pr1IpAddress == 172.20.1.110)
SetIOUnitsPrimaryIPAddress(172.20.1.111)
R1IpAddress = 172.20.1.101;

  1. The other question i have is if the pr1 looses communication to the R-1 do i need to include code in my strategy to open communication back up? I will include pseudo code below about what i was think about.

If Not(IsCommunicationOpen(R1IpAddress)) Then
CommStatus = OpenOutgoingCommunication(R1IpAddress);
EndIf

  1. Lastly would anyone be willing to point me to an example strategy that incorporates either an S1, S2 or PR1 as the main device controlling a separate snap pac system? I aplologize for the long post but this is the first project with Opto that I have used a standalone controller running a seperate I/O Rack.

I appreciate any help anyone is willing to provide or any best practices for systems like this.

I’d really like it if you had a moment to take a step back and tell us what problem you are trying to solve/address in the bigger picture…

But that said, lets just jump right in (but I have to be honest and say that I don’t feel I have all the facts).

  1. No need. You put the R1 IP address in the control strategy running on the PR1. Check under I/O units.
  2. Yes. Our support group has a nice chart for this very function. https://www.opto22.com/support/resources-tools/downloads/io_enabler-for-enet-pac-mistic-rs-brains-01
  3. Not sure what sort of strategy you are looking for. A lot of Opto strategies have remote I/O as part of them. You just put each IP address of each rack in the strategy and address the I/O as if it was local (which it is to the strategy).

As I said, I don’t feel I have a solid grasp on your system needs, so feel free to take my answers and turn them into more questions!
We are here to help!

Beno thank for the reply. I ask these questions as i would rather not have multiple strategies for changes only to the ip address for the r-1. I currently have 3 different control strategies and they are the same exact program the only difference between the 3 are the IP address set for the R-1 brain under the I/O units. i was hoping to consolidate into one strategy and just set the IP address based on the IP address of the PR1.

This can probably be done, but it may be time consuming to change depending on how many IO points you are dealing with.

The way I would approach this is to have all three IO units (R1s) setup in your strategy. (You will need to rename all your IO points - that is one part that makes this time consuming.)

You should be able to get the IP address of your PR1 control engine using the GetControlEngineAddress command as you posted. Once that is known, you would then assign the individual IO points of the IO unit you want to use to pointer variables. You would then use these pointers everywhere else in your strategy (another step that could take a while).

1 Like

@philip
Thanks for the help philip after seeing the example code for re-enabling communication to the remote I/O it had me thinking about adding each r-1 to the strategy and just disabling IO points based on the ip address of the pr1. it may take me some time but i will see what i can come up with just needed a little nudge to get me down the right path, hope this makes sense and that i am going down the right path.