-
Notifications
You must be signed in to change notification settings - Fork 70
Principia configuration files
string
is any text that can be stored in a value of a KSP configuration node and retrieved by GetValue
.
fixed_step_size_integrator
is the name of a fixed step size integrator supported by Principia.
[Note that this is case-sensitive.]
See also the comments on the declarations of the symplectic partitioned Runge-Kutta integrators, symplectic Runge-Kutta-Nyström integrators, and symmetric linear multistep integrators and the references cited therein for more on these integrators.
fixed_step_size_integrator ⩴ BLANES_MOAN_2002_SRKN_6B
| BLANES_MOAN_2002_SRKN_11B
| BLANES_MOAN_2002_SRKN_14A
| MCLACHLAN_1995_SB3A_4
| MCLACHLAN_1995_SB3A_5
| MCLACHLAN_ATELA_1992_ORDER_4_OPTIMAL
| MCLACHLAN_ATELA_1992_ORDER_5_OPTIMAL
| OKUNBOR_SKEEL_1994_ORDER_6_METHOD_13
| QUINLAN_1999_ORDER_8A
| QUINLAN_1999_ORDER_8B
| QUINLAN_TREMAINE_1990_ORDER_8
| QUINLAN_TREMAINE_1990_ORDER_10
| QUINLAN_TREMAINE_1990_ORDER_12
| QUINLAN_TREMAINE_1990_ORDER_14
floating_point_number
is a floating point number as accepted by
std::strtod
.
signed_integer
is a signed integer as accepted by std::strtol
in base 10.
unit
is one of the following units, as defined
in quantities/parser_body.hpp:
length_unit ⩴ μm | mm | cm | m | km | au
time_unit ⩴ ms | s | min | h | d
power_unit ⩴ W
angle_unit ⩴ deg | ° | rad
solid_angle_unit ⩴ sr
unit ⩴ length_unit | time_unit | power_unit | angle_unit | solid_angle_unit
quantity
is defined by the following grammar from
quantities/parser.hpp:
quantity ⩴ floating_point_number quotient_unit quotient_unit ⩴ quotient_unit / exponentiation_unit | / exponentiation_unit | product_unit product_unit ⩴ exponentiation_unit [product_unit] exponentiation_unit ⩴ unit [^ exponent] exponent ⩴ signed_integer
We will use quantity(length)
, quantity(length / time^2)
, etc. to refer to quantities that are required
to have the dimensions given in parentheses.
Example:
-1.5e+09 km/s
is aquantity(length / time)
.
instant
is a date either given as a Julian Date or a Modified Julian Date (where the decimal mark must be a full stop "."), or as an ISO 8601 complete representation of date and time, where Principia requires that the comma "," be used as a decimal sign if a decimal fraction of seconds is used.
It is interpreted as TT (Temps Terrestre, terrestrial time).
Example:
JD2451545.0
,MJD51544.5
,2000-01-01T12:00:00
,1999-W52-6T12:00:00,000
,2000001T120000
all represent the standard epoch J2000.
colour
is an HTML style colour code in RGB order.
Example:
#aaff32
style
is one of the following styles, as defined
in ksp_plugin_adapter/gl_lines.cs:
style ⩴ solid | dashed | faded
Principia supports four top-level configuration nodes.
There may be at most one of each node [for instance, having two principia_gravity_model
nodes will result in a crash].
These are principia_gravity_model
which defines the physical properties of the celestial bodies,
principia_initial_state
which defines their initial positions and velocities,
principia_numerics_blueprint
which defines the numerical methods used to compute the evolution of the system,
and principia_draw_styles
which defines drawing styles for trajectories.
If principia_initial_state
is provided, it must define the initial positions and velocities for all celestial bodies,
and principia_gravity_model
must be sufficient for all celestial bodies.
If principia_initial_state
is not provided, the initial state is obtained by interpreting KSP's orbital elements
as osculating elements for Jacobi coordinates.
In that case, principia_gravity_model
need not cover all celestial bodies. It must be nominal for the bodies it covers.
The principia_gravity_model
configuration consists of a sequence of body
configuration nodes.
A body
configuration node contains the following values:
-
This is the
name
of the celestial body whose gravity model is being defined. -
gravitational_parameter
: an optionalquantity(length^3 / time^2)
.The gravitational parameter μ. Corresponds to the stock
gravParameter
. -
reference_instant
: an optionalinstant
.This is the instant t0 at which the rotation W of the body is W0.
Defaults to JD2451545.0 (2000-01-01T12:00:00).
-
axis_right_ascension
: an optionalquantity(angle)
.The angle α0.
Defaults to -90°.
-
axis_declination
: an optionalquantity(angle)
.The angle δ0.
Defaults to 90°.
-
reference_angle
: an optionalquantity(angle)
.The angle W0.
Defaults to the stock
initialRotation
. -
angular_frequency
: an optionalquantity(angle / time)
.The time derivative Ẇ of the angle W.
Defaults to the stock
angularV
, which is indirectly configurable in Kopernicus, as it is |2π rad /rotationPeriod
|.TODO(eggrobin): we don't handle retrograde rotation correctly when configured with Kopernicus (with a negative period), since
angularV
is an absolute value... -
reference_radius
: an optionalquantity(length)
.The reference radius ae used to make the spherical harmonics dimensionless.
Defaults to the stock
radius
. -
j2
: an optionalfloating_point_number
.The unnormalized zonal harmonic J2.
Defaults to 0.
-
geopotential_row
: an optional sequence ofgeopotential_row
configuration nodes describing the spherical harmonics of the geopotential of the body. Ageopotential_row
contains the following values:-
degree
: a requiredsigned_integer
.The degree of the geopotential row.
-
geopotential_column
: an optional sequence ofgeopotential_column
configuration nodes describing the spherical harmonics for the given degree. Ageopotential_column
contains the following values:-
order
: a requiredsigned_integer
.The order of the geopotential column.
-
j
: an optionalfloating_point_number
.The unnormalized coefficient of the zonal spherical harmonic of the given degree. For degree n, this is traditionally known as Jn.
-
cos
: an optionalfloating_point_number
.The normalized coefficient of the cosine spherical harmonic of the given degree and order. For degree n and order m this is traditionally known as Cnm.
-
sin
: a requiredfloating_point_number
.The normalized coefficient of the sine spherical harmonic of the given degree and order. For degree n and order m this is traditionally known as Snm.
-
-
A body
configuration node is nominal if:
-
j2
andgeopotential_row
s are not present at the same time; - either
reference_radius
is absent, or one ofj2
andgeopotential_row
is present; - no two
geopotential_row
s share the samedegree
; - within each
geopotential_row
, no twogeopotential_columns
share the sameorder
; - each
geopotential_column
contains exactly one ofcos
andj
; - each
geopotential_column
whosedegree
is not 0 contains acos
.
A sufficient body
configuration node is a nominal body
configuration node where:
-
gravitational_parameter
,reference_instant
,axis_right_ascension
,axis_declination
,reference_angle
, andangular_frequency
are present; -
reference_radius
is present if and only ifj2
orgeopotential_row
s are present.
Example: All
body
nodes in sol_gravity_model.cfg, provided with Principia, are sufficient. The Sun has aj2
. The giant planets havegeopotential_row
s that usej
. The Earth, the Moon, Mars, and some other planets havegeopotential_row
s that usecos
.
The quantities W = W0 + Ẇ (t - t0), α0, and δ0 are Euler angles defining the orientation of the celestial body, as shown on figure 1 of the 2009 report of the IAU Working Group on Cartographic Coordinates and Rotational Elements, where t is terrestrial time.
The gravitational potential used is the one given in equation 6.1 of IERS technical note 36 (IERS conventions 2010), where:
μ = GM and J2 = -C̄20 √5.
Note: A dynamically oblate body has a positive J2. The values for the planets of the solar system can be found, with references, in sol_gravity_model.proto.txt.
The principia_initial_state
configuration consists of:
- a
game_epoch
value; - a
solar_system_epoch
value; - a sequence of
body
configuration nodes.
The game_epoch
is a required instant
, which is the instant at which the game starts.
The solar_system_epoch
is a required instant
, which is the instant at which the initial state is given.
It is required that solar_system_epoch
≤game_epoch
.
The body
nodes must contain the following values:
-
name
: a requiredstring
. This is thename
of the celestial body whose initial state is being defined. -
x
: a requiredquantity(length)
. The x coordinate of the position. -
y
: a requiredquantity(length)
. The y coordinate of the position. -
z
: a requiredquantity(length)
. The z coordinate of the position. -
vx
: a requiredquantity(length / time)
. The x coordinate of the velocity. -
vy
: a requiredquantity(length / time)
. The y coordinate of the velocity. -
vz
: a requiredquantity(length / time)
. The z coordinate of the velocity.
Example: The sol_initial_state_jd_2433282_500000000.cfg configuration file, provided with Principia, is a valid
principia_initial_state
node.
The principia_numerics_blueprint
configuration consists of:
- an optional
ephemeris
node; - an optional
history
node; - an optional
psychohistory
node.
The ephemeris
node contains the following values:
-
fixed_step_size_integrator
, a requiredfixed_step_size_integrator
; -
integration_step_size
, a requiredquantity(time)
. -
fitting_tolerance
, a requiredquantity(length)
. -
geopotential_tolerance
, a requiredfloating_point_number
.
The integration of the motion of the celestial bodies is performed by the ephemeris with the
given fixed_step_size_integrator
at the given integration_step_size
. The result of the integration is approximated by a polynomial with a maximum error given by fitting_tolerance
. Any geopotential effects are ignored if their relative magnitude with respect to the central force is less than geopotential_tolerance
.
Example: The following
principia_numerics_blueprint
node describes the default numerics blueprint used by Principia.principia_numerics_blueprint { ephemeris { fixed_step_size_integrator = QUINLAN_TREMAINE_1990_ORDER_12 integration_step_size = 10 min fitting_tolerance = 1 mm geopotential_tolerance = 0x1.0p-24 } }
☡ The history
and psychohistory
nodes are reserved for internal use.
Modders should not define these nodes.
The history
node contains the following values:
-
fixed_step_size_integrator
, a requiredfixed_step_size_integrator
; -
integration_step_size
, a requiredquantity(time)
.
The psychohistory
node contains the following values:
-
adaptive_step_size_integrator
, a requiredadaptive_step_size_integrator
; -
length_integration_tolerance
, a requiredquantity(length)
; -
speed_integration_tolerance
, a requiredquantity(length / time)
.
The principia_draw_styles
configuration consists of:
- an optional
history
node; - an optional
prediction
node; - an optional
flight_plan
node; - an optional
burn
node; - an optional
target_history
node; - an optional
target_prediction
node.
Each of these nodes contain the same set of values:
-
colour
, a requiredcolour
; -
style
, a requiredstyle
.
Example: The following
principia_draw_styles
node describes the default draw styles used by Principia.principia_draw_styles { history { colour = #aaff32 // Lime style = faded } prediction { colour = #ed0dd9 // Fuchsia style = dashed } flight_plan { colour = #8f99fb // Periwinkle Blue style = solid } burn { colour = #ff81c0 // Pink style = solid } target_history { colour = #fac205 // Goldenrod style = faded } target_prediction { colour = #c292a1 // LightMauve style = solid } }
The symmetric linear multistep integrators tend to be faster when they have converged to small errors, but they can fail catastrophically if they are not yet converged.
The single-step methods (symplectic partitioned Runge-Kutta, symplectic Runge-Kutta-Nyström) produce physically credible behaviour even when they have errors resulting from an overly large time step.
Solar system designers should test the actual stability of their system with a symplectic Runge-Kutta-Nyström method and a small time step, and then try increasing the step size and switching to a linear multistep integrator to reduce computational cost for their users.
The constraint that there may be at most one of each top-level configuration applies after ModuleManager has run.
In the absence of other mods, none of the configurations are present.
With RealSolarSystem, the principia_gravity_model
and principia_initial_state
nodes are both present, since they
use a :NEEDS[RealSolarSystem]
clause.
Modders should make careful use the @
operator (modify an existing node) and :NEEDS[]
clause (condition on the presence of a mod) to ensure the requirement is met.
Example: a modder creating a mod AdditionalRealBodies which adds bodies to RealSolarSystem should append their initial states to
principia_initial_state
and their sufficient gravity models toprincipia_gravity_model
with@principia_initial_state:FOR[AdditionalRealBodies]:NEEDS[RealSolarSystem]
and@principia_gravity_model:FOR[AdditionalRealBodies]:NEEDS[RealSolarSystem]
.
A modder creating a new solar system mod NeuesSonnensystem should create nominal gravity models in a node without any ModuleManager predicates,
principia_gravity_model
. Alternatively, they can create sufficient gravity models in that node and provide an initial state inprincipia_initial_state
.
If the author of NeuesSonnensystem wishes some aspect of the system to be conditioned on the presence or absence of Principia, they can do so in a patch
@Kopernicus:FOR[NeuesSonnensystem]:NEEDS[Principia]
or@Kopernicus:FOR[NeuesSonnensystem]:NEEDS[!Principia]
.
Note that the mathematical operators of ModuleManager will not work on the quantity
values of Principia
configuration nodes. Since ModuleManager is Turing-complete, we
leave it as an exercise to the reader to perform arithmetic on these values.
Modders should refer to the ModuleManager thread for documentation.
- Kronecker
- Колмогоров
- von Koch
- Klein
- Kleene
- 𒁹𒆠𒁷𒉡
- کاشانی
- Καραθεοδωρή
- Канторович
- 掛谷
- Julia
- Jordan
- 賈憲
- 𓇹𓄟𓋴𓏲
- Jensen
- Jacobi
- 岩澤
- 伊藤
- ابن الهيثم
- Ὑπατία
- Hurwitz
- Householder
- Horner
- l’Hôpital
- Ἱπποκράτης
- Ἱππίας
- Ἵππασος
- Ἵππαρχος
- Hilbert
- Hesse
- Ἥρων
- Hermite
- Heine
- Hausdorff
- हरीश चंद्र
- Hardy
- Hamilton
- Halley
- Hadamard
- Haar
- Grothendieck
- Grossmann
- Gröbner
- Green
- Grassmann
- Goldbach
- Gödel
- Germain
- Гельфонд
- Гельфанд
- Gauss
- Gateaux
- Galois
- Gallai
- Galileo
- Fuchs
- Fubini
- Frobenius
- Frenet
- Frege
- Fréchet
- פרנקל
- Fourier
- Fibonacci
- del Ferro
- Ferrari
- Fermat
- Fatou
- Fáry
- Fano
- Euler
- Εὐκλείδης
- Εὔδοξος
- Erdős
- Ἐρατοσθένης
- Διόφαντος
- Descartes
- Desargues
- Δημόκριτος
- Dedekind
- Darboux
- Cramer
- Coxeter
- Cohen
- Clifford
- Christoffel
- 陈景润
- Chasles
- Cesàro
- Чебышёв
- Cayley
- Cauchy
- Catalan
- Cartan
- Cardano
- Cantor
- بوژگانی
- Burnside
- Буняковский
- Buffon
- Brouwer
- Bourbaki
- Borel
- Bolzano
- Bessel
- Бернштейн
- Bernoulli
- Banach
- Agnesi
- Ackermann
- Abel