measur-tools-suite 1.2.1-beta.2 → 1.2.1-beta.3

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.
Files changed (77) hide show
  1. package/AGENTS.md +33 -0
  2. package/BUILD.md +6 -20
  3. package/README.md +5 -8
  4. package/bin/client.d.ts +106 -1
  5. package/bin/package.json +8 -3
  6. package/bin/ts_def_modules/binding/registered_vectors.d.ts +36 -31
  7. package/bin/ts_def_modules/compressedAir/compressedAir.d.ts +6 -4
  8. package/bin/ts_def_modules/compressedAir/compressed_air_utils.d.ts +1 -6
  9. package/bin/ts_def_modules/compressedAir/dryer_operating_cost.d.ts +5 -7
  10. package/bin/ts_def_modules/compressedAir/leak_survey/bag_method.d.ts +1 -9
  11. package/bin/ts_def_modules/compressedAir/leak_survey/compressed_air_leak_survey.d.ts +3 -13
  12. package/bin/ts_def_modules/compressedAir/leak_survey/decibels_method.d.ts +1 -9
  13. package/bin/ts_def_modules/compressedAir/leak_survey/estimate_method.d.ts +1 -9
  14. package/bin/ts_def_modules/compressedAir/leak_survey/orifice_method.d.ts +1 -9
  15. package/bin/ts_def_modules/compressedAir/operating_cost.d.ts +1 -9
  16. package/bin/ts_def_modules/compressedAir/pipe_sizing.d.ts +1 -9
  17. package/bin/ts_def_modules/compressedAir/pneumatic_air_requirement.d.ts +1 -13
  18. package/bin/ts_def_modules/compressedAir/pneumatic_valve.d.ts +1 -17
  19. package/bin/ts_def_modules/compressedAir/receiver_tank.d.ts +1 -45
  20. package/bin/ts_def_modules/databases/default_data.d.ts +45 -58
  21. package/bin/ts_def_modules/motorDriven/fans/fan.d.ts +90 -23
  22. package/bin/ts_def_modules/motorDriven/fans/fan_affinity_laws.d.ts +5 -7
  23. package/bin/ts_def_modules/motorDriven/motor/motor.d.ts +3 -3
  24. package/bin/ts_def_modules/motorDriven/pump/pump.d.ts +5 -4
  25. package/bin/ts_def_modules/motorDriven/pump/pump_valve_power_loss.d.ts +4 -2
  26. package/bin/ts_def_modules/processCooling/process_cooling.d.ts +67 -59
  27. package/bin/ts_def_modules/processHeat/air_heating_using_exhaust.d.ts +1 -5
  28. package/bin/ts_def_modules/processHeat/cascade_heat_high_to_low.d.ts +0 -4
  29. package/bin/ts_def_modules/processHeat/flow_calculations_energy_use.d.ts +0 -4
  30. package/bin/ts_def_modules/processHeat/losses/energy_input_exhaust_gas_heat_loss.d.ts +1 -5
  31. package/bin/ts_def_modules/processHeat/losses/gas_flue_gas_material.d.ts +1 -5
  32. package/bin/ts_def_modules/processHeat/o2_enrichment.d.ts +0 -4
  33. package/bin/ts_def_modules/processHeat/water_heating_using_exhaust.d.ts +0 -4
  34. package/bin/ts_def_modules/steam/air_water_cooling_using_flue.d.ts +0 -4
  35. package/bin/ts_def_modules/steam/steam_leak_survey.d.ts +6 -2
  36. package/bin/ts_def_modules/steam/water_heating_using_flue.d.ts +1 -5
  37. package/bin/ts_def_modules/steam/water_heating_using_steam.d.ts +0 -4
  38. package/bin/ts_def_modules/steamModeler/ssmt.d.ts +9 -5
  39. package/bin/ts_def_modules/steamModeler/ssmtModeler.d.ts +54 -28
  40. package/karma.conf.js +17 -2
  41. package/package.json +8 -3
  42. package/ts_def/client.d.ts +106 -1
  43. package/ts_def/ts_def_modules/binding/registered_vectors.d.ts +36 -31
  44. package/ts_def/ts_def_modules/compressedAir/compressedAir.d.ts +6 -4
  45. package/ts_def/ts_def_modules/compressedAir/compressed_air_utils.d.ts +1 -6
  46. package/ts_def/ts_def_modules/compressedAir/dryer_operating_cost.d.ts +5 -7
  47. package/ts_def/ts_def_modules/compressedAir/leak_survey/bag_method.d.ts +1 -9
  48. package/ts_def/ts_def_modules/compressedAir/leak_survey/compressed_air_leak_survey.d.ts +3 -13
  49. package/ts_def/ts_def_modules/compressedAir/leak_survey/decibels_method.d.ts +1 -9
  50. package/ts_def/ts_def_modules/compressedAir/leak_survey/estimate_method.d.ts +1 -9
  51. package/ts_def/ts_def_modules/compressedAir/leak_survey/orifice_method.d.ts +1 -9
  52. package/ts_def/ts_def_modules/compressedAir/operating_cost.d.ts +1 -9
  53. package/ts_def/ts_def_modules/compressedAir/pipe_sizing.d.ts +1 -9
  54. package/ts_def/ts_def_modules/compressedAir/pneumatic_air_requirement.d.ts +1 -13
  55. package/ts_def/ts_def_modules/compressedAir/pneumatic_valve.d.ts +1 -17
  56. package/ts_def/ts_def_modules/compressedAir/receiver_tank.d.ts +1 -45
  57. package/ts_def/ts_def_modules/databases/default_data.d.ts +45 -58
  58. package/ts_def/ts_def_modules/motorDriven/fans/fan.d.ts +90 -23
  59. package/ts_def/ts_def_modules/motorDriven/fans/fan_affinity_laws.d.ts +5 -7
  60. package/ts_def/ts_def_modules/motorDriven/motor/motor.d.ts +3 -3
  61. package/ts_def/ts_def_modules/motorDriven/pump/pump.d.ts +5 -4
  62. package/ts_def/ts_def_modules/motorDriven/pump/pump_valve_power_loss.d.ts +4 -2
  63. package/ts_def/ts_def_modules/processCooling/process_cooling.d.ts +67 -59
  64. package/ts_def/ts_def_modules/processHeat/air_heating_using_exhaust.d.ts +1 -5
  65. package/ts_def/ts_def_modules/processHeat/cascade_heat_high_to_low.d.ts +0 -4
  66. package/ts_def/ts_def_modules/processHeat/flow_calculations_energy_use.d.ts +0 -4
  67. package/ts_def/ts_def_modules/processHeat/losses/energy_input_exhaust_gas_heat_loss.d.ts +1 -5
  68. package/ts_def/ts_def_modules/processHeat/losses/gas_flue_gas_material.d.ts +1 -5
  69. package/ts_def/ts_def_modules/processHeat/o2_enrichment.d.ts +0 -4
  70. package/ts_def/ts_def_modules/processHeat/water_heating_using_exhaust.d.ts +0 -4
  71. package/ts_def/ts_def_modules/steam/air_water_cooling_using_flue.d.ts +0 -4
  72. package/ts_def/ts_def_modules/steam/steam_leak_survey.d.ts +6 -2
  73. package/ts_def/ts_def_modules/steam/water_heating_using_flue.d.ts +1 -5
  74. package/ts_def/ts_def_modules/steam/water_heating_using_steam.d.ts +0 -4
  75. package/ts_def/ts_def_modules/steamModeler/ssmt.d.ts +9 -5
  76. package/ts_def/ts_def_modules/steamModeler/ssmtModeler.d.ts +54 -28
  77. package/tsconfig.json +19 -0
