feat(registry): AssetResolver + diffuser supplier curves (Jäger / Aerostrip / PIK / PRK)

Two related changes bundled together because the diffuser curve files
only make sense once the registry namespace they live in exists.

src/registry — new asset-metadata resolver:
- AssetResolver with synchronous resolve(namespace, id) + lazy cache,
  async refresh() for future remote pulls.
- FileBackend (per-id or single-file layouts, case-insensitive) and a
  stub HttpBackend (disabled unless EVOLV_ASSET_REMOTE=1).
- Namespaces: curves, menu, monsterSamples, monsterSpecs, units. Menu
  namespace re-keys by inner softwareType + filename so editors that
  pass either string resolve to the same tree.
- README explains how to add a namespace.
- AssetCategoryManager (datasets/assetData/index.js) becomes a thin
  facade over the resolver so existing consumers don't move.
- 246/246 tests pass — including the 39-test registry suite.

datasets/assetData — file moves + new diffuser data:
- modelData/*.json deleted; curves/*.json is the canonical home.
- New diffuser.json menu tree with GVA, Jäger, Aquaconsult/Entec,
  PIK/PRK suppliers.
- gva-elastox-r.json migrated from the inline _loadSpecs hardcode,
  re-tagged coverageBasis="bottom-coverage-pct" (the legacy 2.4
  elements/m² was a prior mis-conversion; we can't recover the
  original % so it's a single-point curve under key "0").
- jaeger-jetflex-td-65-2-g-epdm-1000.json — extracted from the Jäger
  EPDM-1000mm SSOTE/DWP chart on the data sheet (vector-PDF read).
  SSOTE 8.20→6.40 %/m, DWP 25→48 mbar across Q 2-12 Nm³/h. Single
  coverage (vendor doesn't state test conditions).
- aerostrip-phoenix.json — 4-coverage SOTE family at 4.75 m water
  depth (DD 5/10/15/20 %, flux 10-70 Nm³/h·m²) from the Entec/de
  Winter 2023-11-22 dataset; DWP curve from the 21 % @ 4.05 m chart.
- pik300.json / prk300.json — 5-coverage SOTE + SSOTR (DD 5-25 %)
  with split DWP per model variant, water depth ≈ 4.0 m inferred from
  the SOTE↔SSOTR ratio in the source spreadsheet.

src/configs/diffuser.json:
- New asset.{model, assetTagNumber} block so the editor's selected
  model id survives validation.
- diffuser.density description corrected to "Bottom coverage [%]";
  default 2.4 → 15 (typical fine-bubble install).

src/configs/{rotatingMachine,valve}.json: small alignment edits that
came with the registry phase.

src/menu/asset.js + src/menu/aquonSamples.js: rewritten as facades
over assetResolver, keeping the editor-side cascade behaviour intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
znetsixe
2026-05-12 17:12:13 +02:00
parent 84a4430266
commit 0a4b52f517
34 changed files with 1244 additions and 2386 deletions

View File

@@ -0,0 +1,44 @@
{
"_meta": {
"supplier": "Aquaconsult Anlagenbau / Entec",
"type": "Strip",
"model": "AEROSTRIP",
"membrane": "PHOENIX",
"stdAir": { "temp_C": 0, "pressure_mbar": 1013.25, "RH_pct": 0 },
"coverageBasis": "bottom-coverage-pct",
"coverageReference": [5, 10, 15, 20],
"dataQuality": "multi-coverage",
"xAxisBasis": "per-m2-membrane-Nm3h",
"yAxisBasis": "ssotr-g-per-Nm3-per-m",
"waterDepth_m": 4.75,
"sources": [
"Floris de Winter (Entec Holland) email to R. de Ren on 2023-11-22 — tabulated SOTE [%] at 4.75 m water depth for bottom coverage 5/10/15/20 % at fluxes 10/25/40/55/70 Nm3/(h*m2 membrane). Original chart in 'SSOTE_4.75m different density.pdf'.",
"'SSOTR_dP.pdf' — AEROSTRIP fine-bubble diffuser SSOTR + Druckverlust (DWP) chart at water depth 4.05 m, blow-in depth 4.00 m, 21 % bottom coverage. Used for the DWP curve only (read off the vector chart)."
],
"note": "X-axis is flux per m² of membrane area, NOT per element. The existing diffuser specificClass passes `flow_per_element` to the interpolator — if you wire an AEROSTRIP model in, you must either set elements/area such that flow_per_element == flux_per_m2_membrane, OR extend _calcOtrPressure to apply the membrane-area conversion. SSOTR values are SOTE [%] / water_depth_m * 0.299 kg-O2/Nm3 * 10 (linear depth scaling). DWP curve was measured at 21 % bottom coverage; pressure loss is intrinsic to the diffuser geometry so the curve is shared across coverage values."
},
"sote_curve": {
"5": { "x": [10, 25, 40, 55, 70], "y": [34.20, 28.75, 26.16, 24.89, 24.19] },
"10": { "x": [10, 25, 40, 55, 70], "y": [42.01, 35.32, 32.14, 30.58, 29.71] },
"15": { "x": [10, 25, 40, 55, 70], "y": [43.39, 36.48, 33.20, 31.59, 30.69] },
"20": { "x": [10, 25, 40, 55, 70], "y": [43.80, 36.82, 33.51, 31.88, 30.97] }
},
"ssote_curve": {
"5": { "x": [10, 25, 40, 55, 70], "y": [7.20, 6.05, 5.51, 5.24, 5.09] },
"10": { "x": [10, 25, 40, 55, 70], "y": [8.84, 7.44, 6.77, 6.44, 6.26] },
"15": { "x": [10, 25, 40, 55, 70], "y": [9.14, 7.68, 6.99, 6.65, 6.46] },
"20": { "x": [10, 25, 40, 55, 70], "y": [9.22, 7.75, 7.06, 6.71, 6.52] }
},
"otr_curve": {
"5": { "x": [10, 25, 40, 55, 70], "y": [21.53, 18.10, 16.47, 15.67, 15.23] },
"10": { "x": [10, 25, 40, 55, 70], "y": [26.44, 22.23, 20.23, 19.25, 18.70] },
"15": { "x": [10, 25, 40, 55, 70], "y": [27.31, 22.96, 20.90, 19.89, 19.32] },
"20": { "x": [10, 25, 40, 55, 70], "y": [27.57, 23.18, 21.10, 20.06, 19.49] }
},
"p_curve": {
"21": {
"x": [5, 10, 25, 40, 55, 70, 80],
"y": [46.0, 47.3, 51.1, 54.9, 58.7, 62.4, 65.0]
}
}
}

View File

@@ -0,0 +1,27 @@
{
"_meta": {
"supplier": "GVA",
"type": "Tube",
"model": "ELASTOX-R",
"stdAir": { "temp_C": 20, "pressure_bar": 1.01325, "RH_pct": 0 },
"coverageBasis": "bottom-coverage-pct",
"coverageReference": null,
"dataQuality": "point",
"xAxisBasis": "per-element-Nm3h",
"yAxisBasis": "ssotr-g-per-Nm3-per-m",
"waterDepth_m": null,
"note": "Migrated 2026-05-12 from nodes/diffuser/src/specificClass.js _loadSpecs(). The legacy hardcoded data was tagged '2.4 elements/m²' by a prior agent; the originating vendor data was always intended as % surface-area coverage but the original test-bench coverage was not preserved when the numbers were inlined. Treat as a single-coverage point estimate (key '0' = unspecified). Do not extrapolate across density. SSOTR in g O2 / (Nm3 air * m of submergence)."
},
"otr_curve": {
"0": {
"x": [2, 3, 4, 5, 6, 7, 8, 9, 10],
"y": [26, 25, 24, 23.5, 23, 22.75, 22.5, 22.25, 22]
}
},
"p_curve": {
"0": {
"x": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"y": [40, 42.5, 45, 47.5, 50, 51.5, 53, 54.5, 56, 57.5, 59]
}
}
}

View File

@@ -1,148 +0,0 @@
const fs = require('fs');
const path = require('path');
class AssetLoader {
constructor(maxCacheSize = 100) {
this.relPath = './'
this.baseDir = path.resolve(__dirname, this.relPath);
this.cache = new Map();
this.maxCacheSize = maxCacheSize;
}
/**
* Load a specific curve by type
* @param {string} curveType - The curve identifier (e.g., 'hidrostal-H05K-S03R')
* @returns {Object|null} The curve data object or null if not found
*/
loadCurve(curveType) {
return this.loadAsset('curves', curveType);
}
/**
* Load any asset from a specific dataset folder
* @param {string} datasetType - The dataset folder name (e.g., 'curves', 'assetData')
* @param {string} assetId - The specific asset identifier
* @returns {Object|null} The asset data object or null if not found
*/
loadAsset(datasetType, assetId) {
//const cacheKey = `${datasetType}/${assetId}`;
const normalizedAssetId = String(assetId || '').trim();
if (!normalizedAssetId) {
return null;
}
const cacheKey = normalizedAssetId.toLowerCase();
// Check cache first
if (this.cache.has(cacheKey)) {
return this.cache.get(cacheKey);
}
try {
const filePath = this._resolveAssetPath(normalizedAssetId);
// Check if file exists
if (!filePath || !fs.existsSync(filePath)) {
console.warn(`Asset not found for id '${normalizedAssetId}' in ${this.baseDir}`);
return null;
}
// Load and parse JSON
const rawData = fs.readFileSync(filePath, 'utf8');
const assetData = JSON.parse(rawData);
// Cache the result (evict oldest if at capacity)
if (this.cache.size >= this.maxCacheSize) {
const oldestKey = this.cache.keys().next().value;
this.cache.delete(oldestKey);
}
this.cache.set(cacheKey, assetData);
return assetData;
} catch (error) {
console.error(`Error loading asset ${cacheKey}:`, error.message);
return null;
}
}
_resolveAssetPath(assetId) {
const exactPath = path.join(this.baseDir, `${assetId}.json`);
if (fs.existsSync(exactPath)) {
return exactPath;
}
const target = `${assetId}.json`.toLowerCase();
const files = fs.readdirSync(this.baseDir);
const matched = files.find((file) => file.toLowerCase() === target);
if (!matched) {
return null;
}
return path.join(this.baseDir, matched);
}
/**
* Get all available assets in a dataset
* @param {string} datasetType - The dataset folder name
* @returns {string[]} Array of available asset IDs
*/
getAvailableAssets(datasetType) {
try {
const datasetPath = path.join(this.baseDir, datasetType);
if (!fs.existsSync(datasetPath)) {
return [];
}
return fs.readdirSync(datasetPath)
.filter(file => file.endsWith('.json'))
.map(file => file.replace('.json', ''));
} catch (error) {
console.error(`Error reading dataset ${datasetType}:`, error.message);
return [];
}
}
/**
* Clear the cache (useful for development/testing)
*/
clearCache() {
this.cache.clear();
}
}
// Create and export a singleton instance
const assetLoader = new AssetLoader();
module.exports = {
AssetLoader,
assetLoader,
// Convenience methods for backward compatibility
loadCurve: (curveType) => assetLoader.loadCurve(curveType),
loadAsset: (datasetType, assetId) => assetLoader.loadAsset(datasetType, assetId),
getAvailableAssets: (datasetType) => assetLoader.getAvailableAssets(datasetType)
};
/*
// Example usage in your scripts
const loader = new AssetLoader();
// Load a specific curve
const curve = loader.loadCurve('hidrostal-H05K-S03R');
if (curve) {
console.log('Curve loaded:', curve);
} else {
console.log('Curve not found');
}
/*
// Load any asset from any dataset
const someAsset = loadAsset('assetData', 'some-asset-id');
// Get list of available curves
const availableCurves = getAvailableAssets('curves');
console.log('Available curves:', availableCurves);
// Using the class directly for more control
const { AssetLoader } = require('./index.js');
const customLoader = new AssetLoader();
const data = customLoader.loadCurve('hidrostal-H05K-S03R');
*/

