Skip to content

Commit 2bf6dcb

Browse files
committed
Properly include motor metadata into the database and support multiple thrustcurves
1 parent 02309e8 commit 2bf6dcb

File tree

8 files changed

+10142
-97
lines changed

8 files changed

+10142
-97
lines changed

README.md

Lines changed: 83 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,25 @@ The `metadata.json` structure is defined as follows:
4949

5050
## Database Schema
5151

52-
The SQLite schema lives in `schema/V1__initial_schema.sql` and is optimized for fast client lookups. Foreign keys are enabled, with `motors` referencing `manufacturers` and `thrust_data` referencing `motors` (cascade delete).
52+
The SQLite schema lives in `schema/V1__initial_schema.sql` and is optimized for fast client lookups. Foreign keys are enabled with cascade deletes.
53+
54+
### Entity Relationship
55+
56+
```
57+
manufacturers motors thrust_curves thrust_data
58+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
59+
│ id (PK) │◄─────│ mfr_id (FK) │ │ id (PK) │◄───────│ curve_id(FK) │
60+
│ name │ 1:N │ id (PK) │◄────│ motor_id(FK) │ 1:N │ id (PK) │
61+
│ abbrev │ │ tc_motor_id │ 1:N │ tc_simfile_id│ │ time_seconds │
62+
└──────────────┘ │ designation │ │ source │ │ force_newtons│
63+
│ impulse_class│ │ format │ └──────────────┘
64+
│ ... │ │ ... │
65+
└──────────────┘ └──────────────┘
66+
```
67+
68+
- **manufacturers****motors**: One manufacturer has many motors
69+
- **motors****thrust_curves**: One motor can have multiple thrust curves (different sources/measurements)
70+
- **thrust_curves****thrust_data**: One curve has many time/thrust data points
5371

5472
### Tables and Columns
5573

@@ -60,51 +78,95 @@ The SQLite schema lives in `schema/V1__initial_schema.sql` and is optimized for
6078
| key | TEXT | Primary key |
6179
| value | TEXT | Required |
6280

63-
Keys stored include `schema_version`, `database_version`, `generated_at`, and `motor_count`.
81+
Keys stored: `schema_version`, `database_version`, `generated_at`, `motor_count`.
82+
83+
---
6484

6585
**manufacturers**
6686

6787
| Column | Type | Notes |
6888
| :--- | :--- | :--- |
6989
| id | INTEGER | Primary key, autoincrement |
70-
| name | TEXT | Required, unique |
71-
| abbrev | TEXT | Optional short name |
90+
| name | TEXT | Required, unique (e.g. "AeroTech") |
91+
| abbrev | TEXT | Short name (e.g. "AT") |
92+
93+
---
7294

7395
**motors**
7496

7597
| Column | Type | Notes |
7698
| :--- | :--- | :--- |
7799
| id | INTEGER | Primary key, autoincrement |
78-
| manufacturer_id | INTEGER | Required, FK to `manufacturers.id` |
79-
| designation | TEXT | Required motor designation |
80-
| common_name | TEXT | Optional display name |
81-
| diameter | REAL | mm |
82-
| length | REAL | mm |
83-
| impulse | REAL | Ns |
84-
| avg_thrust | REAL | N |
85-
| burn_time | REAL | s |
86-
| propellant_weight | REAL | kg |
87-
| total_weight | REAL | kg |
88-
| type | TEXT | e.g. SU (Single Use), RE (Reload) |
89-
| data_file_format | TEXT | e.g. RASP, RSE |
90-
| last_updated_source | TEXT | Source metadata string |
100+
| manufacturer_id | INTEGER | FK to `manufacturers.id` |
101+
| tc_motor_id | TEXT | ThrustCurve.org motor ID |
102+
| designation | TEXT | Required (e.g. "H128W") |
103+
| common_name | TEXT | Display name (e.g. "H128") |
104+
| impulse_class | TEXT | Letter class: A, B, C, ... O |
105+
| diameter | REAL | Motor diameter in mm |
106+
| length | REAL | Motor length in mm |
107+
| total_impulse | REAL | Total impulse in Ns |
108+
| avg_thrust | REAL | Average thrust in N |
109+
| max_thrust | REAL | Maximum thrust in N |
110+
| burn_time | REAL | Burn time in seconds |
111+
| propellant_weight | REAL | Propellant weight in grams |
112+
| total_weight | REAL | Total weight in grams |
113+
| type | TEXT | "SU" (single-use), "reload", "hybrid" |
114+
| delays | TEXT | Available delays, e.g. "0,6,10,14" |
115+
| case_info | TEXT | Case info, e.g. "RMS 38/360" |
116+
| prop_info | TEXT | Propellant info, e.g. "White Lightning" |
117+
| sparky | INTEGER | 1 if sparky motor, 0 otherwise |
118+
| info_url | TEXT | URL to motor info page |
119+
| data_files | INTEGER | Number of data files on ThrustCurve |
120+
| updated_on | TEXT | Last update date from ThrustCurve |
121+
122+
---
123+
124+
**thrust_curves**
125+
126+
Each motor can have multiple thrust curves from different sources (certification, manufacturer, user submissions).
127+
128+
| Column | Type | Notes |
129+
| :--- | :--- | :--- |
130+
| id | INTEGER | Primary key, autoincrement |
131+
| motor_id | INTEGER | FK to `motors.id`, cascade delete |
132+
| tc_simfile_id | TEXT | ThrustCurve.org simfile ID |
133+
| source | TEXT | "cert", "mfr", or "user" |
134+
| format | TEXT | "RASP" or "RSE" |
135+
| license | TEXT | "PD", "free", or other |
136+
| info_url | TEXT | URL to simfile info page |
137+
| data_url | TEXT | URL to download simfile |
138+
| total_impulse | REAL | Calculated total impulse (Ns) |
139+
| avg_thrust | REAL | Calculated average thrust (N) |
140+
| max_thrust | REAL | Calculated max thrust (N) |
141+
| burn_time | REAL | Calculated burn time (s) |
142+
143+
---
91144

