12-07-2011 04:44 PM
At my work we have an API that uses a fairly large table(2-20kB typically) to lookup control values. Right now this is saved as default on both the Read and the Write subvis. These are usually run long term and unchanged as an executable, the idea was one less file to worry about and one less wire to run in the .exe distribution. The table won't change once the project is running but is different for each one. The Read and Write VIs are called rapidly around 10-100 times in a row then wait for the next round. We would be willing to trade some inefficiency if it reduces downtime due to the file being changed on the user end.
My problem is the table needs to be saved in two different locations, which I think is asking for trouble. I've already run into delays because they were different. The two ideas I came up with were:
1. Have the table on the top level VI FP saved as default and wired to the subvis. This keeps the security benefits as now but adds a FP element and data wires.
2. Make some form of global variable with the table. Each subvi that needs the table reads from the variable. Again it can be saved as default but adds a global.
I think 1 would be more efficient and 2 easier to use while debugging. We may run a subvi from several layers deep without its callers during debugging. With the current way or 1 we wouldn't have up to date values unless the subvi had been open during a previous run. Any thoughts? Is there a better method I'm not thinking about? Side question of is there a meaningful performance difference from having a large table saved as default vs wiring to each VI vs a global call?
12-07-2011 04:58 PM - edited 12-07-2011 04:59 PM
Saving the table as a block diagram constant on a FGV that writes to the SR on First Call? might just combine the best of both worlds here. Stored in 1 location, customer can't get at it, available from any caller for debug, represented cleanly for modification/integration, traceable versioning and with the new feature of 2011- connected to a typedef without needing to create a control on the FGV's BD. I use this approach now and then![]()
12-08-2011 09:01 AM
I am leaning towards a global, though a constant wouldn't be best for this application. We change the table every project but it's usually a variant of an older one so we have a standard text file we modify and load into LabVIEW. This file is also referenced outside of LV so we need to keep it.