Difference between revisions of "Template:OrbitAltitude"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (!default is available as km/m;)
Line 1: Line 1:
<includeonly>{{formatnum|{{#expr:(({{{period_s}}}^2 * {{G}} * {{{mass_kg}}}/(4 * pi^2)) ^ (1/3)) {{#if: {{{radius_km|}}}|/1000}} - {{#if: {{{radius_km|}}}|{{{radius_km}}}|{{{radius_m}}}}}}}|2}}{{#if: {{{suffix}}}|&nbsp;{{{suffix|{{#if: {{{radius_km|}}}|km|m}}}}}}}</includeonly><noinclude>
+
<includeonly>{{formatnum|{{#expr: {{OrbitAltitude/Core|{{{period|{{{period_s}}}}}}|{{{mass|{{{mass_kg}}}}}}|{{{radius|{{{radius_m|{{#expr: {{{radius_km}}}*1000}}}}}} {{#switch: {{{factor|{{#if: {{{radius_km|}}}|k}}}}}
 +
|k=/1000
 +
|M=/1000000
 +
|G=/1000000000}}}}|2}}{{#if: {{{suffix}}}|&nbsp;{{{suffix|{{{factor|{{#if: {{{radius_km|}}}|k}}}}}m}}}}}</includeonly><noinclude>This template calculates the altitude of an orbit, given the mass of the planet, the planet's radius and the period of the orbit.
  
 +
== Parameters ==
 
{| class="wikitable"
 
{| class="wikitable"
! Usage || Produces
+
! Name/#
 +
! Optional
 +
! Description
 +
{{ParameterRow|period|Period of the orbit in seconds (Old parametername: <tt>{{{period_s}}}</tt>)}}
 +
{{ParameterRow|mass|Mass of central body in kilograms (Old parametername: <tt>{{{mass_kg}}}</tt>)}}
 +
{{ParameterRow|radius|Radius of central body in meters (Old parameternames: <tt>{{{radius_m}}}</tt>, <tt>{{{radius_km}}}</tt> (in km!))}}
 +
{{ParameterRow|factor|Factor in which the altitude should be shown. Available values: None (m), '''k''' (km), '''M''' (Mm), '''G''' (Gm). If the radius was given kilometers it uses the factor '''k'''.|None}}
 +
|}
 +
 
 +
== Examples ==
 +
 
 +
{| class="wikitable"
 +
! Usage || Result
 
|-
 
|-
| <pre><nowiki>{{OrbitAltitude | period_s=64980 | mass_kg=4.515e21 | radius_km=320}}</nowiki></pre> || {{OrbitAltitude | period_s=64980 | mass_kg=4.515e21 | radius_km=320}}
+
| <pre>{{OrbitAltitude | period=64980 | mass=4.515e21 | radius_km=320}}</pre> || {{OrbitAltitude | period=64980 | mass=4.515e21 | radius_km=320}}
 
|-
 
|-
| <pre><nowiki>{{OrbitAltitude | period_s=64980 | mass_kg=4.515e21 | radius_m=320000}}</nowiki></pre> || {{OrbitAltitude | period_s=64980 | mass_kg=4.515e21 | radius_m=320000}}
+
| <pre>{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}</pre> || {{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}
 
|}
 
|}
 
This template calculates the altitude of an orbit, given the mass of the planet (in kg), the planet's radius (in km or m), and the period of the orbit (in seconds).
 
  
 
[[Category:Templates|OrbitAltitude]]</noinclude>
 
[[Category:Templates|OrbitAltitude]]</noinclude>

Revision as of 20:24, 6 April 2013

This template calculates the altitude of an orbit, given the mass of the planet, the planet's radius and the period of the orbit.

Parameters

Name/# Optional Description

Template:ParameterRow Template:ParameterRow Template:ParameterRow Template:ParameterRow

Examples

Usage Result
{{OrbitAltitude | period=64980 | mass=4.515e21 | radius_km=320}}
3 182 362.24 m
{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}
2 862 362.24 m