Communication Between 2 Opto Controllers

I am working on a project with 2 controllers on the same network, each running separate strategies. Each controller will need to read variables from the other’s strategy.

I have been reading some Opto manuals, but I am confused about which method is easier to use, memory map, or scratch pad.

It seems to me that to use scratch pad, each controller would need to write and read variables. However, if the variables already are in the memory map, then why write them to the scratch pad at all? Each controller would only have to read variables from the other’s memory map.

I am using the R1 controller, and S1 controller, is it possible for each to read variables which exist on the other’s memory map? If so, where do I find the syntax?

If there is an even easier way to do this, please inform me.

Thanks in advance
-Geoff

The scratchpad is part of the memory map. The advantage of the scratchpad over the memory map is that there are built in commands to read and write to them so you don’t need to know the memory map addresses and use the memory map commands (you still could if you wanted).

Unfortunately, strategy variables are not in the memory map, so a different controller can not read these directly (other than through the new REST API). If you are running 9.5 firmware and software, you probably want to look into the REST API for sure. If you are not using 9.5, then keep on reading.

The typical scenario is to have a chart on one of the controllers write the variables to the scratchpad that the other controller needs access to and have the other controller read them. You could use the scratchpad on either controller, it doesn’t really matter - just pick a convention and stick to it. I personally put the variables in the scratchpad of the controller that needs to be read from. If I was needed two-way communication, then I would use both scratchpads. Just be sure to document which scratchpad indexes are in use somewhere - I like to put a comment in my power up chart.

This would be a good post to read: Your better Peer-to-Peer for PAC - #11 by philip

RESTful Is a good way.

Z, I read some of the restful literature on the website. I like that the strategy variable names can be used in the syntax, but, it seems like a web browser is required to communicate with the PAC. I am not sure how one PAC would access a browser to query the other PAC.

I’ll probably end up using the scratchpad for this project, but I’m interested in learning more about the Restful api for other purposes.

We certainly didn’t mean to give you the impression a browser was required. Please let us know what you read that made you think so.

The example Philip linked to has subroutines where you can ask for a tag by name, as you mentioned. Those subs use the PAC Control communication commands like HttpGet and HttpPost to read and write via the other PAC’s REST API directly – no browser required!

I was reading the Rest ful API developers guide on the website. Can you point me to a document where I can read about the syntax and commands I can use between 2 pacs?

Thanks

I use this scratchpad method A LOT that Philip described, documenting which controller is sending what to who, (I often draw visual diagrams) helps to keep things straight. But then again I move a few hundred variables at a time, so it may not be a huge deal for a couple variables.

The example itself was meant to document the syntax commands for peer-to-peer. Did you have a peek at that?