Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Read ad Write multiple values
Read ad Write multiple values
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
It looks like that we have worked on similar issue in Python before. The results array is weird - but it still can be processed. Please see www.opclabs.com/forum/general-issues-building/2466-quickopc-in-python#6436 , and attempt to extract the results (roughly) like this:
Result1 = win32com.client.Dispatch(val[0][0])
Result2 = win32com.client.Dispatch(val[0][1])
Result3 = win32com.client.Dispatch(val[0][2])
Vtq1 = Result1.Vtq
Vtq2 = Result2.Vtq
Vtq3 = Result3.Vtq
Please Log in or Create an account to join the conversation.
- Jesus Rodriguez
- Topic Author
- Offline
- Junior Member
- Posts: 2
- Thank you received: 0
import win32com.client
ReadItemArguments1 = win32com.client.Dispatch("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments1.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments1.ItemDescriptor.ItemID = "Demo.Single"
ReadItemArguments2 = win32com.client.Dispatch("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments2.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments2.ItemDescriptor.ItemID = "Demo.Single"
arguments = [ReadItemArguments1, ReadItemArguments2]
client = win32com.client.Dispatch('OpcLabs.EasyOpc.DataAccess.EasyDAClient')
results = client.ReadMultipleItemValues(arguments)
There is no error at this point but still I think is not correct since I cannot get the values.
Thank you for your help
Please Log in or Create an account to join the conversation.
I do not have Python example at hand. hopefully you can derive it from code given in other languages. If you run into an issue, let me know here. Here is a VBScript example for ReadMultipleItemValues:
Rem This example shows how to read values of 4 items at once, and display them.
Option Explicit
Dim ReadItemArguments1: Set ReadItemArguments1 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments1.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments1.ItemDescriptor.ItemID = "Simulation.Random"
Dim ReadItemArguments2: Set ReadItemArguments2 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments2.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments2.ItemDescriptor.ItemID = "Trends.Ramp (1 min)"
Dim ReadItemArguments3: Set ReadItemArguments3 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments3.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments3.ItemDescriptor.ItemID = "Trends.Sine (1 min)"
Dim ReadItemArguments4: Set ReadItemArguments4 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAReadItemArguments")
ReadItemArguments4.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
ReadItemArguments4.ItemDescriptor.ItemID = "Simulation.Register_I4"
Dim arguments(3)
Set arguments(0) = ReadItemArguments1
Set arguments(1) = ReadItemArguments2
Set arguments(2) = ReadItemArguments3
Set arguments(3) = ReadItemArguments4
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
Dim results: results = Client.ReadMultipleItemValues(arguments)
Dim i: For i = LBound(results) To UBound(results)
WScript.Echo "results(" & i & ").Value: " & results(i).Value
Next
Best regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Jesus Rodriguez
- Topic Author
- Offline
- Junior Member
- Posts: 2
- Thank you received: 0
I have the following code to read and write:
import win32com.client
client = win32com.client.Dispatch('OpcLabs.EasyOpc.DataAccess.EasyDAClient')
value = client.ReadItemValue('', 'CoDeSys.OPC.02', '.Inputs[9]')
client.WriteItemValue('', 'CoDeSys.OPC.02', '.Inputs[9]', 7)
They work well but I would like to know how to read and write multiple values in just one function. Is there any function already doing this?
Thank you.
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Read ad Write multiple values