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 live mapping
- miron
- Topic Author
- Visitor
I attached two files:
==========================================
1. Is KepSerwer project. You you could ope and load this project (I changed extension to txt)
2. csv file with list of tags.
In this case you need create memory channel: "common2OpcModel"
and driver: "msarna"
and import tags.
Please Log in or Create an account to join the conversation.
Thank you
Please Log in or Create an account to join the conversation.
- miron
- Topic Author
- Visitor
I have attached linqpad file with test.
In OPC this tag is defined as dword.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- miron
- Topic Author
- Visitor
td.LoadZonePosition.RwTestData.Value = 9001;
mp.WriteTarget(td.LoadZonePosition.RwTestData,true);
Thread.Sleep(1000);
td.LoadZonePosition.RwTestData.Value = 0;
mp.ReadTarget(td.LoadZonePosition.RwTestData,true);
Writing is working but Reading by using mapping is not working.
Could you help me?
Please Log in or Create an account to join the conversation.
- miron
- Topic Author
- Visitor
It looks that read write is working and
also subscribing by EasyDAClient but live mapping is not working.
I have provided example and logs.
I have tested for two KepSerwer drivers:
1. Memory Driver (it works normal - without problems with crating own copy of data for each group with update rating)
2. TCP Simens (with connection with PLC)
=========================
log
=========================
In log you could see: "[Mapped thread] LoadZonePositio : 0 " value is not replicated
but normal subscription is working:
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 2 {System.Int64} @2015-03-04 11:36:39; Good
And it looks that mapping was done:
1: [Mapped thread] NodeDescriptor.BrowsePath=/common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition
(from NodeDescriptor)
2: [Mapped thread] Exception=null
=====================
[TestReadWrite] Test for: /common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition, isolated: True, value: 0
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 24 {System.Int64} @2015-03-04 11:36:33; Good GoodNonspecific LimitOk (192)
[Mapped thread] NodeDescriptor.BrowsePath=/common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition
*************************************************
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 0 {System.Int64} @2015-03-04 11:36:34; Good GoodNonspecific LimitOk (192)
[TestReadWrite] ValueAfterRead=0 {System.Int64} @2015-03-04 11:36:35; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[TestReadWrite] Test for: /common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition, isolated: True, value: 1
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 1 {System.Int64} @2015-03-04 11:36:36; Good GoodNonspecific LimitOk (192)
[TestReadWrite] ValueAfterRead=1 {System.Int64} @2015-03-04 11:36:37; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[TestReadWrite] Test for: /common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition, isolated: True, value: 2
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 2 {System.Int64} @2015-03-04 11:36:39; Good GoodNonspecific LimitOk (192)
[TestReadWrite] ValueAfterRead=2 {System.Int64} @2015-03-04 11:36:39; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[TestReadWrite] Test for: /common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition, isolated: True, value: 3
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 3 {System.Int64} @2015-03-04 11:36:41; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[TestReadWrite] ValueAfterRead=3 {System.Int64} @2015-03-04 11:36:41; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[TestReadWrite] Test for: /common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition, isolated: True, value: 4
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 4 {System.Int64} @2015-03-04 11:36:43; Good GoodNonspecific LimitOk (192)
[TestReadWrite] ValueAfterRead=4 {System.Int64} @2015-03-04 11:36:44; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[TestReadWrite] Test for: /common2OpcModel/msarna/L1/Z1/ZonesCtx/LoadZonePosition, isolated: True, value: 5
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
[Subscribed event] LoadZonePositio : {Isolated=False}[12585986] 5 {System.Int64} @2015-03-04 11:36:45; Good GoodNonspecific LimitOk (192)
[TestReadWrite] ValueAfterRead=5 {System.Int64} @2015-03-04 11:36:46; Good GoodNonspecific LimitOk (192)
[Mapped thread] LoadZonePositio : 0
[Mapped thread] Exception=null
==========================
code
==========================
void Main()
{
var root = "/common2OpcModel";
TestData td = new TestData();
var mp = new DAClientMapper();
var d = new DAMappingContext()
{
ServerDescriptor = Test.cServer, // local OPC server
NodeDescriptor = new DANodeDescriptor { BrowsePath = root + "/msarna/L1/Z1/ZonesCtx"},
GroupParameters = 300,
};
mp.Map(td, d);
mp.Client.SubscribeItem(Test.cServer,
new DAItemDescriptor() { BrowsePath= root + "/msarna/L1/Z1/ZonesCtx/LoadZonePosition"},
300,(e1,e2)=>
{
Console.WriteLine("[Subscribed event] LoadZonePositio : " + e1.ToString() + e2.ToString());
},null);
mp.Subscribe(true);
uint val = 0;
var t1 = new Thread(()=>{
while(true)
{
Test.TestReadWrite(root +"/msarna/L1/Z1/ZonesCtx", "LoadZonePosition", val, true);
// or writing by rw mapping
//td.LoadZonePosition.RwTestData.Value = val;
//mp.WriteTarget(td.LoadZonePosition.RwTestData,false);
Thread.Sleep(1500);
val++;
if(val >40)
{
val =0;
}
}
});
var t2 = new Thread(()=>
{
Thread.Sleep(1000);
Console.WriteLine("[Mapped thread] NodeDescriptor.BrowsePath=" + td.LoadZonePosition.CvTestData.NodeDescriptor.BrowsePath.ToString() );
Console.WriteLine("*************************************************");
while(true)
{
Console.WriteLine("[Mapped thread] LoadZonePositio : " + td.LoadZonePosition.CvTestData.Value );
if (td.LoadZonePosition.CvTestData.Exception != null)
{
Console.WriteLine("[Mapped thread] Exception=" + td.LoadZonePosition.CvTestData.Exception.Message);
}
else
{
Console.WriteLine("[Mapped thread] Exception=null");
}
Thread.Sleep(1500);
}
});
t1.Start();
t2.Start();
t1.Join();
t2.Join();
}
[DAType]
public class TestData
{
public TestData()
{
LoadZonePosition = new CvRwBoxTestData();
}
[DANode()]
public CvRwBoxTestData LoadZonePosition {get;set;}
}
[DAType]
public class CvRwBoxTestData
{
public CvRwBoxTestData()
{
//I have commented RW value mapping
//RwTestData = new RwTestData();
CvTestData = new CvTestData();
}
// [DANode(BrowsePath = "")]
// public RwTestData RwTestData {get;set;}
[DANode(BrowsePath = "")]
public CvTestData CvTestData {get;set;}
}
/*
[DAType]
public class RwTestData
{
[DANode(BrowsePath = "")]
[DAItem(Operations = DAItemMappingOperations.Subscribe)]
[DARead(DataSource = DADataSource.Device)]
public uint Value {get;set;}
[DANode(BrowsePath = "")]
[DAItem(Kind = DAItemMappingKind.Exception,
Operations=DAItemMappingOperations.ReadAndSubscribe)]
[DARead(DataSource = DADataSource.Device)]
public Exception Exception {get;set;}
[MetaMember("NodeDescriptor")]
public NodeDescriptor NodeDescriptor { get; set; }
}*/
[DAType]
public class CvTestData
{
[DANode(BrowsePath = "")]
[DAItem(Operations = DAItemMappingOperations.ReadAndWrite)]
public uint Value {get;set;}
[DANode(BrowsePath = "")]
[DAItem(Kind = DAItemMappingKind.Exception, Operations=DAItemMappingOperations.ReadAndWrite)]
public Exception Exception {get;set;}
[MetaMember("NodeDescriptor")]
public NodeDescriptor NodeDescriptor { get; set; }
}
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("[TestReadWrite] Test for: " + path + ", isolated: " + isolated.ToString() + ", 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("[TestReadWrite] ValueAfterRead=" + valB.ToString());
}
}
Please Log in or Create an account to join the conversation.