View File

@@ -0,0 +1,44 @@
{
"_meta": {
"supplier": "Jäger Umwelt-Technik",
"type": "Tube",
"model": "JetFlex TD 65-2 G",
"membrane": "EPDM",
"tubeLength_mm": 1000,
"totalLength_mm": 1062.5,
"perforatedArea_m2": 0.18,
"outerDiameter_mm": 65,
"operating": {
"continuousFlow_Nm3h": [2, 12],
"maxOverloadFlow_Nm3h": 20,
"operatingMode": "continuous-or-intermittent"
},
"stdAir": { "temp_C": 0, "pressure_mbar": 1013.25, "RH_pct": 0 },
"coverageBasis": "bottom-coverage-pct",
"coverageReference": null,
"dataQuality": "point",
"xAxisBasis": "per-element-Nm3h",
"yAxisBasis": "ssotr-g-per-Nm3-per-m",
"waterDepth_m": null,
"source": "Jäger Umwelt-Technik 'JETFLEX TD 65-2 G Tube Diffuser' data sheet — vector chart on page 2 ('SSOTE and headloss for EPDM 1000 mm'). Curve coordinates recovered directly from the PDF vector paths on 2026-05-12 (bezier endpoints of the red SSOTE polyline and blue DWP polyline); axis calibration against the gridlines is exact.",
"note": "Vendor sheet states neither the tank-floor coverage nor the water depth at which the SSOTE curve was measured. Treat as a single-coverage point estimate (key '0' = unspecified); do not extrapolate across density. SSOTR = SSOTE * 0.299 kg-O2/Nm3 (DIN-1343 dry air, 0 °C 1013.25 mbar)."
},
"ssote_curve": {
"0": {
"x": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"y": [8.20, 7.85, 7.57, 7.30, 7.10, 6.97, 6.85, 6.72, 6.60, 6.50, 6.40]
}
},
"otr_curve": {
"0": {
"x": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"y": [24.52, 23.47, 22.63, 21.83, 21.23, 20.84, 20.48, 20.09, 19.73, 19.44, 19.14]
}
},
"p_curve": {
"0": {
"x": [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"y": [25.0, 27.5, 30.0, 32.5, 35.0, 37.5, 40.0, 42.0, 44.0, 46.0, 48.0]
}
}
}

View File

@@ -0,0 +1,36 @@
{
"_meta": {
"supplier": "Unknown (PIK/PRK family)",
"type": "Disc",
"model": "PIK300",
"stdAir": { "temp_C": 20, "pressure_bar": 1.01325, "RH_pct": 0 },
"coverageBasis": "bottom-coverage-pct",
"coverageReference": [5, 10, 15, 20, 25],
"dataQuality": "multi-coverage",
"xAxisBasis": "per-element-Sm3h",
"yAxisBasis": "ssotr-g-per-Nm3-per-m",
"waterDepth_m": 4.0,
"source": "'PIK & PRK300 data from QM.xlsx' (Sheet1). Two paired models PIK300 and PRK300: identical SOTE/SSOTR curves at DD 5/10/15/20/25 %, separate DWP curves per model. Water depth inferred from the relationship SOTE[%] = SSOTR[g/(Nm3*m)] * depth_m * 100 / 0.2786 kg-O2/Sm3 — gives depth ≈ 4.0 m for every row when standard-cubic-meter mass is taken at 20 °C / 1013.25 mbar.",
"note": "X-axis air flow uses 'Sm3' (US standard, 20 °C / 1013.25 mbar) rather than 'Nm3' (DIN, 0 °C). The existing diffuser specificClass internally normalises to 20 °C — so the values are usable as-is with that convention. SOTE [%] values are the raw spreadsheet entries; otr_curve is the per-meter SSOTR g/(Nm3*m) already in canonical units."
},
"sote_curve": {
"5": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [27.87, 26.99, 25.80, 24.97, 24.38, 23.89, 23.46, 23.12] },
"10": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [30.18, 29.33, 28.15, 27.33, 26.73, 26.21, 25.83, 25.49] },
"15": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [31.51, 30.53, 29.16, 28.27, 27.57, 27.01, 26.55, 26.15] },
"20": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [32.52, 31.39, 29.88, 28.84, 28.06, 27.45, 26.92, 26.49] },
"25": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [33.26, 32.04, 30.39, 29.27, 28.45, 27.77, 27.22, 26.76] }
},
"otr_curve": {
"5": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [19.509, 18.893, 18.060, 17.479, 17.066, 16.723, 16.422, 16.184] },
"10": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [21.126, 20.531, 19.705, 19.131, 18.711, 18.347, 18.081, 17.843] },
"15": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [22.057, 21.371, 20.412, 19.789, 19.299, 18.907, 18.585, 18.305] },
"20": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [22.764, 21.973, 20.916, 20.188, 19.642, 19.215, 18.844, 18.543] },
"25": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [23.282, 22.428, 21.273, 20.489, 19.915, 19.439, 19.054, 18.732] }
},
"p_curve": {
"0": {
"x": [1.5, 2, 3, 4, 5, 6, 7, 8],
"y": [25.5, 26.0, 27.5, 30.3, 34.0, 39.0, 45.0, 52.0]
}
}
}

