# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## optimization problem

hi everyone,
I have some optimization problem
it output piot and waves on XYgraph
when i start my program (choose N1 in project in run-menu)
each next loop take more time than previous,specially if use "follow point" function whis nonzeros arguments dx,dy,t (t is number of iteration and it must be nonzero   )
I think that main problem in "circle.vi" function because it recursion function. I tried swap while loop in that function by "drow circle by radius" but it doesnt work with XYgraph.
Can you give some ideas whou i can optimize it?
and some exaples if it posible because i am beginer in labview and programing
thank you

Message 1 of 6
(1,659 Views)

## Re: optimization problem

• We are missing "point.vi", so we cannot run the code.
• The arrays in the local variables seem to grow without upper limit (subVI dxdy.vi). How often is the case true?
• You are calling circle.vi recursively and seem to be creating more and more plots. How many plot do you create? How much data will be in the graphs?
• Why do you think you have to change the plot colors to the same value over and over? Is there something that changes them to something else?
• What are typical values for all the controls? Please set them all to reasonable values and make them default, the save the VI again. Now we can run without guessing what normal settings are.
• Why do you have loops inside loops inside event cases. For example, the outer N1 loop never completes. All this looks inside out and a poor design.
• What determines the loop rates? They seem to be free running as fast as the computer allows. (also in the N2 case)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 2 of 6
(1,643 Views)

## Re: optimization problem

1)Here is a new version.
2)Not so often i think, size of this arrey =t or t+1.
3)I dont need very large circle wich bigger than XYgraph size. Maby i can do something with them.
4)O, i see it thank you. But when i moved it in another place it stoped work. i add "Untitled 1.vi" which hasnt plot color changing function.
(LAb1.zip has "Untitled 1.vi" which include that function and that  "Untitled 1.vi" does not work )
5)fixed
6)i tried fix it but nothing worked.
7)i have Lenovo S205 with 1GB ram and 1.65 GH proc. Is it not enough?

Message 3 of 6
(1,614 Views)

## Re: optimization problem

So what is the program actually supposed to do? Just dynamically draw a few circles of various sizes? That seems trivial and should not consume any significant computer resources, so something is wrong.

Why does "point.vi" draw two identical points instead of just one?

Again, your VI runs out of control spinning nearly empty loops as fast as the computer allows whenever nothing needs to be done. You need wait statements! You need to rearchitect the code to keep the UI unclogged. Currently, selecting any of the menu entries is an irreversible trap that cannot be escaped. Don't dig yourself into a deep hole with stacks and stacks of while loops. Most likely all you need is a single one!

At this stage, focus on the algorithm and avoid all this UI micromanagement with menus, visibility and other properties. That should be the last step before release and is currently only in the way.

Please explain in a few words what the user does and what is supposed to happen in response. I am sure it could be done with 10% of the current code! 😄

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 4 of 6
(1,588 Views)

## Re: optimization problem

it will be my project about Doppler effect
now i want to take the same animation like here
i fixed "traps"  (i think so) "point.vi" , "circle.vi"(name was chenged to "circle11.vi" and it has less code), removed 1 loop but lost opportynity to continue working after ploting
Unfortunately my mark depends on "menus, visibility and other properties"

Message 5 of 6
(1,577 Views)
Solution
Accepted by topic author mbsto

## Re: optimization problem

@mbsto wrote:

now i want to take the same animation like here

Why so complicated! Here's a solution that does this animation with much less code. To create a circle, create a unit circle once using a ramp to 2pi and complex math and append a NaN to create a gap (=no line!) when appending successive circles to the same plot. For each circle, apply scale and offset as needed.

See if this make sense to you. I am sure you can adapt some of it to your needs. Good luck!

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 6 of 6
(1,563 Views)