Hello, I have a IEC61850 device and i try to operate comands.
First i did a try in script console the fuction system.iec61850.getControlParams("rele")
and i have this error
then i do another try with system.opc.browse(opcServer=server, device="PPC")
nad have the same problem.
Is only available in gateway sessions according to the manual: system.iec61850.getControlParams | Ignition User Manual
So you will have to do a gateway message to the gateway and execute your code there.
For system.opc.browse, you will need to post all your code and then the error message it generates.
Doesn't have the server variable defined.
The documentation doesn't show the example running in the designer script console. It is a gateway-scoped function. Run it from gateway scope. (Gateway message handler is an option, or a project library function called from a message handler.)
If you have my Integration Toolkit, you can also annotate a project library function with my @system.util.runInGateway
decorator, after which you can call that from the designer.
oh ok, I thought all the scrips ran in gateway, and yes, you are right, thank you very much
You might have been mislead by a post somewhere talking about all Perspective scripts running on the gateway. Which is still true - if you create a button in a Perspective view and click that button (even in the designer), the actual execution will happen on the gateway.
But the script console is, as Phil mentioned, running entirely locally.
Iām also still having the same error ā..object has no attribute āiec61850ā even though I added the script in Project Library under gateway scope. I added a button in Vision>Main Windows to trigger the script, but I get the error as stated in the prompt window and Output Console log. Am I missing something?
This is wrong. The project library has no scope of its own. It operates in the scope of the caller.
To use gateway scope functions from Vision (or the designer script console, which is Vision scope), you must use a gateway message handler and system.util.sendRequest()
.
(If you install my Integration Toolkit, you may find my @system.util.runInGateway decorator more convenient than messaging.)
Thanks for replying. So I created the script in the gateway message handler and used system.util.sendRequest()
in the Vision > Windows > Main Windows to create a button to call the gateway message handler. See below for my setup.
Button (Vision > Windows > Main Windows):
returnValue = system.util.sendRequest(project='IEC61850', messageHandler='IEC', payload={'hoursOn':15})
print returnValue
messageHandler āIECā (Scripting > Gateway Events)
def handleMessage(payload):
results = system.iec61850.getControlParams("Controller")
print(results)
So, the system function worked since there is no error. It generated a .json with file name starting with āNonResponsiveEdtā¦ā. However, when I open that .json file, i donāt think it is actually showing a list of report control names and their attributes contained in the configured IEC 61850 device. The .json is just showing lots of stacktrace with unknown sourceā¦.
Anyway, I came across another issue with the select & operate function. When I put the script below in the gateway message handler,
def handleMessage(payload):
mapParams = {'name': u'ControllerLD1/SCGGIO1/SetCB1.Oper.CtlVal', 'T':1, 'orCat': 0, 'orIdent': u'not-supported', 'Check': 0, 'Test': False}
system.iec61850.select("Controller", mapParams, 1)
I get this error:
caused by org.python.core.PyException
Traceback (most recent call last):
File "<MessageHandlerScript:IEC61850/IEC >", line 3, in handleMessage
java.lang.Exception: java.lang.Exception: control not found: ControllerLD1/SCGGIO1/SetCB1.Oper.CtlVal
caused by Exception: control not found: ControllerLD1/SCGGIO1/SetCB1.Oper.CtlVal
I tried adjusting the data attribute portion but I still get error in which the script is not finding the logical device. Could you point to what Iām doing wrong?
Please ignore the issue with select/operate. I found out āControllerLD1/SCGGIO1/SetCB1.Oper.CtlVal' should just be āControllerLD1/SCGGIO1.SetCB1ā. The command will know which data attribute to trigger in the IED device without having to specify āOperā and āCtlValā.
However, I still need help why getControlParams is not properly generating a list of report in the .json file.
You're not returning anything. You're just printing the output.
You need to return results
if you want system.util.sendRequest
to do anything.
Thank you very much! You and @pturmel have been very helpful and provided very speedy responses to my questions.