Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

MyronHuzan

Member

12-07-2013 10:51 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

Thanks for any feedback:)

johnsold

Knight of NI

12-07-2013 11:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

Bob_Schor

Knight of NI

12-07-2013 12:20 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

CoastalMaineBird

Trusted Enthusiast

12-07-2013 02:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

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

Culverson.com

Blog for (mostly LabVIEW) programmers: Tips And Tricks

ToeCutter

Active Participant

12-07-2013 07:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

ToeCutter

Active Participant

12-08-2013 08:06 AM - edited 12-08-2013 08:09 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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

DFGray

NI Employee (retired)

12-09-2013 07:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

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:

- Dynamically vary your dt bases on error estimates. You can estimate your error if you expand the simple first order approximation (a
_{1}+ a_{2}t) 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. - LabVIEW has 3D controls, so you can calculate and plot your results in three dimensions.
- 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.