From f54265319323dc2faedab604eddff8594f784e9a Mon Sep 17 00:00:00 2001
From: Jeff Korenstein <67333843+jkoren@users.noreply.github.com>
Date: Tue, 19 Mar 2024 20:02:12 -0400
Subject: [PATCH] created objects (#133)
* created objects
* home changed to an interface, example of how to use interface included in CurrentHeatingSystem
* updated remaining models to interfaces
* update to reflect changes to main
* field names changed per comments in PR
* made all model names singular
* added ' Propane' option to fuelType, provided inclusionOverride options
* updated field in Location to camel case
* example of instantiating heatLoadAnalysis object
* example of instantiating natural gas bill records
* combined interfaces into /types/index.d.ts
* added type declarations to 2 components
---
.../CaseSummaryComponents/AnalysisHeader.tsx | 43 ++++++---
.../CurrentHeatingSystem.tsx | 1 +
.../EnergyUseHistoryChart.tsx | 87 ++++++++++++-------
.../_heat+/{inputs1.tsx => Inputs1.tsx} | 0
heat-stack/types/index.d.ts | 62 +++++++++++++
5 files changed, 152 insertions(+), 41 deletions(-)
rename heat-stack/app/routes/_heat+/{inputs1.tsx => Inputs1.tsx} (100%)
create mode 100644 heat-stack/types/index.d.ts
diff --git a/heat-stack/app/components/ui/heat/CaseSummaryComponents/AnalysisHeader.tsx b/heat-stack/app/components/ui/heat/CaseSummaryComponents/AnalysisHeader.tsx
index b13c7333..fda3c915 100644
--- a/heat-stack/app/components/ui/heat/CaseSummaryComponents/AnalysisHeader.tsx
+++ b/heat-stack/app/components/ui/heat/CaseSummaryComponents/AnalysisHeader.tsx
@@ -1,9 +1,18 @@
+import { type HeatLoadAnalysis } from '#types/index.js'
+
export function AnalysisHeader() {
- const averageIndoorTemperature = '63.5'
- const dailyOtherUsage = '1.07'
- const balancePoint = '60.5'
- const standardDevationUA = '5.52'
- const wholeHomeUA = '1,112'
+ const heatLoadAnalysis: HeatLoadAnalysis = {
+ rulesEngineVersion: 'Beta 1',
+ estimatedBalancePoint: 60.5,
+ otherFuelUsage: 1.07,
+ averageIndoorTemperature: 68,
+ differenceBetweenTiAndTbp: 0,
+ designTemperature: 0,
+ wholeHomeHeatLossRate: 1112,
+ standardDeviationHeatLossRate: 5.52,
+ averageHeatLoad: 0,
+ maximumHeatLoad: 0,
+ }
return (
@@ -12,9 +21,15 @@ export function AnalysisHeader() {
Average Indoor Temperature
-
{averageIndoorTemperature} °F
+
+ {heatLoadAnalysis.averageIndoorTemperature} °F
+
{' '}
+
Balance Point Temperature (°F)
-
{balancePoint}
+
+ {heatLoadAnalysis.estimatedBalancePoint}
+
{' '}
+
@@ -23,16 +38,24 @@ export function AnalysisHeader() {
(to be calculated)
Daily non-heating Usage
-
{dailyOtherUsage} therms
{' '}
+
+ {heatLoadAnalysis.otherFuelUsage} therms
+
{' '}
Standard Deviation of UA
-
{standardDevationUA} %
+
+ {heatLoadAnalysis.standardDeviationHeatLossRate} %
+
{' '}
+
Whole-home UA
-
{wholeHomeUA} BTU/h-°F
+
+ {heatLoadAnalysis.wholeHomeHeatLossRate} BTU/h-°F
+
{' '}
+
diff --git a/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx b/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx
index 1267c349..5162cae3 100644
--- a/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx
+++ b/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx
@@ -1,5 +1,6 @@
import { Form } from '@remix-run/react'
import { Button } from '#/app/components/ui/button.tsx'
+
import { Input } from '#/app/components/ui/input.tsx'
import { Label } from '#/app/components/ui/label.tsx'
diff --git a/heat-stack/app/components/ui/heat/CaseSummaryComponents/EnergyUseHistoryChart.tsx b/heat-stack/app/components/ui/heat/CaseSummaryComponents/EnergyUseHistoryChart.tsx
index ab530869..2e8d20bc 100644
--- a/heat-stack/app/components/ui/heat/CaseSummaryComponents/EnergyUseHistoryChart.tsx
+++ b/heat-stack/app/components/ui/heat/CaseSummaryComponents/EnergyUseHistoryChart.tsx
@@ -1,3 +1,4 @@
+import { type NaturalGasBillRecord } from '#types/index.js'
import { Checkbox } from '../../../../components/ui/checkbox.tsx'
import {
@@ -9,23 +10,39 @@ import {
TableRow,
} from '../../../../components/ui/table.tsx'
-const months = [
- {
- includeData: true,
- startDate: '02/02/2018',
- endDate: '02/28/2018',
- daysInBill: '27',
- usage: 'Yes',
- fUA: '10',
- },
- {
- includeData: true,
- startDate: '03/01/2018',
- endDate: '03/31/2018',
- daysInBill: '31',
- usage: 'Modest',
- fUA: '30',
- },
+const naturalGasBillRecord01: NaturalGasBillRecord = {
+ periodStartDate: new Date('12/08/2017'),
+ periodEndDate: new Date('01/07/2018'),
+ usageTherms: 197,
+ inclusionOverride: 'Include',
+}
+
+const naturalGasBillRecord02: NaturalGasBillRecord = {
+ periodStartDate: new Date('01/08/2018'),
+ periodEndDate: new Date('02/07/2018'),
+ usageTherms: 205,
+ inclusionOverride: 'Include',
+}
+
+const naturalGasBillRecord03: NaturalGasBillRecord = {
+ periodStartDate: new Date('02/08/2018'),
+ periodEndDate: new Date('03/07/2018'),
+ usageTherms: 220,
+ inclusionOverride: 'Include',
+}
+
+const naturalGasBillRecord04: NaturalGasBillRecord = {
+ periodStartDate: new Date('03/08/2018'),
+ periodEndDate: new Date('04/07/2018'),
+ usageTherms: 196,
+ inclusionOverride: 'Include',
+}
+
+const naturalGasBill = [
+ naturalGasBillRecord01,
+ naturalGasBillRecord02,
+ naturalGasBillRecord03,
+ naturalGasBillRecord04,
]
export function EnergyUseHistoryChart() {
@@ -39,23 +56,31 @@ export function EnergyUseHistoryChart() {
End Date
Days in Bill
Usage (therms)
- 60.5 °F UA (BTU/h-F)
+ Whole-home UA
- {months.map((month, index) => (
-
- {index + 1}
-
-
-
- {month.startDate}
- {month.endDate}
- {month.daysInBill}
- {month.usage}
- {month.fUA}
-
- ))}
+ {naturalGasBill.map((period, index) => {
+ const timeInPeriod =
+ period.periodEndDate.getTime() - period.periodStartDate.getTime()
+ const daysInPeriod = Math.round(timeInPeriod / (1000 * 3600 * 24))
+
+ return (
+
+ {index + 1}
+
+
+
+
+ {period.periodStartDate.toLocaleDateString()}
+
+ {period.periodEndDate.toLocaleDateString()}
+ {daysInPeriod}
+ {period.usageTherms}
+ 0
+
+ )
+ })}
)
diff --git a/heat-stack/app/routes/_heat+/inputs1.tsx b/heat-stack/app/routes/_heat+/Inputs1.tsx
similarity index 100%
rename from heat-stack/app/routes/_heat+/inputs1.tsx
rename to heat-stack/app/routes/_heat+/Inputs1.tsx
diff --git a/heat-stack/types/index.d.ts b/heat-stack/types/index.d.ts
new file mode 100644
index 00000000..62bc01ab
--- /dev/null
+++ b/heat-stack/types/index.d.ts
@@ -0,0 +1,62 @@
+export interface Case {
+ firstName: string
+ lastName: string
+}
+
+export interface HeatLoadAnalysis {
+ rulesEngineVersion: string
+ estimatedBalancePoint: number
+ otherFuelUsage: number
+ averageIndoorTemperature: number
+ differenceBetweenTiAndTbp: number
+ designTemperature: number
+ wholeHomeHeatLossRate: number
+ standardDeviationHeatLossRate: number
+ averageHeatLoad: number
+ maximumHeatLoad: number
+}
+
+export interface Home {
+ livingArea: number
+ fuelType: 'Natural Gas' | 'Oil' | 'Propane'
+ designTemperatureOverride: number
+ heatingSystemEfficiency: number
+ thermostatSetPoint: number
+ setbackTemperature: number
+ setbackHoursPerDay: number
+ numberOfOccupants: number
+ estimatedWaterHeatingEfficiency: number
+ standByLosses: number
+}
+
+export interface Location {
+ address: string
+ addressLine2: string
+ city: string
+ state: string
+ zip: string
+ country: string
+}
+
+export interface NaturalGasBill {
+ provider: string
+}
+
+export interface NaturalGasBillRecord {
+ periodStartDate: Date
+ periodEndDate: Date
+ usageTherms: number
+ inclusionOverride: 'Include' | 'Do not include' | 'Include in other analysis'
+}
+
+export interface OilPropaneBill {
+ provider: string
+ precedingDeliveryDate: Date
+}
+
+export interface OilPropaneBillRecord {
+ periodStartDate: Date
+ periodEndDate: Date
+ gallons: number
+ inclusionOverride: 'Include' | 'Do not include' | 'Include in other analysis'
+}