Professional OPC
Development Tools

logos

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.

Server Auto Tag Creation Doesn't Work with QuickOPC

More
04 Mar 2018 08:37 #6101 by support
Yes, this is the right way

Best regards

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

More
03 Mar 2018 23:57 #6100 by jgyenese
It is our own OPC server for our SCADA application. It is built using SlikDA5 and is very simple - it is used primarily for inter-application sharing of data, not for reading from any field devices. That's why we wanted to add tags dynamically.

I was able to get it working after reviewing your code. The only problem was I am using VB6 which doesn't support initializers, so I had to set the value directly. However, I could not set the requested data type this way:
Dim arg as DAItemValueArguments
arg.ItemDescriptor.RequestedDataType = VarTypes.VarTypes_R8

I had to go down an another step like this:
Dim arg as DAItemValueArguments
arg.ItemDescriptor.RequestedDataType.InternalValue = VarTypes.VarTypes_R8

It does work. Is this the proper way to do this?

Thank you.

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

More
02 Mar 2018 13:00 #6098 by support
Hello,
this should be possible.

For single item write:
// This example shows how to write a value into a single item, specifying its requested data type.
 
using OpcLabs.BaseLib.ComInterop;
using OpcLabs.EasyOpc.DataAccess;
 
namespace DocExamples
{
    namespace _EasyDAClient
    {
        partial class WriteItemValue
        {
            public static void RequestedDataType()
            {
                var client = new EasyDAClient();
 
                client.WriteItemValue("", "OPCLabs.KitServer.2", "Simulation.Register_I4", 12345,
                    VarTypes.I4);   // <-- the requested data type
            }
        }
    }
}

For multiple-items write:
// Shows how to write into multiple OPC items using a single method call, specifying their requested data types.
 
using System;
using System.Diagnostics;
using OpcLabs.BaseLib.ComInterop;
using OpcLabs.BaseLib.OperationModel;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.OperationModel;
 
namespace DocExamples
{
    namespace _EasyDAClient
    {
        partial class WriteMultipleItemValues
        {
            public static void RequestedDataType()
            {
                var client = new EasyDAClient();
 
                Console.WriteLine("Writing multiple item values...");
                OperationResult[] resultArray = client.WriteMultipleItemValues(new[] { 
                    new DAItemValueArguments("", "OPCLabs.KitServer.2", "Simulation.Register_I2", 12345) 
                        { ItemDescriptor = { RequestedDataType = VarTypes.I2}}, // <-- the requested data type
                    new DAItemValueArguments("", "OPCLabs.KitServer.2", "Simulation.Register_R4", 234.56)
                        { ItemDescriptor = { RequestedDataType = VarTypes.R4}}  // <-- the requested data type 
                });
 
 
                for (int i = 0; i < resultArray.Length; i++)
                {
                    Debug.Assert(resultArray[i] != null);
                    if (resultArray[i].Succeeded)
                        Console.WriteLine("Result {0}: success", i);
                    else
                    {
                        Debug.Assert(resultArray[i].Exception != null);
                        Console.WriteLine("Result {0}: {1}", i, resultArray[i].Exception.GetBaseException().Message);
                    }
                }
 
                Console.WriteLine("Reading multiple item values...");
                ValueResult[] valueResultArray = client.ReadMultipleItemValues("OPCLabs.KitServer.2",
                    new DAItemDescriptor[] { "Simulation.Register_I2", "Simulation.Register_R4" });
 
                for (int i = 0; i < valueResultArray.Length; i++)
                {
                    Debug.Assert(valueResultArray[i] != null);
                    Console.WriteLine("valueResultArray[{0}]: {1}", i, valueResultArray[i]);
                }
            }
        }
    }
}

Which OPC server are you using please?

Best regards

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

More
01 Mar 2018 23:56 #6095 by jgyenese
I have an OPC server that will automatically create new tags if the client requests it in one of two ways:
1. By calling the server Tag Validation method.
2. By calling the server Add Tag method.

I send an array of values to the server using DAClient.WriteMultipleItemValues. According to the server logs, QuickOPC is indeed calling the Add Tag method, but it doesn't include a requested Data Type. The server then creates a tag using a default type which is a long integer. But I need to send more than just integers.

Is there some way I can tell QuickOPC to send Data Type information to the server? Or can I make some other call to accomplish this goal?

Thank you.

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

Moderators: support
Time to create page: 0.052 seconds