@measurequick/measurequick-report-generator 1.5.201 → 1.5.203

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measurequick/measurequick-report-generator",
3
- "version": "1.5.201",
3
+ "version": "1.5.203",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,7 +1,6 @@
1
1
  import { PDFDocument } from "pdf-lib";
2
2
  import * as base64 from "../base-64/icons.js";
3
3
  import * as pdf from "../base-64/mq-vitals-heatpump-heating.js";
4
- import * as systemInfoPage from "./system-info-page.js";
5
4
  import * as util from "../util.js";
6
5
  import * as notesSummaryPage from "./notes-summary-page.js";
7
6
 
@@ -186,10 +185,11 @@ export async function getReport(payload, _test) {
186
185
  form.getTextField(`YourSystemScore${systemScoreColor}`).setText(`${systemScorePercentage} ${systemScoreGrade}`);
187
186
 
188
187
  // Heat pump heating measurements (using existing form fields with different data)
189
- form.getTextField("Superheat").setText(`${textFields.tempRise} °${payload.units.temperature}`);
190
- form.getTextField("Subcooling").setText(`${textFields.approach} °${payload.units.temperature}`);
188
+ // Field mapping: Superheat=Capacity, Subcooling=TempSplit, TemperatureSplit=Approach
189
+ form.getTextField("Superheat").setText(`${textFields.capacity}`);
190
+ form.getTextField("Subcooling").setText(`${textFields.tempRise} °${payload.units.temperature}`);
191
191
  form.getTextField("CondenserApproach").setText(`${textFields.cop}`);
192
- form.getTextField("TemperatureSplit").setText(`${textFields.oat} °${payload.units.temperature}`);
192
+ form.getTextField("TemperatureSplit").setText(`${textFields.approach} °${payload.units.temperature}`);
193
193
  form.getTextField("TotalExternalStaticPressure").setText(`${textFields.tesp} inH2O`);
194
194
  form.getTextField("FilterFaceVelocity").setText(`${textFields.airflow} CFM`);
195
195
 
@@ -236,7 +236,19 @@ export async function getReport(payload, _test) {
236
236
  let mid, low, high;
237
237
 
238
238
  if (label === "Superheat") {
239
- // Temperature Rise - uses temperature_split targets for HP heating
239
+ // Capacity (total) - uses capacity_total targets for HP heating
240
+ value = textFields.capacityRaw;
241
+ if (t.targets && t.targets.capacity_total !== undefined) {
242
+ mid = parseFloat(t.targets.capacity_total);
243
+ // Capacity ideal range is typically ±10%
244
+ low = mid * 0.9;
245
+ high = mid * 1.1;
246
+ if (!isNaN(low) && !isNaN(high)) {
247
+ targetZone = `(${(low/1000).toFixed(1)}k - ${(high/1000).toFixed(1)}k)`;
248
+ }
249
+ }
250
+ } else if (label === "Subcooling") {
251
+ // Temperature Split - uses temperature_split targets
240
252
  value = textFields.tempRise;
241
253
  if (t.targets && t.targets.temperature_split !== undefined) {
242
254
  mid = parseFloat(t.targets.temperature_split);
@@ -248,20 +260,6 @@ export async function getReport(payload, _test) {
248
260
  targetZone = `(${low.toFixed(1)} - ${high.toFixed(1)})`;
249
261
  }
250
262
  }
251
- } else if (label === "Subcooling") {
252
- // Approach - LLT minus entering dry bulb
253
- value = textFields.approach;
254
- // Check for approach targets in targets object
255
- if (t.targets && t.targets.approach !== undefined) {
256
- mid = parseFloat(t.targets.approach);
257
- const idealLow = t.targets.approach_ideal_low !== undefined ? parseFloat(t.targets.approach_ideal_low) : 3;
258
- const idealHigh = t.targets.approach_ideal_high !== undefined ? parseFloat(t.targets.approach_ideal_high) : 3;
259
- low = mid - idealLow;
260
- high = mid + idealHigh;
261
- if (!isNaN(low) && !isNaN(high)) {
262
- targetZone = `(${low.toFixed(1)} - ${high.toFixed(1)})`;
263
- }
264
- }
265
263
  } else if (label === "Condenser") {
266
264
  // COP - target is in data.hp_heating_cop_target
267
265
  value = textFields.cop;
@@ -275,8 +273,18 @@ export async function getReport(payload, _test) {
275
273
  }
276
274
  }
277
275
  } else if (label === "TempSplit") {
278
- // Outdoor Air Temp - no target zone, just informational
279
- value = textFields.oat;
276
+ // Approach - LLT minus entering dry bulb, uses approach targets
277
+ value = textFields.approach;
278
+ if (t.targets && t.targets.approach !== undefined) {
279
+ mid = parseFloat(t.targets.approach);
280
+ const idealLow = t.targets.approach_ideal_low !== undefined ? parseFloat(t.targets.approach_ideal_low) : 3;
281
+ const idealHigh = t.targets.approach_ideal_high !== undefined ? parseFloat(t.targets.approach_ideal_high) : 3;
282
+ low = mid - idealLow;
283
+ high = mid + idealHigh;
284
+ if (!isNaN(low) && !isNaN(high)) {
285
+ targetZone = `(${low.toFixed(1)} - ${high.toFixed(1)})`;
286
+ }
287
+ }
280
288
  } else if (label === "Tesp") {
281
289
  // Total External Static Pressure
282
290
  value = textFields.tesp;
@@ -345,18 +353,6 @@ export async function getReport(payload, _test) {
345
353
  // Skip pass/fail subsystem review for heat pump heating
346
354
  form.getTextField("SSR1").setText("Heat Pump Heating Mode");
347
355
 
348
- // Add system info page
349
- if (payload.meta.report_type != "FullReport") {
350
- let systemInfoPageBase64 = await systemInfoPage.getReport(payload);
351
- const systemInfoPageDoc = systemInfoPageBase64
352
- ? await PDFDocument.load(util._base64ToArrayBuffer(systemInfoPageBase64.data))
353
- : false;
354
- const [_systemInfoPageDoc] = systemInfoPageDoc
355
- ? await pdfDoc.copyPages(systemInfoPageDoc, [0])
356
- : false;
357
- if (_systemInfoPageDoc) pdfDoc.insertPage(pdfDoc.getPages().length, _systemInfoPageDoc);
358
- }
359
-
360
356
  // flatten form fields before adding AI summary pages
361
357
  form.flatten();
362
358
 
@@ -377,6 +373,19 @@ function getTextFields(payload, test) {
377
373
  tempRise = (test.data.temperature_leaving_dry_bulb - test.data.temperature_entering_dry_bulb).toFixed(1);
378
374
  }
379
375
 
376
+ // Calculate capacity - use capacity_total from data or targets
377
+ let capacityRaw = null;
378
+ let capacity = "--";
379
+ if (test.data.capacity_total !== undefined && test.data.capacity_total !== null) {
380
+ capacityRaw = +test.data.capacity_total;
381
+ // Format capacity: show in k BTU/h (e.g., "36.2k BTU/h")
382
+ capacity = (capacityRaw / 1000).toFixed(1) + "k BTU/h";
383
+ } else if (test.targets && test.targets.capacity_total !== undefined) {
384
+ // Fall back to target if actual capacity not available
385
+ capacityRaw = +test.targets.capacity_total;
386
+ capacity = (capacityRaw / 1000).toFixed(1) + "k BTU/h";
387
+ }
388
+
380
389
  return {
381
390
  cName:
382
391
  payload.site.customer.first_name && payload.site.customer.last_name
@@ -388,6 +397,8 @@ function getTextFields(payload, test) {
388
397
  state: payload.site.location.state ? `, ${payload.site.location.state}` : "",
389
398
  zip: payload.site.location.zip ? ` ${payload.site.location.zip}` : "",
390
399
  // Heat pump heating specific fields
400
+ capacity: capacity,
401
+ capacityRaw: capacityRaw,
391
402
  tempRise: tempRise,
392
403
  approach: (test.data.temperature_liquid_line !== undefined && test.data.temperature_entering_dry_bulb !== undefined)
393
404
  ? (test.data.temperature_liquid_line - test.data.temperature_entering_dry_bulb).toFixed(1)