12-07-2013 10:51 AM
Hello, I am new to this, so if this has already been posted, I apologise. I was wondering if it would be possible to plot the orbits of the plants around the sun in LabVIEW using equation of motion. I have the general background knowledge of the physics about it, but I was wondering if it would be possible to actually program in LabVIEW.
Thanks for any feedback:)
12-07-2013 11:08 AM
Yes, you can plot the orbits. Of course at any scale which will fit on a screen the orbits will look circular for most of the planets.
The XY graph is one way to show your results. The Polar Plot, Radar Plot, or 2D picture controls are other indicators which might be of use.
The type of coordinate system and the formulation of the equations of motion you use may depend on the type of graph or plot chosen.
Lynn
12-07-2013 12:06 PM
@johnsold wrote:
Yes, you can plot the orbits. Of course at any scale which will fit on a screen the orbits will look circular for most of the planets.
The XY graph is one way to show your results. The Polar Plot, Radar Plot, or 2D picture controls are other indicators which might be of use.
The type of coordinate system and the formulation of the equations of motion you use may depend on the type of graph or plot chosen.
Lynn
Thanks, I might have a mess around and see how it goes:)
12-07-2013 12:20 PM
Do you want to plot the orbit (which should be a static ellipse) or the time-varying position of the orbiting object? LabVIEW graphs are generally used to plot "static" things (like orbits) and let you specify points as X-Y pairs, while LabVIEW charts are generally used to plot time-varying data, with time linearly increasing left-to-right.
Since you need to plot X-Y pairs, you need to use the Graph. Does this mean that you can't plot the time-varying position of the orbiting object? Not at all -- you simply need to load the plot with the points you want to see "right now" at periodic intervals.
I've used this technique to plot a moving object, with a "tail" so I can judge how fast it moves. I create an array of, say, 5 points, initializing the array with the starting X-Y location. Every clock tick, I compute a new point and replace the oldest point in the array with the newest position, then replot the 5 points. What I see is the current and previous 4 positions of the object -- when it moves quickly, the spacing between the position dots is wide, when it slows down, the dots bunch up, and when it stops, it becomes a single dot.
The array is treated as a "circular buffer". You need an index of the points you are plotting (let's call it "Index", starting at 0 and incrementing for each new point). To make an array of size 5 into a circular buffer, simply take Index, divide by 5, and use the remainder to access the array (the remainder will be 0 .. 4, the allowed values for the array index). LabVIEW's Quotient and Remainder function will do this for you.
12-07-2013 12:54 PM
Thanks, for the response, I think I understand what you are saying, but at the minute, I think this is just a little too hard for me to program, I may come back to it, Thanks for the response though
12-07-2013 02:06 PM
Under HELP, choose FIND EXAMPLES.
Browse according to TASK
Look under BUILDING USER INTERFACES
Look under GENERATING 3D PICTURES.
Open 3D MODEL of SOLAR SYSTEM.
Run it.
Look at the code.
You might quibble with the term "Solar System" being equal to "SUN + EARTH + MOON", but this should give you a starting point.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
12-07-2013 07:02 PM
Don't quite understand the point of this thread considering the OP was already pointed to the solar system example before this thread was started? (but kudos to steve for the info).
If you can conceive of it, you can program it. What's the query?
12-08-2013 03:25 AM
@ToeCutter wrote:
Don't quite understand the point of this thread considering the OP was already pointed to the solar system example before this thread was started? (but kudos to steve for the info).
If you can conceive of it, you can program it. What's the query?
Sorry, I am new here and I was just wondering if it would be possible to do it fully with all the Planets orbiting and affecting each others orbits, not just the Sun, Earth and Moon.. Since the more planets the more complicated. So I was wondering if LabVIEW could even handle it.
12-08-2013 08:06 AM - edited 12-08-2013 08:09 AM
No need to apologise- I just needed to understand the reason for the post.
Yes, you can program anything in LabVIEW that you can do in any other language.
The limitations are more down to the fixed nature of the GUI and whether it is suitable for your application. Also, whilst it's perfectly possible to write, say, a computer game in LV there are much better suited languages which will make the task less tortuous.
Pretty quick to get something like what you are talking about up and running, and a modern machine should handle many hundreds if not thousands of 'planets'.
dt=0.01 ' timestep, tweak to get decent results
loop over planets
- for each planet, loop over all other planets, calc distance, add the force component between the planets G(m1)(m2)/r^2 (split into x and y components).
- acceleration of planet=F/(m1) (again, x,y components)
- v1=v1+acceleration*dt (again x,y)
- pos1=pos1+v1*dt (again x,y)
- draw planets
end of loop
12-09-2013 07:36 AM
I programmed this exact problem (in 2D) using FORTRAN IV on a DECSystem 20 mainframe many years ago. I still have the printout and a couple of traces from a TEK4014 graphics terminal in my shelves. I think I even still have the handwritten equations of motion out to about fifth order. A couple of things you may want to do: