Add machine workshop, typed logic, mechanics and sensor-driven ECUs

This commit is contained in:
max
2026-11-02 07:27:13 +01:00
parent eb2b6366c2
commit abfcce0f46
99 changed files with 28835 additions and 145 deletions

View File

@@ -19,6 +19,54 @@ radiation, thermodynamics and convergence under time/space refinement.
## Build and run (Windows and Linux)
The desktop now includes a [3D machine builder](docs/MACHINE_BUILDER.md). Open
**Machine workshop** in the scenario menu to place and configure pipes, tanks,
valves, engine cylinders and piston pumps. Saved machines support **Edit** and
**Play**, and **Tab** switches between building and testing.
The picker includes 3D previews, carburetors and ECUs. **Import engine layout**
opens editable copies of the 450 single, twin, flat six and V8. Shift selects groups;
blue pins carry ECU control wires, and ideal junctions accept multiple pipes at
one point. Engine cylinders require an explicit connected fuel source.
**Ctrl+C / Ctrl+V** copies and pastes selected groups with their internal air and
ECU connections. **Assemblies** saves selected groups for reuse across machines.
Escape cancels tools or selection; use **Menu** to leave the workshop.
**Meters (M)** adds pressure, temperature, flow, AFR/lambda and shaft instruments
with live traces and CSV export. Test playback slows to 1% speed and supports
paused 10 ms steps. Carb/ECU and other safe settings can be tuned live; geometry
and compiled settings stay locked until returning to Build.
The **Mech** category adds explicit shafts, flywheels, drive motors and brakes.
Cylinders/pumps connect to named shafts; independent engines can run at different
speeds. Try **Shaft, flywheel and brake bench** from saved machines. Mechanical-only
machines need no gas pipes. Older machine saves migrate in memory, and new saves
use version 10 with stable ports, mechanical parameters, sensor attachments,
a separate typed signal graph and explicit sensor-ECU/injector bindings.
The **Sense** inspector adds pressure/MAP, differential pressure, gas temperature,
total pipe mass flow, crank speed/angle and throttle-position pickups. Sensor
channels sample independently of recorded instruments and show validity/time;
deleting a host leaves an unresolved binding. Right-click **Add sensor here**
places a tap at the clicked pipe location.
The saved **Automatic air supply / logic bench** runs pressure feedback through
hysteresis, a master switch and an AND gate to a compressor drive command. Choose
**Logic** to edit its graph or **Split** to view signals beside the 3D machine.
The node library supports search, typed click/drag wiring and live controls;
Boolean wires are red, Number green, with ring inputs and filled outputs.
ECUs now offer **Crank ignition**, **Alpha-N EFI** and **Speed-density EFI** presets alongside the
labeled legacy controller. Their grouped Logic connectors require physical crank
speed/position, plus actual TPS for Alpha-N or absolute MAP/IAT for speed-density.
Intake chambers accept explicit fuel
injector attachments with calibrated capacity and finite/ideal rail supply.
Try `machines/sensor-ignition-bench.machine.toml` and
`machines/sensor-alpha-n-bench.machine.toml` and
`machines/sensor-speed-density-bench.machine.toml`; all have working fuel transport
and combustion. See the [workshop guide](docs/MACHINE_BUILDER.md) for calibration
and the current batch-delivery model.
Launch directly with `fluidsim_desktop --builder`, edit a saved design with
`--machine machines/vacuum-pump.machine.toml`, or run it with
`--play-machine machines/vacuum-pump.machine.toml`.
Both platforms use CMake 3.28 or newer, Git, and a C++20 compiler. The presets
build with optimizations and debugging symbols (`RelWithDebInfo`). The first
desktop configure fetches SFML 3.0.2 if it is not installed and needs network
@@ -166,12 +214,16 @@ in each engine TOML's `[simulation] cells_per_meter`. The desktop engine editor
has been removed; edit engine calibration in TOML.
Launching `fluidsim_desktop` without `--scenario` opens a small scenario menu.
Choose the twin, YZ125, Saab B205, or American V8 card, or select with Up/Down
and press Enter.
Launching `fluidsim_desktop` opens a maximized home screen with **Machine
Workshop**, **Engine Scenarios**, and **Quit**. Workshop offers a new design or
saved machines with separate Edit/Play actions. Engine Scenarios opens the engine
collection with category filters, search, a preview and a Start button. Click a
row to select it, then start with the button or Enter; Up/Down also selects rows.
Escape returns from the scenario to the menu, stopping its simulation and
audio so another scenario can be selected. Escape closes the menu at the category
screen. Simulation and audio start after selection. Passing
audio so another scenario can be selected. Escape returns from a browser to the
home screen, and closes the app from Home. Menu, workshop and scenario entry all
maximize the decorated Windows window, retaining its normal restore controls.
Simulation and audio start when an engine is launched. Passing
`--scenario twin`, `--scenario two-stroke`, `--scenario b205`, or `--scenario v8`
bypasses the menu; `--scene` and `--exhaust` options also apply
when choosing through the menu.
@@ -556,10 +608,10 @@ for units, directory discovery, sections and pipe topology ordering.
### Engine families and inspired builds
The browser opens at engine categories; click a category to see variants, then
click a variant or press Enter to start. Backspace, Left, Escape or the
`< Categories` header returns to categories. Both levels support wheel and
keyboard scrolling.
Choose **Engine Scenarios** on the home screen. Categories are listed beside the
engine collection; wheel over them to reach more families. Select a variant,
then press Enter or **Start engine**. Ctrl+F focuses search. Backspace, Escape or
**Back** returns to the main menu. Lists support wheel and keyboard scrolling.
`EngineConfig` supplies cylinder count (up to 12), inline/V/boxer layout,
bank angle, bore/stroke/rod, compression, firing phases, rev limit and fueling.