also looking at this
feat: model VTOL electrical consumption and battery authority
#81
15 files
+605
-28
| @@ -11,6 +11,7 @@ profiles in the `/missions` workspace. | ||
| 11 | 11 | ./buddy vtol:hover |
| 12 | 12 | ./buddy vtol:hover --scenario host-loss |
| 13 | 13 | ./buddy vtol:hover --scenario imu-loss |
| 14 | ./buddy vtol:hover --electrical | |
| 14 | 15 | ``` |
| 15 | 16 | |
| 16 | 17 | The native Stacks command defaults to 60 virtual seconds. It accepts `hover`, `imu-loss`, |
| @@ -25,6 +26,7 @@ The copied standalone CLI registers the same command definition: | ||
| 25 | 26 | ```sh |
| 26 | 27 | bun run runtime:cli |
| 27 | 28 | ./storage/runtime-build/cli/drone vtol:hover |
| 29 | ./storage/runtime-build/cli/drone vtol:hover --electrical | |
| 28 | 30 | ``` |
| 29 | 31 | |
| 30 | 32 | ## Model and measurements |
| @@ -50,8 +52,9 @@ RC takeover, kill and sensor loss revoke shared authority. Host death leaves its | ||
| 50 | 52 | stale while the independently ticking modeled board expires the output lease. |
| 51 | 53 | |
| 52 | 54 | The mission's 50 Wh capacity, 1200 W ceiling and 30% reserve are declared budget inputs for this |
| 53 | fictional hover experiment. They are not identified electrical power, measured endurance or a | |
| 54 | complete hybrid energy model. Neutral outputs during an airborne fault do not establish a safe | |
| 55 | fictional hover experiment. The default retains a constant declared-ceiling charge. The optional | |
| 56 | electrical model below supplies fictional propulsion/battery dynamics and delayed energy measurements. | |
| 57 | Neither mode identifies hardware power or measured endurance. Neutral outputs during an airborne fault do not establish a safe | |
| 55 | 58 | emergency landing. Physical flight commands remain disabled. |
| 56 | 59 | |
| 57 | 60 | ## Explicit hover observation in library plans |
| @@ -96,8 +99,8 @@ requires wrapped heading error within 0.1 rad for the complete 500 ms dwell. Hov | ||
| 96 | 99 | therefore have a finite 45-second ceiling; front requests retain 15 seconds. The original 15-second |
| 97 | 100 | back budget still fails without retry or a claimed landing. This is a virtual task allowance, |
| 98 | 101 | not a wall-clock test timeout. The complete declared mission budget is 131,520 ms, or 43.84 Wh at its |
| 99 | 1200 W ceiling, with 100 Wh capacity and 30% reserve. These remain declared planning values, without | |
| 100 | a complete hybrid electrical-power law or measured battery identification. | |
| 102 | 1200 W ceiling, with 100 Wh capacity and 30% reserve. These remain declared planning values. Select | |
| 103 | the optional electrical law below for modeled consumption; measured battery identification remains open. | |
| 101 | 104 | |
| 102 | 105 | The experiment keeps the 2 m transition-height deviation, 0.6 rad roll, 0.5 rad pitch and 22 m/s |
| 103 | 106 | speed guards. Its own target range is bounded to 400 m. The quadcopter and hover development kernel's |
| @@ -196,7 +199,7 @@ airborne. A separately declared 35-second allowance completes after about 26.94 | ||
| 196 | 199 | the complete 156,520 ms / 52.1733 Wh worst-case plan. A normal 45-second back plus 45-second recovery |
| 197 | 200 | hover and 35-second landing exceeds the unchanged 180-second graph cap and is rejected. The phase |
| 198 | 201 | abort/pause/recover campaigns instead declare 40-second recovery hover and 30-second landing, fitting |
| 199 | 176,520 ms / 58.84 Wh. These remain declared 1200 W planning charges, without identified electrical | |
| 202 | 176,520 ms / 58.84 Wh. These remain conservative 1200 W planning charges, without identified electrical | |
| 200 | 203 | power or measured battery endurance. |
| 201 | 204 | |
| 202 | 205 | Sensor loss, reference/clock guards, RC takeover, kill, fence, reserve and global endurance remain |
| @@ -204,11 +207,72 @@ authoritative during recovery. Host loss still produces a stale host snapshot an | ||
| 204 | 207 | lease expiry. Fault-induced neutral outputs do not become a landing claim. These bounded library |
| 205 | 208 | campaigns do not qualify arbitrary wind, failed lift rotors, every transition state or physical recovery. |
| 206 | 209 | |
| 210 | ## Fictional electrical model | |
| 211 | ||
| 212 | Select `--electrical` in the hover command, or pass `{ electrical: true }` to | |
| 213 | `createVtolHoverProfile('hover', options)` or `createVtolTransitionProfile(options)` in TypeScript. | |
| 214 | The default/disabled profiles keep their prior reports and declared-ceiling energy accounting. | |
| 215 | The same hover option runs through Buddy and the copied standalone CLI. Full transition execution | |
| 216 | remains a library feature. | |
| 217 | ||
| 218 | Each session owns its electrical state. The plant uses actual lagged individual rotor and pusher | |
| 219 | thrust, with these declared coefficients: | |
| 220 | ||
| 221 | | Source | Fictional law | | |
| 222 | | --- | --- | | |
| 223 | | Each of four lift motors | `4 * thrustN ** 1.5` W | | |
| 224 | | Independent pusher | `5 * thrustN ** 1.5` W | | |
| 225 | | Avionics and idle auxiliaries | 12 W | | |
| 226 | | Each surface | `3 * abs(deflectionRad) / 0.4` W | | |
| 227 | | Open-circuit voltage | 20 to 24 V, linear in remaining chemical energy fraction | | |
| 228 | | Series resistance | 0.04 ohm | | |
| 229 | ||
| 230 | The low-current solution of `loadW = (openCircuitV - currentA * resistanceOhm) * currentA` | |
| 231 | sets terminal voltage and current. Chemical source power is `openCircuitV * currentA`, including | |
| 232 | series loss. The four motors, full pusher and all surfaces together draw 948.023527 W at the load. | |
| 233 | At the minimum open-circuit voltage their chemical source demand is 1060.486740 W, rounded upward | |
| 234 | to a **1061 W envelope**. This is an analytic bound on this fictional law, not a motor/battery rating. | |
| 235 | The 20 to 24 V open-circuit range is a simulation parameter; the hardware list's 4S pack retains | |
| 236 | its own specification. | |
| 237 | ||
| 238 | Before session allocation, the runtime requires a planning ceiling at least this envelope and | |
| 239 | capacity matching the captured plant declaration. Existing longest-path graph validation charges | |
| 240 | the complete declared ceiling across normal and supported failure/recovery/landing routes. With the | |
| 241 | 1200 W planning ceiling, the normal route is 43.84 Wh and the declared back-abort route is 58.84 Wh. | |
| 242 | At 50% reserve of 100 Wh, the former fits and the latter is refused before resources are created. | |
| 243 | The front-failure path is shorter than the normal route, so it does not increase that worst-case budget. | |
| 244 | ||
| 245 | The plant integrates chemical source energy on its independent 4 ms steps. Before remaining energy | |
| 246 | cannot fund one complete worst-case step, propulsion demand is cut and latched. Retained motor response | |
| 247 | may coast down; it cannot rearm from a voltage rebound. Auxiliary draw continues to exhaustion. | |
| 248 | Rejected rigid-body integration commits neither body nor electrical state. | |
| 249 | ||
| 250 | Battery data travels through existing delayed, sequence/reference/capture-qualified measurements. | |
| 251 | Energy use rounds upward to micro-watt-hours; current/voltage/load use declared milli-unit quantization. | |
| 252 | The common qualifier rejects missing, nonfinite, inconsistent, over-envelope or decreasing consumption. | |
| 253 | The authority and mission receive a conservative remaining-energy bound after charging the maximum | |
| 254 | source envelope over the measurement's age. A reported supply cutoff withdraws authority even if | |
| 255 | chemical capacity remains. Source loss never substitutes a full battery. | |
| 256 | ||
| 257 | Reports add `energy.model` and `energy.lastObservation`. `energyUsedWh` belongs to its capture epoch; | |
| 258 | `remainingWhLowerBound` and `remainingPercentLowerBound` include the worst-case age charge at | |
| 259 | `observedAtMs`. Host loss leaves this host observation unchanged while independent plant consumption | |
| 260 | and board expiry continue. Mission-policy replay uses the recorded battery observations; it does not | |
| 261 | reconstruct the electrical plant from a mission trace alone. | |
| 262 | ||
| 263 | Actual model campaigns cover combined front demand, all nominal phases, open-circuit pusher timeout, initial/front/back abort | |
| 264 | landing, held recovery/resume, global endurance during pause, supply cutoff, bad battery observations, | |
| 265 | reserve, host loss and independent sessions. The nominal example's front peak is 347.313 W; its | |
| 266 | last captured use is about 4.62 Wh. Neither value predicts aircraft endurance. Motor/propeller advance | |
| 267 | ratio, voltage-dependent thrust, cell temperature/degradation, current-sensor calibration and measured | |
| 268 | capacity remain unmodeled or unqualified. The open-circuit fixture removes pusher demand and thrust; | |
| 269 | it does not model a seized motor's electrical current. | |
| 270 | ||
| 207 | 271 | ## Remaining implementation |
| 208 | 272 | |
| 209 | 273 | [Issue #12](https://github.com/stacksjs/drone/issues/12) remains open. The experimental nominal |
| 210 | 274 | controller and opt-in recovery routes do not establish complete VTOL support. Complete recovery/abort |
| 211 | envelopes, fresh-process restoration, the complete hybrid power/reserve model, native transition CLI and | |
| 275 | envelopes, fresh-process restoration, identified hybrid power/voltage/cell behavior, native transition CLI and | |
| 212 | 276 | the common mission workspace still require implementation and qualification. Wind campaigns and |
| 213 | 277 | broader mission/envelope coverage remain necessary. Full TECS/soaring, tiltrotor/tailsitter mechanisms, |
| 214 | 278 | helicopters and other airframe families remain separate work. Native board control, measured airframe |