From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

RT code that runs ok interactively but breaks as a built application

Solved!
Go to solution

I've just solved this interesting, but frustrating, problem in which a real-time program would run fine interactively, but would be broken when run as a built application.  I thought I'd document it here in case anyone else stumbles into the same trap.

 

In short, I had several indicators on the RT front panel, each of which was bound to a Shared Variable, which had the advantage of writing to the shared variable and the indicator together in one easy process.  It all worked fine interactively, because of course the FP is loaded before the program is run.  However once built into an application and run on startup, the FP does not load, and for some reason the application is broken and does not run.

 

What was particularly frustrating was how difficult this was to track down.  The RT documentation appears to suggest that front panel binding is ok, and interactively it is.  The Front Panel Binding Mass Configuration Dialog supports RT VIs suggesting it should be ok.  An issue is not listed in the LabVIEW features unsupported in RT.  No indication of broken code was given during the Build process.  When I used Operate/Debug Application and connected to the RT application, it would be not running and show a broken Run arrow, but even with debugging turned on there was no way to find out what was causing the program to break.

 

In the end, I removed parts of my code until I had a working application, and then started putting things back in.  It turned out the only thing I needed to change to get a working application was to unbind any indicators.  The bonus is now I've reworked the writing of the shared variables to open the connection to them once only, instead of every time they're written - presumably that's quicker, though I don't have a any benchmarks to show that.  Oh, and this is LV 2012, so perhaps things have changed since.

Message 1 of 5
(6,818 Views)
Solution
Accepted by topic author GregSands

Solved for now!

0 Kudos
Message 2 of 5
(6,817 Views)

Yes, this is a nasty gotcha.

 

For the same reason, property nodes cannot be used in a built RT executable.

Certified LabVIEW Developer
0 Kudos
Message 3 of 5
(6,663 Views)

Well, this had all been working ok, but I managed to break things again, with something I thought was legitimate on RT - using a Shared Variable node directly:

 

SharedVariableError.png

The top line resulted in a broken application (though again running fine interactively), but the code runs correctly when replaced with the programmatic access shown in the lower line.  Once again, it took some time to track down, as there is absolutely no indication (as far as I can find out) of what has caused the application to break.  What made it even more difficult was that I was sure that a Shared Variable node would work on RT, and the documentation certainly appears to say so, unless I'm missing something fundamental.

0 Kudos
Message 4 of 5
(6,480 Views)

Shared variable nodes are indeed supposed to work on RT. There are quirks though.

 

I notice that your shared variable is a cluster. Is it connected to a type defenition? If so, try selecting "disconnect type defititions" in your build specification and see if that helps. http://forums.ni.com/t5/LabVIEW/Application-Builder-What-does-quot-disconnect-type-definitions/m-p/2...

Certified LabVIEW Developer
0 Kudos
Message 5 of 5
(6,210 Views)