STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1"""
2csv_to_eng - Convert CSV thrust curves to RASP .eng engine files.
3
4================================================================================
5OVERVIEW
6================================================================================
7
8This module reads thrust curve data from CSV files and produces properly
9formatted RASP/RockSim-style .eng engine files for use in rocket simulation
10software.
11
12================================================================================
13EXPECTED CSV FORMAT
14================================================================================
15
16Minimal CSV (just time and thrust):
17 time,thrust
18 0.0,0.0
19 0.05,120.5
20 0.1,145.2
21 ...
22 2.5,0.0
23
24With metadata columns:
25 time,thrust,engine_name,diameter_mm,length_mm,prop_mass_kg,total_mass_kg,manufacturer,delays
26 0.0,0.0,K1000,54,326,0.85,1.45,Acme,6-10-14
27 0.05,980.5,,,,,,,
28 ...
29
30Alternative column names supported:
31 - Time: time, t, seconds, time_s, time_ms
32 - Thrust: thrust, F, force, thrust_N, thrust_lbf
33
34================================================================================
35EXAMPLE CLI USAGE
36================================================================================
37
38# Basic conversion (auto-detect columns and units):
39python -m csv_to_eng --input curve.csv --output motor.eng
40
41# With metadata overrides:
42python -m csv_to_eng --input curve.csv --output motor.eng \\
43 --name "K1000" --diameter-mm 54 --length-mm 326 \\
44 --prop-mass-kg 0.85 --total-mass-kg 1.45 \\
45 --manufacturer "Acme Rocketry" --delays "6-10-14"
46
47# Specify units explicitly:
48python -m csv_to_eng --input curve.csv --output motor.eng \\
49 --thrust-units lbf --time-units ms
50
51================================================================================
52EXAMPLE OUTPUT .eng FILE
53================================================================================
54
55; Generated by csv_to_eng
56K1000 54 326 6-10-14 0.85 1.45 Acme_Rocketry
570.000 0.0
580.050 980.5
590.100 1023.4
600.150 1015.2
61...
622.500 0.0
63
64================================================================================
65LIBRARY API
66================================================================================
67
68 from csv_to_eng import (
69 EngineMetadata,
70 read_csv_curve,
71 normalize_curve,
72 write_eng,
73 convert,
74 )
75
76 # Full conversion in one call:
77 convert("input.csv", "output.eng", name="K1000", manufacturer="Acme")
78
79 # Step-by-step:
80 metadata, points = read_csv_curve("input.csv")
81 points = normalize_curve(points)
82 metadata.name = "K1000"
83 write_eng("output.eng", metadata, points)
84
85"""
86
87from .core import (
88 EngineMetadata,
89 read_csv_curve,
90 normalize_curve,
91 write_eng,
92 convert,
93 LBF_TO_N,
94)
95
96__all__ = [
97 "EngineMetadata",
98 "read_csv_curve",
99 "normalize_curve",
100 "write_eng",
101 "convert",
102 "LBF_TO_N",
103]
104
105__version__ = "1.0.0"