# Eldric World-Model — demo simulation models (CPU-only, runs on a Raspberry Pi)

Two compact, ready-to-run world-model files for the Eldric AI OS. Each **simulates a physical system on an ordinary CPU** — no GPU, no Python at runtime — and is small enough to run on a Raspberry Pi 4/5.

## What's here
| file | size | simulates |
|------|------|-----------|
| `threebody_nslot.nsl` | 79 KB | three bodies orbiting under gravity (the 3-body problem) |
| `seismic_wave_nslot.nsl` + `seismic_wave_velocity_cn.npy` | 24 KB + 4 KB | a seismic wave propagating through a heterogeneous crust |
| `policy_mz07_nslot.nsl` | 47 KB | a control policy for a 6-axis industrial robot arm |
| `forecast_mackeyglass.nsl` | 13 KB | a compact time-series forecaster (demo signal) |

Both are derived from **public physics** — Newtonian gravity; the elastic wave equation with the crustal velocity structure from the freely-available **CRUST1.0** model. They are general scientific models: free to download and try.

## How to run
Load a model into the Eldric AI OS world-model rollout and give it an initial condition and a number of steps; you get back the step-by-step evolution (the state trajectory, or the wave field frame-by-frame), which you can animate.

Conceptually:
```
POST  https://<your-eldric-host>/api/v1/worldmodel/rollout
      { model: <the .nsl file>, initial_condition: <see below>, steps: <e.g. 200> }
  →   the K-step rollout (frames) — render to an animation, or read the trajectory.
```

### Initial conditions
- **3-body** — a 12-number state: the three bodies' positions and velocities in 2D
  `[x1,y1, x2,y2, x3,y3,  vx1,vy1, vx2,vy2, vx3,vy3]`. Pick any configuration; the model rolls it forward in time. (Three-body motion is chaotic, so short horizons are precise and long horizons diverge — that's physics, not a model flaw.)
- **Seismic wave** — a field `u` (the wave amplitude on a grid), its previous frame, and the bundled velocity map `seismic_wave_velocity_cn.npy`. Seed `u` with a pulse at the epicentre cell (amplitude scaled to the magnitude); the model propagates the wave through the crust, reflecting and refracting at the material boundaries.
- **Robot arm control** (`policy_mz07_nslot.nsl`) — input = 18 numbers `[6 joint angles, 6 joint velocities, 6 target angles]`; output = 6 joint torques that drive the arm toward the target (a gravity-compensated control law for a 6-axis Nachi MZ07-geometry arm). Feed the current state each control cycle.
- **Forecast** (`forecast_mackeyglass.nsl`) — input = a window of the 16 most recent values of a time series; output = the next value. Feed the prediction back in for multi-step-ahead forecasting.

## Runs anywhere
Pure-CPU arithmetic (matrix / convolution). No GPU, no Python, no network at runtime. Verified CPU-only; runs on ARM (Raspberry Pi 4/5) and x86.

## Model file format
`.nsl` is a small self-contained binary: a 12-byte header (`NSL1` + dimensions) followed by float32 weights. One file = one model.

## Attribution & license
- Seismic crustal velocity structure: **CRUST1.0** — G. Laske, G. Masters, Z. Ma, M. Pasyanos (2013), https://igppweb.ucsd.edu/~gabi/crust1.html (freely distributed; please cite the authors).
- Physics: the standard elastic wave equation and Newtonian gravitation.
- Robot geometry: the public Nachi MZ07 robot description (ROS, github.com/Nishida-Lab/nachi_project).
- These demo models are provided by Eldric for evaluation; see your Eldric license for terms.


## Render manifest (how a viewer displays any model)
Each model ships a `<model>.manifest.json` describing how to display it, so one generic viewer can render any model with no model-specific code:
- `render_kind: "field2d"` — show the grid as an animated heatmap (e.g. the seismic wave).
- `render_kind: "trajectory"` — show the moving entities with trails (e.g. the three bodies).
- `render_kind: "timeseries"` — show the values as an animated line chart (the forecast).
- `render_kind: "controller"` — a control policy; visualised by closing the loop with a dynamics model.
The manifest also carries grid/state layout, value range, colours and frames-per-second.
