10/29/2021
Dear OpcUa,
i'm new in opcua. I need to access for writing and reading to the nodes values from the server side (so that any client who has the session active will be updated too).
How should I do it?
I have added 3 nodes in the object Line --> Machine that are Proximity (only Value of the type double), Temperature (only Value of the type double) and Conveyor (one value of the type double and 2 calls) and I want to access to them. The calls seems to work.
I'm working in .NET environment, language C#
I found something in the Forum:
Updating Server Object Property values | OPC UA Implementation: Stacks, Tools, and Samples | Forum
but from the code I use it seems it doesn't work
BaseVariableState bvs = (BaseVariableState)Server.DiagnosticsNodeManager.FindPredefinedNode(VariableIds.Server_ServiceLevel, typeof(BaseVariableState));
bvs.Value = 200;
I found that calling should be (so that the compiler works):
ExpandedNodeId ExpNId = OPCUAServer.VariableIds.OPCUAServer1_Machine_Proximity_Value;
NamespaceTable Nm = new NamespaceTable();
NodeId NId = ExpandedNodeId.ToNodeId(ExpNId,Nm);
if (NId != null)
{
BaseVariableState I = (BaseVariableState)m_Server.CurrentInstance.DiagnosticsNodeManager.FindPredefinedNode(NId,typeof(BaseVariableState));
I.Value = 200;
}
But I still have a problem.. NId is Null. I think I should initialize NamespaceTable with something... What?
This is because OPCUAServer1_Machine_Proximity_Value has been taken from OPCUAServer.Classes.cs.
Is there the possibility to take the NodeId from the string of the NodeId Name (in this case it should be "ns=2;i=90")?
Why?
Thanks,
Cristian
1 Guest(s)