From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

optimization problem

Solved!
Go to solution

hi everyone,
I have some optimization problem Smiley LOL
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 Smiley Happy  )
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 Smiley Happy
thank you

0 Kudos
Message 1 of 6
(3,135 Views)
  • 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)
Message 2 of 6
(3,119 Views)

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 Smiley Happy 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?
thank you for answers

Download All
0 Kudos
Message 3 of 6
(3,090 Views)

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! 😄

Message 4 of 6
(3,064 Views)

it will be my project about Doppler effect  Smiley Happy  
now i want to take the same animation like here
i fixed "traps" Smiley LOL (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" Smiley Indifferent
Thank you for answer Smiley Happy

0 Kudos
Message 5 of 6
(3,053 Views)
Solution
Accepted by mbsto

@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!

Message 6 of 6
(3,039 Views)