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.

Problem with reading and writing

More
04 Mar 2015 09:45 #2898 by support
I think that the most likely reason for this is the use of the Kepware simulation. It does not work the way most people think. For explanation, please see following articles - there is even a chapter named "Why Can't Two Clients See the Same Data":

- Technical Note: Simulation Mode

- When Simulate Device is enabled in TOP Server, both clients must have the same update rate in order for a value written by one client to be read by another.

(TOP Server is basically just a differently branded Kepware server).

If you connect with your other clients, they will use a constant update rate the whole time, and will actually tend to use the same default (100 ms or 1000 ms, typically) across them. That's why they will view the correct values. But it's not the case with QuickOPC, especially if you are not using subscriptions, and just Reads. What happens is that QuickOPC creates an internal subscription with some update rate, and then changes the rate over time to match the rate of incoming Reads. This means that, if the Kepware simulation works as described in the articles, the written value can get/will be lost.

In my view the Kepware approach is broken, because essentially it implies that any specific "tag" (OPC item) does not refere to ONE piece of data, but potentially to different pieces of data, and in addition in a quite unpredictable manner.

Your best choice is then to stay away from these kind of simulation "feature".

You might be able to configure QuickOPC so that it always uses certain update rate and does not change (or that it uses a "Infinite" update rate, for Inactive OPC Group). This is described in the article below:

Disabling automatic subscriptions made with OPC Reads

At the bottom of the article, I have added an explanation on doing the same thing with Live Mapping; but for your initial tests of this, I suggest that you stay away from Live Mapping, because it only complicates matters further.

Best regards

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
04 Mar 2015 09:16 #2896 by miron
Replied by miron on topic Problem with reading and writing
I found information in Kepserwer documentation:

==============================================================================

In Simulation mode, the item's memory map is based on client update rate(s)(Group Update Rate
for OPC clients or Scan Rate for native and DDE interfaces). This means that two clients that reference the same item with different update rates return different data.

==============================================================================

How I could set update rate in EasyOpcClient for read and write operation?

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
04 Mar 2015 09:00 #2895 by miron
Replied by miron on topic Problem with reading and writing
I have found probably reason.
Documentation from Kepserwer says:

==================================================
Note: In Simulation mode, the item's memory map is based on client update rate(s)(Group Update Rate
for OPC clients or Scan Rate for native and DDE interfaces). This means that two clients that reference the same item with different update rates return different data.
==================================================

How I could set in EasyOpcClient update rates, that two instances of EasyDAClient
could have the same update rates?
By mean two instances I mean with Isolated = true or working in separate process.

I know that is possible to set DAGroupParameters during subscribing.
But how I could set group parameters for group tags for reading and reading?
I aware that EasyOpcClient internal manage groups.

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
03 Mar 2015 22:05 - 03 Mar 2015 22:08 #2893 by miron
Replied by miron on topic Problem with reading and writing
for boolean value QuickOPC has small different behavior:

Test for: /common2OpcModelS7/msarna/L1/CRS/RC01/CellAct/Hold
isolated: False
value: True
ValueAfterRead=False {System.Boolean} @2015-03-03 21:56:22; Good GoodNonspecific LimitOk (192)
Test for: /common2OpcModelS7/msarna/L1/CRS/RC01/CellAct/Hold
isolated: True
value: True
ValueAfterRead=False {System.Boolean} @2015-03-03 21:56:23; Good GoodNonspecific LimitOk (192)

1. It is no matter for isolated instance. But API should be consist. Why for dword (unit) API has different behavior.
2. Result the same: there is no result in quick opc but I could change value in different instances of opc clients from different vendors.
Last edit: 03 Mar 2015 22:08 by miron.

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
03 Mar 2015 21:43 - 03 Mar 2015 22:07 #2892 by miron
Replied by miron on topic Problem with reading and writing
Let's concentrate on one case. writing to TCP for Simens

In picture you could see two connection to Kepware OPC Serwer
from two differenct OPC Client.
(It is driver TCP for Simens)

When I change value in one I could see change in second.

But when I execute code to write this value in Quick OPC
I could not see changes.
I executed test in both cases: for isolated=false and isolated=true


Results was:

Test for: /common2OpcModelS7/msarna/L1/Z1/ZonesCtx/LoadZonePosition
isolated: False
value: 100
ValueAfterRead=100 {System.Int64} @2015-03-03 21:31:49; Good GoodNonspecific LimitOk (192)
Test for: /common2OpcModelS7/msarna/L1/Z1/ZonesCtx/LoadZonePosition
isolated: True
value: 100
ValueAfterRead=0 {System.Int64} @2015-03-03 21:31:50; Good GoodNonspecific LimitOk (192)


This two tests did not modify value in opc server.
Isolated = false looks like read from cache because value in opc server had different value.
Was not set.

Main question:
Why it works for two different OPC client (instances and vendor) but not for QuickOPC?


