Professional OPC
Development Tools

logos

QuickOPC with TestStand (National Instruments)

More
27 May 2015 16:11 #3170 by support
Well,

in your original post, you wrote "Is it possible to call several python scripts who works all at the same session?". I took it that this is the way you can and want to do it, and as a question whether on our side, we can support that, and explained that the answer is "yes".

When you now say "I don't know how can I pass the instance between the scripts.", I have no answer to it. It depends on the tool that you are using. If this is inside TestStand, then it is outside our expertise.

Best regards

Please Log in or Create an account to join the conversation.

More
27 May 2015 14:35 - 27 May 2015 14:35 #3169 by Icebaer
Hi Support-Team,
can you please give me an example with the option EasyUAClient.Isolated = True? I don't know how can I pass the instance between the scripts.

First Python-Script:
import win32com.client
 
# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.EasyUAClient')
client.Isolated = True
# client.IsolatedParameters.Session.LocaleId = "de"
client.IsolatedParameters.Session.LocaleId = "en"
client.IsolatedParameters.Session.EndpointSelectionPolicy.AllowedMessageSecurityModes = 1 # 1 = SecurityNone
client.IsolatedParameters.Session.UserIdentity.UserNameTokenInfo.UserName = "Anonymous"
client.IsolatedParameters.Session.UserIdentity.UserNameTokenInfo.Password = ""

Second Python-Script:
import win32com.client
 
# Define Node IDs
endpointurl = 'opc.tcp://192.168.1.213:4880/OpcUAServer/None'
nodeid = 'ns=2;s=anynodeid'
 
# SubscribeMonitoredItem
client.SubscribeMonitoredItem(endpointurl, nodeid, 500)

Third Python-Script:
import win32com.client
 
# Define Node IDs
endpointurl = 'opc.tcp://192.168.1.213:4880/OpcUAServer/None'
nodeid = 'ns=2;s=anynodeid'
 
# ReadValue
value = client.ReadValue(endpointurl, nodeid)
 
# Display results
print('ReadValue: ', value)

Last Python-Script:
import win32com.client
 
#UnsubscribeMonitoredItems
client.UnsubscribeAllMonitoredItems()

Thank you, Icebaer
Last edit: 27 May 2015 14:35 by Icebaer.

Please Log in or Create an account to join the conversation.

More
22 May 2015 08:41 #3159 by support
Follow-up to the previous answer:

Ad 1: Verified, both Basic256, Basic128Rsa15 are supported.

Ad 2: If you intend to e.g. set the LocaleId using one script, and then use that LocalId in a second script, then you need to consider the fact that LocaleID is part of session parameters. By default, all instances of EasyUAClient share the same, and they are accessible through *static* property EasyUAClient.AdaptableParameters.Session. I am not sure if you can make use of statiuc properties from your tool. The other options is to set EasyUAClient.Isolated to 'true', in which case the this instance of EasyUAClient will use its own session, and take its parameters from (non-static) EasyUAClient.IsolatedParameters.Session. So if you wanted the setting be re-used between scripts, you would have pass the instance of EasyUAClient around between the scripts. The last option goes back to the non-isolated, static property: It is possible to create an instance of EasyUAConfiguration object, which acts as a non-static proxy to otherwise static settings. Setting the session parameters on the EasyUAConfiguration would then have the same affect as setting the static EasyUAClient.AdaptableParameters (which is not directly accessible to OLE Automation clients, because COM only knows about non-static members).

Best regards

Please Log in or Create an account to join the conversation.

More
19 May 2015 06:13 #3154 by support
Dear Sir,
I ask you for some patience, I am currently out of office and will be back on Friday. Will send you more detailed answers then. Most likely the answers are Yes/Yes, but need some checking and qualification.

Please Log in or Create an account to join the conversation.

More
18 May 2015 08:12 - 18 May 2015 08:13 #3152 by Icebaer
Hi Support-Tean,
I have two additional questions.

1.) Security Policy (Basic256, Basic128Rsa15)

I have read the following topic. Supports QuickOPC Basic256 and Basic128Rsa15?
Link

2.) Python

Is it possible to call several python scripts who works all at the same session? For example I make a script who set the localeID, another one who subscribe the items and so on... Now I could call this single scripts with TestStand.

Thank you, Icebaer
Last edit: 18 May 2015 08:13 by Icebaer.

Please Log in or Create an account to join the conversation.

More
11 May 2015 15:10 #3117 by Icebaer
Hi Support-Team,
I have tried your example and it works with Phyton.