package/AGENTS.md ADDED
@@ -0,0 +1,33 @@
1
+ # Project Memory
2
+
3
+ When generating code, always follow the coding standards and conventions in the [Style Guide](../contributing/style-guide.md). When documenting code, always follow the documentation standards in [Documentation](../contributing/documentation.md). If either linked file is not available in context, ask the user to provide it before proceeding.
4
+
5
+ When tasked to refactor code using namespaces, follow these phases in order. In all phases, maintain a **one file per logical module** rule: each .h/.cpp pair produces exactly one corresponding binding file, one C++ test file, and one wasm test file.
6
+
7
+ **Phase 1 — Headers and Source**
8
+ Update the .h and .cpp files to reflect the new structure.
9
+
10
+ **Phase 2 — WebAssembly Bindings**
11
+ For each .h/.cpp pair, create or update exactly one binding file in bindings-wasm/ (one binding file per logical module, matching its .h and .cpp filenames). If no existing binding file exists for a given pair, create one from scratch following the structure used in processHeat/bindings-wasm/.
12
+
13
+ **Phase 3 — C++ Unit Tests**
14
+ Update the .cpp unit tests in tests/cpp to reflect the new structure. Each .cpp file must have its own dedicated test file. If an existing test file covers multiple classes that are being split into separate .cpp files, split the test file accordingly.
15
+
16
+ **Phase 4 — WebAssembly Unit Tests**
17
+ Update or add a unit test in tests/wasm-mocha for each binding file (one test file per binding file). Move old unit tests from tests/wasm to tests/wasm-mocha and update them to reflect the new structure. Once a test has been successfully migrated, delete the original file from tests/wasm.
18
+
19
+ **Phase 5 — Documentation**
20
+ Update the documentation in the docs/dox-content directory. Organize the content logically following the pattern that has already been established.
21
+
22
+ **Reference example:** refer to processHeat/ as the canonical example of how to structure the code, WebAssembly bindings, unit tests, and documentation.
23
+
24
+ **Checklist (verify before finishing):**
25
+ - [ ] Phase 1: All .h and .cpp files updated
26
+ - [ ] Phase 2: One binding file per .h/.cpp pair; new files created where none existed
27
+ - [ ] Phase 3: One C++ test file per .cpp file; split if needed
28
+ - [ ] Phase 4: One wasm test file per binding file; old tests/wasm files migrated and deleted
29
+ - [ ] Phase 5: Documentation updated and organized
30
+
31
+ ## Context
32
+
33
+ The MEASUR Tools Suite is a collection of industrial efficiency calculations written in C++ with WebAssembly bindings for browser and Node.js environments. The suite provides computational engines for the [MEASUR](https://github.com/ORNL-AMO/AMO-Tools-Desktop) (Manufacturing Energy Assessment Suite for Utility Reduction) application ecosystem.
package/BUILD.md CHANGED
@@ -180,11 +180,9 @@ Artifacts appear under `bin/`
180
180
  ### 6.5 WebAssembly Usage Example
181
181
 
182
182
  ```ts
183
- import type { WallHeatLossModule, DryerOperatingCostModule } from 'measur-tools-suite';
183
+ import createModule, { type MeasurToolsSuite } from 'measur-tools-suite';
184
184
 
185
- // Initialize module
186
- const moduleFactory = (await import('/path/to/client.js')).default;
187
- const toolsSuiteModule = await moduleFactory({
185
+ const toolsSuiteModule: MeasurToolsSuite = await createModule({
188
186
  locateFile: (filename) => '/path/to/client.wasm'
189
187
  });
190
188
 
@@ -194,22 +192,10 @@ const totalHeatLoss = toolsSuiteModule.wallTotalHeatLoss(
194
192
  );
195
193
  console.log('Wall total heat loss:', totalHeatLoss);
196
194
 
197
- // Alternatively, narrow to a typed sub-module for IDE assistance
198
- const wallLossModule = toolsSuiteModule as unknown as WallHeatLossModule;
199
- const wthl = wallLossModule.wallTotalHeatLoss(500, 80, 225, 10, 0.9, 1.394, 1);
200
- console.log('Wall total heat loss (typed):', wthl);
201
-
202
- // Example 2: DryerOperatingCost — plain usage
203
- // Enum values and constructors come from the live module instance
204
- const docRes = new toolsSuiteModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25)
205
- .calculate(toolsSuiteModule.DryerType.Heatless);
206
- console.log('DryerOperatingCost => Water Removed:', docRes.waterRemoved);
207
- docRes.delete();
208
-
209
- // Alternatively, narrow to a typed sub-module for IDE assistance
210
- const dryerModule = toolsSuiteModule as unknown as DryerOperatingCostModule;
211
- const doc = new dryerModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
212
- const res = doc.calculate(dryerModule.DryerType.Heatless);
195
+ // Example 2: DryerOperatingCost — class-based API
196
+ // Always call delete() on class instances and output objects to free WASM memory
197
+ const doc = new toolsSuiteModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
198
+ const res = doc.calculate(toolsSuiteModule.DryerType.Heatless);
213
199
  console.log('DryerOperatingCost => Water removed:', res.waterRemoved);
214
200
  res.delete();
215
201
  doc.delete();
package/README.md CHANGED
@@ -48,20 +48,17 @@ res.delete();
48
48
  doc.delete();
49
49
  ```
50
50
 
51
- **TypeScript** — named `import type` provides IDE autocompletion with zero runtime cost; enum values and constructors still come from the live module instance.
51
+ **TypeScript** — `MeasurToolsSuite` is the fully-typed module instance; no casts needed.
52
52
 
53
53
  ```ts
54
- import type { DryerOperatingCostModule } from 'measur-tools-suite';
54
+ import createModule, { type MeasurToolsSuite } from 'measur-tools-suite';
55
55
 
56
- const moduleFactory = (await import('/path/to/client.js')).default;
57
- const toolsSuiteModule = await moduleFactory({
56
+ const toolsSuiteModule: MeasurToolsSuite = await createModule({
58
57
  locateFile: (filename) => '/path/to/client.wasm'
59
58
  });
60
59
 
61
- // Narrow to the typed sub-module for full IDE assistance
62
- const dryerModule = toolsSuiteModule as unknown as DryerOperatingCostModule;
63
- const doc = new dryerModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
64
- const res = doc.calculate(dryerModule.DryerType.Heatless);
60
+ const doc = new toolsSuiteModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
61
+ const res = doc.calculate(toolsSuiteModule.DryerType.Heatless);
65
62
  console.log('Water removed:', res.waterRemoved);
66
63
  res.delete();
67
64
  doc.delete();
package/bin/client.d.ts CHANGED
@@ -89,5 +89,110 @@ export * from "./ts_def_modules/wasteWater/wasteWater";
89
89
 
90
90
  export * from "./ts_def_modules/water/waterAssessment";
91
91
 
92
- declare const _default: (moduleArg?: Record<string, unknown>) => Promise<unknown>;
92
+ /**
93
+ * Represents the fully-initialized MEASUR Tools Suite WebAssembly module instance.
94
+ * This is the intersection of all sub-module types, giving full typed access to every
95
+ * calculator, class, and enum exposed by the WASM bindings.
96
+ *
97
+ * Use this type to annotate the result of the module factory without any casting:
98
+ * @example
99
+ * ```ts
100
+ * import createModule, { type MeasurToolsSuite } from 'measur-tools-suite';
101
+ * const m: MeasurToolsSuite = await createModule({ locateFile: (f) => `/wasm/${f}` });
102
+ * ```
103
+ */
104
+ export type MeasurToolsSuite =
105
+ // binding
106
+ import("./ts_def_modules/binding/registered_vectors").RegisteredVectorsModule &
107
+ // compressedAir
108
+ import("./ts_def_modules/compressedAir/compressedAir").CompressedAirModule &
109
+ import("./ts_def_modules/compressedAir/compressed_air_utils").CompressedAirUtilsModule &
110
+ import("./ts_def_modules/compressedAir/compressorsCalc").CompressorsCalcModule &
111
+ import("./ts_def_modules/compressedAir/dryer_operating_cost").DryerOperatingCostModule &
112
+ import("./ts_def_modules/compressedAir/operating_cost").OperatingCostModule &
113
+ import("./ts_def_modules/compressedAir/pipe_sizing").PipeSizingModule &
114
+ import("./ts_def_modules/compressedAir/pneumatic_air_requirement").PneumaticAirRequirementModule &
115
+ import("./ts_def_modules/compressedAir/pneumatic_valve").PneumaticValveModule &
116
+ import("./ts_def_modules/compressedAir/receiver_tank").ReceiverTankModule &
117
+ // compressedAir/leak_survey
118
+ import("./ts_def_modules/compressedAir/leak_survey/bag_method").BagMethodModule &
119
+ import("./ts_def_modules/compressedAir/leak_survey/compressed_air_leak_survey").CompressedAirLeakSurveyModule &
120
+ import("./ts_def_modules/compressedAir/leak_survey/decibels_method").DecibelsMethodModule &
121
+ import("./ts_def_modules/compressedAir/leak_survey/estimate_method").EstimateMethodModule &
122
+ import("./ts_def_modules/compressedAir/leak_survey/orifice_method").OrificeMethodModule &
123
+ // databases
124
+ import("./ts_def_modules/databases/default_data").DefaultDataModule &
125
+ // motorDriven/fans
126
+ import("./ts_def_modules/motorDriven/fans/fan_affinity_laws").FanAffinityLawsModule &
127
+ import("./ts_def_modules/motorDriven/fans/fanEnum").FanEnumModule &
128
+ import("./ts_def_modules/motorDriven/fans/fan").FanModule &
129
+ // motorDriven/motor
130
+ import("./ts_def_modules/motorDriven/motor/motorEnum").MotorEnumModule &
131
+ import("./ts_def_modules/motorDriven/motor/motor").MotorModule &
132
+ // motorDriven/pump
133
+ import("./ts_def_modules/motorDriven/pump/pump").PumpModule &
134
+ import("./ts_def_modules/motorDriven/pump/pump_valve_power_loss").PumpValvePowerLossModule &
135
+ // motorDriven/pumpFan
136
+ import("./ts_def_modules/motorDriven/pumpFan/pumpFan").PumpFanModule &
137
+ // other
138
+ import("./ts_def_modules/other/chp").ChpModule &
139
+ import("./ts_def_modules/other/lighting_data").LightingDataModule &
140
+ import("./ts_def_modules/other/powerFactor").PowerFactorModule &
141
+ // physics
142
+ import("./ts_def_modules/physics/gas_compositions").GasCompositionsModule &
143
+ // processCooling
144
+ import("./ts_def_modules/processCooling/chillers").ChillersModule &
145
+ import("./ts_def_modules/processCooling/process_cooling").ProcessCoolingModule &
146
+ // processHeat
147
+ import("./ts_def_modules/processHeat/air_heating_using_exhaust").AirHeatingUsingExhaustModule &
148
+ import("./ts_def_modules/processHeat/cascade_heat_high_to_low").CascadeHeatHighToLowModule &
149
+ import("./ts_def_modules/processHeat/energy_equivalency").EnergyEquivalencyModule &
150
+ import("./ts_def_modules/processHeat/flow_calculations_energy_use").FlowCalculationsEnergyUseModule &
151
+ import("./ts_def_modules/processHeat/o2_enrichment").O2EnrichmentModule &
152
+ import("./ts_def_modules/processHeat/water_heating_using_exhaust").WaterHeatingUsingExhaustModule &
153
+ // processHeat/losses
154
+ import("./ts_def_modules/processHeat/losses/atmosphere_heat_loss").AtmosphereHeatLossModule &
155
+ import("./ts_def_modules/processHeat/losses/auxiliary_power_used").AuxiliaryPowerUsedModule &
156
+ import("./ts_def_modules/processHeat/losses/energy_input_electric_arc_furnace").EnergyInputElectricArcFurnaceModule &
157
+ import("./ts_def_modules/processHeat/losses/energy_input_exhaust_gas_heat_loss").EnergyInputExhaustGasHeatLossModule &
158
+ import("./ts_def_modules/processHeat/losses/exhaust_gas_heat_loss_electric_arc_furnace").ExhaustGasHeatLossElectricArcFurnaceModule &
159
+ import("./ts_def_modules/processHeat/losses/fixture_heat_loss").FixtureHeatLossModule &
160
+ import("./ts_def_modules/processHeat/losses/gas_cooling_heat_loss").GasCoolingHeatLossModule &
161
+ import("./ts_def_modules/processHeat/losses/gas_flue_gas_material").GasFlueGasMaterialModule &
162
+ import("./ts_def_modules/processHeat/losses/gas_load_charge_material_heat_required").GasLoadChargeMaterialHeatRequiredModule &
163
+ import("./ts_def_modules/processHeat/losses/leakage_heat_loss").LeakageHeatLossModule &
164
+ import("./ts_def_modules/processHeat/losses/liquid_cooling_heat_loss").LiquidCoolingHeatLossModule &
165
+ import("./ts_def_modules/processHeat/losses/liquid_load_charge_material_heat_required").LiquidLoadChargeMaterialHeatRequiredModule &
166
+ import("./ts_def_modules/processHeat/losses/load_charge_material").LoadChargeMaterialModule &
167
+ import("./ts_def_modules/processHeat/losses/opening_heat_loss").OpeningHeatLossModule &
168
+ import("./ts_def_modules/processHeat/losses/slag_other_material_heat_loss").SlagOtherMaterialHeatLossModule &
169
+ import("./ts_def_modules/processHeat/losses/solid_liquid_flue_gas_material").SolidLiquidFlueGasMaterialModule &
170
+ import("./ts_def_modules/processHeat/losses/solid_load_charge_material_heat_required").SolidLoadChargeMaterialHeatRequiredModule &
171
+ import("./ts_def_modules/processHeat/losses/wall_heat_loss").WallHeatLossModule &
172
+ import("./ts_def_modules/processHeat/losses/water_cooling_heat_loss").WaterCoolingHeatLossModule &
173
+ // steam
174
+ import("./ts_def_modules/steam/air_water_cooling_using_flue").AirWaterCoolingUsingFlueModule &
175
+ import("./ts_def_modules/steam/steam_leak_survey").SteamLeakSurveyModule &
176
+ import("./ts_def_modules/steam/water_heating_using_flue").WaterHeatingUsingFlueModule &
177
+ import("./ts_def_modules/steam/water_heating_using_steam").WaterHeatingUsingSteamModule &
178
+ // steamModeler
179
+ import("./ts_def_modules/steamModeler/ssmtEnum").SsmtEnumModule &
180
+ import("./ts_def_modules/steamModeler/ssmt").SsmtModule &
181
+ import("./ts_def_modules/steamModeler/ssmtModeler").SsmtModelerModule &
182
+ // treasureHunt
183
+ import("./ts_def_modules/treasureHunt/compressed_air_pressure_reduction").CompressedAirPressureReductionModule &
184
+ import("./ts_def_modules/treasureHunt/compressed_air_reduction").CompressedAirReductionModule &
185
+ import("./ts_def_modules/treasureHunt/electricity_reduction").ElectricityReductionModule &
186
+ import("./ts_def_modules/treasureHunt/insulated_pipe_reduction").InsulatedPipeReductionModule &
187
+ import("./ts_def_modules/treasureHunt/insulated_tank_reduction").InsulatedTankReductionModule &
188
+ import("./ts_def_modules/treasureHunt/natural_gas_reduction").NaturalGasReductionModule &
189
+ import("./ts_def_modules/treasureHunt/steam_reduction").SteamReductionModule &
190
+ import("./ts_def_modules/treasureHunt/water_reduction").WaterReductionModule &
191
+ // wasteWater
192
+ import("./ts_def_modules/wasteWater/svi").SviModule &
193
+ import("./ts_def_modules/wasteWater/wasteWater").WasteWaterModule &
194
+ // water
195
+ import("./ts_def_modules/water/waterAssessment").WaterAssessmentModule;
196
+
197
+ declare const _default: (moduleArg?: Record<string, unknown>) => Promise<MeasurToolsSuite>;
93
198
  export default _default;
package/bin/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "measur-tools-suite",
3
- "version": "1.2.1-beta.2",
3
+ "version": "1.2.1-beta.3",
4
4
  "engines": {
5
5
  "node": "20.19.4",
6
6
  "npm": "10.8.2"
@@ -9,7 +9,7 @@
9
9
  "test:browser": "karma start",
10
10
  "tests": "npx karma start --browsers ChromeHeadlessNoSandbox --auto-watch false"
11
11
  },
12
- "description": "Calculation library for the Department of Energy Advanced Manufacturing and Materials Technologies Office and the Industrial Efficiency & Decarbonization Office (DOE AMMTO IEDO) suite of tools",
12
+ "description": "Oak Ridge National Lab's Industrial Resources calculation library for MEASUR.",
13
13
  "author": "Gina Accawi <accawigk@ornl.gov>",
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -20,8 +20,11 @@
20
20
  "url": "https://github.com/ORNL-AMO/MEASUR-Tools-Suite/issues"
21
21
  },
22
22
  "homepage": "https://github.com/ORNL-AMO/MEASUR-Tools-Suite#readme",
23
+ "main": "bin/client.js",
23
24
  "types": "ts_def/client.d.ts",
24
25
  "devDependencies": {
26
+ "@types/chai": "^5.2.3",
27
+ "@types/mocha": "^10.0.10",
25
28
  "chai": "^6.0.1",
26
29
  "express": "^4.17.1",
27
30
  "jquery": "^3.4.1",
@@ -30,6 +33,8 @@
30
33
  "karma-mocha": "^2.0.1",
31
34
  "karma-mocha-reporter": "^2.2.5",
32
35
  "karma-webpack": "^5.0.1",
33
- "mocha": "^11.7.1"
36
+ "mocha": "^11.7.1",
37
+ "ts-loader": "^9.6.1",
38
+ "typescript": "^6.0.3"
34
39
  }
35
40
  }
@@ -2,6 +2,7 @@ import { TraversePlane, PlaneDataNodeBindingData } from "../motorDriven/fans/fan
2
2
  import { LightingData } from "../other/lighting_data";
3
3
  import { MotorData } from "../motorDriven/motor/motor";
4
4
  import {
5
+ AtmosphereGasType,
5
6
  GasFlueGasMaterial,
6
7
  GasLoadChargeMaterial,
7
8
  LiquidLoadChargeMaterial, SolidLiquidFlueGasMaterial,
@@ -59,11 +60,15 @@ export declare abstract class RegisteredVector<T> {
59
60
  delete(): void;
60
61
  }
61
62
 
63
+ export type RegisteredVectorConstructor<TVector extends RegisteredVector<unknown>> = {
64
+ new (): TVector;
65
+ };
66
+
62
67
  /** A vector of {@link number} records, mapped from `std::vector<number>`. */
63
68
  export declare interface DoubleVector extends RegisteredVector<number> {}
64
69
 
65
- /** A vector of {@link number[]} records, mapped from `std::vector<std::vector<number>>`. */
66
- export declare interface DoubleVector2D extends RegisteredVector<number[]> {}
70
+ /** A vector of {@link DoubleVector} records, mapped from `std::vector<std::vector<number>>`. */
71
+ export declare interface DoubleVector2D extends RegisteredVector<DoubleVector> {}
67
72
 
68
73
  /** A vector of {@link CompressorsData} records, mapped from `std::vector<CompressorsData>`. */
69
74
  export declare interface CompressorsDataV extends RegisteredVector<CompressorsData> {}
@@ -89,8 +94,8 @@ export declare interface SolidLiquidFlueGasMaterialV extends RegisteredVector<So
89
94
  /** A vector of {@link WallType} records, mapped from `std::vector<WallType>`. */
90
95
  export declare interface WallTypeV extends RegisteredVector<WallType> {}
91
96
 
92
- /** A vector of {@link GasType} records, mapped from `std::vector<GasType>`. */
93
- export declare interface AtmosphereGasTypeV extends RegisteredVector<GasType> {}
97
+ /** A vector of {@link AtmosphereGasType} records, mapped from `std::vector<AtmosphereGasType>`. */
98
+ export declare interface AtmosphereGasTypeV extends RegisteredVector<AtmosphereGasType> {}
94
99
 
95
100
  /** A vector of {@link TraversePlane} records, mapped from `std::vector<TraversePlane>`. */
96
101
  export declare interface TraversePlaneVector extends RegisteredVector<TraversePlane> {}
@@ -141,40 +146,40 @@ export declare interface GraphDataV extends RegisteredVector<GraphDataPoint> {}
141
146
  export declare interface CalculationsTableV extends RegisteredVector<CalculationsTable> {}
142
147
 
143
148
  export type RegisteredVectorsModule = {
144
- DoubleVector: DoubleVector;
145
- DoubleVector2D: DoubleVector2D;
149
+ DoubleVector: RegisteredVectorConstructor<DoubleVector>;
150
+ DoubleVector2D: RegisteredVectorConstructor<DoubleVector2D>;
146
151
 
147
- CompressorsDataV: CompressorsDataV;
148
- CompressedAirLeakSurveyInputV: CompressedAirLeakSurveyInputV;
152
+ CompressorsDataV: RegisteredVectorConstructor<CompressorsDataV>;
153
+ CompressedAirLeakSurveyInputV: RegisteredVectorConstructor<CompressedAirLeakSurveyInputV>;
149
154
 
150
- GasLoadChargeMaterialV: GasLoadChargeMaterialV;
151
- LiquidLoadChargeMaterialV: LiquidLoadChargeMaterialV;
152
- SolidLoadChargeMaterialV: SolidLoadChargeMaterialV;
153
- GasFlueGasMaterialV: GasFlueGasMaterialV;
154
- SolidLiquidFlueGasMaterialV: SolidLiquidFlueGasMaterialV;
155
- WallTypeV: WallTypeV;
156
- AtmosphereGasTypeV: AtmosphereGasTypeV;
155
+ GasLoadChargeMaterialV: RegisteredVectorConstructor<GasLoadChargeMaterialV>;
156
+ LiquidLoadChargeMaterialV: RegisteredVectorConstructor<LiquidLoadChargeMaterialV>;
157
+ SolidLoadChargeMaterialV: RegisteredVectorConstructor<SolidLoadChargeMaterialV>;
158
+ GasFlueGasMaterialV: RegisteredVectorConstructor<GasFlueGasMaterialV>;
159
+ SolidLiquidFlueGasMaterialV: RegisteredVectorConstructor<SolidLiquidFlueGasMaterialV>;
160
+ WallTypeV: RegisteredVectorConstructor<WallTypeV>;
161
+ AtmosphereGasTypeV: RegisteredVectorConstructor<AtmosphereGasTypeV>;
157
162
 
158
- TraversePlaneVector: TraversePlaneVector;
159
- PlaneDataNodeBindingDataVector: PlaneDataNodeBindingDataVector;
163
+ TraversePlaneVector: RegisteredVectorConstructor<TraversePlaneVector>;
164
+ PlaneDataNodeBindingDataVector: RegisteredVectorConstructor<PlaneDataNodeBindingDataVector>;
160
165
 
161
- MotorDataV: MotorDataV;
162
- LightingDataV: LightingDataV;
166
+ MotorDataV: RegisteredVectorConstructor<MotorDataV>;
167
+ LightingDataV: RegisteredVectorConstructor<LightingDataV>;
163
168
 
164
- GasCompositionsV: GasCompositionsV;
169
+ GasCompositionsV: RegisteredVectorConstructor<GasCompositionsV>;
165
170
 
166
- IntVector: IntVector;
167
- ChillerInputV: ChillerInputV;
171
+ IntVector: RegisteredVectorConstructor<IntVector>;
172
+ ChillerInputV: RegisteredVectorConstructor<ChillerInputV>;
168
173
 
169
- InletVector: InletVector;
174
+ InletVector: RegisteredVectorConstructor<InletVector>;
170
175
 
171
- CompressedAirPressureReductionInputV: CompressedAirPressureReductionInputV;
172
- CompressedAirReductionInputV: CompressedAirReductionInput;
173
- ElectricityReductionInputV: ElectricityReductionInputV;
174
- NaturalGasReductionInputV: NaturalGasReductionInputV;
175
- SteamReductionInputV: SteamReductionInputV;
176
- WaterReductionInputV: WaterReductionInputV;
176
+ CompressedAirPressureReductionInputV: RegisteredVectorConstructor<CompressedAirPressureReductionInputV>;
177
+ CompressedAirReductionInputV: RegisteredVectorConstructor<CompressedAirReductionInputV>;
178
+ ElectricityReductionInputV: RegisteredVectorConstructor<ElectricityReductionInputV>;
179
+ NaturalGasReductionInputV: RegisteredVectorConstructor<NaturalGasReductionInputV>;
180
+ SteamReductionInputV: RegisteredVectorConstructor<SteamReductionInputV>;
181
+ WaterReductionInputV: RegisteredVectorConstructor<WaterReductionInputV>;
177
182
 
178
- GraphDataV: GraphDataV;
179
- CalculationsTableV: CalculationsTableV;
183
+ GraphDataV: RegisteredVectorConstructor<GraphDataV>;
184
+ CalculationsTableV: RegisteredVectorConstructor<CalculationsTableV>;
180
185
  };
@@ -1,3 +1,5 @@
1
+ import { DoubleVector } from "../binding/registered_vectors";
2
+
1
3
  /**
2
4
  * Compressed Air Core Calculations
3
5
  *
@@ -93,7 +95,7 @@ export declare class PipeData {
93
95
  export declare class AirSystemCapacityOutput {
94
96
  constructor(
95
97
  totalPipeVolume: number,
96
- receiverCapacities: number[],
98
+ receiverCapacities: DoubleVector,
97
99
  totalReceiverVolume: number,
98
100
  totalCapacityOfCompressedAirSystem: number,
99
101
  pipeLengths: PipeData
@@ -102,7 +104,7 @@ export declare class AirSystemCapacityOutput {
102
104
  totalPipeVolume: number;
103
105
  totalReceiverVolume: number;
104
106
  totalCapacityOfCompressedAirSystem: number;
105
- receiverCapacities: number[];
107
+ receiverCapacities: DoubleVector;
106
108
  pipeLengths: PipeData;
107
109
 
108
110
  /** Frees the underlying resource; must be called when finished with the instance */
@@ -115,9 +117,9 @@ export declare class AirSystemCapacityOutput {
115
117
  export declare class AirSystemCapacity {
116
118
  /**
117
119
  * @param pipeLengths PipeData, object containing values for different pipe sizes.
118
- * @param receivers number[], vector of receiver volumes.
120
+ * @param receivers DoubleVector, vector of receiver volumes.
119
121
  */
120
- constructor(pipeLengths: PipeData, receivers: number[]);
122
+ constructor(pipeLengths: PipeData, receivers: DoubleVector);
121
123
 
122
124
  /**
123
125
  * @returns {@link AirSystemCapacityOutput} object containing total pipe volume, total receiver volume, total compressed air system capacity, and per-size pipe values.
@@ -18,11 +18,6 @@ export interface CompressorElectricityData {
18
18
  compressorControlAdjustment: number;
19
19
  /** Compressor specific power, units kW/(cfm) */
20
20
  compressorSpecificPower: number;
21
-
22
- /** Frees the underlying resource; must be called when finished with the instance */
23
- delete(): void;
24
21
  }
25
22
 
26
- export type CompressedAirUtilsModule = {
27
- CompressorElectricityData: CompressorElectricityData;
28
- };
23
+ export type CompressedAirUtilsModule = {};
@@ -86,9 +86,6 @@ export interface DryerOperatingCostInput {
86
86
  heatingHoursPerDay: number;
87
87
  purgeRate: number;
88
88
  designDDCPercentage: number;
89
-
90
- /** Frees the underlying resource; must be called when finished with the instance */
91
- delete(): void;
92
89
  }
93
90
 
94
91
  /**
@@ -107,7 +104,9 @@ export interface DryerOperatingCostInput {
107
104
  * @property designDDCPercentage double, Design DDC percentage for the dryer - percentage (0 - 100%)
108
105
  *
109
106
  */
110
- export interface DryerOperatingCostOutput {
107
+ export declare class DryerOperatingCostOutput {
108
+ private constructor();
109
+
111
110
  waterRemoved: number;
112
111
  totalCostPerYear: number;
113
112
  heaterPower: number;
@@ -238,6 +237,5 @@ export declare class DryerOperatingCost {
238
237
  export type DryerOperatingCostModule = {
239
238
  DryerType: typeof DryerType;
240
239
  DryerOperatingCost: typeof DryerOperatingCost;
241
- DryerOperatingCostInput: DryerOperatingCostInput;
242
- DryerOperatingCostOutput: DryerOperatingCostOutput;
243
- };
240
+ DryerOperatingCostOutput: typeof DryerOperatingCostOutput;
241
+ };
@@ -16,9 +16,6 @@ export interface BagMethodInput {
16
16
  operatingTime: number;
17
17
  bagFillTime: number;
18
18
  bagVolume: number;
19
-
20
- /** Frees the underlying resource; must be called when finished with the instance */
21
- delete(): void;
22
19
  }
23
20
 
24
21
  /**
@@ -30,9 +27,6 @@ export interface BagMethodInput {
30
27
  export interface BagMethodResult {
31
28
  flowRate: number;
32
29
  annualConsumption: number;
33
-
34
- /** Frees the underlying resource; must be called when finished with the instance */
35
- delete(): void;
36
30
  }
37
31
 
38
32
  /**
@@ -46,6 +40,4 @@ export function calculateBagMethod(input: BagMethodInput): BagMethodResult;
46
40
 
47
41
  export type BagMethodModule = {
48
42
  calculateBagMethod: typeof calculateBagMethod;
49
- BagMethodInput: BagMethodInput;
50
- BagMethodResult: BagMethodResult;
51
- };
43
+ };
@@ -15,7 +15,7 @@ import { CompressorElectricityData } from "../compressed_air_utils";
15
15
  * Selects the field measurement method used to estimate each leak's flow rate.
16
16
  * @details Each method is implemented in its own leak survey binding module.
17
17
  */
18
- export enum MeasurementMethod {
18
+ export declare const enum MeasurementMethod {
19
19
  Estimate = 0,
20
20
  Decibels = 1,
21
21
  Bag = 2,
@@ -25,7 +25,7 @@ export enum MeasurementMethod {
25
25
  /**
26
26
  * Selects the cost basis used to convert annual leak flow to annual cost.
27
27
  */
28
- export enum UtilityTypeCA {
28
+ export declare const enum UtilityTypeCA {
29
29
  CompressedAir = 0,
30
30
  Electricity = 1
31
31
  }
@@ -61,9 +61,6 @@ export interface CompressedAirLeakSurveyInput {
61
61
  orificeMethodInput: OrificeMethodInput;
62
62
  compressorElectricityData: CompressorElectricityData;
63
63
  units: number;
64
-
65
- /** Frees the underlying resource; must be called when finished with the instance */
66
- delete(): void;
67
64
  }
68
65
 
69
66
  /**
@@ -79,9 +76,6 @@ export interface CompressedAirLeakSurveyResult {
79
76
  annualTotalElectricityCost: number;
80
77
  totalFlowRate: number;
81
78
  annualTotalFlowRate: number;
82
-
83
- /** Frees the underlying resource; must be called when finished with the instance */
84
- delete(): void;
85
79
  }
86
80
 
87
81
  /**
@@ -97,9 +91,5 @@ export function calculateCompressedAirLeakSurvey(
97
91
  ): CompressedAirLeakSurveyResult;
98
92
 
99
93
  export type CompressedAirLeakSurveyModule = {
100
- MeasurementMethod: typeof MeasurementMethod;
101
- UtilityTypeCA: typeof UtilityTypeCA;
102
94
  calculateCompressedAirLeakSurvey: typeof calculateCompressedAirLeakSurvey;
103
- CompressedAirLeakSurveyInput: CompressedAirLeakSurveyInput;
104
- CompressedAirLeakSurveyResult: CompressedAirLeakSurveyResult;
105
- };
95
+ };
@@ -36,9 +36,6 @@ export interface DecibelsMethodInput {
36
36
  pressureB: number;
37
37
  firstFlowB: number;
38
38
  secondFlowB: number;
39
-
40
- /** Frees the underlying resource; must be called when finished with the instance */
41
- delete(): void;
42
39
  }
43
40
 
44
41
  /**
@@ -50,9 +47,6 @@ export interface DecibelsMethodInput {
50
47
  export interface DecibelsMethodResult {
51
48
  leakRateEstimate: number;
52
49
  annualConsumption: number;
53
-
54
- /** Frees the underlying resource; must be called when finished with the instance */
55
- delete(): void;
56
50
  }
57
51
 
58
52
  /**
@@ -66,6 +60,4 @@ export function calculateDecibelsMethod(input: DecibelsMethodInput): DecibelsMet
66
60
 
67
61
  export type DecibelsMethodModule = {
68
62
  calculateDecibelsMethod: typeof calculateDecibelsMethod;
69
- DecibelsMethodInput: DecibelsMethodInput;
70
- DecibelsMethodResult: DecibelsMethodResult;
71
- };
63
+ };
@@ -14,9 +14,6 @@
14
14
  export interface EstimateMethodInput {
15
15
  operatingTime: number;
16
16
  leakRateEstimate: number;
17
-
18
- /** Frees the underlying resource; must be called when finished with the instance */
19
- delete(): void;
20
17
  }
21
18
 
22
19
  /**
@@ -26,9 +23,6 @@ export interface EstimateMethodInput {
26
23
  */
27
24
  export interface EstimateMethodResult {
28
25
  annualConsumption: number;
29
-
30
- /** Frees the underlying resource; must be called when finished with the instance */
31
- delete(): void;
32
26
  }
33
27
 
34
28
  /**
@@ -42,6 +36,4 @@ export function calculateEstimateMethod(input: EstimateMethodInput): EstimateMet
42
36
 
43
37
  export type EstimateMethodModule = {
44
38
  calculateEstimateMethod: typeof calculateEstimateMethod;
45
- EstimateMethodInput: EstimateMethodInput;
46
- EstimateMethodResult: EstimateMethodResult;
47
- };
39
+ };
@@ -24,9 +24,6 @@ export interface OrificeMethodInput {
24
24
  diameter: number;
25
25
  supplyPressure: number;
26
26
  numOrifices: number;
27
-
28
- /** Frees the underlying resource; must be called when finished with the instance */
29
- delete(): void;
30
27
  }
31
28
 
32
29
  /**
@@ -48,9 +45,6 @@ export interface OrificeMethodResult {
48
45
  leakRateScfm: number;
49
46
  leakRateEstimate: number;
50
47
  annualConsumption: number;
51
-
52
- /** Frees the underlying resource; must be called when finished with the instance */
53
- delete(): void;
54
48
  }
55
49
 
56
50
  /**
@@ -64,6 +58,4 @@ export function calculateOrificeMethod(input: OrificeMethodInput): OrificeMethod
64
58
 
65
59
  export type OrificeMethodModule = {
66
60
  calculateOrificeMethod: typeof calculateOrificeMethod;
67
- OrificeMethodInput: OrificeMethodInput;
68
- OrificeMethodResult: OrificeMethodResult;
69
- };
61
+ };
@@ -24,9 +24,6 @@ export interface OperatingCostInput {
24
24
  efficiencyLoaded: number;
25
25
  efficiencyUnloaded: number;
26
26
  costOfElectricity: number;
27
-
28
- /** Frees the underlying resource; must be called when finished with the instance */
29
- delete(): void;
30
27
  }
31
28
 
32
29
  /**
@@ -42,9 +39,6 @@ export interface OperatingCostResult {
42
39
  costForLoaded: number;
43
40
  costForUnloaded: number;
44
41
  totalAnnualCost: number;
45
-
46
- /** Frees the underlying resource; must be called when finished with the instance */
47
- delete(): void;
48
42
  }
49
43
 
50
44
  /**
@@ -58,6 +52,4 @@ export function calculateOperatingCost(input: OperatingCostInput): OperatingCost
58
52
 
59
53
  export type OperatingCostModule = {
60
54
  calculateOperatingCost: typeof calculateOperatingCost;
61
- OperatingCostInput: OperatingCostInput;
62
- OperatingCostResult: OperatingCostResult;
63
- };
55
+ };