Skip to main content

Module on_demand

Module on_demand 

Source
Expand description

One motor found by name on ThrustCurve.org, with the curve file to fly it by: for a simulator that lacks the motor’s curve (M4.5b, motors on demand; ADR-154, the decision on fetching them).

find asks ThrustCurve’s search for the name as a designation (F27R/L), then, if no motor has that designation, as a common name (F27), each time with the manufacturer when one is given. Exactly one solid motor must answer: two or more are FindError::Ambiguous, listed by maker and designation so the caller can say which, and a hybrid is refused, as HPR Sim flies commercial solid motors only. It then downloads the motor’s RASP (.eng) files and takes the first that reads as one motor, ranked by who measured it (rank): a certification test, then the manufacturer, then a user, then a file that names no source, in the answer’s order within each. With no RASP file that reads, it does the same with the RockSim (.rse) files. A file the caller names (Wanted::prefer) goes ahead of that order when it reads, the RockSim files read too when the RASP ones lack it (offline with no copy of them, the RASP files are taken as if none were named). find_with takes the caller’s own reading of a file instead, so the file taken is the first the caller can use: a simulator that builds a motor from the file’s masses refuses more than hpr_motor’s reader does.

Every answer goes through the Client, so it is cached (crate::thrustcurve::TTL_S, a day) and, offline, read from the cache alone: a motor found once is found again with no network. Nothing it fetches is bundled: hpr_motor ships ThrustCurve.org’s whole solid catalog as of 2026-10-28 (ADR-288, M5.7), so a fetch is for a newer motor or file. ThrustCurve grants no license for its records and reserves copyright; ADR-287 lets the project use them as published facts, with its credit. Each file carries its own license (DataFile::license), which the caller shows.

How far to trust it. The curve is the file a contributor uploaded, as ThrustCurve serves it; which file is taken is the rule above, not a judgment of which is right. A name is matched as ThrustCurve’s search matches it (on 2026-10-04, a designation exactly but for case), so a name ThrustCurve spells differently is not found rather than wrongly matched.

Structs§

Found
A motor found, with the file to fly it by.
Wanted
The motor to find: a designation or common name, and its manufacturer if known.

Enums§

FindError
Why no motor was found.

Constants§

PROPELLANT_SHORT_BOUND
How far, as a fraction, a taken file’s propellant mass may fall below the one ThrustCurve’s record states (propWeightG) before Found::propellant_warning warns: 5%, and only below.

Functions§

find
Finds wanted on ThrustCurve.org through client, and the file to fly it by, as the module says: the first file that reads_as_one_motor.
find_with
As find, with build reading a file instead: the file taken is the first, in find’s order, that build turns into an M, returned with it. build’s refusal of the last file tried is FindError::NoFile’s reason.
rank
Where a data file’s source puts it in find’s order: cert (a certification test) 0, mfr (the manufacturer) 1, user 2, anything else or none 3.
reads_as_one_motor
Whether a data file reads as exactly one motor’s curve with hpr_motor’s reader: find’s test of a file.