My problem is on Schneider OPC DA Client with ReadMultipIetem function, this working fine with other OPC Server, with OPC DA Scheider of my customer return the value but also this error:
Incorrect parameter + The client method called (or event/callback invoked) was 'ReadMultipleItems[2]'
The code is:
void DAServerReadDataSync()
{
List<DAReadItemArguments> rgcItems = new List<DAReadItemArguments>();
foreach (COPCDAServer server in lstDAServer)
{
foreach (COPCDAItem item in server.Items)
rgcItems.Add(new DAReadItemArguments(server.MachineName, server.ServerClass, item.ItemID, item.UpdateRate));
}
if (rgcItems.Count > 0)
{
DAVtqResult[] res = clientDA.ReadMultipleItems(rgcItems.ToArray());
int iIndex = 0;
foreach (COPCDAServer server in lstDAServer)
foreach (COPCDAItem item in server.Items)
{
//Se dato è valido aggiorno il valore del tag, altrimenti indico "FAILURE" e aggiungo un log testo
if (res[iIndex].Succeeded)
{
try
{
item.ItemValueReal = Convert.ToDouble(res[iIndex].Vtq.Value);
}
catch
{
item.ItemValueReal = 0;
}
item.ItemValueString = Convert.ToString(res[iIndex].Vtq.Value);
item.LastUpdatedDateTime = DateTime.Now;
item.ItemQuality = res[iIndex].Vtq.Quality.ToString();
item.UpdateOnDatabase = true;
//Loggo il valore tag solo se il log esteso è abilitato
if ((eventLogs != null) && (extendedLogs))
{
ExtendedLog log = new ExtendedLog();
log.LogText = DateTime.Now.ToString("yyyyMMddHHmmss000") + " TAG: " + item.ItemID + " VALORE: " + item.ItemValueString + " STATO: " + item.ItemQuality;
eventLogs(this, log);
}
}
else
{
//item.ItemValueReal = 0.0;
//item.ItemValueString = "FAILURE " + e.Arguments.ItemDescriptor.ItemId + " " + e.ErrorMessageBrief;
item.ItemQuality = "FAILURE";
item.UpdateOnDatabase = true;
if (eventLogs != null)
{
ExtendedLog log = new ExtendedLog();
//log.LogText = DateTime.Now.ToString("yyyyMMddHHmmss000") + " - ERRORE lettura del tag DA " + item.ItemID + " " + item.ItemValueString + " " + res[iIndex].ErrorCode + "" + res[iIndex].ErrorMessage;
log.LogText = DateTime.Now.ToString("yyyyMMddHHmmss000") + " - ERRORE lettura del tag DA " + item.ItemID + " " + item.ItemValueString + " " + res[iIndex].ErrorMessage;
eventLogs(this, log);
}
}
UpdateDAItemOnDatabase(item);//Aggiorna il valore tag nel dataset utente
iIndex++;
}
}
}
The
res[iIndex].Succeeded return False and
res[iIndex].ErrorMessage return the message above.
Can help me.
Thanks.