Difference between revisions of "Template:OrbitAltitude"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (!category didn't work right;)
(+numbered parameters; +link to BodyData subtemplate;)
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|{{#expr: {{OrbitAltitude/Core|{{{1|{{{period|{{{period_s}}}}}}}}}|{{{2|{{{mass|{{{mass_kg}}}}}}}}}|{{{3|{{{radius|{{{radius_m|{{#expr: {{{radius_km}}}*1000}}}}}}}}}}}}} {{#switch: {{{factor|{{#if: {{{radius_km|}}}|k}}}}}
 
|k=/1000
 
|k=/1000
 
|M=/1000000
 
|M=/1000000
|G=/1000000000}}}}|2}}{{#if: {{{suffix}}}|&nbsp;{{{suffix|{{Dict|{{{factor|{{#if: {{{radius_km|}}}|k}}}}}}}{{Dict|m}}}}}}}{{#if: {{{period_s|}}}{{{mass_kg|}}}{{{radius_m|}}}{{{radius_km|}}}|[[Category:OrbitAltitude with old parameters]]}}</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}}.
+
|G=/1000000000}}}}|2}}{{#if: {{{suffix}}}|&nbsp;{{{suffix|{{Dict|{{{factor|{{#if: {{{radius_km|}}}|k}}}}}}}{{Dict|m}}}}}}}{{#if: {{{period_s|}}}{{{mass_kg|}}}{{{radius_m|}}}{{{radius_km|}}}|[[Category:OrbitAltitude with old parameters]]}}</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}}. To add the radius and mass, and possibly the period, automatically the {{Tl|BodyData/Orbit altitude}} can be used.
  
 
All usages with the old parameter names will be sorted into the category [[:Category:OrbitAltitude with old parameters]].
 
All usages with the old parameter names will be sorted into the category [[:Category:OrbitAltitude with old parameters]].
  
 
== Parameters ==
 
== Parameters ==
{| class="wikitable"
+
{{Parameter Table|name=both|parameters=
! Name/#
+
{{Parameter Row|period|name2=1|Period of the orbit in seconds (Old parametername: <tt>{{{period_s}}}</tt>)}}
! Optional
+
{{Parameter Row|mass|name2=2|Mass of central body in kilograms (Old parametername: <tt>{{{mass_kg}}}</tt>)}}
! Description
+
{{Parameter Row|radius|name2=3|Radius of central body in meters (Old parameternames: <tt>{{{radius_m}}}</tt>, <tt>{{{radius_km}}}</tt> (in km!))}}
{{ParameterRow|period|Period of the orbit in seconds (Old parametername: <tt>{{{period_s}}}</tt>)}}
+
{{Parameter Row|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}}
{{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 ==
 
== Examples ==
Line 27: Line 24:
 
|}
 
|}
  
[[Category:Templates|OrbitAltitude]]</noinclude>
+
[[Category:Templates]]</noinclude>

Revision as of 12:17, 15 September 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. To calculate the orbit's altitude without any fancy stuff (like decimal separator) use {{OrbitAltitude/Core}}. To add the radius and mass, and possibly the period, automatically the {{BodyData/Orbit altitude}} can be used.

All usages with the old parameter names will be sorted into the category Category:OrbitAltitude with old parameters.

Parameters

Template:Parameter Table

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