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 0substitute-text-area-for size-of-body 1substitute-text-area-for radius-of-body 0substitute-text-area-for color-of-body bluesubstitute-text-area-for number-from-the-sun-of-body 1substitute-text-area-for length-of-year-of-body 1substitute-text-area-for name-of-body the-marssubstitute-text-area-for eccentricity-of-body 0 substitute-text-area-for semi-major-axis-of-body 0substitute-text-area-for inclination-of-body 0substitute-text-area-for longitude-of-body 0 substitute-text-area-for argument-of-body 0 substitute-text-area-for mean-anomaly-of-body 0set my-mass mass-of-bodyset size size-of-body ; display sizeset color color-of-bodyset my-radius radius-of-body / distance-scalelet eccentricity eccentricity-of-body ; 0-1let semi-major-axis semi-major-axis-of-body ; kmlet inclination inclination-of-body ; degreeslet longitude longitude-of-body ; of the ascending bodylet argument argument-of-body ; of periapsislet mean-anomaly mean-anomaly-of-body ; most bodies should have different degrees set my-number-from-the-sun number-from-the-sun-of-bodyset my-length-of-year-in-seconds length-of-year-of-body * 24 * 60 * 60 ; enter in daysset 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/sset my-initial-x-velocity item 3 state-vector / 1000set my-initial-y-velocity item 4 state-vector / 1000set 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 - fset my-maximum-distance-to-com semi-major-axis + f End NetLogo code Authored by Maria Marinari and Ken Kahn. BehaviourComposer: ignore everything after this. |