92145
**thrust_data**
93146

147+
Time/thrust data points for each thrust curve.
148+
94149
| Column | Type | Notes |
95150
| :--- | :--- | :--- |
96151
| id | INTEGER | Primary key, autoincrement |
97-
| motor_id | INTEGER | Required, FK to `motors.id`, cascade delete |
98-
| time_seconds | REAL | Required, seconds |
99-
| force_newtons | REAL | Required, newtons |
152+
| curve_id | INTEGER | FK to `thrust_curves.id`, cascade delete |
153+
| time_seconds | REAL | Time in seconds |
154+
| force_newtons | REAL | Thrust force in Newtons |
155+
156+
---
100157

101158
### Indices
102159

103160
| Index | Table | Columns | Purpose |
104161
| :--- | :--- | :--- | :--- |
105162
| idx_motor_mfr | motors | manufacturer_id | Filter by manufacturer |
106163
| idx_motor_diameter | motors | diameter | Filter by size |
107-
| idx_motor_impulse | motors | impulse | Filter by impulse class |
164+
| idx_motor_impulse | motors | total_impulse | Filter by impulse |
165+
| idx_motor_impulse_class | motors | impulse_class | Filter by class (A-O) |
166+
| idx_motor_tc_id | motors | tc_motor_id | Lookup by ThrustCurve ID |
167+
| idx_curve_motor | thrust_curves | motor_id | Get curves for a motor |
168+
| idx_curve_simfile | thrust_curves | tc_simfile_id | Lookup by simfile ID |
169+
| idx_thrust_curve | thrust_data | curve_id | Get data for a curve |
108170

109171
## Manual Usage
110172

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"manufacturers": [
3+
{
4+
"name": "AeroTech",
5+
"abbrev": "AeroTech"
6+
},
7+
{
8+
"name": "Alpha Hybrids",
9+
"abbrev": "Alpha"
10+
},
11+
{
12+
"name": "Animal Motor Works",
13+
"abbrev": "AMW"
14+
},
15+
{
16+
"name": "Apogee Components",
17+
"abbrev": "Apogee"
18+
},
19+
{
20+
"name": "Cesaroni Technology",
21+
"abbrev": "Cesaroni"
22+
},
23+
{
24+
"name": "Contrail Rockets",
25+
"abbrev": "Contrail"
26+
},
27+
{
28+
"name": "Ellis Mountain",
29+
"abbrev": "Ellis"
30+
},
31+
{
32+
"name": "Estes Industries",
33+
"abbrev": "Estes"
34+
},
35+
{
36+
"name": "Gorilla Rocket Motors",
37+
"abbrev": "Gorilla"
38+
},
39+
{
40+
"name": "Hypertek",
41+
"abbrev": "Hypertek"
42+
},
43+
{
44+
"name": "Kosdon by AeroTech",
45+
"abbrev": "KBA"
46+
},
47+
{
48+
"name": "Kosdon TRM",
49+
"abbrev": "Kosdon"
50+
},
51+
{
52+
"name": "Loki Research",
53+
"abbrev": "Loki"
54+
},
55+
{
56+
"name": "Piotr Tendera Rocket Motors",
57+
"abbrev": "TSP"
58+
},
59+
{
60+
"name": "Propulsion Polymers",
61+
"abbrev": "PP"
62+
},
63+
{
64+
"name": "Public Missiles, Ltd.",
65+
"abbrev": "PML"
66+
},
67+
{
68+
"name": "Quest Aerospace",
69+
"abbrev": "Quest"
70+
},
71+
{
72+
"name": "R.A.T.T. Works",
73+
"abbrev": "RATT"
74+
},
75+
{
76+
"name": "Raketenmodellbau Klima",
77+
"abbrev": "Klima"
78+
},
79+
{
80+
"name": "Roadrunner Rocketry",
81+
"abbrev": "Roadrunner"
82+
},
83+
{
84+
"name": "Rocketvision Flight-Star",
85+
"abbrev": "RV"
86+
},
87+
{
88+
"name": "Sky Ripper Systems",
89+
"abbrev": "SkyR"
90+
},
91+
{
92+
"name": "Southern Cross Rocketry",
93+
"abbrev": "SCR"
94+
},
95+
{
96+
"name": "West Coast Hybrids",
97+
"abbrev": "WCH"
98+
}
99+
]
100+
}

0 commit comments

Comments
 (0)