LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

L-System Workstation VI

Well, to make a long story short, I got bored one day, looked into fractals, learned about Lindenmayer systems, and made a program.  I turned this into an executable and thought I might get some feedback on it.  All the necessary files (except the LV runtime engine) are in the included zip file, along with a ReadMe file explaining everything you'd need to know about using the program. Anything I'm missing, or any suggestions?
0 Kudos
Message 1 of 7
(3,275 Views)

Thanks for your contribution.

 

So far things seem to work, so that's great! 🙂

 

Still, many things cound be simplified significantly.

 

Here are some suggestions:

  • I would not constanty switch back and forth between arrays of single characters and strings. Decide on one representation.
  • Why do you reverse the arrays just to reverse them again nanoseconds later.
  • Converting an array of strings to a concatenated string requires a size=1 "concatenate strings". That's all! 🙂
  • Use latch action booleans for all buttons and use "value changed" events. Make sure to place the terminal inside the assocoated event so it properly resets.
  • Make the long calculation interruptible.
  • Most of your local variables are not needed.
  • For the "reset case", it might be simpler to reset all to defaults in one step (VI method!).
  • ...

 

See how far you get 😄

Message 2 of 7
(3,240 Views)

Thank you for your input! I have a few comments on your suggestions, though:

  • unfortunately, in order for the L-System VI to function correctly, it has to convert the array back into a string and then back into character arrays.  Otherwise, unless it changes a character to just one other character, one of the "character" strings will have multiple characters in it, and therefore won't fit with any of the rules.  I tested it without converting it back to a string and that is what happened.
  • Thank you for pointing that out. I just fixed it and it works great.
  • That certainly works and cleaned up my code a little.
  • I attempted to make it interruptible before i had posted this, and it didn't work. I put a button on the front panel and gave the for loop a conditional, and it wouldn't read the button until it was done calculating and drawing. Not sure of how else to interrupt it without further cluttering my block diagram.
  • I agree, but some of them are.  The path control doesn't seem to work too well when you put it outside the event case and wire it inside. doesn't like to read a changed path.
  • I do not understand how you might do that... you'd have to explain.

The new version is inclosed in the attached zip file.  Also, I've noticed that for some reason, as it draws, the drawing tends to flicker when it has to deal with complex fractals.  I don't think it used to do that.  Any fixes, or is it just my computer?

0 Kudos
Message 3 of 7
(3,229 Views)

bluekid239 wrote:

The path control doesn't seem to work too well when you put it outside the event case and wire it inside. doesn't like to read a changed path.


To make sure the path does not get read until an event fires, you can do the following:

 

Make one event triggered by both "open" and "save" value changed. Place the path control inside.

 

Add a case structure tied to the "open" terminal. Inside the true case goes the "open" code, inside the false case goes the "save" code.

Message 4 of 7
(3,219 Views)

bluekid239 wrote:

Also, I've noticed that for some reason, as it draws, the drawing tends to flicker when it has to deal with complex fractals.  I don't think it used to do that.  Any fixes, or is it just my computer?


Right-click the picture indicator and select "advanced...smooth updates".

0 Kudos
Message 5 of 7
(3,216 Views)
Thank you! I don't know why I didn't think of that before. That should work.
0 Kudos
Message 6 of 7
(3,169 Views)
Here is the modified code. I also added some simple error handling so that errors would not pop up when you clicked cancel on the prompt for a path.  Of course, this means if there was an error loading (or saving for that matter), it wouldn't tell you. Oh well, I'll look into that later.
Message Edited by bluekid239 on 12-22-2009 10:29 AM
0 Kudos
Message 7 of 7
(3,161 Views)