prographs 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +6 -4
- package/dist/AutoGraph-PDPEAIXL.cjs +145 -0
- package/dist/GraphType.js +19 -0
- package/dist/autograph/chartIndex.js +521 -0
- package/dist/autograph/chartModules.js +2 -1
- package/dist/autograph/index.cjs +98 -93
- package/dist/catalog-DI4XZ46L.cjs +142 -0
- package/dist/catalog.js +2 -1
- package/dist/charts/biologycharts/BiologySamples.js +59 -0
- package/dist/charts/biologycharts/PunnettSquare.js +342 -0
- package/dist/charts/biologycharts/biologyEnums.js +22 -1
- package/dist/charts/biologycharts/index.js +5 -3
- package/dist/charts/doecharts/DoeSamples.js +78 -0
- package/dist/charts/doecharts/SipocDiagram.js +453 -0
- package/dist/charts/doecharts/index.js +4 -2
- package/dist/charts/fieldcharts/SpeciesAccumulationCurve.js +350 -0
- package/dist/charts/fieldcharts/fieldEnums.js +8 -1
- package/dist/charts/fieldcharts/index.js +5 -3
- package/dist/charts/signals/AntennaPatternChart.js +492 -0
- package/dist/charts/signals/SignalSamples.js +17 -0
- package/dist/charts/signals/index.js +5 -3
- package/dist/charts/softwarediagrams/ComponentDiagram.js +504 -0
- package/dist/charts/softwarediagrams/DeploymentDiagram.js +419 -0
- package/dist/charts/softwarediagrams/SoftwareSamples.js +283 -1
- package/dist/charts/softwarediagrams/index.js +7 -3
- package/dist/charts/softwarediagrams/softwareEnums.js +45 -1
- package/dist/charts/sportscharts/PowerDurationCurve.js +301 -0
- package/dist/charts/sportscharts/SportsSamples.js +102 -0
- package/dist/charts/sportscharts/TrainingLoadChart.js +325 -0
- package/dist/charts/sportscharts/index.js +6 -2
- package/dist/charts/strategycharts/BassDiffusionChart.js +362 -0
- package/dist/charts/strategycharts/BassModel.js +96 -0
- package/dist/charts/strategycharts/BurnRunwayChart.js +284 -0
- package/dist/charts/strategycharts/CapTableChart.js +366 -0
- package/dist/charts/strategycharts/KanbanBoard.js +324 -0
- package/dist/charts/strategycharts/OkrTree.js +339 -0
- package/dist/charts/strategycharts/StrategyPane.js +27 -0
- package/dist/charts/strategycharts/StrategySamples.js +251 -0
- package/dist/charts/strategycharts/index.js +15 -3
- package/dist/charts/threefields/BsfcMap3DChart.js +231 -0
- package/dist/charts/threefields/CompressorMap3DChart.js +217 -0
- package/dist/charts/threefields/FieldGrid.js +50 -0
- package/dist/charts/threefields/LossLandscape3DChart.js +201 -0
- package/dist/charts/threefields/MapSheet.js +77 -0
- package/dist/charts/threefields/TerrainRoute3DChart.js +201 -0
- package/dist/charts/threefields/TerrainRouteMath.js +40 -0
- package/dist/charts/threefields/ThreeFieldBase.js +117 -0
- package/dist/charts/threefields/ThreeFieldsSamples.js +80 -0
- package/dist/charts/threefields/WaferMap3DChart.js +218 -0
- package/dist/charts/threefields/index.js +19 -0
- package/dist/charts/threesurfaces/index.js +2 -2
- package/dist/charts/tradingcharts/KeltnerChannelChart.js +171 -0
- package/dist/charts/tradingcharts/TradingMath.js +20 -0
- package/dist/charts/tradingcharts/index.js +4 -2
- package/dist/{chunk-ZL6XDXMK.cjs → chunk-26PSLEP4.cjs} +8 -8
- package/dist/{chunk-W3US6EFP.cjs → chunk-2BO5DZUP.cjs} +12 -12
- package/dist/{chunk-5DP7OUSE.cjs → chunk-2GG5YYSC.cjs} +6 -6
- package/dist/{chunk-7FG4JSVO.cjs → chunk-2GL2VNJU.cjs} +253 -33
- package/dist/{chunk-LCWMRCLF.cjs → chunk-2PYOI7OY.cjs} +21 -21
- package/dist/{chunk-JFWJAEBD.cjs → chunk-3U4MCSKI.cjs} +4 -4
- package/dist/{chunk-CUPLHZRR.cjs → chunk-3ZMM3FSK.cjs} +4 -4
- package/dist/{chunk-L2AV62DP.cjs → chunk-4767WQJ7.cjs} +6 -6
- package/dist/{chunk-DA2EYIIP.cjs → chunk-4E7FSSBF.cjs} +1210 -168
- package/dist/{chunk-VS5LQEZB.cjs → chunk-526STI2S.cjs} +5 -5
- package/dist/{chunk-RXIMEK6C.cjs → chunk-55767YPI.cjs} +20 -20
- package/dist/{chunk-JXLSKIUV.cjs → chunk-5FBQOMMT.cjs} +26 -26
- package/dist/{chunk-27PZV5BR.cjs → chunk-5N4Z7MTS.cjs} +4 -4
- package/dist/{chunk-KEWCUIQA.cjs → chunk-5WEV6YWA.cjs} +22 -22
- package/dist/chunk-5XOVVC5X.cjs +3281 -0
- package/dist/{chunk-HK5J7Q2W.cjs → chunk-6HLXVWXU.cjs} +9 -9
- package/dist/{chunk-7JG47RW4.cjs → chunk-6LQT4WJ5.cjs} +25 -25
- package/dist/{chunk-OCVTI6X4.cjs → chunk-6YTWOUFD.cjs} +329 -36
- package/dist/{chunk-W7IQCAVN.cjs → chunk-7F6W6HKL.cjs} +11 -11
- package/dist/{chunk-F2DCJXDM.cjs → chunk-7L6KYU5A.cjs} +21 -21
- package/dist/{chunk-GTGR6LPR.cjs → chunk-A4GIN4FE.cjs} +17 -17
- package/dist/{chunk-B2CETSR6.cjs → chunk-A4US7SA7.cjs} +5 -5
- package/dist/{chunk-3DIF2YYW.cjs → chunk-AOXPBLPW.cjs} +10 -10
- package/dist/{chunk-7TTR4UF5.cjs → chunk-ATI45Z4M.cjs} +2 -2
- package/dist/{chunk-5BFCIX2V.cjs → chunk-CPPMO4IQ.cjs} +434 -148
- package/dist/{chunk-AYZZQ6AC.cjs → chunk-CZ5KGF6Q.cjs} +9 -9
- package/dist/{chunk-7THJ3ZBK.cjs → chunk-D4I35MCE.cjs} +2 -2
- package/dist/{chunk-MCPPFRLN.cjs → chunk-DCGAAN3Z.cjs} +2 -2
- package/dist/{chunk-VABL6CVX.cjs → chunk-DEY36N37.cjs} +21 -21
- package/dist/{chunk-RNCKGJCC.cjs → chunk-DXHXD3DK.cjs} +3 -3
- package/dist/{chunk-A56ZGMVZ.cjs → chunk-E7B45DBZ.cjs} +11 -11
- package/dist/{chunk-DOR6L4MT.cjs → chunk-EJC6EAC5.cjs} +18 -18
- package/dist/{chunk-UPGNM7MA.cjs → chunk-EULJOOMA.cjs} +11 -11
- package/dist/{chunk-G4AZL4GO.cjs → chunk-EYM6LEIF.cjs} +474 -70
- package/dist/{chunk-NJ4X6XGV.cjs → chunk-EZTYX2GH.cjs} +5 -5
- package/dist/chunk-FDD4UP73.cjs +521 -0
- package/dist/{chunk-WJ3VH2Q4.cjs → chunk-GEAIGM3J.cjs} +110 -615
- package/dist/{chunk-P3SBHF43.cjs → chunk-GRUYVXTS.cjs} +2 -2
- package/dist/{chunk-NX4Z5LMS.cjs → chunk-H3SZXND5.cjs} +5 -5
- package/dist/{chunk-EE4S4TOE.cjs → chunk-HS45TOFJ.cjs} +21 -21
- package/dist/chunk-INGOG6OV.cjs +899 -0
- package/dist/{chunk-UDKA6DGT.cjs → chunk-J3CDXZHF.cjs} +4 -4
- package/dist/{chunk-YO6G7TKI.cjs → chunk-JAU5ADEU.cjs} +11 -11
- package/dist/{chunk-22LBK4GA.cjs → chunk-JQEBSHX3.cjs} +4 -4
- package/dist/{chunk-RXX3U7VQ.cjs → chunk-KLXGLMFU.cjs} +10 -10
- package/dist/chunk-KVOX36J3.cjs +327 -0
- package/dist/chunk-L6BGNHFL.cjs +139 -0
- package/dist/{chunk-GMER35L3.cjs → chunk-L7TB7PU5.cjs} +20 -20
- package/dist/{chunk-AFXYNBL2.cjs → chunk-LBTRYEM2.cjs} +4 -4
- package/dist/{chunk-WYYCKIOD.cjs → chunk-LLULNJSP.cjs} +11 -11
- package/dist/{chunk-J27XOSLP.cjs → chunk-LSO46AFV.cjs} +8 -8
- package/dist/{chunk-5XJO45ES.cjs → chunk-LZ2KJ7ZX.cjs} +11 -11
- package/dist/chunk-M4IQ5LIZ.cjs +422 -0
- package/dist/{chunk-Y2KIUKJF.cjs → chunk-MPDHDKYZ.cjs} +11 -11
- package/dist/{chunk-4EMPKRZU.cjs → chunk-MRQ42ZJE.cjs} +3 -3
- package/dist/{chunk-EU5D2MF4.cjs → chunk-MYV4KZWP.cjs} +9 -9
- package/dist/{chunk-XD7KN4UN.cjs → chunk-MZXVLC24.cjs} +6 -6
- package/dist/{chunk-PPSONARU.cjs → chunk-NLBVDFIR.cjs} +41 -2
- package/dist/{chunk-L3PEGMGM.cjs → chunk-NY3TBZY4.cjs} +33 -33
- package/dist/{chunk-6YNYXXB6.cjs → chunk-OGVVSFAR.cjs} +3 -3
- package/dist/{chunk-MLV7QLB6.cjs → chunk-OMTQIQMN.cjs} +6 -6
- package/dist/{chunk-BEEOSNK7.cjs → chunk-PEJJ6TXJ.cjs} +15 -144
- package/dist/{chunk-SOKOWUF5.cjs → chunk-PPGWHIU7.cjs} +2 -2
- package/dist/{chunk-IELWOM2J.cjs → chunk-PPO6SDAN.cjs} +6 -6
- package/dist/{chunk-6JTZZCSL.cjs → chunk-PUMKX5F2.cjs} +3 -3
- package/dist/{chunk-RFOXFY2U.cjs → chunk-PXBYWCNB.cjs} +190 -799
- package/dist/{chunk-3BYXOISI.cjs → chunk-Q3HB3IX6.cjs} +4 -4
- package/dist/{chunk-RXCOVONX.cjs → chunk-RBMUOIXE.cjs} +289 -34
- package/dist/{chunk-MSBNHCSE.cjs → chunk-RJHGCUUD.cjs} +6 -6
- package/dist/{chunk-I6VG7F6Z.cjs → chunk-RSONDMYW.cjs} +708 -141
- package/dist/{chunk-GZDNPHMT.cjs → chunk-SHMPFCUE.cjs} +19 -19
- package/dist/{chunk-ZIBVCOW6.cjs → chunk-SN4FCXFC.cjs} +19 -19
- package/dist/{chunk-7KM52NMN.cjs → chunk-SN5T7WYO.cjs} +2 -2
- package/dist/{chunk-7MSZR65Z.cjs → chunk-SQJZGVDR.cjs} +7 -7
- package/dist/chunk-SYABFMD7.cjs +633 -0
- package/dist/{chunk-2RRFEYFH.cjs → chunk-TICB3MAC.cjs} +16 -16
- package/dist/{chunk-AOOKHUV5.cjs → chunk-U7Z7XYR2.cjs} +5 -5
- package/dist/{chunk-JEWQAXVG.cjs → chunk-UA2THQFV.cjs} +6 -6
- package/dist/{chunk-LHZPAHU3.cjs → chunk-VIK4L2YF.cjs} +112 -521
- package/dist/{chunk-4YWMAQ4J.cjs → chunk-VM2Y6BDY.cjs} +4 -4
- package/dist/{chunk-IRRKE2ZE.cjs → chunk-VMS3KWYI.cjs} +21 -21
- package/dist/{chunk-4SLARW6F.cjs → chunk-VU5NUD46.cjs} +17 -17
- package/dist/{chunk-XHY6TVYG.cjs → chunk-VV5CVOF7.cjs} +13 -13
- package/dist/{chunk-CCIBPGPZ.cjs → chunk-VYSAWPSS.cjs} +57 -57
- package/dist/{chunk-TTNEMQ2A.cjs → chunk-W7YRWEWQ.cjs} +22 -22
- package/dist/{chunk-C7MUOGEW.cjs → chunk-X7R5SY62.cjs} +6 -6
- package/dist/{chunk-ILR5KBMB.cjs → chunk-XOK3KTSS.cjs} +6 -6
- package/dist/{chunk-2CZM2I3T.cjs → chunk-XUIX45VU.cjs} +19 -19
- package/dist/{chunk-TGRMPS3A.cjs → chunk-XWH46PVJ.cjs} +165 -43
- package/dist/{chunk-WQYXXECR.cjs → chunk-Y5XVMK3K.cjs} +6 -6
- package/dist/{chunk-AK4TX2WG.cjs → chunk-YCNKEDTG.cjs} +13 -13
- package/dist/{chunk-PJJB24DU.cjs → chunk-YEF7SE3X.cjs} +20 -20
- package/dist/{chunk-RVLV4XW6.cjs → chunk-YMTVPMU3.cjs} +22 -22
- package/dist/data/index.cjs +2 -2
- package/dist/entries/autograph-lazy.cjs +2 -2
- package/dist/entries/charts/acoustictransport.cjs +3 -3
- package/dist/entries/charts/analysischarts.cjs +3 -3
- package/dist/entries/charts/astrocharts.cjs +3 -3
- package/dist/entries/charts/bars.cjs +3 -3
- package/dist/entries/charts/bayesiancharts.cjs +3 -3
- package/dist/entries/charts/biocharts.cjs +3 -3
- package/dist/entries/charts/biologycharts.cjs +11 -3
- package/dist/entries/charts/biologycharts.d.ts +1 -1
- package/dist/entries/charts/biologycharts.js +3 -2
- package/dist/entries/charts/business.cjs +3 -3
- package/dist/entries/charts/carecharts.cjs +3 -3
- package/dist/entries/charts/chemistrycharts.cjs +3 -3
- package/dist/entries/charts/civicscharts.cjs +3 -3
- package/dist/entries/charts/clinicalcharts.cjs +3 -3
- package/dist/entries/charts/comparison.cjs +3 -3
- package/dist/entries/charts/demography.cjs +3 -3
- package/dist/entries/charts/density.cjs +3 -3
- package/dist/entries/charts/diagrams.cjs +3 -3
- package/dist/entries/charts/distribution.cjs +3 -3
- package/dist/entries/charts/doecharts.cjs +13 -3
- package/dist/entries/charts/doecharts.d.ts +1 -1
- package/dist/entries/charts/doecharts.js +2 -1
- package/dist/entries/charts/earthscience.cjs +3 -3
- package/dist/entries/charts/economicscharts.cjs +3 -3
- package/dist/entries/charts/energycharts.cjs +3 -3
- package/dist/entries/charts/engineering.cjs +3 -3
- package/dist/entries/charts/fieldcharts.cjs +7 -3
- package/dist/entries/charts/fieldcharts.d.ts +1 -1
- package/dist/entries/charts/fieldcharts.js +3 -2
- package/dist/entries/charts/financial.cjs +3 -3
- package/dist/entries/charts/flow.cjs +3 -3
- package/dist/entries/charts/frameworks.cjs +3 -3
- package/dist/entries/charts/genomics.cjs +3 -3
- package/dist/entries/charts/geoflows.cjs +3 -3
- package/dist/entries/charts/geomaps.cjs +3 -3
- package/dist/entries/charts/geosciencecharts.cjs +3 -3
- package/dist/entries/charts/hierarchy.cjs +3 -3
- package/dist/entries/charts/indicators.cjs +3 -3
- package/dist/entries/charts/inferencecharts.cjs +3 -3
- package/dist/entries/charts/layoutcharts.cjs +3 -3
- package/dist/entries/charts/lifescience.cjs +4 -4
- package/dist/entries/charts/linesareas.cjs +3 -3
- package/dist/entries/charts/logisticscharts.cjs +3 -3
- package/dist/entries/charts/machinecharts.cjs +7 -3
- package/dist/entries/charts/machinecharts.d.ts +1 -1
- package/dist/entries/charts/machinecharts.js +2 -1
- package/dist/entries/charts/massive.cjs +3 -3
- package/dist/entries/charts/mathematical.cjs +3 -3
- package/dist/entries/charts/matrix.cjs +3 -3
- package/dist/entries/charts/medicalcharts.cjs +4 -4
- package/dist/entries/charts/mlcharts.cjs +4 -4
- package/dist/entries/charts/modelcharts.cjs +6 -5
- package/dist/entries/charts/multivariate.cjs +3 -3
- package/dist/entries/charts/musiccharts.cjs +3 -3
- package/dist/entries/charts/network.cjs +3 -3
- package/dist/entries/charts/physicscharts.cjs +3 -3
- package/dist/entries/charts/pictorial.cjs +4 -4
- package/dist/entries/charts/portfoliocharts.cjs +3 -3
- package/dist/entries/charts/productcharts.cjs +3 -3
- package/dist/entries/charts/proportion.cjs +3 -3
- package/dist/entries/charts/qualitycharts.cjs +3 -3
- package/dist/entries/charts/radial.cjs +3 -3
- package/dist/entries/charts/reliabilitycharts.cjs +5 -3
- package/dist/entries/charts/scatter.cjs +3 -3
- package/dist/entries/charts/scientific.cjs +3 -3
- package/dist/entries/charts/seriescharts.cjs +3 -3
- package/dist/entries/charts/signals.cjs +7 -3
- package/dist/entries/charts/signals.d.ts +1 -1
- package/dist/entries/charts/signals.js +2 -1
- package/dist/entries/charts/softwarediagrams.cjs +21 -3
- package/dist/entries/charts/softwarediagrams.d.ts +1 -1
- package/dist/entries/charts/softwarediagrams.js +4 -2
- package/dist/entries/charts/sportscharts.cjs +13 -3
- package/dist/entries/charts/sportscharts.d.ts +1 -1
- package/dist/entries/charts/sportscharts.js +3 -1
- package/dist/entries/charts/statistics.cjs +6 -6
- package/dist/entries/charts/strategycharts.cjs +30 -3
- package/dist/entries/charts/strategycharts.d.ts +1 -1
- package/dist/entries/charts/strategycharts.js +6 -1
- package/dist/entries/charts/structure.cjs +3 -3
- package/dist/entries/charts/surveycharts.cjs +3 -3
- package/dist/entries/charts/systemscharts.cjs +3 -3
- package/dist/entries/charts/textcharts.cjs +5 -5
- package/dist/entries/charts/thematicmaps.cjs +4 -4
- package/dist/entries/charts/threebars.cjs +3 -3
- package/dist/entries/charts/threefields.cjs +53 -0
- package/dist/entries/charts/threefields.d.ts +1 -0
- package/dist/entries/charts/threefields.js +6 -0
- package/dist/entries/charts/threeglobe.cjs +3 -3
- package/dist/entries/charts/threenetwork.cjs +3 -3
- package/dist/entries/charts/threestrata.cjs +3 -3
- package/dist/entries/charts/threesurfaces.cjs +7 -3
- package/dist/entries/charts/threesurfaces.d.ts +1 -1
- package/dist/entries/charts/threesurfaces.js +2 -1
- package/dist/entries/charts/threevolume.cjs +4 -4
- package/dist/entries/charts/timeline.cjs +3 -3
- package/dist/entries/charts/tracecharts.cjs +3 -3
- package/dist/entries/charts/trackscharts.cjs +3 -3
- package/dist/entries/charts/tradingcharts.cjs +6 -4
- package/dist/entries/charts/tradingcharts.d.ts +1 -1
- package/dist/entries/charts/tradingcharts.js +2 -1
- package/dist/entries/three.cjs +60 -20
- package/dist/entries/three.d.ts +1 -1
- package/dist/entries/three.js +7 -1
- package/dist/index.cjs +258 -97
- package/dist/index.d.cts +1953 -10
- package/dist/index.d.ts +1953 -10
- package/dist/index.js +26 -5
- package/dist/page/index.cjs +2 -2
- package/dist/react/components.js +58 -1
- package/dist/react/index.cjs +135 -92
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
- package/dist/AutoGraph-XLBJQDRB.cjs +0 -140
- package/dist/catalog-O7XGDD2H.cjs +0 -137
- package/dist/chunk-77K2HTRC.cjs +0 -3220
- package/dist/chunk-XEK47TVD.cjs +0 -323
- /package/dist/{chunk-UMEKIIHJ.cjs → chunk-LNWTC72Y.cjs} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9;
|
|
2
2
|
|
|
3
3
|
var _chunk4VWNDCUScjs = require('./chunk-4VWNDCUS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunkXX2YTCORcjs = require('./chunk-XX2YTCOR.cjs');
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
var _chunkPY4R3IFFcjs = require('./chunk-PY4R3IFF.cjs');
|
|
10
8
|
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
|
|
11
|
+
var _chunkFDD4UP73cjs = require('./chunk-FDD4UP73.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkPY4R3IFFcjs = require('./chunk-PY4R3IFF.cjs');
|
|
13
15
|
|
|
14
16
|
// src/charts/machinecharts/AshbyChart.ts
|
|
15
17
|
var _d3 = require('d3');
|
|
@@ -52,333 +54,6 @@ var AshbyMath = class {
|
|
|
52
54
|
}
|
|
53
55
|
};
|
|
54
56
|
|
|
55
|
-
// src/charts/machinecharts/MachineChart.ts
|
|
56
|
-
|
|
57
|
-
var CHAR = 6.2;
|
|
58
|
-
var SIZE = 11;
|
|
59
|
-
var MachineChart = class extends _chunkXX2YTCORcjs.CartesianChart {
|
|
60
|
-
/** A cell as a finite number, or null for blanks, text and dates. */
|
|
61
|
-
static number(cell) {
|
|
62
|
-
if (typeof cell === "string" && !cell.trim()) return null;
|
|
63
|
-
const value = typeof cell === "number" || typeof cell === "string" ? Number(cell) : NaN;
|
|
64
|
-
return Number.isFinite(value) ? value : null;
|
|
65
|
-
}
|
|
66
|
-
/** Short number for labels and tooltips. */
|
|
67
|
-
static short(value, digits = 3) {
|
|
68
|
-
return String(+value.toPrecision(digits));
|
|
69
|
-
}
|
|
70
|
-
/** Axis titles that depend on the options. A title the caller set wins. */
|
|
71
|
-
axisTitles() {
|
|
72
|
-
return {};
|
|
73
|
-
}
|
|
74
|
-
paint() {
|
|
75
|
-
const { xLabel, yLabel } = this.options, titles = this.axisTitles();
|
|
76
|
-
this.options.xLabel = _nullishCoalesce(xLabel, () => ( titles.x));
|
|
77
|
-
this.options.yLabel = _nullishCoalesce(yLabel, () => ( titles.y));
|
|
78
|
-
try {
|
|
79
|
-
super.paint();
|
|
80
|
-
} finally {
|
|
81
|
-
Object.assign(this.options, { xLabel, yLabel });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
get rows() {
|
|
85
|
-
const { data } = this.options;
|
|
86
|
-
return Array.isArray(data) ? data.filter((row) => row !== null && typeof row === "object") : [];
|
|
87
|
-
}
|
|
88
|
-
/** Padded extent that survives no values and one value. `zero` keeps 0 in view. */
|
|
89
|
-
span(values, pad = 0.05, zero = false) {
|
|
90
|
-
let low = _nullishCoalesce(_d3.min.call(void 0, values), () => ( 0)), high = _nullishCoalesce(_d3.max.call(void 0, values), () => ( 1));
|
|
91
|
-
if (zero) {
|
|
92
|
-
low = Math.min(0, low);
|
|
93
|
-
high = Math.max(0, high);
|
|
94
|
-
}
|
|
95
|
-
if (low === high) {
|
|
96
|
-
const half = Math.abs(low) * 0.5 || 1;
|
|
97
|
-
return [zero && low >= 0 ? 0 : low - half, high + half];
|
|
98
|
-
}
|
|
99
|
-
const room = (high - low) * pad;
|
|
100
|
-
return [zero && low === 0 ? 0 : low - room, zero && high === 0 ? 0 : high + room];
|
|
101
|
-
}
|
|
102
|
-
/** A data point in plot pixels. */
|
|
103
|
-
place({ x, y }, [px, py]) {
|
|
104
|
-
return [_nullishCoalesce(x(px), () => ( NaN)), _nullishCoalesce(y(py), () => ( NaN))];
|
|
105
|
-
}
|
|
106
|
-
curves(ctx, axes, name, list) {
|
|
107
|
-
const path = _d3.line.call(void 0, ).defined((point) => Number.isFinite(point[0]) && Number.isFinite(point[1]));
|
|
108
|
-
const shape = (d) => _nullishCoalesce(path.curve(_nullishCoalesce(d.curve, () => ( _chunkPY4R3IFFcjs.Scales.curve())))(d.points.map((point) => this.place(axes, point))), () => ( ""));
|
|
109
|
-
const marks = ctx.marks(name, "path", list, (d) => d.key).attr("fill", "none").attr("stroke", (d) => d.color).attr("stroke-width", (d) => _nullishCoalesce(d.width, () => ( 2))).attr("stroke-linejoin", "round").attr("stroke-linecap", "round").attr("stroke-dasharray", (d) => _nullishCoalesce(d.dash, () => ( null)));
|
|
110
|
-
return ctx.set(marks, { d: shape });
|
|
111
|
-
}
|
|
112
|
-
/** Ringed dots with a tooltip each. */
|
|
113
|
-
dots(ctx, axes, name, items, at, fill, tip, radius = 4) {
|
|
114
|
-
const spot = (d) => this.place(axes, at(d));
|
|
115
|
-
const shown = items.filter((item) => spot(item).every(Number.isFinite));
|
|
116
|
-
const marks = ctx.marks(name, "circle", shown).attr("fill", fill).attr("stroke", ctx.theme.surface).attr("stroke-width", radius < 3 ? 1 : 2);
|
|
117
|
-
ctx.set(marks, { cx: (d) => spot(d)[0], cy: (d) => spot(d)[1], r: radius }, { r: 0 });
|
|
118
|
-
return ctx.hover(marks, tip);
|
|
119
|
-
}
|
|
120
|
-
/** Halo-backed labels kept inside the plot. A label that would overlap an earlier one, or cannot fit, is dropped. */
|
|
121
|
-
notes(ctx, name, notes) {
|
|
122
|
-
const { width, height } = ctx.plot;
|
|
123
|
-
const taken = [];
|
|
124
|
-
const kept = notes.flatMap((note) => {
|
|
125
|
-
const wide = note.text.length * CHAR;
|
|
126
|
-
if (!Number.isFinite(note.x) || !Number.isFinite(note.y) || wide > width || note.y < -SIZE || note.y > height + SIZE || note.x < -wide || note.x > width + wide) return [];
|
|
127
|
-
const anchor = _nullishCoalesce(note.anchor, () => ( "start")), offset = anchor === "start" ? 0 : anchor === "middle" ? wide / 2 : wide;
|
|
128
|
-
const x = Math.max(offset, Math.min(width - wide + offset, note.x)), y = Math.max(SIZE, Math.min(height - 3, note.y));
|
|
129
|
-
const box = [x - offset - 3, y - SIZE, x - offset + wide + 3, y + 3];
|
|
130
|
-
if (taken.some((other) => box[0] < other[2] && box[2] > other[0] && box[1] < other[3] && box[3] > other[1])) return [];
|
|
131
|
-
taken.push(box);
|
|
132
|
-
return [{ ...note, x, y, anchor }];
|
|
133
|
-
});
|
|
134
|
-
const tones = { ink: ctx.theme.ink, secondary: ctx.theme.inkSecondary, muted: ctx.theme.inkMuted };
|
|
135
|
-
ctx.marks(name, "text", kept, (d) => d.key).attr("x", (d) => d.x).attr("y", (d) => d.y).attr("text-anchor", (d) => d.anchor).attr("font-size", SIZE).attr("font-family", ctx.theme.fontFamily).attr("fill", (d) => d.over ? ctx.palette.inkOn(d.over) : tones[_nullishCoalesce(d.tone, () => ( "secondary"))]).attr("stroke", (d) => _nullishCoalesce(d.over, () => ( ctx.theme.surface))).attr("stroke-width", 3).attr("paint-order", "stroke").text((d) => d.text);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// src/charts/machinecharts/GasCycleMath.ts
|
|
140
|
-
|
|
141
|
-
var CLOSE = 1e-3;
|
|
142
|
-
var positive = (values) => values.every((value) => Number.isFinite(value) && value > 0);
|
|
143
|
-
var GasCycleMath = class _GasCycleMath {
|
|
144
|
-
/** Isentropic compression by volume `ratio`, heat added at constant volume up to `peak` K, isentropic expansion, heat rejected at constant volume. */
|
|
145
|
-
static otto(gas, ratio, peak) {
|
|
146
|
-
const { gamma, inletPressure: p1, inletTemperature: t1 } = gas;
|
|
147
|
-
const t2 = t1 * ratio ** (gamma - 1), p2 = p1 * ratio ** gamma, p3 = p2 * peak / t2;
|
|
148
|
-
return _GasCycleMath.ideal(gas, [[p1, t1], [p2, t2], [p3, peak], [p3 / ratio ** gamma, peak / ratio ** (gamma - 1)]]);
|
|
149
|
-
}
|
|
150
|
-
/** Isentropic compression by volume `ratio`, heat added at constant pressure while the volume grows by `cutoff`, isentropic expansion, heat rejected at constant volume. */
|
|
151
|
-
static diesel(gas, ratio, cutoff) {
|
|
152
|
-
const { gamma, inletPressure: p1, inletTemperature: t1 } = gas;
|
|
153
|
-
const t2 = t1 * ratio ** (gamma - 1), p2 = p1 * ratio ** gamma, t3 = t2 * cutoff, expansion = ratio / cutoff;
|
|
154
|
-
return _GasCycleMath.ideal(gas, [[p1, t1], [p2, t2], [p2, t3], [p2 / expansion ** gamma, t3 / expansion ** (gamma - 1)]]);
|
|
155
|
-
}
|
|
156
|
-
/** Isentropic compression by pressure `ratio`, heat added at constant pressure up to `peak` K, isentropic expansion, heat rejected at constant pressure. */
|
|
157
|
-
static brayton(gas, ratio, peak) {
|
|
158
|
-
const { gamma, inletPressure: p1, inletTemperature: t1 } = gas, rise = ratio ** ((gamma - 1) / gamma);
|
|
159
|
-
return _GasCycleMath.ideal(gas, [[p1, t1], [p1 * ratio, t1 * rise], [p1 * ratio, peak], [p1, peak / rise]]);
|
|
160
|
-
}
|
|
161
|
-
/** States at `[pressure, temperature]` corners, numbered in order. None when a number is not above zero or `gamma` is not above 1. */
|
|
162
|
-
static ideal(gas, corners) {
|
|
163
|
-
if (!(gas.gamma > 1) || !positive([gas.gasConstant, ...corners.flat()])) return [];
|
|
164
|
-
return _GasCycleMath.entropies(corners.map(([pressure, temperature], i) => ({ label: `${i + 1}`, pressure, temperature, volume: gas.gasConstant * temperature / pressure })), gas);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* States read from rows, in row order. Each needs a pressure and a temperature above zero; a volume the row
|
|
168
|
-
* leaves out comes from `Pv = RT`. A label that repeats, as when the first state closes the list, counts once.
|
|
169
|
-
*/
|
|
170
|
-
static states(rows, columns, gas) {
|
|
171
|
-
const found = /* @__PURE__ */ new Map();
|
|
172
|
-
rows.forEach((row, i) => {
|
|
173
|
-
const [pressure, temperature, given] = [columns.pressure, columns.temperature, columns.volume].map((column) => _nullishCoalesce(MachineChart.number(row[column]), () => ( NaN)));
|
|
174
|
-
const label = String(_nullishCoalesce(row[columns.label], () => ( i + 1))), volume = given > 0 ? given : gas.gasConstant * temperature / pressure;
|
|
175
|
-
if (positive([pressure, temperature, volume]) && !found.has(label)) found.set(label, { label, pressure, temperature, volume });
|
|
176
|
-
});
|
|
177
|
-
return _GasCycleMath.entropies([...found.values()], gas);
|
|
178
|
-
}
|
|
179
|
-
/** `s = cv ln(T / T₁) + R ln(v / v₁)`, so the first state sits at zero. A gas whose `gamma` is not above 1 has no states. */
|
|
180
|
-
static entropies(states, { gamma, gasConstant }) {
|
|
181
|
-
const cv = gasConstant / (gamma - 1), [first] = states;
|
|
182
|
-
return states.map((state) => ({ ...state, entropy: cv * Math.log(state.temperature / first.temperature) + gasConstant * Math.log(state.volume / first.volume) })).filter((state) => Number.isFinite(state.entropy));
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* The legs of the closed cycle, the last one returning to the first state. Along a polytrope `ln P` is linear in `ln v`
|
|
186
|
-
* and `s` in `ln T`, which gives the work `∫P dv` and the heat `∫T ds` in closed form.
|
|
187
|
-
*/
|
|
188
|
-
static processes(states) {
|
|
189
|
-
if (states.length < 2) return [];
|
|
190
|
-
return states.map((from, i) => {
|
|
191
|
-
const to = states[(i + 1) % states.length];
|
|
192
|
-
const dv = Math.log(to.volume / from.volume), dp = Math.log(to.pressure / from.pressure), dt = Math.log(to.temperature / from.temperature);
|
|
193
|
-
const heat = (to.entropy - from.entropy) * (Math.abs(dt) < 1e-9 ? from.temperature : (to.temperature - from.temperature) / dt);
|
|
194
|
-
const work = Math.abs(dv + dp) < 1e-9 ? from.pressure * from.volume * dv : dv * (to.pressure * to.volume - from.pressure * from.volume) / (dv + dp);
|
|
195
|
-
const name = Math.abs(dv) < CLOSE ? "Constant volume" : Math.abs(dp) < CLOSE ? "Constant pressure" : Math.abs(dt) < CLOSE ? "Isothermal" : Math.abs(heat) < CLOSE * Math.abs(work) ? "Isentropic" : `Polytropic, n = ${(-dp / dv).toFixed(2)}`;
|
|
196
|
-
return { from, to, name, heat, work };
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
/** Heat in is the heat of every leg that takes some in, heat out of every leg that gives some up, and the efficiency is `1 - out / in`. */
|
|
200
|
-
static totals(processes) {
|
|
201
|
-
const heatIn = _d3.sum.call(void 0, processes, (leg) => Math.max(0, leg.heat)), heatOut = _d3.sum.call(void 0, processes, (leg) => Math.max(0, -leg.heat));
|
|
202
|
-
return { heatIn, heatOut, work: _d3.sum.call(void 0, processes, (leg) => leg.work), efficiency: heatIn > heatOut ? 1 - heatOut / heatIn : null };
|
|
203
|
-
}
|
|
204
|
-
/** Points along a leg between two plotted corners. `y` always changes geometrically; `x` does too on P-V (`geometric`), and linearly on T-s. */
|
|
205
|
-
static leg(from, to, geometric, steps = 24) {
|
|
206
|
-
return Array.from({ length: steps + 1 }, (_, i) => {
|
|
207
|
-
const t = i / steps;
|
|
208
|
-
return [geometric ? from[0] * (to[0] / from[0]) ** t : from[0] + (to[0] - from[0]) * t, from[1] * (to[1] / from[1]) ** t];
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
// src/charts/machinecharts/MachineSamples.ts
|
|
214
|
-
var round = (value, digits = 2) => +value.toFixed(digits);
|
|
215
|
-
var MATERIALS = [
|
|
216
|
-
["Foams", "Polymer foam, low density", 0.035, 2e-3],
|
|
217
|
-
["Foams", "Polymer foam, rigid", 0.12, 0.08],
|
|
218
|
-
["Foams", "Metal foam", 0.35, 0.6],
|
|
219
|
-
["Foams", "Ceramic foam", 0.5, 1.6],
|
|
220
|
-
["Elastomers", "Natural rubber", 0.93, 2e-3],
|
|
221
|
-
["Elastomers", "Butyl rubber", 0.92, 15e-4],
|
|
222
|
-
["Elastomers", "Silicone elastomer", 1.25, 0.012],
|
|
223
|
-
["Elastomers", "Polyurethane elastomer", 1.15, 0.03],
|
|
224
|
-
["Natural materials", "Cork", 0.18, 0.03],
|
|
225
|
-
["Natural materials", "Balsa", 0.16, 3.2],
|
|
226
|
-
["Natural materials", "Pine", 0.5, 9.5],
|
|
227
|
-
["Natural materials", "Oak", 0.75, 12],
|
|
228
|
-
["Natural materials", "Bamboo", 0.7, 17],
|
|
229
|
-
["Polymers", "Polyethylene", 0.95, 0.75],
|
|
230
|
-
["Polymers", "Polypropylene", 0.9, 1.4],
|
|
231
|
-
["Polymers", "Polyamide", 1.14, 2.8],
|
|
232
|
-
["Polymers", "Polycarbonate", 1.2, 2.3],
|
|
233
|
-
["Polymers", "Epoxy", 1.25, 3.2],
|
|
234
|
-
["Composites", "Glass fibre laminate", 1.9, 22],
|
|
235
|
-
["Composites", "Carbon fibre laminate", 1.55, 110],
|
|
236
|
-
["Composites", "Aramid laminate", 1.38, 60],
|
|
237
|
-
["Composites", "Metal matrix composite", 2.8, 95],
|
|
238
|
-
["Metals", "Magnesium alloys", 1.8, 44],
|
|
239
|
-
["Metals", "Aluminium alloys", 2.7, 71],
|
|
240
|
-
["Metals", "Titanium alloys", 4.5, 112],
|
|
241
|
-
["Metals", "Steels", 7.85, 205],
|
|
242
|
-
["Metals", "Nickel alloys", 8.6, 200],
|
|
243
|
-
["Metals", "Copper alloys", 8.7, 125],
|
|
244
|
-
["Metals", "Lead alloys", 11.2, 15],
|
|
245
|
-
["Metals", "Tungsten alloys", 18.5, 360],
|
|
246
|
-
["Ceramics", "Concrete", 2.4, 28],
|
|
247
|
-
["Ceramics", "Soda-lime glass", 2.5, 70],
|
|
248
|
-
["Ceramics", "Alumina", 3.9, 370],
|
|
249
|
-
["Ceramics", "Silicon carbide", 3.15, 420],
|
|
250
|
-
["Ceramics", "Tungsten carbide", 15.6, 640]
|
|
251
|
-
];
|
|
252
|
-
var POLARS = [
|
|
253
|
-
["Clean", 0.22, 0.021, 0.043, 1.6],
|
|
254
|
-
["Take-off flaps", 0.62, 0.044, 0.049, 2.05],
|
|
255
|
-
["Landing flaps", 1.02, 0.086, 0.056, 2.5]
|
|
256
|
-
];
|
|
257
|
-
var HILLS = [[18, 190, 5], [36, 640, 7.5], [58, 260, 4], [74, 1020, 9], [97, 520, 5.5], [110, 150, 3]];
|
|
258
|
-
var MachineSamples = class {
|
|
259
|
-
/** `{ speed, mode, frequency }`: rotor natural frequencies in Hz by speed in rpm, with whirl pairs that split and a mode that stiffens. */
|
|
260
|
-
static campbell(seed) {
|
|
261
|
-
const { u } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
262
|
-
const first = 48 + u() * 14, second = 128 + u() * 20, torsion = 196 + u() * 24;
|
|
263
|
-
const modes = [
|
|
264
|
-
["1st bending, backward", (rev) => first - 0.085 * rev],
|
|
265
|
-
["1st bending, forward", (rev) => first + 0.1 * rev],
|
|
266
|
-
["2nd bending, backward", (rev) => second - 0.16 * rev],
|
|
267
|
-
["2nd bending, forward", (rev) => second + 0.19 * rev],
|
|
268
|
-
["1st torsion", (rev) => Math.hypot(torsion, 0.42 * rev)]
|
|
269
|
-
];
|
|
270
|
-
return modes.flatMap(([mode, at]) => Array.from({ length: 13 }, (_, i) => ({ speed: i * 1e3, mode, frequency: round(at(i * 1e3 / 60), 1) })));
|
|
271
|
-
}
|
|
272
|
-
/** `{ speed, flow, pressureRatio, efficiency }`: points along each corrected speed line, named as a share of design speed, surge end first. Flow in kg/s, efficiency as a share. */
|
|
273
|
-
static compressor(seed) {
|
|
274
|
-
const { u, n } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
275
|
-
const design = 3.6 + u() * 0.8, flow = 9 + u() * 3;
|
|
276
|
-
return [60, 70, 80, 90, 100, 105].flatMap((speed) => {
|
|
277
|
-
const share = speed / 100, choke = flow * share ** 1.45 * 1.06, surge = choke * (0.66 + 0.16 * share);
|
|
278
|
-
const top = 1 + (design - 1) * share ** 2.3 * 1.07, peak = 0.86 - (share < 0.92 ? 0.9 : 6) * (share - 0.92) ** 2;
|
|
279
|
-
return Array.from({ length: 9 }, (_, i) => {
|
|
280
|
-
const t = i / 8;
|
|
281
|
-
return {
|
|
282
|
-
speed: `${speed}%`,
|
|
283
|
-
flow: round(surge + (choke - surge) * (1 - (1 - t) ** 2.2), 3),
|
|
284
|
-
pressureRatio: round(top - (top - 1) * (0.06 * t + 0.4 * t ** 3.5), 3),
|
|
285
|
-
efficiency: round(peak - 0.3 * (t - 0.36) ** 2 * (t > 0.36 ? 1.7 : 1) + n() * 2e-3, 4)
|
|
286
|
-
};
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
/** `{ speed, torque, bsfc }`: load sweeps at each engine speed up to full load. Speed in rpm, torque in N·m, BSFC in g/kWh. */
|
|
291
|
-
static bsfcMap(seed) {
|
|
292
|
-
const { u, n } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
293
|
-
const peak = 255 + u() * 50, best = 2200 + u() * 600, floor = 228 + u() * 14;
|
|
294
|
-
return Array.from({ length: 11 }, (_, i) => 1e3 + i * 500).flatMap((speed) => {
|
|
295
|
-
const rev = speed / 1e3;
|
|
296
|
-
const full = peak * Math.min(1, 0.62 + 0.3 * rev - 0.02 * rev ** 2, 1.62 - 0.14 * rev);
|
|
297
|
-
return Array.from({ length: 10 }, (_, j) => {
|
|
298
|
-
const load = (j + 1) / 10;
|
|
299
|
-
const bsfc = floor + 9 * ((speed - best) / 1e3) ** 2 + 95 * (load - 0.78) ** 2 + 26 * (0.2 / load) ** 1.6 * (1 + rev / 6) + n() * 0.8;
|
|
300
|
-
return { speed, torque: round(full * load, 1), bsfc: round(bsfc, 1) };
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/** `{ time, lateral, longitudinal }`: one lap of accelerations in g, braking negative, sampled through each corner. */
|
|
305
|
-
static lap(seed) {
|
|
306
|
-
const { u, n } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
307
|
-
const grip = 1.25 + u() * 0.25, rows = [];
|
|
308
|
-
let time = 0, [x, y] = [0, 0.35];
|
|
309
|
-
const glide = (toX, toY, steps) => {
|
|
310
|
-
const [fromX, fromY] = [x, y];
|
|
311
|
-
for (let i = 1; i <= steps; i++) {
|
|
312
|
-
const t = i / steps, ease = t * t * (3 - 2 * t);
|
|
313
|
-
x = fromX + (toX - fromX) * ease + n() * 0.03;
|
|
314
|
-
y = fromY + (toY - fromY) * ease + n() * 0.03;
|
|
315
|
-
rows.push({ time: round(time += 0.1, 1), lateral: round(x, 3), longitudinal: round(y, 3) });
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
for (let corner = 0; corner < 14; corner++) {
|
|
319
|
-
const side = u() < 0.5 ? -1 : 1, hard = 0.55 + u() * 0.45;
|
|
320
|
-
glide(0, 0.5 - u() * 0.25, 10);
|
|
321
|
-
glide(side * 0.08, -grip * 0.9 * hard, 5);
|
|
322
|
-
glide(side * grip * 0.72 * hard, -grip * 0.55 * hard, 6);
|
|
323
|
-
glide(side * grip * hard, n() * 0.05, 9);
|
|
324
|
-
glide(side * grip * 0.6 * hard, 0.42, 7);
|
|
325
|
-
}
|
|
326
|
-
return rows;
|
|
327
|
-
}
|
|
328
|
-
/** `{ configuration, alpha, cl, cd }`: lift and drag coefficients by angle of attack in degrees, for three flap settings. */
|
|
329
|
-
static dragPolar(seed) {
|
|
330
|
-
const { u, n } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
331
|
-
const tilt = 0.96 + u() * 0.08;
|
|
332
|
-
return POLARS.flatMap(([configuration, cl0, cd0, k, clMax]) => Array.from({ length: 9 }, (_, i) => {
|
|
333
|
-
const alpha = -4 + i * 2, straight = cl0 + 0.098 * alpha * tilt;
|
|
334
|
-
const cl = clMax - Math.log(1 + Math.exp((clMax - straight) * 14)) / 14;
|
|
335
|
-
return { configuration, alpha, cl: round(cl, 3), cd: round(cd0 + k * (straight - 0.12) ** 2 + 0.25 * (straight - cl) + Math.abs(n()) * 6e-4, 4) };
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
338
|
-
/** `{ family, material, density, modulus }`: density in Mg/m³ and Young's modulus in GPa, close to handbook orders of magnitude. */
|
|
339
|
-
static materials(seed) {
|
|
340
|
-
const { n } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
341
|
-
return MATERIALS.map(([family, material, density, modulus]) => ({ family, material, density: +(density * Math.exp(n() * 0.07)).toPrecision(3), modulus: +(modulus * Math.exp(n() * 0.12)).toPrecision(3) }));
|
|
342
|
-
}
|
|
343
|
-
/** `{ wingLoading, thrustRatio, weight, cruiseSpeed }`: a sizing study over wing loading (kg/m²) and thrust-to-weight, with take-off weight in t and cruise speed in km/h. */
|
|
344
|
-
static sizing(seed) {
|
|
345
|
-
const { u } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
346
|
-
const base = 58 + u() * 14, bend = 0.8 + u() * 0.5;
|
|
347
|
-
return [350, 425, 500, 575, 650].flatMap((wingLoading) => [0.24, 0.28, 0.32, 0.36].map((thrustRatio) => {
|
|
348
|
-
const wing = (650 - wingLoading) / 300, engine = (thrustRatio - 0.24) / 0.12;
|
|
349
|
-
return {
|
|
350
|
-
wingLoading,
|
|
351
|
-
thrustRatio,
|
|
352
|
-
weight: round(base + 7.5 * wing ** 1.6 * bend + 5.2 * engine ** 1.3 + 2.4 * wing * engine, 2),
|
|
353
|
-
cruiseSpeed: Math.round(705 + 0.26 * (wingLoading - 350) + 520 * (thrustRatio - 0.24) + 14 * wing * engine)
|
|
354
|
-
};
|
|
355
|
-
}));
|
|
356
|
-
}
|
|
357
|
-
/** `{ distance, elevation }`: a mountain stage sampled every 250 m, distance in km and elevation in m. */
|
|
358
|
-
static route(seed) {
|
|
359
|
-
const { u, n } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
360
|
-
const hills = HILLS.map(([centre, rise, width]) => [centre + (u() - 0.5) * 5, rise * (0.8 + u() * 0.4), width * (0.85 + u() * 0.3)]);
|
|
361
|
-
let drift = 0;
|
|
362
|
-
return Array.from({ length: 481 }, (_, i) => {
|
|
363
|
-
const distance = i * 0.25;
|
|
364
|
-
drift = drift * 0.96 + n() * 1.6;
|
|
365
|
-
const ground = 310 + 0.9 * distance + hills.reduce((sum2, [centre, rise, width]) => sum2 + rise * Math.exp(-(((distance - centre) / width) ** 2)), 0);
|
|
366
|
-
return { distance, elevation: Math.round(ground + drift) };
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
/** `{ cycle, state, pressure, volume, temperature }`: the four states of an air-standard Otto, Diesel and Brayton cycle, in kPa, m³/kg and K. */
|
|
370
|
-
static gasCycles(seed) {
|
|
371
|
-
const { u } = _chunkUMEKIIHJcjs.SampleData.rng(seed);
|
|
372
|
-
const gas = { gamma: 1.4, gasConstant: 0.287, inletPressure: 95 + u() * 10, inletTemperature: 288 + u() * 22 };
|
|
373
|
-
const cycles = [
|
|
374
|
-
["Otto", GasCycleMath.otto(gas, 8 + u() * 3, 1900 + u() * 500)],
|
|
375
|
-
["Diesel", GasCycleMath.diesel(gas, 16 + u() * 5, 1.8 + u() * 0.8)],
|
|
376
|
-
["Brayton", GasCycleMath.brayton(gas, 8 + u() * 8, 1250 + u() * 350)]
|
|
377
|
-
];
|
|
378
|
-
return cycles.flatMap(([cycle, states]) => states.map((state) => ({ cycle, state: state.label, pressure: +state.pressure.toPrecision(5), volume: +state.volume.toPrecision(5), temperature: +state.temperature.toPrecision(5) })));
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
|
|
382
57
|
// src/charts/machinecharts/AshbyChart.ts
|
|
383
58
|
var AshbyEnvelope = /* @__PURE__ */ ((AshbyEnvelope2) => {
|
|
384
59
|
AshbyEnvelope2["Ellipse"] = "ellipses";
|
|
@@ -396,7 +71,7 @@ var AshbyGuide = /* @__PURE__ */ ((AshbyGuide2) => {
|
|
|
396
71
|
var SLOPE = { ["tie-guides" /* Tie */]: 1, ["beam-guides" /* Beam */]: 2, ["plate-guides" /* Plate */]: 3, ["no-guides" /* None */]: 0 };
|
|
397
72
|
var ROOT = ["", "", "^\xBD", "^\u2153"];
|
|
398
73
|
var plain = (value) => value.toLocaleString("en", { maximumSignificantDigits: 3 });
|
|
399
|
-
var AshbyChart = (_class = class extends MachineChart {
|
|
74
|
+
var AshbyChart = (_class = class extends _chunkFDD4UP73cjs.MachineChart {
|
|
400
75
|
static __initStatic() {this.meta = {
|
|
401
76
|
id: "ashby-chart",
|
|
402
77
|
name: "Ashby chart",
|
|
@@ -405,7 +80,7 @@ var AshbyChart = (_class = class extends MachineChart {
|
|
|
405
80
|
shape: "table" /* Table */,
|
|
406
81
|
description: "Maps material families as labelled envelopes on log-log axes of two properties, with guide lines of constant performance index.",
|
|
407
82
|
tags: ["materials selection", "material property chart", "modulus", "density", "performance index", "bubble chart"],
|
|
408
|
-
sample: (seed) => MachineSamples.materials(seed),
|
|
83
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.materials(seed),
|
|
409
84
|
variants: { envelope: Object.values(AshbyEnvelope), guide: Object.values(AshbyGuide), markers: [true, false] },
|
|
410
85
|
valid: (values) => values.markers === true || values.envelope !== "no-envelopes" /* None */
|
|
411
86
|
}}
|
|
@@ -433,13 +108,13 @@ var AshbyChart = (_class = class extends MachineChart {
|
|
|
433
108
|
}
|
|
434
109
|
/** Log axes label their decades only. */
|
|
435
110
|
tickFormat(scale) {
|
|
436
|
-
const log = scale === _optionalChain([this, 'access',
|
|
111
|
+
const log = scale === _optionalChain([this, 'access', _2 => _2.#axes, 'optionalAccess', _3 => _3.x]) ? this.options.xScaleType === "log" /* Log */ : this.options.yScaleType === "log" /* Log */;
|
|
437
112
|
return log ? (value) => Math.abs(Math.log10(+value) % 1) < 1e-9 ? plain(+value) : "" : (value) => plain(+value);
|
|
438
113
|
}
|
|
439
114
|
get materials() {
|
|
440
115
|
const { x, y, series, label, xScaleType, yScaleType } = this.options;
|
|
441
116
|
return this.rows.flatMap((row) => {
|
|
442
|
-
const px = MachineChart.number(row[x]), py = MachineChart.number(row[y]);
|
|
117
|
+
const px = _chunkFDD4UP73cjs.MachineChart.number(row[x]), py = _chunkFDD4UP73cjs.MachineChart.number(row[y]);
|
|
443
118
|
if (px === null || py === null || xScaleType === "log" /* Log */ && px <= 0 || yScaleType === "log" /* Log */ && py <= 0) return [];
|
|
444
119
|
return [{ family: String(_nullishCoalesce(row[series], () => ( "Materials"))), name: String(_nullishCoalesce(row[label], () => ( ""))), point: [px, py], row }];
|
|
445
120
|
});
|
|
@@ -459,9 +134,9 @@ var AshbyChart = (_class = class extends MachineChart {
|
|
|
459
134
|
const { theme, palette } = ctx, { materials } = this;
|
|
460
135
|
const slope = SLOPE[guide];
|
|
461
136
|
const window = [axes.x.domain(), axes.y.domain()];
|
|
462
|
-
const
|
|
137
|
+
const positive = window.flat().every((value) => value > 0);
|
|
463
138
|
const index = ([px, py]) => py ** (1 / slope) / px;
|
|
464
|
-
const corners =
|
|
139
|
+
const corners = positive && slope ? [index([window[0][1], window[1][0]]), index([window[0][0], window[1][1]])].map(Math.log10) : [];
|
|
465
140
|
const guides = (corners.length ? _d3.ticks.call(void 0, corners[0], corners[1], 5) : []).map((power) => ({ m: 10 ** power, points: AshbyMath.guide(10 ** power, slope, ...window) })).filter((d) => d.points.length);
|
|
466
141
|
this.curves(ctx, axes, "axis-guides", guides.map(({ m, points }) => ({ key: `${m}`, points, color: theme.axis, width: 1, dash: "5 4" })));
|
|
467
142
|
const families = [..._d3.group.call(void 0, materials, (d) => d.family)].map(([family, own]) => {
|
|
@@ -491,7 +166,7 @@ var AshbyChart = (_class = class extends MachineChart {
|
|
|
491
166
|
const names = families.flatMap((d) => {
|
|
492
167
|
if (!d.spots.length) return [];
|
|
493
168
|
const top = envelope === "ellipses" /* Ellipse */ && d.ellipse ? d.ellipse.cy - Math.max(d.ellipse.ry, 14) * 0.6 : Math.min(...d.spots.map((spot) => spot[1])) - 10;
|
|
494
|
-
return [{ key: d.family, text: d.family, x: d.spots.reduce((
|
|
169
|
+
return [{ key: d.family, text: d.family, x: d.spots.reduce((sum, spot) => sum + spot[0], 0) / d.spots.length, y: top, anchor: "middle", tone: "ink" }];
|
|
495
170
|
});
|
|
496
171
|
const marks = guides.map(({ m, points }, i) => {
|
|
497
172
|
const [px, py] = this.place(axes, points[points.length - 1]);
|
|
@@ -504,109 +179,6 @@ var AshbyChart = (_class = class extends MachineChart {
|
|
|
504
179
|
|
|
505
180
|
// src/charts/machinecharts/BsfcMap.ts
|
|
506
181
|
|
|
507
|
-
|
|
508
|
-
// src/charts/machinecharts/BsfcMath.ts
|
|
509
|
-
|
|
510
|
-
var BsfcMath = (_class2 = class _BsfcMath {
|
|
511
|
-
/** rpm × N·m per kW. */
|
|
512
|
-
static __initStatic2() {this.PER_KW = 6e4 / (2 * Math.PI)}
|
|
513
|
-
static power(speed, torque) {
|
|
514
|
-
return speed * torque / _BsfcMath.PER_KW;
|
|
515
|
-
}
|
|
516
|
-
static torque(speed, power) {
|
|
517
|
-
return power * _BsfcMath.PER_KW / speed;
|
|
518
|
-
}
|
|
519
|
-
/** Brake mean effective pressure of a four-stroke engine of `litres` swept volume. */
|
|
520
|
-
static bmep(torque, litres) {
|
|
521
|
-
return 4 * Math.PI * torque / (litres * 100);
|
|
522
|
-
}
|
|
523
|
-
/** Load sweeps, one per engine speed in rising order, each from its lowest torque to full load. Repeated points are averaged. */
|
|
524
|
-
static sweeps(rows, speed, torque, bsfc) {
|
|
525
|
-
const nodes = rows.flatMap((row) => {
|
|
526
|
-
const x = MachineChart.number(row[speed]), y = MachineChart.number(row[torque]), z = MachineChart.number(row[bsfc]);
|
|
527
|
-
return x === null || y === null || z === null ? [] : [{ x, y, z }];
|
|
528
|
-
});
|
|
529
|
-
return [..._d3.group.call(void 0, nodes, (node) => node.x)].sort(([a], [b]) => a - b).map(([x, own]) => [..._d3.group.call(void 0, own, (node) => node.y)].map(([y, same]) => ({ x, y, z: _d3.mean.call(void 0, same, (node) => node.z) })).sort((a, b) => a.y - b.y));
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* The `[speed, torque]` of least BSFC at each power: where a constant-power line touches its lowest contour. The minimum
|
|
533
|
-
* is shallow, so noise in the map moves it; each speed is averaged with its neighbours in power, weighted 1-2-1.
|
|
534
|
-
*/
|
|
535
|
-
static economy(mesh, powers) {
|
|
536
|
-
const found = powers.flatMap((power) => {
|
|
537
|
-
let best = null;
|
|
538
|
-
for (const sweep of mesh.nodes) {
|
|
539
|
-
const speed = sweep[0].x, torque = _BsfcMath.torque(speed, power);
|
|
540
|
-
const i = sweep.findIndex((node, at) => at > 0 && node.y >= torque && sweep[at - 1].y <= torque);
|
|
541
|
-
if (i < 1) continue;
|
|
542
|
-
const below = sweep[i - 1], above = sweep[i], t = (torque - below.y) / (above.y - below.y || 1);
|
|
543
|
-
const bsfc = below.z + (above.z - below.z) * t;
|
|
544
|
-
if (!best || bsfc < best.bsfc) best = { power, speed, bsfc };
|
|
545
|
-
}
|
|
546
|
-
return best ? [best] : [];
|
|
547
|
-
});
|
|
548
|
-
return found.map(({ power, speed }, i) => {
|
|
549
|
-
const smooth = ((_nullishCoalesce(_optionalChain([found, 'access', _5 => _5[i - 1], 'optionalAccess', _6 => _6.speed]), () => ( speed))) + 2 * speed + (_nullishCoalesce(_optionalChain([found, 'access', _7 => _7[i + 1], 'optionalAccess', _8 => _8.speed]), () => ( speed)))) / 4;
|
|
550
|
-
return [smooth, _BsfcMath.torque(smooth, power)];
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
}, _class2.__initStatic2(), _class2);
|
|
554
|
-
|
|
555
|
-
// src/charts/machinecharts/MachineMesh.ts
|
|
556
|
-
|
|
557
|
-
var lerp = (a, b, t) => ({ x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t, z: a.z + (b.z - a.z) * t });
|
|
558
|
-
var spline = (a, b, c, d, t) => 0.5 * (2 * b + (c - a) * t + (2 * a - 5 * b + 4 * c - d) * t * t + (3 * b - a - 3 * c + d) * t ** 3);
|
|
559
|
-
var MachineMesh = class {
|
|
560
|
-
/** `nodes[row][column]`: rows run across the lines, columns along them. */
|
|
561
|
-
|
|
562
|
-
/** `lines` in map order, each from one edge of the map to the other. Lines with fewer than two points are left out. */
|
|
563
|
-
constructor(lines, along = 24, between = 5) {
|
|
564
|
-
const usable = lines.filter((line4) => line4.length > 1), all = usable.flat();
|
|
565
|
-
const [x0 = 0, x1 = 1] = _d3.extent.call(void 0, all, (node) => node.x), [y0 = 0, y1 = 1] = _d3.extent.call(void 0, all, (node) => node.y);
|
|
566
|
-
const sx = x1 - x0 || 1, sy = y1 - y0 || 1;
|
|
567
|
-
const even = usable.map((line4) => {
|
|
568
|
-
const reach = [0];
|
|
569
|
-
for (let i = 1; i < line4.length; i++) reach.push(reach[i - 1] + Math.hypot((line4[i].x - line4[i - 1].x) / sx, (line4[i].y - line4[i - 1].y) / sy));
|
|
570
|
-
const total = reach[reach.length - 1] || 1;
|
|
571
|
-
let at = 0;
|
|
572
|
-
return Array.from({ length: along }, (_, step) => {
|
|
573
|
-
const want = step / (along - 1) * total;
|
|
574
|
-
while (at < line4.length - 2 && reach[at + 1] < want) at++;
|
|
575
|
-
return lerp(line4[at], line4[at + 1], Math.max(0, Math.min(1, (want - reach[at]) / (reach[at + 1] - reach[at] || 1))));
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
const last = even.length - 1;
|
|
579
|
-
this.nodes = last < 1 ? [] : Array.from({ length: last * between + 1 }, (_, row) => {
|
|
580
|
-
const line4 = Math.min(last - 1, Math.floor(row / between)), t = row / between - line4;
|
|
581
|
-
const [a, b, c, d] = [-1, 0, 1, 2].map((shift) => even[Math.max(0, Math.min(last, line4 + shift))]);
|
|
582
|
-
return b.map((_2, i) => ({ x: spline(a[i].x, b[i].x, c[i].x, d[i].x, t), y: spline(a[i].y, b[i].y, c[i].y, d[i].y, t), z: spline(a[i].z, b[i].z, c[i].z, d[i].z, t) }));
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
get rows() {
|
|
586
|
-
return this.nodes.length;
|
|
587
|
-
}
|
|
588
|
-
get columns() {
|
|
589
|
-
return _nullishCoalesce(_optionalChain([this, 'access', _9 => _9.nodes, 'access', _10 => _10[0], 'optionalAccess', _11 => _11.length]), () => ( 0));
|
|
590
|
-
}
|
|
591
|
-
/** The contoured quantity, row by row, as d3's contour generator takes it. */
|
|
592
|
-
get values() {
|
|
593
|
-
return this.nodes.flatMap((row) => row.map((node) => node.z));
|
|
594
|
-
}
|
|
595
|
-
/** Where fractional mesh coordinates sit on the map. */
|
|
596
|
-
at(column, row) {
|
|
597
|
-
const i = Math.max(0, Math.min(this.columns - 2, Math.floor(column))), j = Math.max(0, Math.min(this.rows - 2, Math.floor(row)));
|
|
598
|
-
const top = lerp(this.nodes[j][i], this.nodes[j][i + 1], column - i), bottom = lerp(this.nodes[j + 1][i], this.nodes[j + 1][i + 1], column - i);
|
|
599
|
-
const { x, y } = lerp(top, bottom, row - j);
|
|
600
|
-
return [x, y];
|
|
601
|
-
}
|
|
602
|
-
/** Round contour levels strictly inside the range of the mesh. */
|
|
603
|
-
levels(count = 6) {
|
|
604
|
-
const [low, high] = _d3.extent.call(void 0, this.values);
|
|
605
|
-
return low === void 0 || high === void 0 ? [] : _d3.ticks.call(void 0, low, high, count).filter((level) => level > low && level < high);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
// src/charts/machinecharts/BsfcMap.ts
|
|
610
182
|
var BsfcLoad = /* @__PURE__ */ ((BsfcLoad2) => {
|
|
611
183
|
BsfcLoad2["Torque"] = "torque";
|
|
612
184
|
BsfcLoad2["Bmep"] = "bmep";
|
|
@@ -625,8 +197,8 @@ var BsfcOptimum = /* @__PURE__ */ ((BsfcOptimum2) => {
|
|
|
625
197
|
})(BsfcOptimum || {});
|
|
626
198
|
var BSFC = "BSFC";
|
|
627
199
|
var ECONOMY = "Best economy line";
|
|
628
|
-
var BsfcMap = (
|
|
629
|
-
static
|
|
200
|
+
var BsfcMap = (_class2 = class extends _chunkFDD4UP73cjs.MachineChart {
|
|
201
|
+
static __initStatic2() {this.meta = {
|
|
630
202
|
id: "bsfc-map",
|
|
631
203
|
name: "Engine BSFC map",
|
|
632
204
|
family: "scientific" /* Scientific */,
|
|
@@ -634,7 +206,7 @@ var BsfcMap = (_class3 = class extends MachineChart {
|
|
|
634
206
|
shape: "table" /* Table */,
|
|
635
207
|
description: "Draws brake specific fuel consumption as contours over engine speed and torque or BMEP, with the full-load curve and constant-power lines.",
|
|
636
208
|
tags: ["engine map", "fuel consumption", "fuel island", "bmep", "torque curve", "automotive", "powertrain"],
|
|
637
|
-
sample: (seed) => MachineSamples.bsfcMap(seed),
|
|
209
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.bsfcMap(seed),
|
|
638
210
|
variants: { contours: Object.values(BsfcContours), load: Object.values(BsfcLoad), power: [true, false], optimum: Object.values(BsfcOptimum) }
|
|
639
211
|
}}
|
|
640
212
|
defaults() {
|
|
@@ -644,11 +216,11 @@ var BsfcMap = (_class3 = class extends MachineChart {
|
|
|
644
216
|
return { y: this.options.load === "bmep" /* Bmep */ ? "BMEP (bar)" : "Torque (N\xB7m)" };
|
|
645
217
|
}
|
|
646
218
|
get sweeps() {
|
|
647
|
-
return BsfcMath.sweeps(this.rows, this.options.x, this.options.y, this.options.bsfc);
|
|
219
|
+
return _chunkFDD4UP73cjs.BsfcMath.sweeps(this.rows, this.options.x, this.options.y, this.options.bsfc);
|
|
648
220
|
}
|
|
649
221
|
/** Torque as the load axis plots it. */
|
|
650
222
|
load(torque) {
|
|
651
|
-
return this.options.load === "bmep" /* Bmep */ ? BsfcMath.bmep(torque, this.options.displacement || 1) : torque;
|
|
223
|
+
return this.options.load === "bmep" /* Bmep */ ? _chunkFDD4UP73cjs.BsfcMath.bmep(torque, this.options.displacement || 1) : torque;
|
|
652
224
|
}
|
|
653
225
|
scales(ctx) {
|
|
654
226
|
const nodes = this.sweeps.flat(), [low, high] = this.span(nodes.map((node) => node.x), 0);
|
|
@@ -661,7 +233,7 @@ var BsfcMap = (_class3 = class extends MachineChart {
|
|
|
661
233
|
const { contours, power, optimum } = this.options;
|
|
662
234
|
const { sweeps } = this, { theme, palette } = ctx;
|
|
663
235
|
const spot = (node) => [node.x, this.load(node.y)];
|
|
664
|
-
const mesh = new MachineMesh(sweeps, 24, 4), filled = contours === "contour-fills" /* Filled */;
|
|
236
|
+
const mesh = new (0, _chunkFDD4UP73cjs.MachineMesh)(sweeps, 24, 4), filled = contours === "contour-fills" /* Filled */;
|
|
665
237
|
const tone = palette.color(BSFC);
|
|
666
238
|
const field = new (0, _chunk4VWNDCUScjs.FieldContours)(mesh.values.map((value) => -value), mesh.columns, mesh.rows, (i, j) => {
|
|
667
239
|
const [x, y] = mesh.at(i, j);
|
|
@@ -669,12 +241,12 @@ var BsfcMap = (_class3 = class extends MachineChart {
|
|
|
669
241
|
});
|
|
670
242
|
const levels = mesh.levels(10).reverse();
|
|
671
243
|
const regions = levels.map((level, i) => {
|
|
672
|
-
const { area: area3, line:
|
|
244
|
+
const { area: area3, line: line3, polylines } = field.at(-level);
|
|
673
245
|
const longest = polylines.reduce((best2, run) => run.length > best2.length ? run : best2, []);
|
|
674
246
|
const share = levels.length > 1 ? i / (levels.length - 1) : 1;
|
|
675
|
-
return { level, share, fill: palette.sequential(0.08 + 0.8 * share), area: area3, line:
|
|
247
|
+
return { level, share, fill: palette.sequential(0.08 + 0.8 * share), area: area3, line: line3, mid: _nullishCoalesce(longest[Math.floor(longest.length / 2)], () => ( null)) };
|
|
676
248
|
});
|
|
677
|
-
const told = (d) => ({ title: `${MachineChart.short(d.level)} g/kWh`, color: tone, rows: [[BSFC, filled ? "at or below" : "contour"]] });
|
|
249
|
+
const told = (d) => ({ title: `${_chunkFDD4UP73cjs.MachineChart.short(d.level)} g/kWh`, color: tone, rows: [[BSFC, filled ? "at or below" : "contour"]] });
|
|
678
250
|
const fills = ctx.marks("regions", "path", filled ? regions : [], (d) => d.level).attr("fill", (d) => d.fill).attr("stroke", "none");
|
|
679
251
|
ctx.set(fills, { d: (d) => d.area });
|
|
680
252
|
ctx.hover(fills, told);
|
|
@@ -688,40 +260,40 @@ var BsfcMap = (_class3 = class extends MachineChart {
|
|
|
688
260
|
const a = full[i - 1], b = full[i];
|
|
689
261
|
return a.y + (b.y - a.y) * (speed - a.x) / (b.x - a.x || 1);
|
|
690
262
|
};
|
|
691
|
-
const peak = _nullishCoalesce(_d3.max.call(void 0, full, (node) => BsfcMath.power(node.x, node.y)), () => ( 0));
|
|
692
|
-
const [first, last] = [_nullishCoalesce(_optionalChain([full, 'access',
|
|
263
|
+
const peak = _nullishCoalesce(_d3.max.call(void 0, full, (node) => _chunkFDD4UP73cjs.BsfcMath.power(node.x, node.y)), () => ( 0));
|
|
264
|
+
const [first, last] = [_nullishCoalesce(_optionalChain([full, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.x]), () => ( 0)), _nullishCoalesce(_optionalChain([full, 'access', _6 => _6[full.length - 1], 'optionalAccess', _7 => _7.x]), () => ( 0))];
|
|
693
265
|
const steps = _d3.range.call(void 0, 0, 81).map((i) => first + (last - first) * i / 80);
|
|
694
266
|
const hyperbolas = (power && peak > 0 ? _d3.ticks.call(void 0, 0, peak, 6).filter((kw) => kw > 0) : []).map((kw) => ({
|
|
695
267
|
kw,
|
|
696
268
|
points: steps.map((speed) => {
|
|
697
|
-
const torque = BsfcMath.torque(speed, kw);
|
|
269
|
+
const torque = _chunkFDD4UP73cjs.BsfcMath.torque(speed, kw);
|
|
698
270
|
return torque <= limit(speed) ? spot({ x: speed, y: torque }) : [NaN, NaN];
|
|
699
271
|
})
|
|
700
|
-
})).filter((
|
|
272
|
+
})).filter((line3) => line3.points.filter((point) => Number.isFinite(point[1])).length > 1);
|
|
701
273
|
this.curves(ctx, axes, "axis-power", hyperbolas.map(({ kw, points }) => ({ key: `${kw}`, points, color: theme.axis, width: 1, dash: "5 4" })));
|
|
702
274
|
this.curves(ctx, axes, "full-load", full.length > 1 ? [{ key: "full", points: full.map(spot), color: theme.ink, width: 2.5 }] : []);
|
|
703
|
-
const economy = optimum === "economy-line" /* Line */ && mesh.rows ? BsfcMath.economy(mesh, _d3.range.call(void 0, 1, 25).map((i) => peak * i / 25)) : [];
|
|
275
|
+
const economy = optimum === "economy-line" /* Line */ && mesh.rows ? _chunkFDD4UP73cjs.BsfcMath.economy(mesh, _d3.range.call(void 0, 1, 25).map((i) => peak * i / 25)) : [];
|
|
704
276
|
this.curves(ctx, axes, "economy", economy.length > 1 ? [{ key: "economy", points: economy.map(([x, y]) => spot({ x, y })), color: palette.color(ECONOMY), curve: _d3.curveBasis }] : []);
|
|
705
277
|
const best = optimum === "best-point" /* Point */ ? sweeps.flat().reduce((low, node) => !low || node.z < low.z ? node : low, null) : null;
|
|
706
278
|
this.dots(ctx, axes, "best", best ? [best] : [], spot, () => theme.ink, (d) => ({
|
|
707
279
|
title: "Lowest BSFC",
|
|
708
|
-
rows: [["BSFC", `${MachineChart.short(d.z, 4)} g/kWh`], ["Speed", `${Math.round(d.x).toLocaleString("en")} rpm`], ["Torque", `${MachineChart.short(d.y)} N\xB7m`], ["Power", `${MachineChart.short(BsfcMath.power(d.x, d.y))} kW`]]
|
|
280
|
+
rows: [["BSFC", `${_chunkFDD4UP73cjs.MachineChart.short(d.z, 4)} g/kWh`], ["Speed", `${Math.round(d.x).toLocaleString("en")} rpm`], ["Torque", `${_chunkFDD4UP73cjs.MachineChart.short(d.y)} N\xB7m`], ["Power", `${_chunkFDD4UP73cjs.MachineChart.short(_chunkFDD4UP73cjs.BsfcMath.power(d.x, d.y))} kW`]]
|
|
709
281
|
}), 5);
|
|
710
282
|
const at = (point) => point ? this.place(axes, point) : [NaN, NaN];
|
|
711
283
|
const top = full.reduce((high, node) => !high || node.y > high.y ? node : high, void 0);
|
|
712
284
|
const [tx, ty] = at(top && spot(top)), [bx, by] = at(best ? spot(best) : void 0);
|
|
713
285
|
const notes = [
|
|
714
|
-
{ key: "best", text: best ? `${MachineChart.short(best.z, 4)} g/kWh` : "", x: bx + 9, y: by + 4, tone: "ink", over: filled ? _optionalChain([regions, 'access',
|
|
286
|
+
{ key: "best", text: best ? `${_chunkFDD4UP73cjs.MachineChart.short(best.z, 4)} g/kWh` : "", x: bx + 9, y: by + 4, tone: "ink", over: filled ? _optionalChain([regions, 'access', _8 => _8[regions.length - 1], 'optionalAccess', _9 => _9.fill]) : void 0 },
|
|
715
287
|
{ key: "full", text: "Full load", x: tx, y: ty - 8, anchor: "middle", tone: "ink" },
|
|
716
288
|
...hyperbolas.map(({ kw, points }) => {
|
|
717
289
|
const [x, y] = at(points.findLast((point) => Number.isFinite(point[1])));
|
|
718
290
|
return { key: `kw${kw}`, text: `${kw} kW`, x: x + 5, y: y + 4, tone: "muted" };
|
|
719
291
|
}),
|
|
720
|
-
...regions.flatMap((region) => region.mid ? [{ key: `level${region.level}`, text: MachineChart.short(region.level), x: region.mid[0], y: region.mid[1] + 4, anchor: "middle", over: filled ? region.fill : void 0 }] : [])
|
|
292
|
+
...regions.flatMap((region) => region.mid ? [{ key: `level${region.level}`, text: _chunkFDD4UP73cjs.MachineChart.short(region.level), x: region.mid[0], y: region.mid[1] + 4, anchor: "middle", over: filled ? region.fill : void 0 }] : [])
|
|
721
293
|
];
|
|
722
294
|
this.notes(ctx, "labels", notes.filter((note) => note.text));
|
|
723
295
|
}
|
|
724
|
-
},
|
|
296
|
+
}, _class2.__initStatic2(), _class2);
|
|
725
297
|
|
|
726
298
|
// src/charts/machinecharts/CampbellDiagram.ts
|
|
727
299
|
|
|
@@ -732,7 +304,7 @@ var CampbellMath = class {
|
|
|
732
304
|
/** One line per mode, ordered by speed, with repeated speeds averaged. */
|
|
733
305
|
static modes(rows, speed, frequency, series) {
|
|
734
306
|
const usable = rows.flatMap((row) => {
|
|
735
|
-
const x = MachineChart.number(row[speed]), y = MachineChart.number(row[frequency]);
|
|
307
|
+
const x = _chunkFDD4UP73cjs.MachineChart.number(row[speed]), y = _chunkFDD4UP73cjs.MachineChart.number(row[frequency]);
|
|
736
308
|
return x === null || y === null ? [] : [{ mode: String(_nullishCoalesce(row[series], () => ( "Mode"))), x, y }];
|
|
737
309
|
});
|
|
738
310
|
return [..._d3.group.call(void 0, usable, (d) => d.mode)].map(([mode, own]) => ({
|
|
@@ -761,8 +333,8 @@ var CampbellMath = class {
|
|
|
761
333
|
|
|
762
334
|
// src/charts/machinecharts/CampbellDiagram.ts
|
|
763
335
|
var rpm = (speed) => `${Math.round(speed).toLocaleString("en")} rpm`;
|
|
764
|
-
var CampbellDiagram = (
|
|
765
|
-
static
|
|
336
|
+
var CampbellDiagram = (_class3 = class extends _chunkFDD4UP73cjs.MachineChart {
|
|
337
|
+
static __initStatic3() {this.meta = {
|
|
766
338
|
id: "campbell-diagram",
|
|
767
339
|
name: "Campbell diagram",
|
|
768
340
|
family: "scientific" /* Scientific */,
|
|
@@ -770,7 +342,7 @@ var CampbellDiagram = (_class4 = class extends MachineChart {
|
|
|
770
342
|
shape: "table" /* Table */,
|
|
771
343
|
description: "Plots natural frequencies against rotor speed with engine-order lines from the origin, and marks the critical speeds where they cross.",
|
|
772
344
|
tags: ["rotordynamics", "critical speed", "engine order", "whirl", "vibration", "turbomachinery"],
|
|
773
|
-
sample: (seed) => MachineSamples.campbell(seed),
|
|
345
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.campbell(seed),
|
|
774
346
|
variants: { maxOrder: [4, 2, 6, 1], crossings: [true, false], bands: [false, true], markers: [false, true] },
|
|
775
347
|
valid: (values) => !(values.bands && !values.crossings)
|
|
776
348
|
}}
|
|
@@ -816,7 +388,7 @@ var CampbellDiagram = (_class4 = class extends MachineChart {
|
|
|
816
388
|
markers ? modes.flatMap(({ mode, points }) => points.map((point) => ({ mode, point }))) : [],
|
|
817
389
|
(d) => d.point,
|
|
818
390
|
(d) => ctx.palette.color(d.mode),
|
|
819
|
-
(d) => ({ title: d.mode, color: ctx.palette.color(d.mode), rows: [["Speed", rpm(d.point[0])], ["Frequency", `${MachineChart.short(d.point[1])} Hz`]] }),
|
|
391
|
+
(d) => ({ title: d.mode, color: ctx.palette.color(d.mode), rows: [["Speed", rpm(d.point[0])], ["Frequency", `${_chunkFDD4UP73cjs.MachineChart.short(d.point[1])} Hz`]] }),
|
|
820
392
|
3
|
|
821
393
|
);
|
|
822
394
|
this.dots(
|
|
@@ -826,7 +398,7 @@ var CampbellDiagram = (_class4 = class extends MachineChart {
|
|
|
826
398
|
found,
|
|
827
399
|
(d) => [d.speed, d.frequency],
|
|
828
400
|
() => ctx.theme.ink,
|
|
829
|
-
(d) => ({ title: `${d.mode} at ${d.order}\xD7`, rows: [["Critical speed", rpm(d.speed)], ["Frequency", `${MachineChart.short(d.frequency)} Hz`]] }),
|
|
401
|
+
(d) => ({ title: `${d.mode} at ${d.order}\xD7`, rows: [["Critical speed", rpm(d.speed)], ["Frequency", `${_chunkFDD4UP73cjs.MachineChart.short(d.frequency)} Hz`]] }),
|
|
830
402
|
4.5
|
|
831
403
|
);
|
|
832
404
|
const ends = rays.map(({ order, points }) => {
|
|
@@ -839,7 +411,7 @@ var CampbellDiagram = (_class4 = class extends MachineChart {
|
|
|
839
411
|
});
|
|
840
412
|
this.notes(ctx, "labels", [...speeds, ...ends]);
|
|
841
413
|
}
|
|
842
|
-
},
|
|
414
|
+
}, _class3.__initStatic3(), _class3);
|
|
843
415
|
|
|
844
416
|
// src/charts/machinecharts/CarpetPlot.ts
|
|
845
417
|
|
|
@@ -855,8 +427,8 @@ var CarpetGrid = class {
|
|
|
855
427
|
|
|
856
428
|
constructor(rows, columns, shift = 1) {
|
|
857
429
|
const read = rows.flatMap((row) => {
|
|
858
|
-
const a = MachineChart.number(row[columns.a]), b = MachineChart.number(row[columns.b]), value = MachineChart.number(row[columns.value]);
|
|
859
|
-
return a === null || b === null || value === null ? [] : [{ a, b, value, other: MachineChart.number(row[columns.other]) }];
|
|
430
|
+
const a = _chunkFDD4UP73cjs.MachineChart.number(row[columns.a]), b = _chunkFDD4UP73cjs.MachineChart.number(row[columns.b]), value = _chunkFDD4UP73cjs.MachineChart.number(row[columns.value]);
|
|
431
|
+
return a === null || b === null || value === null ? [] : [{ a, b, value, other: _chunkFDD4UP73cjs.MachineChart.number(row[columns.other]) }];
|
|
860
432
|
});
|
|
861
433
|
const levels = (pick) => [...new Set(read.map(pick))].sort((p, q) => p - q);
|
|
862
434
|
const as = levels((node) => node.a), bs = levels((node) => node.b);
|
|
@@ -882,8 +454,8 @@ var words = (column) => {
|
|
|
882
454
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
883
455
|
};
|
|
884
456
|
var KEY_ROW = 15;
|
|
885
|
-
var CarpetPlot = (
|
|
886
|
-
static
|
|
457
|
+
var CarpetPlot = (_class4 = class extends _chunkFDD4UP73cjs.MachineChart {constructor(...args) { super(...args); _class4.prototype.__init.call(this); }
|
|
458
|
+
static __initStatic4() {this.meta = {
|
|
887
459
|
id: "carpet-plot",
|
|
888
460
|
name: "Carpet plot",
|
|
889
461
|
family: "scientific" /* Scientific */,
|
|
@@ -891,7 +463,7 @@ var CarpetPlot = (_class5 = class extends MachineChart {constructor(...args) { s
|
|
|
891
463
|
shape: "table" /* Table */,
|
|
892
464
|
description: "Draws a response over two independent variables as two crossing families of curves, spread along a cheater axis or a second response.",
|
|
893
465
|
tags: ["cheater plot", "design study", "sizing", "trade study", "aerospace", "two variables"],
|
|
894
|
-
sample: (seed) => MachineSamples.sizing(seed),
|
|
466
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.sizing(seed),
|
|
895
467
|
variants: { abscissa: Object.values(CarpetAbscissa), shift: [1, 0.5, 2], curve: ["natural" /* Natural */, "linear" /* Linear */], nodes: [true, false] },
|
|
896
468
|
valid: (values) => values.abscissa === "cheater-axis" /* Cheater */ || values.shift === 1
|
|
897
469
|
}}
|
|
@@ -927,21 +499,21 @@ var CarpetPlot = (_class5 = class extends MachineChart {constructor(...args) { s
|
|
|
927
499
|
const { a, b, y, x, curve, nodes } = this.options;
|
|
928
500
|
const { grid, cheater } = this, { theme, palette } = ctx, { height } = ctx.plot;
|
|
929
501
|
const names = [words(a), words(b)], shape = _chunkPY4R3IFFcjs.Scales.curve(curve);
|
|
930
|
-
const lines = grid.families.flatMap((family, side) => family.map((
|
|
931
|
-
const drawn = this.curves(ctx, axes, "carpet", lines.map((
|
|
502
|
+
const lines = grid.families.flatMap((family, side) => family.map((line3) => ({ side, level: line3.level, points: line3.nodes.map(this.spot).filter((point) => Number.isFinite(point[0])) }))).filter((line3) => line3.points.length > 1);
|
|
503
|
+
const drawn = this.curves(ctx, axes, "carpet", lines.map((line3) => ({ key: `${line3.side}/${line3.level}`, points: line3.points, color: palette.color(names[line3.side]), curve: shape })));
|
|
932
504
|
ctx.hover(drawn, (d) => {
|
|
933
505
|
const [side, level] = d.key.split("/");
|
|
934
506
|
return { title: `${names[+side]} = ${level}`, color: d.color };
|
|
935
507
|
});
|
|
936
|
-
const number = (value) => MachineChart.short(value, 4);
|
|
508
|
+
const number = (value) => _chunkFDD4UP73cjs.MachineChart.short(value, 4);
|
|
937
509
|
this.dots(ctx, axes, "nodes", nodes ? grid.nodes : [], this.spot, () => theme.ink, (d) => ({
|
|
938
510
|
title: `${names[0]} ${number(d.a)}, ${names[1]} ${number(d.b)}`,
|
|
939
511
|
rows: [[words(y), number(d.value)], ...d.other === null ? [] : [[words(x), number(d.other)]]]
|
|
940
512
|
}), 3.5);
|
|
941
|
-
const ends = lines.map((
|
|
942
|
-
const first = this.place(axes,
|
|
943
|
-
const end =
|
|
944
|
-
return
|
|
513
|
+
const ends = lines.map((line3) => {
|
|
514
|
+
const first = this.place(axes, line3.points[0]), last = this.place(axes, line3.points[line3.points.length - 1]);
|
|
515
|
+
const end = line3.side === 0 ? first[1] > last[1] ? first : last : first[0] > last[0] ? first : last;
|
|
516
|
+
return line3.side === 0 ? { key: `0/${line3.level}`, text: number(line3.level), x: end[0], y: end[1] + 15, anchor: "middle" } : { key: `1/${line3.level}`, text: number(line3.level), x: end[0] + 7, y: end[1] + 4 };
|
|
945
517
|
});
|
|
946
518
|
this.notes(ctx, "labels", ends);
|
|
947
519
|
const origin = _nullishCoalesce(axes.x(0), () => ( 0)), reach = (step) => (_nullishCoalesce(axes.x(step), () => ( 0))) - origin;
|
|
@@ -958,7 +530,7 @@ var CarpetPlot = (_class5 = class extends MachineChart {constructor(...args) { s
|
|
|
958
530
|
ctx.set(rules, { d: (d) => `M${d.from},${d.y - 4}V${d.y + 4}M${d.from},${d.y}H${d.to.toFixed(1)}M${d.to.toFixed(1)},${d.y - 4}V${d.y + 4}` });
|
|
959
531
|
ctx.text(ctx.marks("captions", "text", bars, (d) => d.key, key)).attr("x", (d) => d.to + 8).attr("y", (d) => d.y + 4).text((d) => d.text);
|
|
960
532
|
}
|
|
961
|
-
},
|
|
533
|
+
}, _class4.__initStatic4(), _class4);
|
|
962
534
|
|
|
963
535
|
// src/charts/machinecharts/CompressorMap.ts
|
|
964
536
|
|
|
@@ -977,8 +549,8 @@ var CompressorLimits = /* @__PURE__ */ ((CompressorLimits2) => {
|
|
|
977
549
|
var EFFICIENCY = "Efficiency";
|
|
978
550
|
var SPEED = "Speed lines";
|
|
979
551
|
var PEAK = "Peak efficiency";
|
|
980
|
-
var CompressorMap = (
|
|
981
|
-
static
|
|
552
|
+
var CompressorMap = (_class5 = class extends _chunkFDD4UP73cjs.MachineChart {
|
|
553
|
+
static __initStatic5() {this.meta = {
|
|
982
554
|
id: "compressor-map",
|
|
983
555
|
name: "Compressor map",
|
|
984
556
|
family: "scientific" /* Scientific */,
|
|
@@ -986,7 +558,7 @@ var CompressorMap = (_class6 = class extends MachineChart {
|
|
|
986
558
|
shape: "table" /* Table */,
|
|
987
559
|
description: "Plots pressure ratio against corrected mass flow along speed lines, with efficiency islands as contours and the surge and choke lines.",
|
|
988
560
|
tags: ["turbomachinery", "turbocharger", "surge line", "choke", "efficiency island", "speed line", "gas turbine"],
|
|
989
|
-
sample: (seed) => MachineSamples.compressor(seed),
|
|
561
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.compressor(seed),
|
|
990
562
|
variants: { islands: Object.values(CompressorIslands), limits: Object.values(CompressorLimits), ridge: [false, true], markers: [true, false] }
|
|
991
563
|
}}
|
|
992
564
|
defaults() {
|
|
@@ -1007,8 +579,8 @@ var CompressorMap = (_class6 = class extends MachineChart {
|
|
|
1007
579
|
get lines() {
|
|
1008
580
|
const { x, y, series, efficiency } = this.options;
|
|
1009
581
|
const points = this.rows.flatMap((row) => {
|
|
1010
|
-
const flow = MachineChart.number(row[x]), ratio = MachineChart.number(row[y]);
|
|
1011
|
-
return flow === null || ratio === null ? [] : [{ speed: String(_nullishCoalesce(row[series], () => ( "Speed"))), x: flow, y: ratio, z: _nullishCoalesce(MachineChart.number(row[efficiency]), () => ( NaN)) }];
|
|
582
|
+
const flow = _chunkFDD4UP73cjs.MachineChart.number(row[x]), ratio = _chunkFDD4UP73cjs.MachineChart.number(row[y]);
|
|
583
|
+
return flow === null || ratio === null ? [] : [{ speed: String(_nullishCoalesce(row[series], () => ( "Speed"))), x: flow, y: ratio, z: _nullishCoalesce(_chunkFDD4UP73cjs.MachineChart.number(row[efficiency]), () => ( NaN)) }];
|
|
1012
584
|
});
|
|
1013
585
|
return [..._d3.group.call(void 0, points, (d) => d.speed)].map(([speed, own]) => ({ speed, points: own.sort((a, b) => a.x - b.x) })).sort((a, b) => _d3.mean.call(void 0, a.points, (d) => d.x) - _d3.mean.call(void 0, b.points, (d) => d.x));
|
|
1014
586
|
}
|
|
@@ -1018,7 +590,7 @@ var CompressorMap = (_class6 = class extends MachineChart {
|
|
|
1018
590
|
return ridge && items.length ? [...items, { key: PEAK, color: this.theme.ink }] : items;
|
|
1019
591
|
}
|
|
1020
592
|
scales(ctx) {
|
|
1021
|
-
const points = this.lines.flatMap((
|
|
593
|
+
const points = this.lines.flatMap((line3) => line3.points);
|
|
1022
594
|
return {
|
|
1023
595
|
x: _d3.scaleLinear.call(void 0, this.span(points.map((d) => d.x), 0.07), [0, ctx.plot.width]),
|
|
1024
596
|
y: _d3.scaleLinear.call(void 0, this.span(points.map((d) => d.y), 0.07), [ctx.plot.height, 0])
|
|
@@ -1028,42 +600,42 @@ var CompressorMap = (_class6 = class extends MachineChart {
|
|
|
1028
600
|
const { islands, limits, ridge, markers } = this.options;
|
|
1029
601
|
const { lines } = this, { theme, palette } = ctx;
|
|
1030
602
|
const tone = palette.color(EFFICIENCY), ink = palette.color(SPEED);
|
|
1031
|
-
const measured = lines.filter((
|
|
1032
|
-
const percent = (_nullishCoalesce(_d3.max.call(void 0, measured.flatMap((
|
|
1033
|
-
const efficiency = (value) => percent ? `${MachineChart.short(value * 100)}%` : MachineChart.short(value);
|
|
1034
|
-
const mesh = new MachineMesh(measured.map((
|
|
603
|
+
const measured = lines.filter((line3) => line3.points.length > 1 && line3.points.every((d) => Number.isFinite(d.z)));
|
|
604
|
+
const percent = (_nullishCoalesce(_d3.max.call(void 0, measured.flatMap((line3) => line3.points), (d) => d.z), () => ( 0))) <= 1.5;
|
|
605
|
+
const efficiency = (value) => percent ? `${_chunkFDD4UP73cjs.MachineChart.short(value * 100)}%` : _chunkFDD4UP73cjs.MachineChart.short(value);
|
|
606
|
+
const mesh = new (0, _chunkFDD4UP73cjs.MachineMesh)(measured.map((line3) => line3.points));
|
|
1035
607
|
const field = new (0, _chunk4VWNDCUScjs.FieldContours)(mesh.values, mesh.columns, mesh.rows, (i, j) => this.place(axes, mesh.at(i, j)));
|
|
1036
608
|
const levels = islands === "no-islands" /* None */ || !mesh.rows ? [] : mesh.levels();
|
|
1037
609
|
const shapes = levels.map((level, i) => {
|
|
1038
|
-
const { area: area3, line:
|
|
610
|
+
const { area: area3, line: line3, polylines } = field.at(level);
|
|
1039
611
|
const share = levels.length > 1 ? i / (levels.length - 1) : 1;
|
|
1040
612
|
const longest = polylines.reduce((best, run) => run.length > best.length ? run : best, []);
|
|
1041
|
-
return { level, share, fill: palette.sequential(0.1 + 0.75 * share), area: area3, line:
|
|
613
|
+
return { level, share, fill: palette.sequential(0.1 + 0.75 * share), area: area3, line: line3, at: _nullishCoalesce(longest[Math.floor((longest.length - 1) * (0.2 + 0.6 * share))], () => ( null)) };
|
|
1042
614
|
});
|
|
1043
615
|
const fills = ctx.marks("islands", "path", islands === "island-fills" /* Filled */ ? shapes : [], (d) => d.level).attr("fill", (d) => d.fill).attr("stroke", "none");
|
|
1044
616
|
ctx.set(fills, { d: (d) => d.area });
|
|
1045
617
|
ctx.hover(fills, (d) => ({ title: `Efficiency at or above ${efficiency(d.level)}`, color: tone }));
|
|
1046
618
|
const rings = ctx.marks("island-lines", "path", islands === "island-lines" /* Lines */ ? shapes : [], (d) => d.level).attr("fill", "none").attr("stroke", (d) => palette.sequential(0.4 + 0.6 * d.share)).attr("stroke-width", 1.5);
|
|
1047
619
|
ctx.set(rings, { d: (d) => d.line });
|
|
1048
|
-
const ends = (pick) => lines.filter((
|
|
1049
|
-
const node = pick(
|
|
620
|
+
const ends = (pick) => lines.filter((line3) => line3.points.length).map((line3) => {
|
|
621
|
+
const node = pick(line3);
|
|
1050
622
|
return [node.x, node.y];
|
|
1051
623
|
});
|
|
1052
|
-
const surge = limits === "no-limits" /* None */ ? [] : ends((
|
|
1053
|
-
const choke = limits === "surge-and-choke" /* Both */ ? ends((
|
|
624
|
+
const surge = limits === "no-limits" /* None */ ? [] : ends((line3) => line3.points[0]);
|
|
625
|
+
const choke = limits === "surge-and-choke" /* Both */ ? ends((line3) => line3.points[line3.points.length - 1]) : [];
|
|
1054
626
|
this.curves(ctx, axes, "limits", [
|
|
1055
627
|
...choke.length > 1 ? [{ key: "choke", points: choke, color: theme.inkMuted, dash: "6 4" }] : [],
|
|
1056
628
|
...surge.length > 1 ? [{ key: "surge", points: surge, color: theme.ink, width: 2.5 }] : []
|
|
1057
629
|
]);
|
|
1058
|
-
const speeds = this.curves(ctx, axes, "speed-lines", lines.map((
|
|
1059
|
-
ctx.hover(speeds, (d) => ({ title: `Speed ${d.key}`, color: ink, rows: [["Flow at surge", MachineChart.short(d.points[0][0])], ["Flow at choke", MachineChart.short(d.points[d.points.length - 1][0])]] }));
|
|
630
|
+
const speeds = this.curves(ctx, axes, "speed-lines", lines.map((line3) => ({ key: line3.speed, points: line3.points.map((d) => [d.x, d.y]), color: ink })));
|
|
631
|
+
ctx.hover(speeds, (d) => ({ title: `Speed ${d.key}`, color: ink, rows: [["Flow at surge", _chunkFDD4UP73cjs.MachineChart.short(d.points[0][0])], ["Flow at choke", _chunkFDD4UP73cjs.MachineChart.short(d.points[d.points.length - 1][0])]] }));
|
|
1060
632
|
const tip = (d) => ({
|
|
1061
633
|
title: `Speed ${d.speed}`,
|
|
1062
634
|
color: ink,
|
|
1063
|
-
rows: [["Flow", MachineChart.short(d.x, 4)], ["Pressure ratio", MachineChart.short(d.y, 4)], ...Number.isFinite(d.z) ? [["Efficiency", efficiency(d.z)]] : []]
|
|
635
|
+
rows: [["Flow", _chunkFDD4UP73cjs.MachineChart.short(d.x, 4)], ["Pressure ratio", _chunkFDD4UP73cjs.MachineChart.short(d.y, 4)], ...Number.isFinite(d.z) ? [["Efficiency", efficiency(d.z)]] : []]
|
|
1064
636
|
});
|
|
1065
|
-
this.dots(ctx, axes, "markers", markers ? lines.flatMap((
|
|
1066
|
-
const peaks = ridge ? measured.map((
|
|
637
|
+
this.dots(ctx, axes, "markers", markers ? lines.flatMap((line3) => line3.points) : [], (d) => [d.x, d.y], () => ink, tip, 2.5);
|
|
638
|
+
const peaks = ridge ? measured.map((line3) => line3.points.reduce((best, d) => d.z > best.z ? d : best)) : [];
|
|
1067
639
|
this.curves(ctx, axes, "ridge", peaks.length > 1 ? [{ key: "ridge", points: peaks.map((d) => [d.x, d.y]), color: theme.ink, width: 1.5, dash: "2 4" }] : []);
|
|
1068
640
|
this.dots(ctx, axes, "peaks", peaks, (d) => [d.x, d.y], () => theme.ink, tip, 4.5);
|
|
1069
641
|
const at = (point) => point ? this.place(axes, point) : [NaN, NaN];
|
|
@@ -1071,15 +643,15 @@ var CompressorMap = (_class6 = class extends MachineChart {
|
|
|
1071
643
|
const notes = [
|
|
1072
644
|
{ key: "surge", text: "Surge line", x: sx - 8, y: sy + 2, anchor: "end", tone: "ink" },
|
|
1073
645
|
{ key: "choke", text: "Choke", x: cx + 6, y: cy + 16, tone: "muted" },
|
|
1074
|
-
...lines.filter((
|
|
1075
|
-
const [x, y] = at(ends(() =>
|
|
1076
|
-
return { key: `speed${
|
|
646
|
+
...lines.filter((line3) => line3.points.length).map((line3) => {
|
|
647
|
+
const [x, y] = at(ends(() => line3.points[line3.points.length - 1])[0]);
|
|
648
|
+
return { key: `speed${line3.speed}`, text: line3.speed, x: x + 7, y: y + 4 };
|
|
1077
649
|
}),
|
|
1078
650
|
...shapes.flatMap((shape) => shape.at ? [{ key: `level${shape.level}`, text: `\u03B7 ${efficiency(shape.level)}`, x: shape.at[0], y: shape.at[1] + 4, anchor: "middle", tone: "muted", over: islands === "island-fills" /* Filled */ ? shape.fill : void 0 }] : [])
|
|
1079
651
|
];
|
|
1080
652
|
this.notes(ctx, "labels", notes);
|
|
1081
653
|
}
|
|
1082
|
-
},
|
|
654
|
+
}, _class5.__initStatic5(), _class5);
|
|
1083
655
|
|
|
1084
656
|
// src/charts/machinecharts/DragPolar.ts
|
|
1085
657
|
|
|
@@ -1089,8 +661,8 @@ var det = (m) => m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) - m[0][1] * (
|
|
|
1089
661
|
var DragPolarMath = class _DragPolarMath {
|
|
1090
662
|
/** Least-squares quadratic through the points, or null with fewer than three lift coefficients to fit. */
|
|
1091
663
|
static fit(points) {
|
|
1092
|
-
const s = [0, 1, 2, 3, 4].map((power) => points.reduce((
|
|
1093
|
-
const t = [0, 1, 2].map((power) => points.reduce((
|
|
664
|
+
const s = [0, 1, 2, 3, 4].map((power) => points.reduce((sum, [, cl]) => sum + cl ** power, 0));
|
|
665
|
+
const t = [0, 1, 2].map((power) => points.reduce((sum, [cd, cl]) => sum + cd * cl ** power, 0));
|
|
1094
666
|
const normal = [[s[0], s[1], s[2]], [s[1], s[2], s[3]], [s[2], s[3], s[4]]], scale = det(normal);
|
|
1095
667
|
if (points.length < 3 || Math.abs(scale) < 1e-12) return null;
|
|
1096
668
|
const [c0, c1, c2] = [0, 1, 2].map((column) => det(normal.map((row, i) => row.map((value, j) => j === column ? t[i] : value))) / scale);
|
|
@@ -1122,8 +694,8 @@ var DragPolarFit = /* @__PURE__ */ ((DragPolarFit2) => {
|
|
|
1122
694
|
DragPolarFit2["Parabolic"] = "parabolic-fit";
|
|
1123
695
|
return DragPolarFit2;
|
|
1124
696
|
})(DragPolarFit || {});
|
|
1125
|
-
var DragPolar = (
|
|
1126
|
-
static
|
|
697
|
+
var DragPolar = (_class6 = class extends _chunkFDD4UP73cjs.MachineChart {constructor(...args2) { super(...args2); _class6.prototype.__init2.call(this); }
|
|
698
|
+
static __initStatic6() {this.meta = {
|
|
1127
699
|
id: "drag-polar",
|
|
1128
700
|
name: "Drag polar",
|
|
1129
701
|
family: "scientific" /* Scientific */,
|
|
@@ -1131,7 +703,7 @@ var DragPolar = (_class7 = class extends MachineChart {constructor(...args2) { s
|
|
|
1131
703
|
shape: "table" /* Table */,
|
|
1132
704
|
description: "Plots lift coefficient against drag coefficient for each configuration, with the tangent from the origin that marks the best lift-to-drag ratio.",
|
|
1133
705
|
tags: ["aerodynamics", "aircraft", "lift-to-drag", "glide ratio", "aerofoil", "flaps"],
|
|
1134
|
-
sample: (seed) => MachineSamples.dragPolar(seed),
|
|
706
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.dragPolar(seed),
|
|
1135
707
|
variants: { view: Object.values(DragPolarView), fit: Object.values(DragPolarFit), tangent: [true, false], markers: [true, false] }
|
|
1136
708
|
}}
|
|
1137
709
|
defaults() {
|
|
@@ -1148,7 +720,7 @@ var DragPolar = (_class7 = class extends MachineChart {constructor(...args2) { s
|
|
|
1148
720
|
get polars() {
|
|
1149
721
|
const { x, y, series, fit } = this.options;
|
|
1150
722
|
const usable = this.rows.flatMap((row) => {
|
|
1151
|
-
const cd = MachineChart.number(row[x]), cl = MachineChart.number(row[y]);
|
|
723
|
+
const cd = _chunkFDD4UP73cjs.MachineChart.number(row[x]), cl = _chunkFDD4UP73cjs.MachineChart.number(row[y]);
|
|
1152
724
|
return cd === null || cl === null ? [] : [{ name: String(_nullishCoalesce(row[series], () => ( "Polar"))), point: [cd, cl], row }];
|
|
1153
725
|
});
|
|
1154
726
|
return [..._d3.group.call(void 0, usable, (d) => d.name)].map(([name, measured]) => {
|
|
@@ -1180,7 +752,7 @@ var DragPolar = (_class7 = class extends MachineChart {constructor(...args2) { s
|
|
|
1180
752
|
});
|
|
1181
753
|
this.curves(ctx, axes, "axis-tangents", rays);
|
|
1182
754
|
this.curves(ctx, axes, "polars", polars.map((polar) => ({ key: polar.name, points: polar.curve.map(this.seen), color: palette.color(polar.name) })));
|
|
1183
|
-
const number = (value) => MachineChart.short(value, 3);
|
|
755
|
+
const number = (value) => _chunkFDD4UP73cjs.MachineChart.short(value, 3);
|
|
1184
756
|
this.dots(
|
|
1185
757
|
ctx,
|
|
1186
758
|
axes,
|
|
@@ -1206,87 +778,10 @@ var DragPolar = (_class7 = class extends MachineChart {constructor(...args2) { s
|
|
|
1206
778
|
return ratio ? { key, text, x, y: y - 10, anchor: "middle", tone: "ink" } : { key, text, x: x + 6, y: y + 14, tone: "ink" };
|
|
1207
779
|
}));
|
|
1208
780
|
}
|
|
1209
|
-
},
|
|
781
|
+
}, _class6.__initStatic6(), _class6);
|
|
1210
782
|
|
|
1211
783
|
// src/charts/machinecharts/ElevationProfile.ts
|
|
1212
784
|
|
|
1213
|
-
|
|
1214
|
-
// src/charts/machinecharts/ElevationMath.ts
|
|
1215
|
-
|
|
1216
|
-
var CLASSES = [3, 6, 9];
|
|
1217
|
-
var SCORES = [8e3, 16e3, 32e3, 64e3, 8e4];
|
|
1218
|
-
var ElevationMath = class _ElevationMath {
|
|
1219
|
-
/** The profile ordered by distance, with repeated distances averaged. */
|
|
1220
|
-
static profile(rows, distance, elevation) {
|
|
1221
|
-
const read = rows.flatMap((row) => {
|
|
1222
|
-
const x = MachineChart.number(row[distance]), y = MachineChart.number(row[elevation]);
|
|
1223
|
-
return x === null || y === null ? [] : [[x, y]];
|
|
1224
|
-
});
|
|
1225
|
-
return [..._d3.group.call(void 0, read, (point) => point[0])].map(([x, same]) => [x, _d3.mean.call(void 0, same, (point) => point[1])]).sort((a, b) => a[0] - b[0]);
|
|
1226
|
-
}
|
|
1227
|
-
/** Elevation at a distance, by linear interpolation, held level past either end. */
|
|
1228
|
-
static at(points, distance) {
|
|
1229
|
-
const i = points.findIndex((point) => point[0] >= distance);
|
|
1230
|
-
if (i < 0) return _nullishCoalesce(_optionalChain([points, 'access', _18 => _18[points.length - 1], 'optionalAccess', _19 => _19[1]]), () => ( NaN));
|
|
1231
|
-
if (i === 0) return points[0][1];
|
|
1232
|
-
const [x0, y0] = points[i - 1], [x1, y1] = points[i];
|
|
1233
|
-
return y0 + (y1 - y0) * (distance - x0) / (x1 - x0);
|
|
1234
|
-
}
|
|
1235
|
-
/** Total climbed. A rise or fall smaller than `deadband` is treated as noise in the survey and not counted. */
|
|
1236
|
-
static ascent(points, deadband = 0) {
|
|
1237
|
-
let held = _nullishCoalesce(_optionalChain([points, 'access', _20 => _20[0], 'optionalAccess', _21 => _21[1]]), () => ( 0)), gain = 0;
|
|
1238
|
-
for (const [, elevation] of points) {
|
|
1239
|
-
if (elevation > held + deadband) gain += elevation - held;
|
|
1240
|
-
if (Math.abs(elevation - held) > deadband) held = elevation;
|
|
1241
|
-
}
|
|
1242
|
-
return gain;
|
|
1243
|
-
}
|
|
1244
|
-
static steepness(grade) {
|
|
1245
|
-
return grade <= -CLASSES[0] ? -1 : CLASSES.filter((bound) => grade >= bound).length;
|
|
1246
|
-
}
|
|
1247
|
-
/** The route cut into stretches of `length`, each with its mean gradient. */
|
|
1248
|
-
static segments(points, length, rise = 1e3) {
|
|
1249
|
-
if (points.length < 2 || !(length > 0)) return [];
|
|
1250
|
-
const first = points[0][0], last = points[points.length - 1][0];
|
|
1251
|
-
return Array.from({ length: Math.min(2e3, Math.ceil((last - first) / length - 1e-9)) }, (_, i) => {
|
|
1252
|
-
const from = first + i * length, to = Math.min(last, from + length), start = _ElevationMath.at(points, from), end = _ElevationMath.at(points, to);
|
|
1253
|
-
const grade = (end - start) / ((to - from) * rise) * 100;
|
|
1254
|
-
return { from, to, start, end, grade, steep: _ElevationMath.steepness(grade) };
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
* Sustained ascents: from a low point to the highest point reached before the road drops by more than `dip`. A climb
|
|
1259
|
-
* counts when it gains at least `least` and averages 3% or more from the last point within 8% of its gain above the foot,
|
|
1260
|
-
* which trims a flat approach.
|
|
1261
|
-
*/
|
|
1262
|
-
static climbs(points, { rise = 1e3, dip = 30, least = 80 } = {}) {
|
|
1263
|
-
const found = [];
|
|
1264
|
-
const close = (low2, top2) => {
|
|
1265
|
-
const foot = points[low2][1] + 0.08 * (points[top2][1] - points[low2][1]);
|
|
1266
|
-
for (let i = top2 - 1; i > low2; i--) if (points[i][1] <= foot) {
|
|
1267
|
-
low2 = i;
|
|
1268
|
-
break;
|
|
1269
|
-
}
|
|
1270
|
-
const [from, start] = points[low2], [to, end] = points[top2], gain = end - start, length = to - from, grade = gain / (length * rise) * 100;
|
|
1271
|
-
if (gain < least || grade < CLASSES[0]) return;
|
|
1272
|
-
const rank = SCORES.filter((score) => length * rise * grade >= score).length;
|
|
1273
|
-
found.push({ from, to, start, end, gain, length, grade, category: rank ? Math.max(0, 5 - rank) : null });
|
|
1274
|
-
};
|
|
1275
|
-
let low = 0, top = 0;
|
|
1276
|
-
points.forEach(([, elevation], i) => {
|
|
1277
|
-
if (elevation > points[top][1]) top = i;
|
|
1278
|
-
else if (top === low && elevation < points[low][1]) low = top = i;
|
|
1279
|
-
else if (points[top][1] - elevation > dip) {
|
|
1280
|
-
close(low, top);
|
|
1281
|
-
low = top = i;
|
|
1282
|
-
}
|
|
1283
|
-
});
|
|
1284
|
-
if (top > low) close(low, top);
|
|
1285
|
-
return found;
|
|
1286
|
-
}
|
|
1287
|
-
};
|
|
1288
|
-
|
|
1289
|
-
// src/charts/machinecharts/ElevationProfile.ts
|
|
1290
785
|
var ElevationShading = /* @__PURE__ */ ((ElevationShading2) => {
|
|
1291
786
|
ElevationShading2["Gradient"] = "gradient-classes";
|
|
1292
787
|
ElevationShading2["Plain"] = "plain-fill";
|
|
@@ -1299,8 +794,8 @@ var ElevationBaseline = /* @__PURE__ */ ((ElevationBaseline2) => {
|
|
|
1299
794
|
})(ElevationBaseline || {});
|
|
1300
795
|
var STEEP = [{ steep: -1, key: "Descent", tone: -0.55 }, { steep: 0, key: "Under 3%", tone: 0 }, { steep: 1, key: "3 to 6%", tone: 0.4 }, { steep: 2, key: "6 to 9%", tone: 0.72 }, { steep: 3, key: "Over 9%", tone: 1 }];
|
|
1301
796
|
var tenth = (value) => (+value.toFixed(1)).toLocaleString("en");
|
|
1302
|
-
var ElevationProfile = (
|
|
1303
|
-
static
|
|
797
|
+
var ElevationProfile = (_class7 = class extends _chunkFDD4UP73cjs.MachineChart {
|
|
798
|
+
static __initStatic7() {this.meta = {
|
|
1304
799
|
id: "elevation-profile",
|
|
1305
800
|
name: "Elevation profile",
|
|
1306
801
|
family: "scientific" /* Scientific */,
|
|
@@ -1308,7 +803,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1308
803
|
shape: "table" /* Table */,
|
|
1309
804
|
description: "Fills elevation against distance along a route, shades each stretch by steepness class, brackets the climbs and totals the ascent.",
|
|
1310
805
|
tags: ["route profile", "gradient", "climb", "cycling", "hiking", "road grade", "total ascent"],
|
|
1311
|
-
sample: (seed) => MachineSamples.route(seed),
|
|
806
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.route(seed),
|
|
1312
807
|
variants: { shading: Object.values(ElevationShading), segment: [1, 0.5, 2], climbs: [true, false], baseline: Object.values(ElevationBaseline) },
|
|
1313
808
|
valid: (values) => values.shading === "gradient-classes" /* Gradient */ || values.segment === 1
|
|
1314
809
|
}}
|
|
@@ -1330,7 +825,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1330
825
|
return { x: `Distance (${this.options.distanceUnit})`, y: `Elevation (${this.options.elevationUnit})` };
|
|
1331
826
|
}
|
|
1332
827
|
get profile() {
|
|
1333
|
-
return ElevationMath.profile(this.rows, this.options.x, this.options.y);
|
|
828
|
+
return _chunkFDD4UP73cjs.ElevationMath.profile(this.rows, this.options.x, this.options.y);
|
|
1334
829
|
}
|
|
1335
830
|
get shaded() {
|
|
1336
831
|
return this.options.shading === "gradient-classes" /* Gradient */;
|
|
@@ -1340,7 +835,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1340
835
|
}
|
|
1341
836
|
legendItems() {
|
|
1342
837
|
if (!this.shaded) return super.legendItems();
|
|
1343
|
-
const used = new Set(ElevationMath.segments(this.profile, this.options.segment, this.options.rise).map((part) => part.steep));
|
|
838
|
+
const used = new Set(_chunkFDD4UP73cjs.ElevationMath.segments(this.profile, this.options.segment, this.options.rise).map((part) => part.steep));
|
|
1344
839
|
return STEEP.filter((entry) => used.has(entry.steep)).map((entry) => ({ key: entry.key, color: this.tone(entry.steep) }));
|
|
1345
840
|
}
|
|
1346
841
|
/** Headroom above the summit holds the climb labels and the total. */
|
|
@@ -1353,7 +848,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1353
848
|
/** Neighbouring stretches of one class become one shape, so the fill has no seams inside a class. */
|
|
1354
849
|
stretches(profile) {
|
|
1355
850
|
const { segment, rise } = this.options, runs = [];
|
|
1356
|
-
for (const part of ElevationMath.segments(profile, segment, rise)) {
|
|
851
|
+
for (const part of _chunkFDD4UP73cjs.ElevationMath.segments(profile, segment, rise)) {
|
|
1357
852
|
const run = runs[runs.length - 1];
|
|
1358
853
|
if (run && run[0].steep === part.steep) run.push(part);
|
|
1359
854
|
else runs.push([part]);
|
|
@@ -1368,7 +863,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1368
863
|
const whole = (value) => `${Math.round(value).toLocaleString("en")} ${elevationUnit}`, far = (value) => `${tenth(value)} ${distanceUnit}`;
|
|
1369
864
|
const { profile, shaded } = this, { theme, palette } = ctx, { height } = ctx.plot;
|
|
1370
865
|
const fill = _d3.area.call(void 0, ).curve(_chunkPY4R3IFFcjs.Scales.curve()).x((d) => this.place(axes, d)[0]).y1((d) => this.place(axes, d)[1]).y0(height);
|
|
1371
|
-
const ascent = ElevationMath.ascent(profile, deadband), length = profile.length ? profile[profile.length - 1][0] - profile[0][0] : 0;
|
|
866
|
+
const ascent = _chunkFDD4UP73cjs.ElevationMath.ascent(profile, deadband), length = profile.length ? profile[profile.length - 1][0] - profile[0][0] : 0;
|
|
1372
867
|
const ink = shaded ? theme.ink : palette.color("Elevation");
|
|
1373
868
|
const stretches = shaded ? this.stretches(profile) : [];
|
|
1374
869
|
const bands = ctx.marks("stretches", "path", stretches, (d) => d.key).attr("fill", (d) => this.tone(d.steep)).attr("stroke", "none");
|
|
@@ -1381,7 +876,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1381
876
|
ctx.set(plain2, { d: (d) => _nullishCoalesce(fill(d), () => ( "")) });
|
|
1382
877
|
ctx.hover(plain2, () => ({ title: "Elevation", color: ink, rows: [["Distance", far(length)], ["Total ascent", whole(ascent)], ["Highest", whole(Math.max(...profile.map((point) => point[1])))]] }));
|
|
1383
878
|
this.curves(ctx, axes, "profile", profile.length > 1 ? [{ key: "profile", points: profile, color: ink, width: shaded ? 1.5 : 2 }] : []);
|
|
1384
|
-
const found = (climbs ? ElevationMath.climbs(profile, { rise }) : []).map((climb) => {
|
|
879
|
+
const found = (climbs ? _chunkFDD4UP73cjs.ElevationMath.climbs(profile, { rise }) : []).map((climb) => {
|
|
1385
880
|
const [x1, top] = this.place(axes, [climb.to, climb.end]), [x0] = this.place(axes, [climb.from, climb.start]);
|
|
1386
881
|
return { climb, x0, x1, y: top - 10 };
|
|
1387
882
|
});
|
|
@@ -1395,7 +890,7 @@ var ElevationProfile = (_class8 = class extends MachineChart {
|
|
|
1395
890
|
{ key: `climb${climb.from}`, text: `${name(climb)} \xB7 ${far(climb.length)} at ${tenth(climb.grade)}%`, x: (x0 + x1) / 2, y: y - 6, anchor: "middle", tone: "ink" }
|
|
1396
891
|
])]);
|
|
1397
892
|
}
|
|
1398
|
-
},
|
|
893
|
+
}, _class7.__initStatic7(), _class7);
|
|
1399
894
|
|
|
1400
895
|
// src/charts/machinecharts/GasCycleDiagram.ts
|
|
1401
896
|
|
|
@@ -1416,8 +911,8 @@ var HEAT_OUT = "Heat out";
|
|
|
1416
911
|
var energy = (value) => `${Math.round(value).toLocaleString("en")} kJ/kg`;
|
|
1417
912
|
var TURNS = [0, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6].map((step) => step * Math.PI / 6);
|
|
1418
913
|
var kelvin = (state) => `${Math.round(state.temperature).toLocaleString("en")} K`;
|
|
1419
|
-
var GasCycleDiagram = (
|
|
1420
|
-
static
|
|
914
|
+
var GasCycleDiagram = (_class8 = class extends _chunkFDD4UP73cjs.MachineChart {constructor(...args3) { super(...args3); _class8.prototype.__init3.call(this); }
|
|
915
|
+
static __initStatic8() {this.meta = {
|
|
1421
916
|
id: "gas-cycle-diagram",
|
|
1422
917
|
name: "Gas power cycle diagram",
|
|
1423
918
|
family: "scientific" /* Scientific */,
|
|
@@ -1425,7 +920,7 @@ var GasCycleDiagram = (_class9 = class extends MachineChart {constructor(...args
|
|
|
1425
920
|
shape: "table" /* Table */,
|
|
1426
921
|
description: "Draws an ideal-gas Otto, Diesel or Brayton cycle on pressure-volume or temperature-entropy axes, with numbered states, the net-work and heat areas and the thermal efficiency.",
|
|
1427
922
|
tags: ["thermodynamics", "otto cycle", "diesel cycle", "brayton cycle", "p-v diagram", "t-s diagram", "air-standard cycle", "thermal efficiency", "heat engine"],
|
|
1428
|
-
sample: (seed) => MachineSamples.gasCycles(seed),
|
|
923
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.gasCycles(seed),
|
|
1429
924
|
variants: { cycle: Object.values(GasCycleKind), plane: Object.values(GasCyclePlane), areas: [true, false], isotherms: [false, true] }
|
|
1430
925
|
}}
|
|
1431
926
|
defaults() {
|
|
@@ -1471,10 +966,10 @@ var GasCycleDiagram = (_class9 = class extends MachineChart {constructor(...args
|
|
|
1471
966
|
const name = String(_nullishCoalesce(row[series], () => ( ""))).toLowerCase();
|
|
1472
967
|
return !name || name.includes(cycle);
|
|
1473
968
|
});
|
|
1474
|
-
const read = GasCycleMath.states(own, { pressure, temperature, volume, label }, gas);
|
|
969
|
+
const read = _chunkFDD4UP73cjs.GasCycleMath.states(own, { pressure, temperature, volume, label }, gas);
|
|
1475
970
|
if (read.length) return read;
|
|
1476
|
-
if (cycle === "brayton" /* Brayton */) return GasCycleMath.brayton(gas, pressureRatio, _nullishCoalesce(peakTemperature, () => ( 1400)));
|
|
1477
|
-
return cycle === "diesel" /* Diesel */ ? GasCycleMath.diesel(gas, _nullishCoalesce(compressionRatio, () => ( 18)), cutoffRatio) : GasCycleMath.otto(gas, _nullishCoalesce(compressionRatio, () => ( 9)), _nullishCoalesce(peakTemperature, () => ( 2e3)));
|
|
971
|
+
if (cycle === "brayton" /* Brayton */) return _chunkFDD4UP73cjs.GasCycleMath.brayton(gas, pressureRatio, _nullishCoalesce(peakTemperature, () => ( 1400)));
|
|
972
|
+
return cycle === "diesel" /* Diesel */ ? _chunkFDD4UP73cjs.GasCycleMath.diesel(gas, _nullishCoalesce(compressionRatio, () => ( 18)), cutoffRatio) : _chunkFDD4UP73cjs.GasCycleMath.otto(gas, _nullishCoalesce(compressionRatio, () => ( 9)), _nullishCoalesce(peakTemperature, () => ( 2e3)));
|
|
1478
973
|
}
|
|
1479
974
|
/** P-V starts both axes at zero. T-s starts temperature at absolute zero, so the area under a leg is its heat, and leaves room above for the efficiency. */
|
|
1480
975
|
scales(ctx) {
|
|
@@ -1488,9 +983,9 @@ var GasCycleDiagram = (_class9 = class extends MachineChart {constructor(...args
|
|
|
1488
983
|
plotMarks(ctx, axes) {
|
|
1489
984
|
const { areas, isotherms } = this.options;
|
|
1490
985
|
const { states, pv } = this, { theme, palette } = ctx, { width, height } = ctx.plot;
|
|
1491
|
-
const legs = GasCycleMath.processes(states), totals = GasCycleMath.totals(legs);
|
|
986
|
+
const legs = _chunkFDD4UP73cjs.GasCycleMath.processes(states), totals = _chunkFDD4UP73cjs.GasCycleMath.totals(legs);
|
|
1492
987
|
const at = (point) => this.place(axes, point);
|
|
1493
|
-
const run = (leg) => GasCycleMath.leg(this.spot(leg.from), this.spot(leg.to), pv);
|
|
988
|
+
const run = (leg) => _chunkFDD4UP73cjs.GasCycleMath.leg(this.spot(leg.from), this.spot(leg.to), pv);
|
|
1494
989
|
const edge = _d3.line.call(void 0, ).x((d) => at(d)[0]).y((d) => at(d)[1]);
|
|
1495
990
|
const under = _d3.area.call(void 0, ).x((d) => at(d)[0]).y1((d) => at(d)[1]).y0(at([0, 0])[1]);
|
|
1496
991
|
const tint = palette.color(WORK);
|
|
@@ -1504,17 +999,17 @@ var GasCycleDiagram = (_class9 = class extends MachineChart {constructor(...args
|
|
|
1504
999
|
const ranked = [...states].sort((a, b) => b.temperature - a.temperature);
|
|
1505
1000
|
const levels = (isotherms && states.length > 1 ? [ranked[0], ranked[ranked.length - 1]] : []).map((state) => {
|
|
1506
1001
|
const product = state.pressure * state.volume, start = Math.max(left, product / top);
|
|
1507
|
-
return { state, points: pv ? GasCycleMath.leg([start, product / start], [right, product / right], true) : [[left, state.temperature], [right, state.temperature]] };
|
|
1002
|
+
return { state, points: pv ? _chunkFDD4UP73cjs.GasCycleMath.leg([start, product / start], [right, product / right], true) : [[left, state.temperature], [right, state.temperature]] };
|
|
1508
1003
|
});
|
|
1509
1004
|
this.curves(ctx, axes, "axis-isotherms", levels.map(({ state, points }) => ({ key: state.label, points, color: theme.axis, width: 1, dash: "5 4" })));
|
|
1510
1005
|
const lines = this.curves(ctx, axes, "processes", legs.map((leg) => ({ key: leg.from.label, points: run(leg), color: theme.ink })));
|
|
1511
1006
|
ctx.hover(lines, (_, i) => ({ title: `${legs[i].from.label} to ${legs[i].to.label}: ${legs[i].name}`, rows: [["Heat", energy(legs[i].heat)], ["Work", energy(legs[i].work)]] }));
|
|
1512
1007
|
this.dots(ctx, axes, "states", states, this.spot, () => theme.ink, (d) => ({
|
|
1513
1008
|
title: `State ${d.label}`,
|
|
1514
|
-
rows: [["Pressure", `${MachineChart.short(d.pressure, 4)} kPa`], ["Specific volume", `${MachineChart.short(d.volume, 4)} m\xB3/kg`], ["Temperature", kelvin(d)], ["Entropy", `${MachineChart.short(d.entropy)} kJ/kg\xB7K`]]
|
|
1009
|
+
rows: [["Pressure", `${_chunkFDD4UP73cjs.MachineChart.short(d.pressure, 4)} kPa`], ["Specific volume", `${_chunkFDD4UP73cjs.MachineChart.short(d.volume, 4)} m\xB3/kg`], ["Temperature", kelvin(d)], ["Entropy", `${_chunkFDD4UP73cjs.MachineChart.short(d.entropy)} kJ/kg\xB7K`]]
|
|
1515
1010
|
}), 4.5);
|
|
1516
1011
|
const pixels = states.map((state) => at(this.spot(state))), count = pixels.length, placed = [];
|
|
1517
|
-
const track = legs.flatMap((leg) => GasCycleMath.leg(this.spot(leg.from), this.spot(leg.to), pv, 60)).map(at);
|
|
1012
|
+
const track = legs.flatMap((leg) => _chunkFDD4UP73cjs.GasCycleMath.leg(this.spot(leg.from), this.spot(leg.to), pv, 60)).map(at);
|
|
1518
1013
|
const clear = (points, [cx, cy], wide, tall) => points.every(([ox, oy, other = 0]) => Math.abs(cx - ox) >= wide + other || Math.abs(cy - oy) >= tall);
|
|
1519
1014
|
const corners = states.map((state, i) => {
|
|
1520
1015
|
const [x2, y] = pixels[i], half = state.label.length * 3.1;
|
|
@@ -1542,7 +1037,7 @@ var GasCycleDiagram = (_class9 = class extends MachineChart {constructor(...args
|
|
|
1542
1037
|
});
|
|
1543
1038
|
this.notes(ctx, "labels", [...head, ...corners, ...limits]);
|
|
1544
1039
|
}
|
|
1545
|
-
},
|
|
1040
|
+
}, _class8.__initStatic8(), _class8);
|
|
1546
1041
|
|
|
1547
1042
|
// src/charts/machinecharts/GgDiagram.ts
|
|
1548
1043
|
|
|
@@ -1596,8 +1091,8 @@ var GgEnvelope = /* @__PURE__ */ ((GgEnvelope2) => {
|
|
|
1596
1091
|
})(GgEnvelope || {});
|
|
1597
1092
|
var NAME = "Acceleration";
|
|
1598
1093
|
var g = (value) => `${value.toFixed(2)} g`;
|
|
1599
|
-
var GgDiagram = (
|
|
1600
|
-
static
|
|
1094
|
+
var GgDiagram = (_class9 = class extends _chunkFDD4UP73cjs.MachineChart {
|
|
1095
|
+
static __initStatic9() {this.meta = {
|
|
1601
1096
|
id: "gg-diagram",
|
|
1602
1097
|
name: "g-g diagram",
|
|
1603
1098
|
family: "scientific" /* Scientific */,
|
|
@@ -1605,7 +1100,7 @@ var GgDiagram = (_class10 = class extends MachineChart {
|
|
|
1605
1100
|
shape: "table" /* Table */,
|
|
1606
1101
|
description: "Plots lateral against longitudinal acceleration as points, a density or a trace, with the grip envelope the samples reach.",
|
|
1607
1102
|
tags: ["friction circle", "traction circle", "vehicle dynamics", "motorsport", "grip", "telemetry"],
|
|
1608
|
-
sample: (seed) => MachineSamples.lap(seed),
|
|
1103
|
+
sample: (seed) => _chunkFDD4UP73cjs.MachineSamples.lap(seed),
|
|
1609
1104
|
variants: { form: Object.values(GgForm), envelope: Object.values(GgEnvelope), rings: [true, false] }
|
|
1610
1105
|
}}
|
|
1611
1106
|
defaults() {
|
|
@@ -1614,7 +1109,7 @@ var GgDiagram = (_class10 = class extends MachineChart {
|
|
|
1614
1109
|
get samples() {
|
|
1615
1110
|
const { x, y } = this.options;
|
|
1616
1111
|
return this.rows.flatMap((row) => {
|
|
1617
|
-
const lateral = MachineChart.number(row[x]), longitudinal = MachineChart.number(row[y]);
|
|
1112
|
+
const lateral = _chunkFDD4UP73cjs.MachineChart.number(row[x]), longitudinal = _chunkFDD4UP73cjs.MachineChart.number(row[y]);
|
|
1618
1113
|
return lateral === null || longitudinal === null ? [] : [{ point: [lateral, longitudinal], row }];
|
|
1619
1114
|
});
|
|
1620
1115
|
}
|
|
@@ -1663,7 +1158,7 @@ var GgDiagram = (_class10 = class extends MachineChart {
|
|
|
1663
1158
|
] : [];
|
|
1664
1159
|
this.notes(ctx, "labels", [...notes, ...radii.map((d) => ({ key: `ring${d}`, text: `${d} g`, x: ox - 5, y: oy - d * unit2 - 4, anchor: "end", tone: "muted" }))]);
|
|
1665
1160
|
}
|
|
1666
|
-
},
|
|
1161
|
+
}, _class9.__initStatic9(), _class9);
|
|
1667
1162
|
|
|
1668
1163
|
// src/charts/machinecharts/index.ts
|
|
1669
1164
|
var machinechartsCatalog = [CampbellDiagram, CompressorMap, BsfcMap, GgDiagram, DragPolar, AshbyChart, CarpetPlot, ElevationProfile, GasCycleDiagram];
|