InformationModel.RemoteRead(variables, timeoutMilliseconds)
Returns a list of variables of interest.
static IEnumerable<RemoteVariableValue> RemoteRead(IEnumerable<RemoteVariable>variables, doubletimeoutMilliseconds);
Arguments
- variables(IEnumerable<RemoteVariable>)
- The list of the variables of interest.
- timeoutMilliseconds(double)
- The timeout period, expressed in milliseconds, after which the API throws an exception.TIP: If not specified, the default value of the argument is30000(30 seconds).
Returns
- IEnumerable<RemoteVariableValue>
- The list of variables of interest, expressed as a pair of the following properties of theRemoteVariableValueclass:
- Variable(IUAVariable)
- The variable.
- Value(UAValue)
- The value of the variable.
Example
In the following example, the values of three tag variables are read. The variables of interest are included and searched with the
Get()
method in the remoteVariables
list, which is passed as the argument of the RemoteRead()
method. The read values are then displayed using three different text boxes.
var tag1 = Project.Current.Get<Tag>("CommDrivers/CodesysDriver1/CodesysStation1/Tags/Application/PLC_PRG/VAR1"); var tag2 = Project.Current.Get<Tag>("CommDrivers/CodesysDriver2/CodesysStation1/Tags/Application/PLC_PRG/VAR1"); var tag3 = Project.Current.Get<Tag>("CommDrivers/CodesysDriver3/CodesysStation1/Tags/Application/PLC_PRG/VAR1"); var remoteVariables = new List<RemoteVariable>() { new RemoteVariable(tag1), new RemoteVariable(tag2), new RemoteVariable(tag3), }; var values = InformationModel.RemoteRead(remoteVariables).ToList(); textbox1.Text = values[0].Value; textbox2.Text = values[1].Value; textbox3.Text = values[2].Value;
Provide Feedback