My test:
 
void Main()
{
 
  Test.TestReadWrite("/common2OpcModelS7/msarna/L1/Z1/ZonesCtx", "LoadZonePosition", (uint)100,false);
  Test.TestReadWrite("/common2OpcModelS7/msarna/L1/Z1/ZonesCtx", "LoadZonePosition", (uint)100,true);   
}
 
class Test
{
   public const string cServer = "Kepware.KEPServerEX.V5";
    public static void TestReadWrite(string rootPath, string valName, object value, bool isolated)
  {
 
     string path = rootPath + "/" + valName;
	 Console.WriteLine("--------------------------------------------------------------------------");
	 Console.WriteLine("Test for: " + path);
	 Console.WriteLine("isolated: " + isolated.ToString());
	 Console.WriteLine("value: " + value.ToString());
 
 
	 EasyDAClient c1 = new EasyDAClient();	 
	 EasyDAClient c2 = new EasyDAClient();
 
	 c1.Isolated = isolated;
	 c2.Isolated = isolated;	 	
 
    c1.WriteItemValue(new ServerDescriptor (){ ServerClass = cServer}, 
	  	              new DAItemDescriptor() { BrowsePath= path},value);		                  
 
	Thread.Sleep(1000);
 
	var ds = new DAItemDescriptor() { BrowsePath= path};
	if (value is bool)
		ds.RequestedDataType = VarType.Bool;
 
	var valB = c2.ReadItem(
		new ServerDescriptor (){ ServerClass = cServer}, 
		ds ,
		new DAReadParameters(){ DataSource= DADataSource.Device, }
	);	
 
 
 
	Console.WriteLine("ValueAfterRead=" + valB.ToString());	
 
 }
}
 
Attachments:
Last edit: 03 Mar 2015 22:07 by miron.

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
03 Mar 2015 20:01 #2891 by miron
Replied by miron on topic Problem with reading and writing
but, as I wrote.
In the same time I was using several instances of OPC Client.
When I made change in one client I could see it in another.

I have used client provided by KepSerwer and Matrikon.
When use QuickOPC.NET Debug I could set in one case value (as I wrote).

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

More
03 Mar 2015 19:53 #2890 by support
If you are using the Kepware simulation driver/features, the values it keeps (for writing) may be separate for each OPC client - i.e. also for each EasyDAClient that has Isolated = true, and also because it may disconnects and then reconnect and thus event the same EasyDAClient may appear as a new client to the server. Not sure if this is the case, but I have encountered it once with Kepware, and you need to ask them. And possibly test the same things with a different server.

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
03 Mar 2015 15:54 #2884 by miron
Replied by miron on topic Problem with reading and writing
I don't know. I am tied.
No I have used memory driver.
Two OPC Clients works ok.
Quikc OPC.NET read and write ok.

But now I could not read correctly value:


void Main()
{
Test.Test2();
}

class Test
{

public static void Test2()
{
EasyDAClient c1 = new EasyDAClient();
EasyDAClient c2 = new EasyDAClient();

c1.Isolated = true;
c2.Isolated = true;

c1.WriteItemValue(new ServerDescriptor (){ ServerClass = "Kepware.KEPServerEX.V5"},
new DAItemDescriptor() { BrowsePath= "/common2Opc/msarna/L1/Z1/ZonesCtx/IsJigScanned"},true);

Thread.Sleep(1000);
var valB = c2.ReadItem(
new ServerDescriptor (){ ServerClass = "Kepware.KEPServerEX.V5"},
new DAItemDescriptor() { BrowsePath= "/common2OpcModel/msarna/L1/Z1/ZonesCtx/IsJigScanned"} ,
new DAReadParameters(){ DataSource= DADataSource.Device }
);



Console.WriteLine("valB=" + valB.ToString());
}
}


Result is:

valB=False {System.Boolean} @2015-03-03 15:46:18; Good GoodNonspecific LimitOk (192)

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
03 Mar 2015 15:15 - 03 Mar 2015 15:27 #2883 by miron
Replied by miron on topic Problem with reading and writing
I have used EasyOPC.Net Demo.
1. Reading is working
2. Subscription is working
3. Writing is not working

I have used two clients:
1. Quick OPC - From Kepserwer
2. MatrikonOPC

Both could write value.
Last edit: 03 Mar 2015 15:27 by miron.

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

  • miron
  • Topic Author
  • Visitor
  • Visitor
03 Mar 2015 15:02 #2882 by miron
Replied by miron on topic Problem with reading and writing
Ok. I have tested few cases.

1. Reading is work. I have set manualy valu in OPCClient and I could read.
2. I have tested on another driver from KepSerwer (just Simulator) it is working.
3. Writing for QuickOPC is not working.
Writing for Opc Client is working.

Question,
which parameters I should set up in QuickOPC?

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

Moderators: support
Time to create page: 0.079 seconds