Libraries‎ > ‎orbits‎ > ‎

Body elements

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:

Begin description:

sets the elements of a body to result in a more elliptical orbit.

End description

Kepler-36 b elements

Begin NetLogo code:

substitute-text-area-for mass-of-body 0
substitute-text-area-for size-of-body 1
substitute-text-area-for radius-of-body 0
substitute-text-area-for color-of-body blue
substitute-text-area-for number-from-the-sun-of-body 1
substitute-text-area-for length-of-year-of-body 1
substitute-text-area-for name-of-body the-mars
substitute-text-area-for eccentricity-of-body 0 
substitute-text-area-for semi-major-axis-of-body 0
substitute-text-area-for inclination-of-body 0
substitute-text-area-for longitude-of-body 0 
substitute-text-area-for argument-of-body 0 
substitute-text-area-for mean-anomaly-of-body 0
set my-mass                      mass-of-body
set size                         size-of-body ; display size
set color                        color-of-body
set my-radius                    radius-of-body / distance-scale
let eccentricity                 eccentricity-of-body ; 0-1
let semi-major-axis              semi-major-axis-of-body ; km
let inclination                  inclination-of-body ; degrees
let longitude                    longitude-of-body ; of the ascending body
let argument                     argument-of-body ; of periapsis
let mean-anomaly                 mean-anomaly-of-body ; most bodies should have different degrees 
set my-number-from-the-sun       number-from-the-sun-of-body
set my-length-of-year-in-seconds length-of-year-of-body  * 24 * 60 * 60 ; enter in days
set name-of-body                 self ; name starts with the-...
let state-vector convert-orbital-elements-to-state-vectors 
                    eccentricity (semi-major-axis * 1000) inclination longitude argument mean-anomaly 
let x item 0 state-vector / (distance-scale * 1000) 
let y item 1 state-vector / (distance-scale * 1000)
let z item 2 state-vector / ( distance-scale * 1000 )
if x != 0 or y != 0 
      [ set my-initial-heading atan x y ] 
 ; converting from m/s to km/s
set my-initial-x-velocity item 3 state-vector / 1000
set my-initial-y-velocity item 4 state-vector / 1000
set my-initial-z-velocity item 5 state-vector / 1000   
if not the-world-is-3-d?
[
   ifelse abs x < abs y and abs x < abs z 
[ 
      set x z 
      set my-initial-x-velocity my-initial-z-velocity
]
[
   if abs y < abs x and abs y < abs z 
[ 
          set y z 
          set my-initial-y-velocity my-initial-z-velocity ]]
   setxy x y
]
if the-world-is-3-d?
  [setxyz x y z ; distance from center
   facexyz my-initial-x-velocity my-initial-y-velocity my-initial-z-velocity 
   set my-initial-velocity-pitch pitch ] 
let initial-speed  ( sqrt ( my-initial-x-velocity ^ 2 + my-initial-y-velocity ^ 2 + my-initial-z-velocity ^ 2 )
                            / distance-scale) * time-scale  
if initial-speed > the-maximum-speed [set the-maximum-speed initial-speed]
let f ( eccentricity * semi-major-axis )
set my-minimum-distance-to-com semi-major-axis - f
set my-maximum-distance-to-com semi-major-axis + f

End NetLogo code

Authored by Maria Marinari and Ken Kahn.

BehaviourComposer: ignore everything after this.

Comments