Command Line Interface

Note that there is an official web frontend for kspalculator at: https://kspalculator.appspot.com/.

Here we explain how to use the kspalculator command line tool, but the basic concepts don’t vary.

Installation

Make sure you have Python, at least version 3.4 installed.

If you have pip installed, you may install kspalculator using

pip3 install kspalculator

Alternatively, fetch the most recent version of kspalculator at https://github.com/aandergr/kspalculator/releases. Installation is then done by unzipping the archive and calling

python3 setup.py install

Invocation

kspalculator is invoked on the command line. Syntax is

kspalculator [--boosters] [--cost] [preferences] <payload> <Delta-v[:acceleration[:pressure]] [...]>

where payload is the payload in kg and Delta-v[:acceleration[:pressure]] are tuples of required Delta-v in m/s, acceleration in m/s² and environment pressure in ATM (0.0 = vacuum, 1.0 = kerbin sea level pressure) for each flight phase. You have to specify at least one of these tuples. Acceleration and pressure are optional and default to zero.

If you add --boosters, kspalculator will consider adding solid fuel boosters. This is very useful for launcher stages.

Options for preferences are:

  • --preferred-radius {tiny,small,large,extralarge}: Preferred radius of the stage. Tiny = 0.625 m, Small = 1.25 m, Large = 2.5 m (Rockomax), ExtraLarge = 3.75 m (Kerbodyne),
  • --electricity: Prefer engines generating electricity,
  • --length or --lander: Prefer engines which are short or radially mounted,
  • --gimbal: Prefer engines having gimbal. If you specify this option twice, a higher gimbal range is considered better.
  • --rcs or --monopropellant: Prefer engines using RCS fuel (monopropellant), i.e. prefer the O-10 Puff engine.

In contrast to the constraints, preferences aren’t hard requirements for a design suggestion to be shown up. Adding preferences only adds criteria under which designs may be considered better than others. This means, specifying more preferences, more designs will be suggested.

If you specify --cost, results will be sorted by their cost instead of their mass.

For a brief reference for options, call kspalculator --help. To display the version of the tool as well as the corresponding version of Kerbal Space Program, call kspalculator --version.

Note that kspalculator calculates optimal designs for one stage only (or two if you allow boosters, where the first is a stage only utilizing solid fuel boosters). It will never split up your design into multiple stages.