STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1
"""
2
csv_to_eng - Convert CSV thrust curves to RASP .eng engine files.
3
4
================================================================================
5
OVERVIEW
6
================================================================================
7
8
This module reads thrust curve data from CSV files and produces properly
9
formatted RASP/RockSim-style .eng engine files for use in rocket simulation
10
software.
11
12
================================================================================
13
EXPECTED CSV FORMAT
14
================================================================================
15
16
Minimal 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
24
With 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
30
Alternative column names supported:
31
- Time: time, t, seconds, time_s, time_ms
32
- Thrust: thrust, F, force, thrust_N, thrust_lbf
33
34
================================================================================
35
EXAMPLE CLI USAGE
36
================================================================================
37
38
# Basic conversion (auto-detect columns and units):
39
python -m csv_to_eng --input curve.csv --output motor.eng
40
41
# With metadata overrides:
42
python -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:
48
python -m csv_to_eng --input curve.csv --output motor.eng \\
49
--thrust-units lbf --time-units ms
50
51
================================================================================
52
EXAMPLE OUTPUT .eng FILE
53
================================================================================
54
55
; Generated by csv_to_eng
56
K1000 54 326 6-10-14 0.85 1.45 Acme_Rocketry
57
0.000 0.0
58
0.050 980.5
59
0.100 1023.4
60
0.150 1015.2
61
...
62
2.500 0.0
63
64
================================================================================
65
LIBRARY 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
87
from
.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"
EngineDesign
csv_to_eng
__init__.py
Generated by
1.15.0