LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Planet Orbits

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:)

0 Kudos
Message 1 of 13
(2,309 Views)

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

0 Kudos
Message 2 of 13
(2,301 Views)

@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:)

 

0 Kudos
Message 3 of 13
(2,292 Views)

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.

0 Kudos
Message 4 of 13
(2,288 Views)

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

0 Kudos
Message 5 of 13
(2,283 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 6 of 13
(2,270 Views)

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?

0 Kudos
Message 7 of 13
(2,243 Views)

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

0 Kudos
Message 8 of 13
(2,216 Views)

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

 

0 Kudos
Message 9 of 13
(2,195 Views)

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:

 

  1. Dynamically vary your dt bases on error estimates.  You can estimate your error if you expand the simple first order approximation (a1 + a2t) into higher orders.  You can use the value of the last term in your expansion as an error approximation, then set your step size to achieve the error you want to see.  Your code with approximately double for each order you add, but your step size will go up by about an order of magnitude at the same time.
  2. LabVIEW has 3D controls, so you can calculate and plot your results in three dimensions.
  3. If you are in to pain, you can use the same equations to calculate the trajectories of charged particles - but you will need to add the effects of the moving electric fields...
This account is no longer active. Contact ShadesOfGray for current posts and information.
Message 10 of 13
(2,145 Views)