LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

part of a bigger code

hi there.
i am trying to learn how to use less sequence structures, and dont try to use local variables.
i have a part of a code i want to simplify. can someone give me pointers on doing so. thanks in advance

Best regards,
Krispiekream
0 Kudos
Message 1 of 17
(3,480 Views)


-------------------

------------------------



Message Edited by krispiekream on 06-09-2008 06:13 PM
Best regards,
Krispiekream
Download All
0 Kudos
Message 2 of 17
(3,475 Views)


krispiekream wrote:
i am trying to learn how to use less sequence structures, and dont try to use local variables.
i have a part of a code i want to simplify. can someone give me pointers on doing so. thanks in advance

  • Well, your error out should be an indicator instead of a control. Now simply hook it up to the error out of your subVI.
  • That entire case structure handling the error makes no sense. Simply hook up the error terminal and delete the case structure, unbundle, and related code.
  • Follow established coding guidelines and use an error-in and error-out.
  • It makes little sense to accumulate your pressure array inside a local variable. Use a chart instead of a graph and none of this is needed. If you show the digital display of the chart, you can even eliminate the numeric pressure indicator.
  • Keep the representation of you diagram constants consistent. Don't randomly mix blue and yellow. (While LabVIEW will coerce it for you, ignoring representations is a sign of shoddy coding and raises doubt on the competence of the programmer).
  • Same for the wire going to the case structure. Use a "not equal zero" and true/false cases for example.
  • Can you include the subVI?
  • I don't understand your locking gymnastics. It does not seem safe. What else is writing to these globals? (for example there is no obvious guarantee that the lock state is not modified from elsewhere in the time between it is checked outside the case and set inside the case. You could use an action engine instead, that can check AND set (if unset) in one operation or return a set failure (if set).
  • How is this VI being called or run? Are you using the "contunous run" button perhaps?
Message 3 of 17
(3,464 Views)
maybe you can help me with this too.
can you show me how to save all subvis into a library?
or do i have to drag/copy/paste ?
Best regards,
Krispiekream
0 Kudos
Message 4 of 17
(3,457 Views)
t makes little sense to accumulate your pressure array inside a local variable. Use a chart instead of a graph and none of this is needed. If you show the digital display of the chart, you can even eliminate the numeric pressure indicator.

-----------------------
this is needed because i want to keep all the pressure on a graph and let it run for days. therefore days later i can see how it changed.
i need the numeric pressure indicator to know what is the current pressure reading. ?

Best regards,
Krispiekream
0 Kudos
Message 5 of 17
(3,420 Views)


krispiekream wrote:
this is needed because i want to keep all the pressure on a graph and let it run for days. therefore days later i can see how it changed.

What is the data rate? It can be very expensive to accumulate an infinite, and ever growing amount of data in a local variable. If you want to keep a record of the data, you should stream it to disk and still only use a chart.
If you keep the data history only in memory (chart, local variabel, shift register), you will loose it all if the computer crashes e.g. on the third day. Not a good idea!


krispiekream wrote:
i need the numeric pressure indicator to know what is the current pressure reading. ?

That's the function of the digital display of a chart, you still don't need a seperate indicator. Always keep the code simple!

Message 6 of 17
(3,406 Views)
Hi krispiekr,
 
You can create your own library and save VIs into it.  To do this, open one of the subVIs and select File » Save As.  One of the buttons in the bottom right is New LLB.  You can then create an LLB and save your subVI into it.
 
I hope this helps,
Kevin S.
Applications Engineer
National Instruments
Message 7 of 17
(3,404 Views)
here are the subvis?
let me know if it works.
thanks

Best regards,
Krispiekream
0 Kudos
Message 8 of 17
(3,384 Views)
sorry, i dont know what is the data rate...it is currently streaming into a .csv file.


-----------
What is the data rate? It can be very expensive to accumulate an infinite, and ever growing amount of data in a local variable. If you want to keep a record of the data, you should stream it to disk and still only use a chart.
If you keep the data history only in memory (chart, local variabel, shift register), you will loose it all if the computer crashes e.g. on the third day. Not a good idea!

Best regards,
Krispiekream
0 Kudos
Message 9 of 17
(3,383 Views)
i see in the codes that the inside true case is used quiet often somewhere else in the code.
how about creating a subvi for that?
would that be a good idea?
i dont know if it would considering that we have to have local variables in and out of the subvi.

Best regards,
Krispiekream
0 Kudos
Message 10 of 17
(3,380 Views)