View File

@@ -0,0 +1,36 @@
{
"_meta": {
"supplier": "Unknown (PIK/PRK family)",
"type": "Disc",
"model": "PRK300",
"stdAir": { "temp_C": 20, "pressure_bar": 1.01325, "RH_pct": 0 },
"coverageBasis": "bottom-coverage-pct",
"coverageReference": [5, 10, 15, 20, 25],
"dataQuality": "multi-coverage",
"xAxisBasis": "per-element-Sm3h",
"yAxisBasis": "ssotr-g-per-Nm3-per-m",
"waterDepth_m": 4.0,
"source": "'PIK & PRK300 data from QM.xlsx' (Sheet1). Same SOTE/SSOTR curves as the PIK300 sibling; the PRK300 differs only in DWP characteristics.",
"note": "X-axis air flow uses 'Sm3' (US standard, 20 °C / 1013.25 mbar) rather than 'Nm3' (DIN, 0 °C). The existing diffuser specificClass internally normalises to 20 °C — so the values are usable as-is with that convention."
},
"sote_curve": {
"5": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [27.87, 26.99, 25.80, 24.97, 24.38, 23.89, 23.46, 23.12] },
"10": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [30.18, 29.33, 28.15, 27.33, 26.73, 26.21, 25.83, 25.49] },
"15": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [31.51, 30.53, 29.16, 28.27, 27.57, 27.01, 26.55, 26.15] },
"20": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [32.52, 31.39, 29.88, 28.84, 28.06, 27.45, 26.92, 26.49] },
"25": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [33.26, 32.04, 30.39, 29.27, 28.45, 27.77, 27.22, 26.76] }
},
"otr_curve": {
"5": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [19.509, 18.893, 18.060, 17.479, 17.066, 16.723, 16.422, 16.184] },
"10": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [21.126, 20.531, 19.705, 19.131, 18.711, 18.347, 18.081, 17.843] },
"15": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [22.057, 21.371, 20.412, 19.789, 19.299, 18.907, 18.585, 18.305] },
"20": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [22.764, 21.973, 20.916, 20.188, 19.642, 19.215, 18.844, 18.543] },
"25": { "x": [1.5, 2, 3, 4, 5, 6, 7, 8], "y": [23.282, 22.428, 21.273, 20.489, 19.915, 19.439, 19.054, 18.732] }
},
"p_curve": {
"0": {
"x": [1.5, 2, 3, 4, 5, 6, 7, 8],
"y": [21.3, 24.0, 29.3, 35.3, 41.3, 46.8, 52.4, 58.6]
}
}
}