ALLSHIFT/docs/04-simulations/simulink-model-inventory.md
pepe 72dd781dbc Organize documentation into docs/ and superseded/
Audit every document in the repository, convert the non-markdown ones into
markdown reports, and split current documentation from outdated material.

docs/ — 31 markdown documents in seven numbered sections. Twenty are new
reports generated from .docx / .pdf / .xlsx / .mlx / .m sources that were
previously unreadable in the browser and undiffable in git. Each report
carries a provenance block (source path, format, MD5) and links back to its
original; all 13 recorded checksums verify against the files on disk.
Machine-extraction losses (PDF table column interleaving, Word OMML
equations, embedded figures) are called out explicitly rather than silently
smoothed over.

superseded/ — outdated material with a documented reason per entry:
two byte-identical ClickUp re-exports, an older revision of the BIDMC/UCSD
energy-flow doc (the retained copy adds the SoC Violation Rate KPI), a
duplicate of Shift input data.docx, the May 2026 simulation plan, the
root PV+Battery.md now covered by a fuller report, GitHub's stock
demo-repository template, and a zero-byte placeholder. Its README also
records what was deliberately NOT retired and why — the "Old Frameworks"
and "Old Simulations" folders hold unique Simulink revisions, and
"Big Ugly Folder" holds the only copy of framework revision 1.3.

Findings worth flagging, all documented in the reports:
- Simulink lineage recovered from each .slx's internal coreProperties.xml
  revision counter. The current model is
  Current Framework/Bobert0206_Initial_Simulation_Framework.slx (rev 2.7);
  the top-level copy is rev 1.3, five revisions behind.
- Simulations/Constants.m is a truncated byte-prefix of the Current
  Framework copy, silently missing H2_leak, H2_cap and E_H2_vol_h.
- The PEM electrolyser and fuel cell are unmodified MathWorks Simscape
  examples still at vendor defaults; the "10x bigger" sizing TODO recorded
  in Constants.m was never carried out.
- controller-claude.m does not compile — undefined P_Electro_max, outputs
  unassigned on several paths.
- The specification set uses two incompatible variable naming conventions
  and disagrees on action-space size (5 vs 16).
- MA_hourly_load.csv (13.7 MB) is the same 35,040 rows as 89993-0.parquet
  (2.4 MB).
- Clinical data is the MIMIC-IV *demo* (ODbL, 100 patients), not full
  MIMIC-IV — redistributable, but the licence and citation are unrecorded.

Housekeeping: untrack 21 Simulink build artefacts (slprj/, *.slxc) and add
ignore rules for them. Root README rewritten around the new layout.

Recruitment notes naming individual candidates are excluded from version
control via .gitignore rather than committed; the generic question template
is kept in docs/07-team-and-operations/.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 21:20:33 -07:00

