LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a subVI with fgv

I guess that company was not a NI Alliance Partner... 😄

 

IMHO, you could try to compress little part of this code, since there are many dependencies with property nodes and local variables. If you hide some of the code in subVIs, I do not think it gets easier.

What you should figure out, how the code is intended to work. First just work with the code if you can run it on the real system, and use pen+paper to draw flowcharts. You have to create a proper documentation of the future code, what functionality is must have? When you have a clear proper documentation, you can write your own code.

Probably there are other ways to deal with this mess, lets wait for some more experienced programmers here, you may get a better/more detailed advice...

0 Kudos
Message 11 of 31
(1,513 Views)

I agree with Blokk that piecemeal "fixes' are likely to cause more problems than they fix.  Every time I have tried to take that approach to fixing some monster of a program, it ended up with a rewrite anyway or the project got canceled because the fix was taking too long.

 

Document everything you can about how it works and what it is supposed to do. Also identify as many bugs, "features" which do not work the way the users want, and new features the users want to add as possible - write everything down.   Then write a new program.

 

Without seeing the code I cannot say for sure but the process above is what most consultants would do if you hired them to fix it.

 

Lynn

0 Kudos
Message 12 of 31
(1,504 Views)

I do not know your company structure, neither the available resources/constraints. However it is always important to make a kind of money/time analysis. Your goal is to get a properly working/maintainable (or even scalable if you wanna add components/features in the future) piece of software. If your company does not have a LabVIEW programmer with a required level, they should decide what is more beneficial for them. They can "set" a collegue on the LabVIEW learning curve, paying for courses, for either online self-paced ones or with real teacher. This costs money and time, but someone at the company with good LV skills can be money saving in the future. Or they can hire a third-party company: http://www.ni.com/alliance/partner-types/

0 Kudos
Message 13 of 31
(1,483 Views)

I've dealt with several examples of "sprawling code", and have also attempted to "improve it" by adding sub-VIs.  It was generally not satisfactory.

 

However, I'll tell you what works -- Start Over!  Begin by writing as detailed a document as you can that describes what the software is supposed to do.  If there is an important User Interface that needs to be maintained, include that.  Don't worry (for now) about how to do any of it, other than taking note (in your document) about the Hardware and Software capabilities you have at your disposal.

 

Especially if you Hire An Expert, the Documentation Step is vital!  A LabVIEW Expert is not going to want to wade through that code, but will want to know what functionality you need, and will then decide how to deliver that functionality while still maintaining easy-to-read, easy-to-maintain, easy-to-verify LabVIEW code (it really is possible to do this).

 

Bob Schor

0 Kudos
Message 14 of 31
(1,454 Views)

It's the result of negotiating partnerships with subcontractors.

I try to contact the company responsible for the code and see the possibility of straightens.

 

 

One last question: I would like to shorten main time loop. Now it's in 100ms and I'm using the tool wait until next ms multiple at 100ms. When I put a shorter time of 100ms, the program continues to show me that the boucle this in 100ms, however if I increase the time to 300ms for example, the program indicates 300ms. Anyone know why that?

 

 

0 Kudos
Message 15 of 31
(1,410 Views)

Because of the timeout case of the event structure. Essentially the loop wait until all code is completed so, it does the wait 100 ms and the timeout 100 ms in parallel, if you decrease the wait, it'll still wait for the event to time out.



Remember Cunningham's Law
0 Kudos
Message 16 of 31
(1,398 Views)

@eecharlesbr wrote:

It's the result of negotiating partnerships with subcontractors.

I try to contact the company responsible for the code and see the possibility of straightens.

 

 

One last question: I would like to shorten main time loop. Now it's in 100ms and I'm using the tool wait until next ms multiple at 100ms. When I put a shorter time of 100ms, the program continues to show me that the boucle this in 100ms, however if I increase the time to 300ms for example, the program indicates 300ms. Anyone know why that?

 

 


Not my business, but I am interested how much money they asked for such a low quality software...

About the timing: have a look at the help description of the "wait until next ms multiple". Actually the answer is in the name: LabVIEW will try to keep the loop iteration time 100 msec if you set it.

 

For example, if the functions to execute inside the loop take altogether like 80 msec, LV will wait another 20 msec before starting the next iteration. If you set it 300 msec, the total loop iteration time will be 300 msec obviously. If you set 50 msec, LV will still wait 100 msec obviously...

 

edit: yes, i did not notice the Event structure's timeout. So you have a timeout at the Event case, and also a "wait until next ms multiple" set both to 100 msec.

 

Actually what kind of iteration speed you want to reach?

0 Kudos
Message 17 of 31
(1,396 Views)

BTW:

Rube.PNG

equals:

Rube2.PNG

Doesn't it?



Remember Cunningham's Law
0 Kudos
Message 18 of 31
(1,387 Views)

it's true, I do not have associated this fact the function.

I would also like to know the price of this code.

hahaah

 

Thank you all.

0 Kudos
Message 19 of 31
(1,385 Views)

Yes, This is  PeterFoerster.

I already did this change but time remains the same.

 

I found it strange because inputs and outputs are the most responsible for the time of execution.

0 Kudos
Message 20 of 31
(1,380 Views)