Difference between revisions of "Template:OrbitAltitude"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Undo revision 79402 by Aru (talk))
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{formatnum|{{#expr: {{OrbitAltitude/Core|{{{period|{{{period_s}}}}}}|{{{mass|{{{mass_kg}}}}}}|{{{radius|{{{radius_m|{{#expr: {{{radius_km}}}*1000}}}}}}}}}} {{#switch: {{{factor|{{#if: {{{radius_km|}}}|k}}}}}
+
<includeonly>{{formatnum|{{OrbitAltitude/Core|{{{1|{{{period|}}}}}}|{{{2|{{{mass|}}}}}}|{{{3|{{{radius|}}}}}}|f={{{factor|{{{f|}}}}}}|b={{{body|{{{b|}}}}}}|pf={{{period factor|{{{pf|1}}}}}}}}|2}}&nbsp;{{Dict|{{{factor|{{{f|}}}}}}}}{{Dict|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. The altitude will be calculated by {{Tl|OrbitAltitude/Core}} and then parsed with {{Tl|Formatnum}} and adding a unit.
|{{lang|en=k|ru=к}}=/1000
 
|{{lang|en=M|ru=М}}=/1000000
 
|{{lang|en=G|ru=Г}}=/1000000000}}}}|2}}{{#if: {{{suffix}}}|&nbsp;{{{suffix|{{{factor|{{#if: {{{radius_km|}}}|{{lang|en=k|ru=к}}}}}}}{{Dict|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. To calculate the orbit's altitude without any fancy stuff (like decimal separator) use {{Tl|OrbitAltitude/Core}}.
 
  
 
== Parameters ==
 
== Parameters ==
{| class="wikitable"
+
{{Parameter table|name=both|parameters=
! Name/#
+
{{Parameter row|period|name2=1|Period of the orbit in seconds}}
! Optional
+
{{Parameter row|mass|name2=2|Mass of central body in kilograms}}
! Description
+
{{Parameter row|radius|name2=3|Radius of central body in meters|0}}
{{ParameterRow|period|Period of the orbit in seconds (Old parametername: <tt>{{{period_s}}}</tt>)}}
+
{{Parameter row|factor|name2=f|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}}
{{ParameterRow|mass|Mass of central body in kilograms (Old parametername: <tt>{{{mass_kg}}}</tt>)}}
+
{{Parameter row|body|name2=b|Uses the sidereal rotation period, mass and radius as default from the given body. Can be overwritten.|Not set (makes the first three parameters mandatory)}}
{{ParameterRow|radius|Radius of central body in meters (Old parameternames: <tt>{{{radius_m}}}</tt>, <tt>{{{radius_km}}}</tt> (in km!))}}
+
{{Parameter row|period factor|name2=pf|2=Multiplies the period with this value. Useful to easily calculate semi-synchronous orbits (<tt>pf=1/2</tt> then).|3=<tt>1</tt>}}
{{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 ==
 
== Examples ==
Line 20: Line 16:
 
! Usage || Result
 
! Usage || Result
 
|-
 
|-
| <pre>{{OrbitAltitude | period=64980 | mass=4.515e21 | radius_km=320}}</pre> || {{OrbitAltitude | period=64980 | mass=4.515e21 | radius_km=320}}
+
| <pre>{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000 | factor=k}}</pre> || {{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000|factor=k}}
 
|-
 
|-
 
| <pre>{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}</pre> || {{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}
 
| <pre>{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}</pre> || {{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}
 
|}
 
|}
  
[[Category:Templates|OrbitAltitude]]</noinclude>
+
[[Category:Calculating templates]]
 +
[[Category:Translating templates]]</noinclude>

Latest revision as of 14:20, 28 August 2017

This template calculates the altitude of an orbit, given the mass of the planet, the planet's radius and the period of the orbit. The altitude will be calculated by {{OrbitAltitude/Core}} and then parsed with {{Formatnum}} and adding a unit.

Parameters

#/Name Optional Description Default
period or 1 No Period of the orbit in seconds
mass or 2 No Mass of central body in kilograms
radius or 3 Yes Radius of central body in meters 0
factor or f Yes 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
body or b Yes Uses the sidereal rotation period, mass and radius as default from the given body. Can be overwritten. Not set (makes the first three parameters mandatory)
period factor or pf Yes Multiplies the period with this value. Useful to easily calculate semi-synchronous orbits (pf=1/2 then). 1

Examples

Usage Result
{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000 | factor=k}}
2 862.36 km
{{OrbitAltitude | period=64980 | mass=4.515e21 | radius=320000}}
2 862 362.24 m