Difference between revisions of "Template:Infobox/Body"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (!detailed orbital period should work now;)
(+Parameters table; +expand time for siderial period; -default values for mandatory parameters;)
Line 15: Line 15:
 
|#default=Orbital Characteristics
 
|#default=Orbital Characteristics
 
}}'''
 
}}'''
{{PlanetBoxRow|[[w:Semi-major axis|Semi-Major Axis]]          |{{#if: {{{apoap|}}}|{{#expr: ({{{apoap}}} + {{{periap|{{{apoap}}}}}})/2}}|??}} |m|f}}
+
{{PlanetBoxRow|[[w:Semi-major axis|Semi-Major Axis]]          |{{#expr: ({{{apoap}}} + {{{periap|{{{apoap}}}}}})/2}} |m|f}}
{{PlanetBoxRow|[[w:Apoapsis|Apoapsis]]                        |{{{apoap|??}}}  |m|f}}
+
{{PlanetBoxRow|[[w:Apoapsis|Apoapsis]]                        |{{{apoap}}}  |m|f}}
{{PlanetBoxRow|[[w:Periapsis|Periapsis]]                      |{{{periap|{{{apoap|??}}}}}} |m|f}}
+
{{PlanetBoxRow|[[w:Periapsis|Periapsis]]                      |{{{periap|{{{apoap}}}}}} |m|f}}
{{PlanetBoxRow|[[w:Orbital_eccentricity|Orbital Eccentricity]]|{{#if: {{{apoap|}}}|{{#expr: 1-2/({{{apoap}}}/{{{periap|{{{apoap}}}}}}+1) round 2}}|??}} |}}
+
{{PlanetBoxRow|[[w:Orbital_eccentricity|Orbital Eccentricity]]|{{#expr: 1-2/({{{apoap}}}/{{{periap|{{{apoap}}}}}}+1) round 2}} |}}
{{PlanetBoxRow|[[w:Orbital_Inclination|Orbital Inclination]]  |{{{orbinc|??}}} |°}}
+
{{PlanetBoxRow|[[w:Orbital_Inclination|Orbital Inclination]]  |{{{orbinc}}} |°}}
{{PlanetBoxRow|[[w:Mean_Anomaly|Mean Anomaly]]                |{{{anomaly|??}}}|°}}
+
{{PlanetBoxRow|[[w:Mean_Anomaly|Mean Anomaly]]                |{{{anomaly}}}|°}}
{{PlanetBoxRow|[[w:Orbital_Period|Orbital Period]]            |{{sigfigs| {{{orbps}}} |8}} s |}}
+
{{PlanetBoxRow|[[w:Orbital_Period|Orbital Period]]            |{{sigfigs| {{{orbps}}} |8}}|s|f}}
 
{{!}}-
 
{{!}}-
{{!}}{{!}} {{!}}{{!}} <small>{{#ifexpr: {{{orbps}}} > 86400|{{formatnum: {{#expr: trunc({{{orbps}}} / 86400)}}}} d|}} {{#ifexpr: {{{orbps}}} > 3600|{{#expr: {{{orbps}}} / 3600 mod 24}} h|}} {{#ifexpr: {{{orbps}}} > 60|{{#expr: {{{orbps}}} / 60 mod 60}} m|}} {{#expr: {{{orbps}}} mod 60}} s</small>
+
{{!}}{{!}} {{!}}{{!}} <small>{{ExpandTime|{{{orbps}}}}}</small>
 
{{PlanetBoxRow|[[w:Orbital_speed|Orbital Velocity]]        |{{#ifeq: {{{apoap|}}}|{{{periap|{{{apoap|}}}}}}|{{#expr: 2*pi*{{{apoap}}}/{{{orbps}}} round 1}}|{{formatnum: {{#expr: pi*({{{apoap}}}+{{{periap}}})/{{{orbps}}}*({{{periap}}}/{{{apoap}}})^(0.5) round 1}}}} to {{formatnum: {{#expr: pi*({{{apoap}}}+{{{periap}}})/{{{orbps}}}*({{{apoap}}}/{{{periap}}})^(0.5) round 1}}}}}}  |m/s}}|
 
{{PlanetBoxRow|[[w:Orbital_speed|Orbital Velocity]]        |{{#ifeq: {{{apoap|}}}|{{{periap|{{{apoap|}}}}}}|{{#expr: 2*pi*{{{apoap}}}/{{{orbps}}} round 1}}|{{formatnum: {{#expr: pi*({{{apoap}}}+{{{periap}}})/{{{orbps}}}*({{{periap}}}/{{{apoap}}})^(0.5) round 1}}}} to {{formatnum: {{#expr: pi*({{{apoap}}}+{{{periap}}})/{{{orbps}}}*({{{apoap}}}/{{{periap}}})^(0.5) round 1}}}}}}  |m/s}}|
 
}}
 
}}
Line 36: Line 36:
 
|-
 
|-
 
| [[w:Radius|Equatorial Radius]]
 
| [[w:Radius|Equatorial Radius]]
| {{#if: {{{radius|}}}|{{formatnum: {{{radius}}}}}|??}} m
+
| {{formatnum: {{{radius}}}}} m
 
|-
 
|-
 
| [[w:Surface Area|Surface Area]]
 
| [[w:Surface Area|Surface Area]]
| {{#if: {{{radius|}}}|{{sigfigs|{{#expr: 4 * pi * {{{radius}}}^2}}|8}}|??}} m<sup>2</sup>
+
| {{sigfigs|{{#expr: 4 * pi * {{{radius}}}^2}}|8}} m<sup>2</sup>
 
|-
 
|-
 
| [[w:Mass|Mass]]
 
| [[w:Mass|Mass]]
|{{#if: {{{mass|}}}|{{sigfigs|{{{mass}}}|8}}|??}} kg
+
| {{sigfigs|{{{mass}}}|8}} kg
 
|-
 
|-
 
| [[w:Standard gravitational parameter|Gravitational Parameter]]
 
| [[w:Standard gravitational parameter|Gravitational Parameter]]
|{{#if: {{{mass|}}}|{{sigfigs|{{#expr: {{{mass}}} * {{G}}}}|8}}|??}} m<sup>3</sup>/s<sup>2</sup>
+
| {{sigfigs|{{#expr: {{{mass}}} * {{G}}}}|8}} m<sup>3</sup>/s<sup>2</sup>
 
|-
 
|-
 
| [[w:Density|Density]]
 
| [[w:Density|Density]]
| {{#if: {{{mass|}}}|{{#if: {{{radius|}}}|{{sigfigs|{{#expr: {{{mass}}} / (4 * pi * {{{radius}}}^3 / 3)}}|8}}|??}}|??}} kg/m<sup>3</sup>
+
| {{sigfigs|{{#expr: {{{mass}}} / (4 * pi * {{{radius}}}^3 / 3)}}|8}} kg/m<sup>3</sup>
 
|-
 
|-
 
| [[w:Surface_gravity|Surface Gravity]]
 
| [[w:Surface_gravity|Surface Gravity]]
| {{#if: {{{mass|}}}|{{#if: {{{radius|}}}|{{sigfigs|{{#expr: {{{mass}}} * {{G}} / ({{{radius}}}^2)}}|3}}|??}}|??}} m/s<sup>2</sup>
+
| {{sigfigs|{{#expr: {{{mass}}} * {{G}} / ({{{radius}}}^2)}}|3}} m/s<sup>2</sup>
 
{{PlanetBoxRow|[[w:Escape_velocity|Escape Velocity]]                  <!--
 
{{PlanetBoxRow|[[w:Escape_velocity|Escape Velocity]]                  <!--
 
-->    |{{#expr: (2 * {{G}} * {{{mass|0}}} / {{{radius|1}}})^0.5 round2 }}|m/s}}
 
-->    |{{#expr: (2 * {{G}} * {{{mass|0}}} / {{{radius|1}}})^0.5 round2 }}|m/s}}
{{PlanetBoxRow|[[w:Rotation_period|Sidereal Rotation Period]]        |{{#if: {{{sidrot|}}}|{{sigfigs|{{{sidrot}}}|8}}|??}}|s}}
+
{{PlanetBoxRow|[[w:Rotation_period|Sidereal Rotation Period]]        |{{sigfigs|{{{sidrot}}}|8}}|s}}
{{PlanetBoxRow|[[w:Sidereal_time|Sidereal Rotational Velocity]]      |{{#if: {{{sidrot|}}}|{{sigfigs|{{#expr: {{{radius}}} * 2 * pi / {{{sidrot}}}}}|5}}|??}}|m/s}}
+
{{!}}-
{{PlanetBoxRow|[[w:Synchronous_orbit|Synchronous Orbit]]              |{{#if: {{{radius|}}}|{{#if: {{{mass|}}}|{{#if: {{{sidrot}}}|{{#ifeq: {{{SoI}}}|N/A|N/A|<!--
+
{{!}}{{!}} {{!}}{{!}} <small>{{ExpandTime|{{{sidrot}}}}}</small>
--> {{#if: {{#ifeq: {{{SoI}}}|∞|1}}{{#ifexpr: {{OrbitAltitude | radius_m={{{radius}}} | mass_kg={{{mass}}} | period_s={{{sidrot}}} | suffix= }} < {{{SoI}}}|1}} <!--
+
{{PlanetBoxRow|[[w:Sidereal_time|Sidereal Rotational Velocity]]      |{{sigfigs|{{#expr: {{{radius}}} * 2 * pi / {{{sidrot}}}}}|5}}|m/s}}
-->    |{{sigfigs|{{OrbitAltitude | radius_m={{{radius}}} | mass_kg={{{mass}}} | period_s={{{sidrot}}} | suffix=  }}|8}} m <!--
+
{{PlanetBoxRow|[[w:Synchronous_orbit|Synchronous Orbit]]              |{{#if: {{#ifeq: {{{SoI}}}|∞|1}}{{#ifexpr: {{OrbitAltitude | radius_m={{{radius}}} | mass_kg={{{mass}}} | period_s={{{sidrot}}} | suffix= }} < {{{SoI}}}|1}}|{{sigfigs|{{OrbitAltitude | radius_m={{{radius}}} | mass_kg={{{mass}}} | period_s={{{sidrot}}} | suffix=  }}|8}} m|Outside sphere of influence}}}}
-->    |Outside sphere of influence<!--
 
--> }}}}|??}}|??}}|??}}}}
 
 
|-
 
|-
 
| [[w:Sphere_of_influence_(astrodynamics)|Sphere of Influence]]
 
| [[w:Sphere_of_influence_(astrodynamics)|Sphere of Influence]]
|{{#ifeq: {{{SoI|}}}|∞|∞|{{#if: {{{SoI|}}}|{{sigfigs|{{{SoI}}}|8}}|??}} m}}
+
| {{#ifeq: {{{SoI|}}}|∞|∞|{{sigfigs|{{{SoI}}}|8}} m}}
 
|-
 
|-
{{#if: {{{highest|}}}|{{!}} Highest elevation {{!}}{{!}} {{{highest|??}}} m}}
+
{{#if: {{{highest|}}}|{{!}} Highest elevation {{!}}{{!}} {{{highest}}} m}}
 
|-
 
|-
 
| colspan="2" | '''{{#switch:{{{1}}}
 
| colspan="2" | '''{{#switch:{{{1}}}
Line 74: Line 72:
 
|#default=Atmospheric Characteristics
 
|#default=Atmospheric Characteristics
 
}}'''
 
}}'''
{{PlanetBoxRow|[[w:atmosphere|Atmosphere Present]]                    |{{{atmosyorn|??}}}|}}
+
{{PlanetBoxRow|[[w:atmosphere|Atmosphere Present]]                    |{{{atmosyorn}}}|}}
{{#switch:{{{atmosyorn|??}}}
+
{{#switch:{{{atmosyorn}}}
 
|#default=
 
|#default=
{{PlanetBoxRow|[[w:Atmospheric_pressure|Atmospheric Pressure]]        |{{#if: {{{atmoskPa|}}}|{{{atmoskPa|}}}|{{#if: {{{atmosatm|}}}|{{sigfigs|{{#expr: {{{atmosatm|}}} * 101.327}}|3}}|??}}}} |kPa}}
+
{{PlanetBoxRow|[[w:Atmospheric_pressure|Atmospheric Pressure]]        |{{sigfigs|{{#expr: {{{atmosatm}}} * 101.327}}|3}} |kPa}}
{{PlanetBoxRow|                                                      |{{#if: {{{atmosatm|}}}|{{{atmosatm|}}}|{{#if: {{{atmoskPa|}}}|{{sigfigs|{{#expr: {{{atmoskPa|}}} / 101.327}}|3}}|??}}}} |atm}}
+
{{PlanetBoxRow|                                                      |{{{atmosatm}}} |atm}}
{{PlanetBoxRow|[[w:Scale_height|Scale Height]]                        |{{{atmossh|??}}}  |m}}
+
{{PlanetBoxRow|[[w:Scale_height|Scale Height]]                        |{{{atmossh}}}  |m}}
{{PlanetBoxRow|[[w:Atmospheric_height|Atmospheric Height]]            |{{#if: {{{atmossh|}}}|{{sigfigs|{{#expr: ln1e-6 * -{{{atmossh|}}}}}|8}}|??}}  |m}}
+
{{PlanetBoxRow|[[w:Atmospheric_height|Atmospheric Height]]            |{{{sigfigs|{{#expr: ln1e-6 * -{{{atmossh|}}}}}|8}}  |m}}
{{PlanetBoxRow|[[w:Atmospheric_temperature|Temperature<sub>min</sub>]]|{{{T-minC|??}}} °C <small>{{#if: {{{T-minC|}}}|{{#expr: {{{T-minC}}} + 273.15}}|??}} K</small>|}}
+
{{#if: T-minC|{{PlanetBoxRow|[[w:Atmospheric_temperature|Temperature<sub>min</sub>]]|{{{T-minC|??}}} °C <small>{{#expr: {{{T-minC}}} + 273.15}}|??}} K</small>}}
{{PlanetBoxRow|[[w:Atmospheric_temperature|Temperature<sub>max</sub>]]|{{{T-maxC|??}}} °C <small>{{#if: {{{T-maxC|}}}|{{#expr: {{{T-maxC}}} + 273.15}}|??}} K</small>|}}
+
{{#if: T-maxC|{{PlanetBoxRow|[[w:Atmospheric_temperature|Temperature<sub>max</sub>]]|{{{T-maxC|??}}} °C <small>{{#expr: {{{T-maxC}}} + 273.15}}|??}} K</small>}}
{{PlanetBoxRow|[[w:Oxygen|Oxygen Present]]                            |{{{O2yorn|??}}}  |}}
+
{{PlanetBoxRow|[[w:Oxygen|Oxygen Present]]                            |{{{O2yorn}}}  |}}
 
|No=
 
|No=
 
}}
 
}}
Line 103: Line 101:
 
|SoI=200000
 
|SoI=200000
 
|highest=2357
 
|highest=2357
|atmosyorn=yes
+
|atmosyorn=Yes
<!-- |atmoskPa=?? -->
 
 
|atmosatm=1
 
|atmosatm=1
 
|atmossh=3000
 
|atmossh=3000
Line 121: Line 118:
 
* Sidereal Rotation Period: Sidereal Rotational Velocity, Synchronous Orbit
 
* Sidereal Rotation Period: Sidereal Rotational Velocity, Synchronous Orbit
 
* Scale Height: Atmospheric Height
 
* Scale Height: Atmospheric Height
 +
* Atmospheric pressure (in atm): Atmospheric pressure (in kPa)
  
It will also calculate the Atmospheric Pressure from '''atm''' to '''kPa''' and vice versa. If the periapsis isn't defined it will assume a circular orbit where the apoapsis is identical to the periapsis.
+
If the periapsis isn't defined it will assume a circular orbit where the apoapsis is identical to the periapsis.
  
 
To deactivate orbital information (for example [[Kerbol]]) set <tt><nowiki>{{{orbityorn}}}</nowiki></tt> to <tt>no</tt>. The atmospheric information can be hidden when <tt><nowiki>{{{atmosyorn}}}</nowiki></tt> is set to <tt>no</tt>. On all other values it will show the atmospheric entries.
 
To deactivate orbital information (for example [[Kerbol]]) set <tt><nowiki>{{{orbityorn}}}</nowiki></tt> to <tt>no</tt>. The atmospheric information can be hidden when <tt><nowiki>{{{atmosyorn}}}</nowiki></tt> is set to <tt>no</tt>. On all other values it will show the atmospheric entries.
 +
 +
== Parameters ==
 +
{| class="wikitable mw-datatable"
 +
! Name
 +
! Optional
 +
! Description
 +
|-
 +
| <tt>Class</tt>
 +
| No
 +
| Class of celestial object: [[Star]], [[Planet]], [[Dwarf Planet]] or [[Moon]]
 +
|-
 +
| <tt>File</tt>
 +
| No
 +
| Filename to image of the celestial object
 +
|-
 +
| <tt>Parent</tt>
 +
| Yes
 +
| Object which this object does orbit. Default: Not set
 +
|-
 +
| <tt>orbityorn</tt>
 +
| Yes
 +
| Does this object orbit another object (usually when Parent is set). '''no''' to hide. Default: Yes
 +
|-
 +
| style="padding-left:2em" | <tt>apoap</tt>
 +
| No
 +
| Apoapsis in meters
 +
|-
 +
| style="padding-left:2em" | <tt>periap</tt>
 +
| Yes
 +
| Periapsis in meters. Default: Apoapsis
 +
|-
 +
| style="padding-left:2em" | <tt>orbinc</tt>
 +
| No
 +
| Orbital inclination in degrees.
 +
|-
 +
| style="padding-left:2em" | <tt>anomaly</tt>
 +
| No
 +
| Mean anomaly in degrees
 +
|-
 +
| style="padding-left:2em" | <tt>orbps</tt>
 +
| No
 +
| Orbital period in seconds
 +
|-
 +
| <tt>radius</tt>
 +
| No
 +
| Radius in meters
 +
|-
 +
| <tt>mass</tt>
 +
| No
 +
| Mass in kilograms
 +
|-
 +
| <tt>sidrot</tt>
 +
| No
 +
| Siderial period in seconds
 +
|-
 +
| <tt>SoI</tt>
 +
| No
 +
| Sphere of influence in meters. Special value: ∞
 +
|-
 +
| <tt>highest</tt>
 +
| Yes
 +
| Highest elevation in meters. Default: Not set
 +
|-
 +
| <tt>atmosyorn</tt>
 +
| Yes
 +
| Does this celestial object have a atmosphere? '''No''' to hide. Default: Yes
 +
|-
 +
| style="padding-left:2em" | <tt>atmosatm</tt>
 +
| No
 +
| Atmospheric pressure in atm.
 +
|-
 +
| style="padding-left:2em" | <tt>atmossh</tt>
 +
| No
 +
| Atmospheric scale height in meters
 +
|-
 +
| style="padding-left:2em" | <tt>T-minC</tt>
 +
| No
 +
| Lowest temperature in degrees celsius
 +
|-
 +
| style="padding-left:2em" | <tt>T-maxC</tt>
 +
| No
 +
| Highest temperature in degrees celsius
 +
|-
 +
| style="padding-left:2em" | <tt>O2yorn</tt>
 +
| No
 +
| Is oxygen present?
 +
|}
  
 
== Template ==
 
== Template ==
 
<pre><nowiki>{{Planetbox
 
<pre><nowiki>{{Planetbox
|Class=??
+
|Class=?? <!-- Star, Planet, Dwarf Planet, Moon -->
 
|File=??
 
|File=??
|Parent=??
+
|Parent=??  
 
|orbityorn=??
 
|orbityorn=??
|apoap=??
+
|apoap=?? <!-- in meters -->
|periap=??
+
|periap=?? <!-- in meters -->
|orbinc=??
+
|orbinc=?? <!-- in degrees -->
|anomaly=??
+
|anomaly=?? <!-- in degrees -->
|orbps=??
+
|orbps=?? <!-- in seconds -->
|radius=??
+
|radius=?? <!-- in meters -->
|mass=??
+
|mass=?? <!-- in kilograms -->
|sidrot=??
+
|sidrot=?? <!-- in seconds -->
|SoI=??
+
|SoI=?? <!-- in meters -->
|highest=??
+
|highest=?? <!-- in meters (optional) -->
 
|atmosyorn=??
 
|atmosyorn=??
|atmoskPa=??
 
 
|atmosatm=??
 
|atmosatm=??
 
|atmossh=??
 
|atmossh=??

Revision as of 12:49, 19 February 2013

Template:Planetbox

Dependencies

Some values are calculated automatically:

  • Periapsis: Semi-major axis, Orbital eccentricity, Orbital velocity
  • Apoapsis: Semi-major axis, Orbital eccentricity, Orbital velocity
  • Orbital period: Orbital velocity
  • Radius: Surface Area, Density, Surface Gravity, Synchronous Orbit
  • Mass: Gravitational Parameter, Density, Surface Gravity, Synchronous Orbit
  • Sidereal Rotation Period: Sidereal Rotational Velocity, Synchronous Orbit
  • Scale Height: Atmospheric Height
  • Atmospheric pressure (in atm): Atmospheric pressure (in kPa)

If the periapsis isn't defined it will assume a circular orbit where the apoapsis is identical to the periapsis.

To deactivate orbital information (for example Kerbol) set {{{orbityorn}}} to no. The atmospheric information can be hidden when {{{atmosyorn}}} is set to no. On all other values it will show the atmospheric entries.

Parameters

Name Optional Description
Class No Class of celestial object: Star, Planet, Dwarf Planet or Moon
File No Filename to image of the celestial object
Parent Yes Object which this object does orbit. Default: Not set
orbityorn Yes Does this object orbit another object (usually when Parent is set). no to hide. Default: Yes
apoap No Apoapsis in meters
periap Yes Periapsis in meters. Default: Apoapsis
orbinc No Orbital inclination in degrees.
anomaly No Mean anomaly in degrees
orbps No Orbital period in seconds
radius No Radius in meters
mass No Mass in kilograms
sidrot No Siderial period in seconds
SoI No Sphere of influence in meters. Special value: ∞
highest Yes Highest elevation in meters. Default: Not set
atmosyorn Yes Does this celestial object have a atmosphere? No to hide. Default: Yes
atmosatm No Atmospheric pressure in atm.
atmossh No Atmospheric scale height in meters
T-minC No Lowest temperature in degrees celsius
T-maxC No Highest temperature in degrees celsius
O2yorn No Is oxygen present?

Template

{{Planetbox
|Class=?? <!-- Star, Planet, Dwarf Planet, Moon -->
|File=??
|Parent=?? 
|orbityorn=??
|apoap=?? <!-- in meters -->
|periap=?? <!-- in meters -->
|orbinc=?? <!-- in degrees -->
|anomaly=?? <!-- in degrees -->
|orbps=?? <!-- in seconds -->
|radius=?? <!-- in meters -->
|mass=?? <!-- in kilograms -->
|sidrot=?? <!-- in seconds -->
|SoI=?? <!-- in meters -->
|highest=?? <!-- in meters (optional) -->
|atmosyorn=??
|atmosatm=??
|atmossh=??
|T-minC=??
|T-maxC=??
|O2yorn=??
}}

Example

Example used on this page:

{{Planetbox
|Class=Planet
|File=Image-needed.png
|Parent=Gilly
|orbityorn=yes
|apoap=1337000
|periap=470000
|orbinc=7.4
|anomaly=4.2
|orbps=36000
|radius=10000
|mass=1e20
|sidrot=3600
|SoI=200000
|highest=2357
|atmosyorn=yes
|atmosatm=1
|atmossh=3000
|T-minC=-42
|T-maxC=47
|O2yorn=no
}}