Tomorrow I will test how can I set the Security Policy (Basic256, Basic128Rsa15) and the Publishing Time.

Thank you, Icebaer

Please Log in or Create an account to join the conversation.

More
11 May 2015 04:29 #3107 by support
I have not actually tried it, but it should look like this:
import win32com.client
 
client = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.EasyUAClient') 
 
client.Isolated = true
client.IsolatedParameters.Session.LocaleId = "de-DE"
client.IsolatedParameters.Session.EndpointSelectionPolicy.AllowedMessageSecurityModes = 1    #UAMessageSecurityModes.SecurityNone
 

Best regards
The following user(s) said Thank You: Icebaer

Please Log in or Create an account to join the conversation.

More
07 May 2015 15:05 #3100 by Icebaer
Hi Support-Team,
can you give me an example how I can set the "global" LocaleID and the Security Mode with Phyton.


Thank you, Icebaer

Please Log in or Create an account to join the conversation.

More
06 May 2015 10:54 #3086 by support
Thank you for the .SEQ file and the instructions. I was able to open your project in NI TestStand 2014 and had a quick look around. I think I now understand the nature of your question to AllowedMessageSecurityModes - when you set a property value in TestStand, you need to specify a value using an expression, and you cannot select an enumeration member from the type library here (and even less from a library different from where the object being targeted resides).

I think that in this situation, you can resort to a "quick and dirty" solution, and assign a constant - in the case you mentioned, the value for SecurityNone is 1.

The actual definition of the UAMessageSecurityModes enum in our software looks like this, and you can take additional values from there if you need:
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using OpcLabs.BaseLib.Annotations;
 
namespace OpcLabs.EasyOpc.UA
{
    /// <summary>
    /// Specifies what security should be applied to messages exchanges during a Session.
    /// </summary>
    [CLSCompliant(true)]
    [ComVisible(true)]
    [Description("Specifies what security should be applied to messages exchanges during a Session.")]
    [Designable]
    [Editor("OpcLabs.BaseLib.Design.FlagsEnumEditor, " + BaseLib.AssemblyNames.BaseLibDesign, typeof(UITypeEditor))]
    [Flags]
    [Guid("9E047321-4643-4BA1-8CD8-5CD6F3F3B464")]
    public enum UAMessageSecurityModes
    {
        // Users sometimes confuse None for SecurityNone. We are trying various ways to prevent it from happening.
        /// <summary>
        /// No security mode is specified. DO NOT USE - ENDPOINT SELECTION WILL ALWAYS FAIL. Did you mean <see cref="SecurityNone"/>?
        /// </summary>
        [Browsable(false)]
        [CompilerGenerated]
        [Description("No security mode is specified. DO NOT USE - ENDPOINT SELECTION WILL ALWAYS FAIL. Did you mean SecurityNone?")]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        [Obsolete(
            "This choice disables all message security modes, therefore it is not possible to select any endpoint with it. " +
            "To allow endpoints with no message security, use SecurityNone instead.")]
        None = 0,
 
 
 
        /// <summary>
        /// No security is applied.
        /// </summary>
        [Description("No security is applied.")]
        SecurityNone = 1,
 
        /// <summary>
        /// All messages are signed but not encrypted.
        /// </summary>
        [Description("All messages are signed but not encrypted.")]
        SecuritySign = 2,
 
        /// <summary>
        /// All messages are signed and encrypted.
        /// </summary>
        [Description("All messages are signed and encrypted.")]
        SecuritySignAndEncrypt = 4,
 
 
 
        // Combinations
 
        /// <summary>
        /// Any mode that is secure.
        /// </summary>
        [Description("Any mode that is secure.")]
        Secure = SecuritySign | SecuritySignAndEncrypt,
 
        /// <summary>
        /// All possible security modes, including no security.
        /// </summary>
        [Description("All possible security modes, including no security.")]
        All = SecurityNone | SecuritySign | SecuritySignAndEncrypt,
    }
}
BTW, TestStand 2014 offers me ".NET" as well, besides COM/ActiveX - I have not tried it, but it would be more natural to use - if it works.

Best regards

Please Log in or Create an account to join the conversation.

More
06 May 2015 09:19 #3085 by Icebaer
Hi Support-Team,
at the attachments you can find a short description and my test sequence test.seq. I use TestStand 2012, but you shouldn't get problems with my file.

If you have any questions then please contact me.

Thank you, Icebaer
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.211 seconds

      

 Recommend this on Google