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-UA in COM
- Reading, Writing, Subscriptions
- Send a command to the OPC-UA machine for creation of a new order/job
Send a command to the OPC-UA machine for creation of a new order/job
" ns=2;s=xxxxCoiler.Global_OPCUA.OPC_sRxChat"
What you probably wanted to have is
"ns=2;s=xxxxCoiler.Global_OPCUA.OPC_sRxChat"
Best regards
Please Log in or Create an account to join the conversation.
- albi.majun.1960@gmail.com
- Topic Author
- Offline
- Premium Member
- Posts: 13
- Thank you received: 1
I got a look at other posts and seems to be that to write "string value" has to be changed the code approach, so I wrote the following alternative code belove.
I cannot test it now because the Coiler Machine is down for the weekend
So I have to wait till next monday
Any feedback will be appreciate anyway, thanks
Alberto
Dim endpointDescriptor As String
'********************** ServerOPCUA$ = "opc.tcp://192.168.1.97:4840"
endpointDescriptor = ServerOPCUA$
' Instantiate the client object
Dim Client As New EasyUAClient
' Prepare the arguments
Dim WriteValueArguments1 As New UAWriteValueArguments
WriteValueArguments1.endpointDescriptor.UrlString = endpointDescriptor
'********************** txtChat$ = " ns=2;s=xxxxCoiler.Global_OPCUA.OPC_sRxChat"
WriteValueArguments1.NodeDescriptor.NodeId.expandedText = txtChat$
'********************** valore$= "<CMD>NEWJOB|E456||||3345|"
WriteValueArguments1.Value = valore$
WriteValueArguments1.ValueTypeCode = TypeCode_string
Dim arguments(0) As Variant
Set arguments(0) = WriteValueArguments1
' Modify value of node
Dim results As Variant
results = Client.WriteMultipleValues(arguments)
' Display results
Dim Result As UAWriteResult: Set Result = results(0)
If Not Result.Succeeded Then
cosa$ = "*** Failure #41: " & Result.Exception.GetBaseException().Message
risp = MsgBox(cosa$, vbCritical)
Call WriteLog(routine$, cosa$)
End If
Please Log in or Create an account to join the conversation.
- albi.majun.1960@gmail.com
- Topic Author
- Offline
- Premium Member
- Posts: 13
- Thank you received: 1
as you suggested I used the following instruction to write
ServerOPCUA$ = "opc.tcp://192.168.1.211:4840"
txtChat$ = " ns=2;s=xxxxxCoiler.Global_OPCUA.OPC_sRxChat"
valore$ = "<CMD>NEWJOB|ABC123||||100|"
Call Client.WriteValue(ServerOPCUA$, txtChat$, valore$)
but raise up the following error message
11/12/2020 15.18.27 - *** Failure: OpcLabs.EasyOpcUA: The status of the OPC-UA attribute data is not Good. The actual status is 'BadNodeIdUnknown'.
+ The client method called was 'WriteMultiple'.
If I write the string "CMD>NEWJOB|ABC123||||100|" using a OPC-UA client in the same "node id", that is a string type, it works fine
see attachment "manual_input.jpg"
Where is the mistake ?
Thanks
Alberto
Attachments:
Please Log in or Create an account to join the conversation.
The part that I understand is that the command you want to send to the OPC UA server is a string, and that you have some knowledge about how that string should be formed. That's good.
The next thing you need to know is what you are supposed to do with that string, in order to send the command to the server. Here I can be only of a little help - somebody who is in charge of the server or its configuration must tell you.
One possibility is that the command needs to be written as a value into some node in the server. That would be somewhat similar to your code snippet. You will, however, need to know *which* node to write to. Example: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...rite%20a%20single%20value.html .
Second possibility, more "in line" with OPC UA way of doing things, would be that the command is sent by invoking a UA *method*. You will need to know the node to call the method on, and the method node. Example: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...all%20a%20single%20method.html .
Best regards
Please Log in or Create an account to join the conversation.
- albi.majun.1960@gmail.com
- Topic Author
- Offline
- Premium Member
- Posts: 13
- Thank you received: 1
I have already integrated in an application/service (simple MES) developed in VB6 the customer request like getting in realtime what is runninng and pass all the info needed to the CRM
The new goal is to create a new order/job by sending a command to the OPC-UA machine, just to increase the interaction between CRM and the production
The syntax of the OPC UA command is as follows:
<CMD> NEWJOB | job-code-1 | job-code-2 | coil-code-1 | coil-code-2 | preset-quantity to produce | spring-file-name
On HDMI of machine will appear the new job, the joblist of the jobs ready to be used...etc etc
So i was thinking to start with following:
Dim Client As New EasyUAClient
WriteCMD = Client.WriteValueList("<CMD>NEWJOB|Code1|Code2|bundle1|bundle2|3553|D:\MCxFiles\program_to_be_sent.spr")
Could you please be so kind to suggest me which kind of function I can use available from the object, to fit the goal ?
Below the detailed explanation ot technicality of the CMD
Best regards and thanks for any suggestion
Alberto
AUTOMATIC RECEIPT OF ORDER DATA
The wrapping machine is able to receive, through an appropriately coded OPC-UA message, the data relating to a new next order and to propose it, automatically, to the operator.
The syntax of the OPC UA command is as follows:
<CMD> NEWJOB | job-code-1 | job-code-2 | coil-code-1 | coil-code-2 | preset-quantity to produce | spring-file-name
The order sending command must respect the following syntactic rules:
• the parts in italics must be replaced with the appropriate values, the other strings are prefixed and must be respected.
• The separator character is the vertical bar "|" (ASCII 124).
• job-order-code-1 and job-order-code-2 are made up of any 0 to 16 characters and at least one of the 2 must be non-null, otherwise the message is discarded.
• code-hank-1 and code-hank-2 are made up of any 0 to 16 characters and can be empty.
• preset-quantity to be produced is an integer greater than zero.
• spring-file-name is the full path of the spring file and can be empty.
A queue of orders is not currently managed by the machine, in the case of sending several orders in succession, the last one will overwrite the previous ones. The overwritten orders will be visible as messages and only the last one will be proposed and will be loaded automatically.
Here are some examples of commands for sending order data via OPC UA.
Command string
Note <CMD> NEWJOB | Code1 | Code2 | bundle1 | bundle2 | 3553 | D: \ MCxFiles \ program_to_be_sent.spr All fields are specified
<CMD> NEWJOB | Code1 || bund1 | bund2 | 3553 | D: \ MCxFiles \ program_to_be_sent.spr
Second job code empty <CMD> NEWJOB || Code2 | bund1 | bund2 | 3553 | D: \ MCxFiles \ program_to_be_sent.spr First job code empty
<CMD> NEWJOB | Code1 | Code2 || bund2 | 3553 | D: \ MCxFiles \ program_to_be_sent.spr
First empty skein code <CMD> NEWJOB | Code1 | Code2 ||| 3553 | Hank codes and empty spring files
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in COM
- Reading, Writing, Subscriptions
- Send a command to the OPC-UA machine for creation of a new order/job