300 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Simulink Model Inventory
> **Markdown report of non-markdown source files.**
>
> | | |
> |---|---|
> | **Sources** | Every `.slx`, `.slxc` and `.mat` under `Shift Matlab Drive/Shift Matlab Drive/Simulations/` (excluding the vendored [EST model](existing-est-model.md)) |
> | **Format** | Simulink models — **binary**, not readable or diffable outside MATLAB |
> | **Status** | Current inventory |
> | **Report generated** | 2026-07-25 |
Simulink `.slx` files are opaque to everyone without MATLAB and carry no readable git history.
This inventory makes their lineage legible.
> [!IMPORTANT]
> **Filesystem timestamps are useless here.** Every file in `Shift Matlab Drive/` carries an
> mtime inside a 4-second window on `2026-06-16 10:15` — the whole tree was bulk-copied from
> MATLAB Drive in one operation.
>
> **The lineage below comes from inside the files.** An `.slx` is a ZIP archive; its
> `metadata/coreProperties.xml` records Simulink's own **revision counter**, **release
> version**, **creation date**, and **last-modified-by username**. That is authoritative
> version data, and it is what every ordering claim on this page rests on.
## The current model
**`Current Framework/Bobert0206_Initial_Simulation_Framework.slx`** — revision **2.7**,
MATLAB **R2026a**, last saved by **`robert`**.
Three independent lines of evidence agree:
1. It carries the highest Simulink revision anywhere in the tree.
2. It sits in the folder literally named `Current Framework`.
3. `Current Framework/` is the only folder that also holds the live `Constants.m` (the complete
variant — see [below](#constantsm--the-top-level-copy-is-stale)) and the input workbook.
`Bobert0206` reads as *Bobert* (robert) + `0206` — a date-stamped personal save.
## The `Initial_Simulation_Framework` family
Nine files, **seven distinct byte-states**. All share `dcterms:created = 2025-11-30T10:58:42Z`,
so every one descends from a single original model.
| Rev | Release | Saved by | Size | MD5 | Path (under `Simulations/`) |
|:---:|---|---|---:|---|---|
| **2.7** | R2026a | `robert` | 173,799 | `ba7f9f6e` | **`Current Framework/Bobert0206_Initial_Simulation_Framework.slx`** ← current |
| 2.6 | R2026a | `chal` | 157,508 | `306c11f9` | `Current Framework/Initial_Simulation_Framework_CLEAR_CONNECTIONS.slx` |
| 2.2 | R2026a | `20243274` | 169,553 | `95d08300` | `Old Frameworks/Copy_of_Initial_Simulation_Framework.slx` |
| 2.0 | R2026a | `20243274` | 162,353 | `b766d7d6` | `Old Frameworks/Initial_Simulation_Framework.slx` |
| 2.0 | R2026a | `20243274` | 162,353 | `b766d7d6` | `Old Simulations/Initial_Simulation_Framework.slx` |
| 1.3 | R2025b | `robert` | 105,571 | `e30dbf8a` | `Initial_Simulation_Framework.slx` *(top level)* |
| 1.3 | R2025b | `robert` | 105,571 | `e30dbf8a` | `Old Simulations/Initial_Simulation_Framework.slx.r2025b` |
| 1.3 | R2025b | `20243274` | 1,033,972 | `46010d0d` | `Big Ugly Folder/Initial_Simulation_Framework.slx` |
| 1.2 | R2025b | `20243274` | 1,007,485 | `541b7087` | `Old Simulations/Initial_Simulation_Framework.slx.autosave` |
### Reconstructed history
```
rev 1.2 (autosave, 20243274, R2025b)
rev 1.3 ── forks ──┬── 20243274's copy → Big Ugly Folder/ (1.03 MB)
│ └── robert's copy → top level + .r2025b (106 KB)
│ [upgraded R2025b → R2026a]
rev 2.0 (20243274) → Old Frameworks/ and Old Simulations/
rev 2.2 (20243274) → Old Frameworks/Copy_of_...
rev 2.6 (chal) → Current Framework/..._CLEAR_CONNECTIONS
rev 2.7 (robert) → Current Framework/Bobert0206_... ← CURRENT
```
### Findings
**The top-level model is *not* the newest.** `Simulations/Initial_Simulation_Framework.slx` is
byte-identical to `Old Simulations/Initial_Simulation_Framework.slx.r2025b` and is revision
**1.3** — five revisions behind current. Its prominent top-level position is misleading.
**`_CLEAR_CONNECTIONS` is a parallel branch, not a predecessor.** Revision 2.6 by `chal`, one
revision behind `robert`'s 2.7. The name suggests a signal-routing cleanup fork that was not
merged before 2.7 was saved. Whether that cleanup still needs merging is an open question for
the Simulations cluster — it is the one piece of work in this family that may have been lost.
**`Old Frameworks/` and `Old Simulations/` hold the same rev-2.0 file** (identical MD5). One of
the two folders is redundant.
**The two ~1 MB outliers** (`Big Ugly Folder` rev 1.3, and the rev 1.2 `.autosave`) are 6×
larger than every other variant and are the two oldest revisions. Likely they retain cached
simulation output that later saves discarded.
### Contributors
Four usernames appear across the tree: **`robert`**, **`chal`**, **`nallu`**, and
**`20243274`** (a TU/e student number).
## `Big Ugly Folder/` versus the two "Ready Made" folders
**21 of the 22 files** in `Big Ugly Folder/` are byte-identical to a file in
`Ready Made PEM Electrolyzer/` or `Ready Made PEM fuel cell/` — the `.ssc` sources, the `.svg`
icons, the `.slx` models, the `.slxc` caches, `PEMFuelCellSystemDriveCycle.mat`, all the
`PEM*System*.m` scripts, and all six `slprj/` cache files.
The set difference is exactly one file each way:
| Only in `Big Ugly Folder` | Only in the clean folders |
|---|---|
| `Initial_Simulation_Framework.slx` (`46010d0d`, rev 1.3, 1.03 MB) | `Ready Made PEM fuel cell/PEMElectrolysisSystem.slxc` (`f8c088e4`) |
**Verdict: `Big Ugly Folder` is the unsplit predecessor.** Someone downloaded both MathWorks
example packages into one directory alongside the team's own framework model, then later split
the vendor code into two tidy folders. Supporting evidence:
1. Its content is the **exact union** of the two clean folders, with zero drift across 21 files
— consistent with copy-then-split, not independent work.
2. Its unique extra file is the framework at **revision 1.3 / R2025b**, the *oldest* era. A
folder assembled later by merging the clean folders would not contain an obsolete rev-1.3
model.
3. The stray `.slxc` is a **newer build** of the electrolysis cache (5,779 B) than the one in
both `Big Ugly Folder` and `Ready Made PEM Electrolyzer` (5,777 B) — so the clean folders
were opened and re-simulated *after* the split, while `Big Ugly Folder` was frozen.
**This folder cannot simply be deleted.** Its rev-1.3 `Initial_Simulation_Framework.slx`
(`46010d0d`) is unique — it exists nowhere else. Roughly 470 kB of the folder is pure
redundancy, but that one file is not. See [`superseded/README.md`](../../superseded/README.md)
for the disposition.
## The "Ready Made" folders are unmodified MathWorks code
> [!WARNING]
> **Every `.m` and `.ssc` file in `Ready Made PEM Electrolyzer/`, `Ready Made PEM fuel cell/`
> and `Big Ugly Folder/` carries a MathWorks copyright line.** Not one file lacks it, and there
> is no SHIFT attribution anywhere.
```
Electrolyzer.ssc:9 % Copyright 2021-2024 The MathWorks, Inc.
PEMElectrolysisSystemExample.m:57 % Copyright 2021 The MathWorks, Inc.
PEMElectrolysisSystemParameters.m:6 % Copyright 2021 The MathWorks, Inc.
FuelCell.ssc:10 % Copyright 2020-2024 The MathWorks, Inc.
PEMFuelCellSystemExample.m:64 % Copyright 2020-2021 The MathWorks, Inc.
PEMFuelCellSystemParameters.m:6 % Copyright 2020 The MathWorks, Inc.
…and 8 more Plot*.m files
```
`Constants.m` records how they were obtained:
```matlab
%openExample('simscape/PEMElectrolysisSystemExample')
%openExample('simscape/PEMFuelCellSystemExample')
```
These are the canonical Simscape shipped-example IDs, and `Constants.m` calls the electrolyser
*"Ready made electrolyser"* — the origin of the folder names.
Unlike the [EST model](existing-est-model.md), which carries its MIT LICENSE and upstream URL,
**this vendored code is marked nowhere**. A short `PROVENANCE.md` in each folder recording
"unmodified MathWorks Simscape example, obtained via `openExample(...)`" would close the gap.
See [PEM Electrolyser and Fuel Cell Models](pem-electrolyser-and-fuel-cell-models.md) for the
parameter sets and the unfinished sizing work.
## `FC_DigitalTwin_MathModel.slx`
SHIFT-authored (no MathWorks markers), separate from the Simscape package. Two revisions, same
creation date `2026-03-18T18:14:27Z`:
| Rev | Saved by | Size | MD5 | Path |
|:---:|---|---:|---|---|
| **1.2** | `robert` | 84,858 | `3b17283e` | **`Fuelcell/FC_DigitalTwin_MathModel.slx`** ← current |
| 1.1 | `nallu` | 75,673 | `d0dcd69c` | `Old Frameworks/FC_DigitalTwin_MathModel.slx` |
`Fuelcell/` holds the newer revision, so the `Old Frameworks/` label is accurate for this file.
`Fuelcell/` is a bare single-file directory — no `Constants.m`, no data, no README.
## Electrolyser models in `Old Frameworks/`
| File | Rev | Release | Saved by | Created | Size |
|---|:---:|---|---|---|---:|
| `EL20N_Electrolyser_Model.slx` | 1.3 | R2025b | `chal` | 2026-02-11 | 116,355 |
| `electrolyserNEW.slx` | 1.1 | R2025b | `chal` | **2026-05-26** | 119,836 |
Both by `chal`. `electrolyserNEW.slx` was **created three months later** but carries a *lower*
revision — it is a fresh model, not a continuation of `EL20N`. `EL20N` encodes a specific
commercial unit choice.
Both sit in `Old Frameworks/` and are superseded in practice by the MathWorks PEM package that
`Constants.m` points at. They are retired rather than deleted — `EL20N` in particular records a
real product decision worth recovering.
## `Constants.m` — the top-level copy is stale
| MD5 | Size | Path |
|---|---:|---|
| `4a4bac92` | 839 B | `Simulations/Constants.m` |
| `b3cf89c4` | 1,006 B | `Simulations/Current Framework/Constants.m` |
| `b3cf89c4` | 1,006 B | `Simulations/Old Simulations/Constants.m` |
**`Simulations/Constants.m` is a strict byte-prefix of the other two** — its first 839 bytes are
bit-for-bit identical, and it is simply missing the final 167 bytes:
```matlab
%%-------------------------------------------------------------------------
H2_leak = 0.001; %Fraction (%)
H2_cap = 128; %m3
E_H2_vol_h = 3000; %Wh/m3
```
> [!WARNING]
> Despite occupying the most prominent position, the top-level `Constants.m` is an **older,
> truncated snapshot**. Anyone who runs it gets a workspace silently missing `H2_leak`,
> `H2_cap`, and `E_H2_vol_h`.
>
> The corroboration is decisive: `controller-claude.m`'s commented-out hydrogen block
> references `H2_leak` and `E_H2_vol_h` — variables that exist **only** in the longer version.
> The controller was written against `b3cf89c4`.
Shared content (the common 839-byte prefix):
```matlab
%Energy production
E_PV = 460000; %kWh
E_Grid = 140000; %kWh
E_ExternalGrid = 400000; %kWh
E_HospitalLoad = -1000000; %kWh
```
followed by the developer's notes, verbatim:
> `%Ready made electrolyser -`
> `%Good news: it has a solar profile.`
> `%Bad news: random constants - we want it at 128m3 hydrogen production a day`
> `%I have attempted to find volume via the volumetric flow rate, however this`
> `%uses "standard conditions". THIS BRINGS IT TO 12.8m3, JUST ADJUST (power?)`
> `%SO ITS 10 TIMES BIGGER AND WE ARE GOOD!`
>
> `%To do: Check if PEM is ok, change parameters for electrolyzer so that`
> `%production is exactely 10times bigger, adjust fuel cell, create grid,`
> `%ensure its power output is appropriate`
**That TODO is still unresolved** — see
[PEM Electrolyser and Fuel Cell Models](pem-electrolyser-and-fuel-cell-models.md).
## `PV+Battery Simulink/`
| File | Size | Purpose |
|---|---:|---|
| `SolarPanel.slx` | 108,605 | PV model |
| `Battery.slx` | 89,343 | Battery model |
| `SolarPanel_n_Battery.slx` | 126,034 | Combined model |
| `SolarPanel.slxc` | 5,141 | Build cache |
| `slprj/` | 2,488 | Build cache |
Documented in full in [PV + Battery Simulink Model](pv-battery-simulink.md).
## Zero-byte placeholders
An exhaustive `find . -type f -size 0` over `Simulations/` returns exactly three files:
- `Simulations/Some.m`
- `Simulations/Old Simulations/Some.m`
- `Simulations/Current Framework/TEST.txt`
Empty placeholders carrying no content or structural role. Safe to delete.
## Build artefacts
`.slxc` files and `slprj/` directories are machine-generated Simulink caches — regenerated on
demand, no information content, spurious diffs.
**All 15 `slprj/` files are committed to git**, across four directories:
| Directory | Cached models | Files | Bytes |
|---|---|---:|---:|
| `Big Ugly Folder/slprj/` | `PEMElectrolysisSystem`, `PEMFuelCellSystem` | 6 | 38,176 |
| `Ready Made PEM fuel cell/slprj/` | `PEMFuelCellSystem` | 3 | 21,776 |
| `Ready Made PEM Electrolyzer/slprj/` | `PEMElectrolysisSystem` | 3 | 16,776 |
| `PV+Battery Simulink/slprj/` | `SolarPanel` | 3 | 2,488 |
Six of the fifteen are byte-identical duplicates between `Big Ugly Folder/` and the clean
folders — further corroboration of the split.
The root `.gitignore` covers `*.asv` and `*.autosave` but **has no `slprj/` rule**. That is a
genuine gap: `slprj/` is by far the more common MATLAB build artefact. Suggested addition:
```gitignore
slprj/
*.slxc
*.slx.r20*
```
`Old Simulations/Initial_Simulation_Framework.slx.autosave` (1 MB) is a MATLAB crash autosave.
It is correctly ignored by `*.autosave` and **untracked** — but still sitting in the working
tree. It is the only surviving trace of revision 1.2.
## Related
- [PEM Electrolyser and Fuel Cell Models](pem-electrolyser-and-fuel-cell-models.md) — vendor parameter sets
- [Rule-Based Controller Implementation](rule-based-controller-implementation.md) — `controller-claude.m`
- [PV + Battery Simulink Model](pv-battery-simulink.md)
- [PowerWorld Microgrid Model](powerworld-microgrid.md)
- [Existing EST Model](existing-est-model.md) — the vendored model, excluded here
- [`superseded/README.md`](../../superseded/README.md) — disposition of retired folders