LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

x scale.range:maximum and minimum

Hi people,

I created a vi that I expected to work this way:

when the local variable changes the value FAE to FC the Elapsed Time counter actives, the chart is clean and it defines the minimum range by Get Start Time (s) from counter and the maximum range by minimum + a constant. When the counter reaches the time, it changes the local variable's value to FAE and reset the program until the user change again the local variable's value to FC.

 

But it doesn't work like I imagined. What is my mistake? could someone help me?

Thanks

0 Kudos
Message 1 of 8
(961 Views)

Hello,

 

To achieve what you described for your application, I would sugest you to change the architecture of your code for a event driven state machine, where each state will acomplish the task you want. So you'll have to states, one for each state of your control value, inside each case event you'll create your code. Taking a look at your code I would suggest you to avoid using flat sequence structure, because you can do it without the sequence structure and avoid the unnecessary use of memory, the same thing fo the local variable, and you don't need to use the timed loop for this (unless you're are going to use determinism or the timing functions of the loop), you can use a simple while loop. Use one state to adjust the scales you want and the other to reset your settngs just like you said.

 

Here follows the event driven state machine tutorial:

 

http://www.ni.com/white-paper/2926/en/

 

If you need any help doing it we'll be glad to help you.

Thiago Matos
Engenharia de Aplicações
National Instruments Brasil
0 Kudos
Message 2 of 8
(932 Views)

Hi Thiago, thank you for your advices but my real problem is the x axis. I would like to define programally the minimum range with the start of data acquisition and the end of range displayed with minimum plus a constant, for example 10:00 h. But when I define any value to xscale.minimum the chart becomes crazy. My use of this code is to get a recharge battery graph, when a specific condition happen I will get the voltage of the battery every second for 8 hours then it will resume for previous condition until the specific condition will happen again.

0 Kudos
Message 3 of 8
(916 Views)

Yes that's true, if you ain't collecting it real time you could use a graph instead. This one doesn't have any problems to scaling.

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
0 Kudos
Message 4 of 8
(896 Views)

Hi,

 

You are having problems because the way you are building your LabVIEW code is not an ideal way. There are a lot of architectures developed and tested that ensures the correct functionality of your code, this problem of your chart getting crazy is related to the way your code was built, so using a state machine with a state where you programatically changes the range values of your chart/graph will avoid this problem.

 

If you have any problems just ask.

Thiago Matos
Engenharia de Aplicações
National Instruments Brasil
0 Kudos
Message 5 of 8
(885 Views)

Thiago, I did a small code using state machine and the same way, the x axis doesn't work properly. Any value attributed to xscale.minimum in property node different from zero becomes the axis crazy. I am considering this as a bug in labVIEW.

0 Kudos
Message 6 of 8
(861 Views)

I am really thinking to substitute the chart with a graph. I was avoiding to use arrays, but i think this is the unique solution

0 Kudos
Message 7 of 8
(860 Views)

Could you upload your code with the changes you made and describe with more details what your application is going to do? I will take a look, test it here and tell you what is happening.

 

Hope to help you!

Thiago Matos
Engenharia de Aplicações
National Instruments Brasil
0 Kudos
Message 8 of 8
(821 Views)