I have a driver that requests status information and puts that information in what I hope are OPC Tags.
Now I have to implement method calls to do the various control functions.
I was intending to use the scripting-rpc-examples as a basis for how to define the Java-Python Gateway script integration.
I’m confused how to identify which instance of the driver I wish the method call to be processed in, and I was wondering if somebody could quickly tell me what I’m missing.
Basically, I want to tell the machine to load a program. Then report the success/failure of that load back to the calling gateway script (or SQF chart step)
Then tell the program to start running. Report status of start. When the job has completed I then need to report the results of the job.
Trying to do this all with tags seems a bit convoluted.
What I’d like to do, is have
[code]result = system.edm.load(“c:/dir/program.job”)
if result == GOOD:
result = system.edm.start()
At the moment, the controlling scripts are all gateway scripts, but I am not going to say that will remain the case.
You’re not really missing anything. The RPC and scripting systems aren’t coupled in any way to the drivers. RPC calls don’t run in the context of any device unless you implement them that way. If this were possible, you’d make your scripting function signature something like:
system.edm.doTheThing("devicename", other, params)
which is what we’re doing in Ignition 7.8 for the DNP3-related scripting functions.
Unfortunately there’s no API for enumerating or getting a driver instance by name in the 7.7 OPC-UA module, so I’m not really sure right now what you’d be able to do to get ahold of a driver instance even if you had the name.
So, I am going to have to use OPC Tags to have my script initiate methods?
In order to accomplish that, do I need to attach some kind of scan class to the tags in my driver?
[quote=“BillS”]So, I am going to have to use OPC Tags to have my script initiate methods?
In order to accomplish that, do I need to attach some kind of scan class to the tags in my driver?[/quote]
No, nothing like that. Assuming these methods don’t need any parameters, you would just create some boolean tags at startup using the VariableNodeFactory available from DriverContext, and when a write comes in to that tag and value==true you would invoke whatever method that tag represents. Then set the value to false again when the method is finished.
This is pretty much how old school OPC-DA “methods” are/were done.