06-24-2019 02:47 AM
Hi All,
This might be best explained with an example:
I'm working with the Polynomial Scaling and Modbus modules. I have about 80 Modbus registers and a large proportion of the tags are floating point values which need to be integers in Modbus (multiply by 100 for 2 decimal places). Using the config editor I have to map the tags in the scaling module one at a time, selecting the input tag and output tag, then create a modbus register for each one the Modbus module, all of which is quite a laborious process.
Is there a better way?
Is it feasible to modify the config file outside the Configuration Editor? It would be useful to have a general tool which could import configs from a csv given the specific data structure required for a module. I haven't got deep enough into DCAF to know how to do that and DCAF is also my first real introduction to OOP, so the learning curve is steep.
Thank You!
Mike
06-24-2019 08:23 AM
I've done similar in the past both by generating the text of the PCFG file directly, and by loading an existing one and modifying using the LabVIEW classes. The latter is a better approach, and I found it much easier if you do start from an existing config and modify as creating the basic system, target and engine from scratch took quite a bit of figuring. The starting point is the CEF library in the Addons palette, in particular the "tree serialization" folder. That has the VIs to load a PCFG file from disk and get an array of modules. I then iterate over this and pick out specific IDs to modify using the DCAF classes that can be found in the vi.lib/NI/DCAF folder.
I'm a big subscriber to the unix philosophy of preferring to create a tool to do jobs like this, even if it takes a bit longer the first time. It saved me more time in the long run being able to generate from a spreadsheet as I was then able to generate slaves for use with a simulator when testing from the same spreadsheet, and was able to regenerate the modbus modules when I started using a custom one. In that case, there were about 800 modbus registers though, so it would have been a huge job to do by hand and scripting it saved a considerable amount of time.
06-24-2019 09:57 AM
The latest version of the Modbus Module (2.2.0.34) also supports importing/exporting its tags mappings from a CSV. I think this version is not yet in VIPM (we will release it soon) but you can also find the source in github: https://github.com/LabVIEW-DCAF/ModbusModules