@measurequick/measurequick-report-generator 1.5.199 → 1.5.200

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.199",
3
+ "version": "1.5.200",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -223,55 +223,103 @@ export async function getReport(payload, _test) {
223
223
 
224
224
  form.getTextField("YourSystemScorePage2").setText(`${systemScorePercentage} ${systemScoreGrade}`);
225
225
 
226
- // Print targets and range icons (using appropriate values for heat pump heating)
227
- // Only show range icons for measurements that exist
228
- // Map field names to textFields values and check if they exist
229
- const measureChecks = [
230
- { label: "Superheat", value: textFields.tempRise }, // Temperature Rise
231
- { label: "Subcooling", value: textFields.approach, ref: "temperature_difference_condenser" }, // Approach
232
- { label: "Condenser", value: textFields.cop }, // COP/Efficiency
233
- { label: "TempSplit", value: textFields.oat }, // Outdoor Air Temp
234
- { label: "Tesp", value: textFields.tesp }, // Total External Static Pressure
235
- { label: "FilterFace", value: textFields.airflow } // Airflow
236
- ];
237
-
238
- for (let i = 0; i < measureChecks.length; i++) {
239
- const { label, value, ref } = measureChecks[i];
240
- // Only show range indicator if value exists (is not "--")
241
- if (value && value !== "--") {
242
- let icon = iconRangeGreen;
243
- let iconPlacement = "Mid";
244
-
245
- // Check if we have target zone data for this measurement
246
- if (ref && t.targets && t.targets[ref] !== undefined) {
247
- const target = parseFloat(t.targets[ref]);
248
- const idealLow = t.targets[`${ref}_ideal_low`] ? parseFloat(t.targets[`${ref}_ideal_low`]) : 0;
249
- const idealHigh = t.targets[`${ref}_ideal_high`] ? parseFloat(t.targets[`${ref}_ideal_high`]) : 0;
250
- const actual = parseFloat(value);
251
- const low = target - idealLow;
252
- const high = target + idealHigh;
253
-
254
- if (actual < low) {
255
- icon = iconRangeRed;
256
- iconPlacement = "Low";
257
- } else if (actual > high) {
258
- icon = iconRangeRed;
259
- iconPlacement = "High";
226
+ // Print targets and range icons for heat pump heating
227
+ // Heat pump heating target zones - some are in data, some in targets
228
+ const measureLabels = ["Superheat", "Subcooling", "Condenser", "TempSplit", "Tesp", "FilterFace"];
229
+
230
+ for (let i = 0; i < measureLabels.length; i++) {
231
+ const label = measureLabels[i];
232
+ let targetZone = "";
233
+ let icon = iconRangeGreen;
234
+ let iconPlacement = "Mid";
235
+ let value = "";
236
+ let mid, low, high;
237
+
238
+ if (label === "Superheat") {
239
+ // Temperature Rise - no specific target zone for HP heating, show measured value
240
+ value = textFields.tempRise;
241
+ // HP heating doesn't have fixed temp rise targets like gas heating
242
+ } else if (label === "Subcooling") {
243
+ // Approach - LLT minus entering dry bulb
244
+ value = textFields.approach;
245
+ // Check for approach targets in targets object
246
+ if (t.targets && t.targets.approach !== undefined) {
247
+ mid = parseFloat(t.targets.approach);
248
+ const idealLow = t.targets.approach_ideal_low !== undefined ? parseFloat(t.targets.approach_ideal_low) : 3;
249
+ const idealHigh = t.targets.approach_ideal_high !== undefined ? parseFloat(t.targets.approach_ideal_high) : 3;
250
+ low = mid - idealLow;
251
+ high = mid + idealHigh;
252
+ if (!isNaN(low) && !isNaN(high)) {
253
+ targetZone = `(${low.toFixed(1)} - ${high.toFixed(1)})`;
254
+ }
255
+ }
256
+ } else if (label === "Condenser") {
257
+ // COP - target is in data.hp_heating_cop_target
258
+ value = textFields.cop;
259
+ if (t.data && t.data.hp_heating_cop_target !== undefined) {
260
+ mid = parseFloat(t.data.hp_heating_cop_target);
261
+ // COP ideal range is typically ±0.3
262
+ low = mid - 0.3;
263
+ high = mid + 0.3;
264
+ if (!isNaN(low) && !isNaN(high)) {
265
+ targetZone = `(${low.toFixed(2)} - ${high.toFixed(2)})`;
266
+ }
267
+ }
268
+ } else if (label === "TempSplit") {
269
+ // Outdoor Air Temp - no target zone, just informational
270
+ value = textFields.oat;
271
+ } else if (label === "Tesp") {
272
+ // Total External Static Pressure
273
+ value = textFields.tesp;
274
+ if (t.targets && t.targets.pressure_static_total_external !== undefined) {
275
+ mid = parseFloat(t.targets.pressure_static_total_external);
276
+ high = mid * 1.4;
277
+ if (!isNaN(high)) {
278
+ targetZone = `(< ${high.toFixed(2)})`;
260
279
  }
261
280
  }
281
+ } else if (label === "FilterFace") {
282
+ // Airflow - no specific target zone
283
+ value = textFields.airflow;
284
+ }
262
285
 
263
- try {
264
- form.getButton(`Image${label}${iconPlacement}_af_image`).setImage(icon);
265
- } catch (e) {
266
- // Field may not exist
286
+ // Determine range indicator position if we have target values
287
+ if (value && value !== "--" && mid !== undefined) {
288
+ const actual = parseFloat(value);
289
+ if (!isNaN(actual)) {
290
+ if (label === "Tesp") {
291
+ // TESP: only check if above threshold
292
+ if (actual > high) {
293
+ icon = iconRangeRed;
294
+ iconPlacement = "High";
295
+ }
296
+ } else if (low !== undefined && high !== undefined) {
297
+ if (actual < low) {
298
+ icon = iconRangeRed;
299
+ iconPlacement = "Low";
300
+ } else if (actual > high) {
301
+ icon = iconRangeRed;
302
+ iconPlacement = "High";
303
+ }
304
+ }
267
305
  }
268
306
  }
269
- // Clear target zone text for heat pump heating (different targets apply)
307
+
308
+ // Set target zone text
270
309
  try {
271
- form.getTextField(`${label}Target`).setText("");
310
+ form.getTextField(`${label}Target`).setText(targetZone);
272
311
  } catch (e) {
273
312
  // Field may not exist
274
313
  }
314
+
315
+ // Set range indicator icon if value exists
316
+ if (value && value !== "--") {
317
+ try {
318
+ form.getButton(`Image${label}${iconPlacement}_af_image`).setImage(icon);
319
+ } catch (e) {
320
+ // Field may not exist
321
+ }
322
+ }
275
323
  }
276
324
 
277
325
  // Skip pass/fail subsystem review for heat pump heating