LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically applying a custom scale in an active VI

Reposting this after I originally posted on an outdated thread:

 

I am having a problem when trying to apply a new scale with a programmatically-reset y-intercept value while my VI is running. I am attempting to remove the baseline offset from 9 full bridge load cell channels. Using scale property nodes and the save scale VI, I am able to update the scale shown in MAX while my VI is still running. However, the new scale does not get applied to my continuous data without stopping and starting the entire VI (not an option for my testing scenario). I tried programmatically stopping and starting the task, as well as reseting the device (SCXI 1520 + SCXI 1314), but this still does not apply the new scale to my continuously sampled data stream. 

 

I have tried using the Perform Bridge Offset Nulling VI and the AutoZero mode. While these do successfully update my data while the VI is running, they are not correctly zeroing the signals. So it seems like I must use the y-intercept scale method. 

 

Any ideas how to make the new scale work without restarting my VI? 

 

Thanks

Eric

0 Kudos
Message 1 of 14
(4,359 Views)

Hi Eric,

 

It sounds like the issue you are running into is occuring because the task itself needs to be stopped before any scaling occurs. At that point you would have to resave and start the task again.

 

I hope this helps!

National Instruments
0 Kudos
Message 2 of 14
(4,309 Views)

Hi Mr. Brill

 

Thanks for the reply. I tried stopping, scaling, saving, and restarting as you suggested, but am still not having any luck. I attached a screenshot of this portion of my code. Does anything look suspect to you? 

 

Also, I have run up against one more issue. After trying the Bridge Offset Nulling VI (which did not correctly zero my signal), it seems that the offset that was applied is being stored somewhere and applied to my channel. For example, in the MAX test panels, I get a value of about -20N at baseline with my custom scale applied with a y-intercept of 0. But as soon as I run my VI and sample from the same channel, the value at baseline is a 85N with the same custom scale applied. Is there a way to remove the effects of the Bridge Offset Nulling? Maybe wire a 0 value to Initial Bridge Voltage DAQmx channel property? (http://digital.ni.com/public.nsf/allkb/76FB3F1EC361E64E8625742B0070A4E9)

 

Thanks again

Eric

0 Kudos
Message 3 of 14
(4,279 Views)

Eric_SeattleVA wrote:

Thanks for the reply. I tried stopping, scaling, saving, and restarting as you suggested, but am still not having any luck. I attached a screenshot of this portion of my code. Does anything look suspect to you?


You seem to be stopping and starting a different task that the one you are trying to apply the scale to.

What is the purpose of the sequence structure? Execution order is fully determined by dataflow alone.

0 Kudos
Message 4 of 14
(4,267 Views)

Yes, I admit the sequence structure is unnecessary Smiley Embarassed. I should have removed that before I took the screenshot. I was getting desperate. 

 

Regarding the Scale Property Node and Save Scale VI, I did not find a way to wire the specific task to either. I thought I could only assign a specific scale, and I assumed the scale would be applied to all tasks. Is there a way to assign my task to the scale property node?

 

 

0 Kudos
Message 5 of 14
(4,253 Views)

Did you solve the active scale change?

 

I know I'm about a month late with my response, but I'll put it out there anyway.

It is true that the task needs to be stopped in order to get the change to occur, but I've found that if the scale name doesn't change, then the task won't update the scale info. What I've done is create a second "dummy scale" that I assign to the channel and then immediately reassign my desired scale to the channel, then start the task back up. This seems to work well (see attached picture). One caveat is that the "dummy scale" should be reasonably appropriate for the channel so it doesn't throw an error. I would start the application by making a copy of the real scale and naming it as my dummy scale.

 

Tobin

Message 6 of 14
(4,163 Views)

You need to use Save Scale to update the scale as it exists in "xml-land" The new properties of the scale should be applied to any tasks with channels using the saved scale then (or an error will be reported if the scale won't allow the task to "verify".)


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 14
(4,157 Views)

I definitely agree that proper houskeeping needs to be done by saving the scale and making sure all tasks that use it stay healthy. However, I would be concerned if the same scale (with a change to the "offset") was being used for more than just the single channel and sensor combination.

 

If I have 5 pressure sensors connected to five channels, I would define 5 unique scales so I could independently null any offsets.

 

Tobin

0 Kudos
Message 8 of 14
(4,150 Views)

@Tobin wrote:

I definitely agree that proper houskeeping needs to be done by saving the scale and making sure all tasks that use it stay healthy. However, I would be concerned if the same scale (with a change to the "offset") was being used for more than just the single channel and sensor combination.

 

If I have 5 pressure sensors connected to five channels, I would define 5 unique scales so I could independently null any offsets.

 

Tobin


In That case I would be fairly concerned too!  (Unless you used things like MyTestA_Pressure and MyTestB_Pressure Tasks that called common saved scales)

 

I just wanted to point out the scope of a saved scale vs a saved scale with uncommited changes to properties.Smiley Wink  When you get several years worth on engineering utilities on a lab PC, odd things like that can become a PITA.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 14
(4,142 Views)

Hi all- 

Thanks for revitalizing the post. I found a solution prior to the most recent set of comments. It was a combination of the suggestions posted. I attached a screenshot of the meat of it in case anyone is curious how I got the tare to work. I have 9 load cells, so it's a little on the busy/messy side. But it works. Fully stopping and clearing the task, then restarting, did the trick.

Thanks

Eric

0 Kudos
Message 10 of 14
(4,122 Views)