Reposting the answer to the question I received via email:
Hi Roger,
Here are some answers to your questions:
- Given a fixed amount of data per item (assume most are 4-byte tags), is there a way to calculate how much "bandwidth" is consumed for each tag, given its communication settings (sync/async, read/write time interval, etc.)?
No. This is typically not material either; the processing time is related to the server needing to manage large amounts of data, how it manages that data (one group is slower than many groups) and networking bandwidth is typically sufficient all but massive data transfers.
- Why does increasing the model solver step time improve the OPC pseudo real-time performance? I would have assumed that evaluating the model and sending/receiving data through DCOM are mutually exclusive.
OPC reads and writes happen in MATLAB, so they block the simulation even in instances where asynchronous read/write operations move the data from the server to the OPC Toolbox client. Increasing the model solver step time simply gives the OPC Toolbox blocks more time to fetch the data from the local OPC client and translate that to Simulink data.
- Why does navigating the model subsystems (clicking in and out of them) negatively impact pseudo real-time performance? I assume the reason is similar to why Scope blocks negatively impact model performance more broadly.
OPC blocks execute in MATLAB. Navigating still blocks the MATLAB execution thread, just like Scope blocks do.
- Per the second article: How does the guidance on multiple groups apply to Simulink? By "group", does that mean number of items configured inside an OPC Read or OPC Write block? If so, the article mentions having 100 items per group versus 1000. Is there any recommendation for the maximum number of items in a group?
Each OPC Read or OPC Write block is a separate group. So yes, to the second question in this bullet. There is no general guidance for the number of items per group. It is too dependent on the rest of the simulation to provide any form of guidance except that one OPC Read for 100 items is less efficient than breaking that into multiple groups with fewer items.
- Are the resources available for the OPC Toolbox fixed, or may they be expanded through running of additional services, multithreading, etc?
Since OPC client operates through the MATLAB single thread, the only way to extend this is to split the simulation across multiple MATLAB sessions.
- Not particularly about sizing, but is it possible to programatically enter the OPC shortcut for each Item ID in an OPC Read/Write block as opposed to manual entry?
Yes, you can use
>> set_param(blockPath, ‘itemIDs’, csvListOfItems)
Where csvListOfItems is a comma-separated list of ItemIDs. Here’s an example showing how to set two items for the OPC Read block of the OPCBlksTutorial model from the examples:
>> set_param("OPCBlksTutorial/OPC Read","itemIDs","Bucket Brigade.Real8, Random.Real4")
Best Answer