Expand description
Converting motor files between RASP .eng and RockSim .rse.
Both formats give a motor’s name, maker, casing, masses, delays and thrust curve; the rules
for each are in docs/format/eng.md and docs/format/rse.md. What differs is how they say
it, and what .rse adds:
.eng | .rse | |
|---|---|---|
| masses | kg | g |
| delays | 6-10-14, P for plugged | 6,10,14, 1000 for plugged |
the curve’s (0, 0) origin | implicit, “should not be specified” | written out, in every observed file |
| comments | ; lines before the header | one <comments> text |
type, stated figures, m and cg per point | none | Type, Itot, avgThrust, peakThrust, burn-time, massFrac, Isp, … |
eng_to_rse fills what .eng lacks the way the observed .rse files do (the rse page’s
writer policy): a (0, 0) origin when the curve starts after ignition; Itot by the
trapezoid rule; peakThrust; burn-time, the last time; avgThrust = Itot / burn-time;
m, the propellant left, m(t) = m₀ (1 − I(t) / Itot) with m₀ the propellant mass and I
the trapezoidal impulse; cg, half the length; both auto-calc flags 1; massFrac = 100 m₀ / initWt; Isp = Itot / (m₀ g₀); and Type="unspecified", which RockSim’s guide
requires and the files use when they don’t say.
rse_to_eng drops what .eng can’t hold, each named in a ConvertWarning. hpr uses
none of it for a solid motor: it works the mass and center of gravity out from the curve and
the masses (SolidMotor::from_envelope). It refuses a
hybrid, whose Type a .eng file couldn’t keep, and an engine without delays it can read,
since a .eng header must give them. A .eng header is seven fields split on spaces, and
OpenRocket refuses more, so a name or a maker of several words is written with _ between
them (Estes_Industries,_Inc.).
Round trips. Masses move between kg and g by moving the decimal point in their shortest
digits, not by multiplying, so a mass of at most 15 significant digits, in the normal range
of a double, comes back bit for bit. One of 16 or 17 digits may not (2 of the 29 bundled
.eng files write one, such as 0.0036000000000000003), and a warning says so.
The thrust curve hpr flies comes back bit for bit both ways, and so do the diameter, the length, and the masses above. The rest may come back written differently:
- delays spelled with commas, spaces,
por1000come back in the other spelling, and read as the same delays (DelayList); - a name or maker of several words comes back with
_between them, said in a warning; - a
(0, 0)origin is written in.rseand left out of.eng, so a curve that gives it the other way comes back the usual way; - comments lose blank lines and the spaces ending a line, said in a warning; comments after a
.engfile’s last motor are dropped, said in a warning; - the
.rsefigures.engcan’t hold are dropped, said in a warning, and filled again by the rules above.
After one conversion, a file converts to the other format and back to the same bytes, but for
a .eng motor whose delays name none (-): its .rse file leaves them out, and a .eng
header must give them, so converting it back needs them given again.
Structs§
- Convert
Warning - Something the other format couldn’t hold as it was.
- Converted
- A converted file and what the conversion said.
Constants§
- RSE_
PLUGGED - The delay a
.rsefile writes for a plugged motor, where.engwritesP. - UNSPECIFIED_
TYPE - The
Typeeng_to_rsewrites: a.engfile doesn’t say.
Functions§
- eng_
to_ rse - A
.engfile as a.rsefile, filled the way RockSim’s files are (see the module’s docs). - g_to_kg
- Grams to kilograms, by moving the decimal point as
kg_to_gdoes. - kg_to_g
- Kilograms to grams, by moving the decimal point in the mass’s shortest digits rather than
multiplying:
0.0041kg is4.1g, where0.0041 × 1000is4.1000000000000005. - rse_
to_ eng - A
.rsefile as a.engfile, with what.engcan’t hold named in the warnings.