@mark1russell7/stack-needs 0.9.9 → 0.9.10

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/README.md CHANGED
@@ -352,7 +352,7 @@ The 2025-2030 edition of the guidelines was read on 2026-11-24. It has no table
352
352
 
353
353
  - `alert.watch` comes from two pages of the National Weather Service (read on 2026-11-24). Many receivers have a muted standby mode that turns on when a warning comes. Warnings also come at night. Thus a receiver stays on and listens at all hours, so 24 hours each day. One receiver for each home is a choice of this model, not of the pages. The pages are in the public domain (the license `us-public-domain`).
354
354
  - `light.see` is a no read. The kit lists of Ready.gov give a flashlight and extra batteries, but no hours of use each day. The hours of dark are the same for all the persons of a home, so the users are the household. The count of lights of each person is a fact of the plan or the device. `lightNeed` gives a read from the point of the home and its awake window.
355
- - `warmth.shelter` is a no read. The heat that a home needs changes with the weather, the building and the persons. It is space heat only. The blankets and the sleeping bags of each person are gear, not this need.
355
+ - `warmth.shelter` is a no read. The heat that a home needs changes with the weather, the building and the persons. It is space heat only. The blankets and the sleeping bags of each person are gear, not this need. `warmthNeed` gives a read from the facts of the building and the temperatures.
356
356
  - A user gives each no read as input data.
357
357
  - The rate of a device is a fact of the device, not of the need. An example is the watts of a radio in standby.
358
358
 
@@ -386,8 +386,19 @@ The gate refuses an empty code and two needs with one code (`daily-need-id`). It
386
386
 
387
387
  The read goes into `deviceFragment` through the input `needs`. Then the need of light gets a draw.
388
388
 
389
+ ## The heat of a home
390
+
391
+ `warmthHeat` gives the space heat that a home needs on each day of a plan. `warmthNeed` changes it into a read of the need `warmth.shelter`.
392
+
393
+ - The heat loss coefficient of the home is in watts for each kelvin. `heatLossOf` sums the area times the U-value of each element of the envelope.
394
+ - `heatLossFromUse` gives the same coefficient from the heat of a past period, divided by its degree days times 24 hours. The heat is the energy of the heaters, not the fuel.
395
+ - The heat flow of a day is the coefficient times the indoor temperature minus the outdoor temperature, minus the gains of the persons. A flow of 0 or less needs no heat.
396
+ - The indoor target, the outdoor temperature of each day and the facts of the building are input data of the household. The package has no default target.
397
+ - The rate of `warmthNeed` is the heat of the worst day, in `kWh/d`.
398
+ - The sources are the pages "Thermal transmittance" and "Degree day" of Wikipedia (license `cc-by-sa-4.0`).
399
+
389
400
  ## The entries
390
401
 
391
402
  | Entry | What it has |
392
403
  | --- | --- |
393
- | `@mark1russell7/stack-needs` | The records, the calorie tables and `CALORIE_CHAIN`, the gates, `calorieNeed`, `householdFragment`, `cookFragment` and its constants, `formulaMixFragment` and `FORMULA_MIX`, `deviceFragment`, `lightHours`, `lightNeed`, the daily needs, the uses, the supply parts and `checkJoins`. |
404
+ | `@mark1russell7/stack-needs` | The records, the calorie tables and `CALORIE_CHAIN`, the gates, `calorieNeed`, `householdFragment`, `cookFragment` and its constants, `formulaMixFragment` and `FORMULA_MIX`, `deviceFragment`, `lightHours`, `lightNeed`, `warmthHeat`, `warmthNeed`, `heatLossOf`, `heatLossFromUse`, the daily needs, the uses, the supply parts and `checkJoins`. |
package/build/index.d.ts CHANGED
@@ -975,6 +975,7 @@ export declare const NWS_ALARMS_SOURCE: Source;
975
975
  * - `light.see`: no read, for each household. The kit lists of official sources give a flashlight and extra batteries, but no hours of use.
976
976
  * The count of lights of each person is a fact of the plan or the device. `lightNeed` gives a read from the point and the awake window.
977
977
  * - `warmth.shelter`: no read. The heat of a home changes with the weather, the building and the persons. It is space heat only.
978
+ * `warmthNeed` gives a read from the facts of the building and the temperatures.
978
979
  */
979
980
  export declare const DAILY_NEEDS: readonly DailyNeed[];
980
981
  /**
@@ -1154,4 +1155,73 @@ export declare function lightHours(input: LightHoursInput): LightHours;
1154
1155
  * One light that is on in the dark awake hours is a choice of this model. A household with more lights gives more draws.
1155
1156
  */
1156
1157
  export declare function lightNeed(hours: LightHours): DailyNeed;
1158
+ /** The page "Thermal transmittance" of Wikipedia: the heat flow through an element is its area times its U-value times the difference of the temperatures. */
1159
+ export declare const THERMAL_TRANSMITTANCE_SOURCE: Source;
1160
+ /** The page "Degree day" of Wikipedia: the energy to keep the base temperature indoors is approximately in proportion to the degree days. */
1161
+ export declare const DEGREE_DAY_SOURCE: Source;
1162
+ /** The most days of one calculation of the warmth: three years. */
1163
+ export declare const MAX_WARMTH_DAYS = 1096;
1164
+ /** One element of the envelope of a home: a wall, a roof, a floor or a window. */
1165
+ export interface EnvelopeElement {
1166
+ /** The area, in square metres. */
1167
+ readonly areaM2: number;
1168
+ /** The thermal transmittance (U-value), in watts for each square metre and each kelvin. */
1169
+ readonly uWm2K: number;
1170
+ }
1171
+ /**
1172
+ * This function gives the heat loss coefficient of a home, in watts for each kelvin. It is the sum of the area times the U-value of each element.
1173
+ * Air leaks are not in the sum. A caller adds them as an element, or uses `heatLossFromUse`.
1174
+ *
1175
+ * @throws RangeError - An area or a U-value is not a finite number of 0 or more, or the list is empty.
1176
+ */
1177
+ export declare function heatLossOf(elements: readonly EnvelopeElement[]): number;
1178
+ /**
1179
+ * This function gives the heat loss coefficient of a home from the heat of a past period, in watts for each kelvin.
1180
+ * The heat is the energy that the heaters gave, not the fuel. The degree days are on the balance temperature of the home.
1181
+ * The coefficient is the heat divided by the degree days times 24 hours.
1182
+ *
1183
+ * @param heatKWh - The heat of the period, in `kWh`, a finite number of 0 or more
1184
+ * @param degreeDaysKd - The heating degree days of the period on the balance temperature, in kelvin days, a finite number above 0
1185
+ * @throws RangeError - The heat or the degree days are out of range.
1186
+ */
1187
+ export declare function heatLossFromUse(heatKWh: number, degreeDaysKd: number): number;
1188
+ /** The input of `warmthHeat`. */
1189
+ export interface WarmthInput {
1190
+ /** The heat loss coefficient of the home, in watts for each kelvin. `heatLossOf` and `heatLossFromUse` give it. */
1191
+ readonly heatLossWK: number;
1192
+ /** The indoor temperature that the household keeps in a cut, in degrees Celsius. It is a choice of the household. */
1193
+ readonly indoorC: number;
1194
+ /** The mean outdoor temperature of each day of the plan, in degrees Celsius, for example a cold week of the place. */
1195
+ readonly outdoorC: readonly number[];
1196
+ /** The heat that the persons and the devices give in the cut, in watts. The default is 0. */
1197
+ readonly gainsW?: number | undefined;
1198
+ }
1199
+ /** The heat of one day of the plan. */
1200
+ export interface WarmthDay {
1201
+ readonly outdoorC: number;
1202
+ /** The heat that the heaters must give on the day, in `kWh`. */
1203
+ readonly heatKWh: number;
1204
+ }
1205
+ /** The result of `warmthHeat`: each day, and the most and the mean of the heat of a day. */
1206
+ export interface WarmthHeat {
1207
+ readonly days: readonly WarmthDay[];
1208
+ /** The heat of the worst day, in `kWh`. */
1209
+ readonly most: number;
1210
+ /** The mean heat of the days, in `kWh`. */
1211
+ readonly mean: number;
1212
+ }
1213
+ /**
1214
+ * This function gives the heat that a home needs on each day of a plan, in `kWh`.
1215
+ *
1216
+ * - The heat flow is the heat loss coefficient times the indoor temperature minus the outdoor temperature, minus the gains.
1217
+ * - A day with a flow of 0 or less needs no heat. The heat of a day is the flow times 24 hours.
1218
+ *
1219
+ * @throws RangeError - A value is not a finite number, or the coefficient or the gains are less than 0. Or the count of days is not from 1 to `MAX_WARMTH_DAYS`.
1220
+ */
1221
+ export declare function warmthHeat(input: WarmthInput): WarmthHeat;
1222
+ /**
1223
+ * This function gives the need of space heat of a household from its heat: the heat of its worst day, in `kWh` each day.
1224
+ * The facts of the building, the indoor target and the outdoor temperatures are input data. The sources give the method.
1225
+ */
1226
+ export declare function warmthNeed(heat: WarmthHeat): DailyNeed;
1157
1227
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/calorie.ts","../src/data.ts","../src/check.ts","../src/uses.ts","../src/household.ts","../src/cook.ts","../src/mix.ts","../src/daily.ts","../src/device.ts","../src/light.ts"],"mappings":";;;;;;qBAQa;;YAGD,wBAAwB;;qBAGvB;;YAGD,qBAAqB;;;;;YAMrB;WAAyB,QAAQ,SAAS,OAAO,eAAe;WAAqB;;WAA4B,MAAM;WAAmB;;;iBAGrI;WACN,KAAK;;WAEL;;WAEA;;WAEA;WACA,MAAM;;;;;;iBAOA;;WA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;;wBAiEK,WAAW,OAAO,kBAAkB;;;;;wBAiCpC,UAAU,OAAO,aAAa"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/calorie.ts","../src/data.ts","../src/check.ts","../src/uses.ts","../src/household.ts","../src/cook.ts","../src/mix.ts","../src/daily.ts","../src/device.ts","../src/light.ts","../src/warmth.ts"],"mappings":";;;;;;qBAQa;;YAGD,wBAAwB;;qBAGvB;;YAGD,qBAAqB;;;;;YAMrB;WAAyB,QAAQ,SAAS,OAAO,eAAe;WAAqB;;WAA4B,MAAM;WAAmB;;;iBAGrI;WACN,KAAK;;WAEL;;WAEA;;WAEA;WACA,MAAM;;;;;;iBAOA;;WAEN;;WAEA;;WAEA,KAAK;;WAEL,QAAQ;;WAER;;WAEA;;;iBAIM;;WAEN;WACA;WACA,QAAQ;;WAER;;WAEA,eAAe;;WAEf,mBAAmB;;;;;;YAOlB,gBAAgB,wBAAwB;;;;;;;;qBASvC;;YAGD,wBAAwB;;iBAGnB;WACN,KAAK;;WAEL;WACA;;WAEA,QAAQ;;WAER;;;;;WAKA,UAAU;;;YAIT;WACG,QAAQ;WAAiB;WAAqB,OAAO;WAAwB;WAAwB;WAAsB;WAAqC,MAAM;;WACtK,QAAQ;WAAiB;WAAsB;;;iBAG7C;;WAEN,gBAAgB;;WAEhB;;WAEA,MAAM;;WAEN;;;wBASK,gBAAgB,iBAAiB,SAAS;;;;;;;;wBAW1C,WAAW,OAAO,cAAc,KAAK,YAAY,oBAAoB;;;;;;;;;wBAYrE,aAAa,QAAQ,eAAe,KAAK,YAAY;WAA+B,OAAO;WAAuB,KAAK;;;;;;;;;wBAoBvH,cAAc,OAAO,cAAc,KAAK,YAAY,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;wBA4BpE,YAAY,QAAQ,eAAe,kBAAkB,UAAU,OAAO,eAAe,eAAe;;qBCnLvG,YAAY;;qBAmBZ,cAAc;;qBA6Fd,mBAAmB;;iBAYf;WACN;WACA,QAAQ;WACR;;;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WAC9B;WACA;;;iBAIM;;WAEN;WACA;WACA,oBAAoB;WACpB;WACA,gBAAgB;WAChB,qBAAqB;;;YAIpB;WAA0B;WAA0B;WAAuB;;WAA2B;WAAuB;WAA0B;;;iBAGlJ;WACN,OAAO;;WAEP,gBAAgB;;WAEhB,kBAAkB;;WAElB;;;;;;;;;;;;;;wBA4CK,eAAe,OAAO,sBAAsB;;qBChI/C,qBAAqB;;qBAWrB,yBAAyB;;qBAWzB;;iBAMI;;WAEN,OAAO;;WAEP,OAAO;;WAEP,MAAM;;WAEN;;WAEA;;;iBAIM;WACN,MAAM;WACN;WACA;;;iBAIM;WACN,eAAe;;WAEf;;WAEA;;;;;;;;;;;wBAiEK,WAAW,OAAO,kBAAkB;;;;;wBAiCpC,UAAU,OAAO,aAAa;;qBC3JjC,8BAA8B;;qBAW9B,mBAAmB;;qBAWnB;;iBAGI;;WAEN;;WAEA;;;;;;;;wBASK,WAAW,mBAAmB;;;;;;;;;;wBAoB9B,gBAAgB,iBAAiB;;iBAOhC;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;WACN;;WAEA;;;iBAIM;WACN,eAAe;;WAEf;;WAEA;;;;;;;;;;wBAWK,WAAW,OAAO,cAAc;;;;;wBAoBhC,WAAW,MAAM,aAAa"}
package/build/index.js CHANGED
@@ -2162,6 +2162,7 @@ const NWS_ALARMS_SOURCE = {
2162
2162
  * - `light.see`: no read, for each household. The kit lists of official sources give a flashlight and extra batteries, but no hours of use.
2163
2163
  * The count of lights of each person is a fact of the plan or the device. `lightNeed` gives a read from the point and the awake window.
2164
2164
  * - `warmth.shelter`: no read. The heat of a home changes with the weather, the building and the persons. It is space heat only.
2165
+ * `warmthNeed` gives a read from the facts of the building and the temperatures.
2165
2166
  */
2166
2167
  const DAILY_NEEDS = [
2167
2168
  {
@@ -2577,6 +2578,106 @@ function lightNeed(hours) {
2577
2578
  }
2578
2579
  };
2579
2580
  }
2580
- export { ACTIVITY_LEVELS, ALERT_WATCH_NEED, BOIL_CELSIUS, BREAST_MILK_MONTHS, CALORIE_CHAIN, CALORIE_SEXES, CALORIE_TABLES, COLD_START_CELSIUS, DAILY_NEEDS, DAILY_NEED_CODES, DGA_CALORIES, DGA_SOURCE, DIRECT_USES, FDC_SR_LEGACY_SOURCE, FOOD_NEED, FORMULA_DRAW_MONTHS, FORMULA_FEEDS, FORMULA_LATER_LEAST, FORMULA_MIX, FORMULA_NEED, FORMULA_POWDER, FORMULA_READY, HOURS_IN_DAY, INFANT_FEEDINGS, INFANT_MONTHS, JOIN_CODES, LIGHT_NEED, MAX_LIGHT_DAYS, MILK_LATER, NASEM_ENERGY_SOURCE, NASEM_INFANT_CALORIES, NEEDS_CODES, NEED_SUPPLIES, NIST_SI_GUIDE_SOURCE, NO_COOK, NWS_ALARMS_SOURCE, NWS_RECEIVERS_SOURCE, STORED_WATER, SUNRISE_EQUATION_SOURCE, SUN_POSITION_SOURCE, USGS_WATER_DENSITY_SOURCE, WARMTH_NEED, WATER_DENSITY_MAX, WATER_DENSITY_MIN, WATER_NEED, WATER_SPECIFIC_HEAT, WIC_INFANT_SOURCE, calorieChange, calorieNeed, calorieRow, calorieRowOf, checkCalorieChain, checkCalorieTable, checkDailyNeeds, checkJoins, cookFragment, deviceFragment, formulaMixCheck, formulaMixFragment, formulaMixWater, hasNeedsError, householdFragment, isActivityLevel, lightHours, lightNeed };
2581
+ // src/warmth.ts
2582
+ /** The page "Thermal transmittance" of Wikipedia: the heat flow through an element is its area times its U-value times the difference of the temperatures. */
2583
+ const THERMAL_TRANSMITTANCE_SOURCE = {
2584
+ id: "wikipedia-thermal-transmittance",
2585
+ title: "Thermal transmittance",
2586
+ url: "https://en.wikipedia.org/w/index.php?title=Thermal_transmittance&oldid=1326419561",
2587
+ license: "cc-by-sa-4.0",
2588
+ checked: "2026-11-24",
2589
+ by: "Wikipedia contributors",
2590
+ terms: "https://foundation.wikimedia.org/wiki/Policy:Terms_of_Use"
2591
+ };
2592
+ /** The page "Degree day" of Wikipedia: the energy to keep the base temperature indoors is approximately in proportion to the degree days. */
2593
+ const DEGREE_DAY_SOURCE = {
2594
+ id: "wikipedia-degree-day",
2595
+ title: "Degree day",
2596
+ url: "https://en.wikipedia.org/w/index.php?title=Degree_day&oldid=1358071209",
2597
+ license: "cc-by-sa-4.0",
2598
+ checked: "2026-11-24",
2599
+ by: "Wikipedia contributors",
2600
+ terms: "https://foundation.wikimedia.org/wiki/Policy:Terms_of_Use"
2601
+ };
2602
+ /** The most days of one calculation of the warmth: three years. */
2603
+ const MAX_WARMTH_DAYS = 1096;
2604
+ /**
2605
+ * This function gives the heat loss coefficient of a home, in watts for each kelvin. It is the sum of the area times the U-value of each element.
2606
+ * Air leaks are not in the sum. A caller adds them as an element, or uses `heatLossFromUse`.
2607
+ *
2608
+ * @throws RangeError - An area or a U-value is not a finite number of 0 or more, or the list is empty.
2609
+ */
2610
+ function heatLossOf(elements) {
2611
+ if (elements.length === 0) throw new RangeError("The envelope has no element.");
2612
+ let sum = 0;
2613
+ for (const [index, element] of elements.entries()) {
2614
+ if (!(Number.isFinite(element.areaM2) && element.areaM2 >= 0)) throw new RangeError(`The area of element ${index} is not a finite number of 0 or more.`);
2615
+ if (!(Number.isFinite(element.uWm2K) && element.uWm2K >= 0)) throw new RangeError(`The U-value of element ${index} is not a finite number of 0 or more.`);
2616
+ sum += element.areaM2 * element.uWm2K;
2617
+ }
2618
+ return sum;
2619
+ }
2620
+ /**
2621
+ * This function gives the heat loss coefficient of a home from the heat of a past period, in watts for each kelvin.
2622
+ * The heat is the energy that the heaters gave, not the fuel. The degree days are on the balance temperature of the home.
2623
+ * The coefficient is the heat divided by the degree days times 24 hours.
2624
+ *
2625
+ * @param heatKWh - The heat of the period, in `kWh`, a finite number of 0 or more
2626
+ * @param degreeDaysKd - The heating degree days of the period on the balance temperature, in kelvin days, a finite number above 0
2627
+ * @throws RangeError - The heat or the degree days are out of range.
2628
+ */
2629
+ function heatLossFromUse(heatKWh, degreeDaysKd) {
2630
+ if (!(Number.isFinite(heatKWh) && heatKWh >= 0)) throw new RangeError(`The heat ${heatKWh} kWh is not a finite number of 0 or more.`);
2631
+ if (!(Number.isFinite(degreeDaysKd) && degreeDaysKd > 0)) throw new RangeError(`The degree days ${degreeDaysKd} are not a finite number above 0.`);
2632
+ return heatKWh * 1e3 / (degreeDaysKd * 24);
2633
+ }
2634
+ /**
2635
+ * This function gives the heat that a home needs on each day of a plan, in `kWh`.
2636
+ *
2637
+ * - The heat flow is the heat loss coefficient times the indoor temperature minus the outdoor temperature, minus the gains.
2638
+ * - A day with a flow of 0 or less needs no heat. The heat of a day is the flow times 24 hours.
2639
+ *
2640
+ * @throws RangeError - A value is not a finite number, or the coefficient or the gains are less than 0. Or the count of days is not from 1 to `MAX_WARMTH_DAYS`.
2641
+ */
2642
+ function warmthHeat(input) {
2643
+ const gains = input.gainsW ?? 0;
2644
+ if (!(Number.isFinite(input.heatLossWK) && input.heatLossWK >= 0)) throw new RangeError(`The heat loss ${input.heatLossWK} W/K is not a finite number of 0 or more.`);
2645
+ if (!Number.isFinite(input.indoorC)) throw new RangeError(`The indoor temperature ${input.indoorC} is not a finite number.`);
2646
+ if (!(Number.isFinite(gains) && gains >= 0)) throw new RangeError(`The gains ${gains} W are not a finite number of 0 or more.`);
2647
+ if (input.outdoorC.length < 1 || input.outdoorC.length > 1096) throw new RangeError(`The plan has ${input.outdoorC.length} days, not from 1 to ${MAX_WARMTH_DAYS}.`);
2648
+ const days = input.outdoorC.map((outdoorC, index) => {
2649
+ if (!Number.isFinite(outdoorC)) throw new RangeError(`The outdoor temperature of day ${index} is not a finite number.`);
2650
+ return {
2651
+ outdoorC,
2652
+ heatKWh: Math.max(0, input.heatLossWK * (input.indoorC - outdoorC) - gains) * 24 / 1e3
2653
+ };
2654
+ });
2655
+ return {
2656
+ days,
2657
+ most: Math.max(...days.map((day) => day.heatKWh)),
2658
+ mean: days.reduce((sum, day) => sum + day.heatKWh, 0) / days.length
2659
+ };
2660
+ }
2661
+ /**
2662
+ * This function gives the need of space heat of a household from its heat: the heat of its worst day, in `kWh` each day.
2663
+ * The facts of the building, the indoor target and the outdoor temperatures are input data. The sources give the method.
2664
+ */
2665
+ function warmthNeed(heat) {
2666
+ return {
2667
+ code: WARMTH_NEED,
2668
+ unit: "kWh",
2669
+ users: "household",
2670
+ rate: {
2671
+ read: true,
2672
+ perDay: {
2673
+ value: heat.most,
2674
+ unit: "kWh/d"
2675
+ },
2676
+ sources: [THERMAL_TRANSMITTANCE_SOURCE, DEGREE_DAY_SOURCE],
2677
+ note: "The heat flow through each element is its area times its U-value times the difference of the temperatures. The energy of a past period gives the same coefficient through its degree days. The indoor target, the outdoor temperatures and the facts of the building are input data. The rate is the heat of the worst day of the plan."
2678
+ }
2679
+ };
2680
+ }
2681
+ export { ACTIVITY_LEVELS, ALERT_WATCH_NEED, BOIL_CELSIUS, BREAST_MILK_MONTHS, CALORIE_CHAIN, CALORIE_SEXES, CALORIE_TABLES, COLD_START_CELSIUS, DAILY_NEEDS, DAILY_NEED_CODES, DEGREE_DAY_SOURCE, DGA_CALORIES, DGA_SOURCE, DIRECT_USES, FDC_SR_LEGACY_SOURCE, FOOD_NEED, FORMULA_DRAW_MONTHS, FORMULA_FEEDS, FORMULA_LATER_LEAST, FORMULA_MIX, FORMULA_NEED, FORMULA_POWDER, FORMULA_READY, HOURS_IN_DAY, INFANT_FEEDINGS, INFANT_MONTHS, JOIN_CODES, LIGHT_NEED, MAX_LIGHT_DAYS, MAX_WARMTH_DAYS, MILK_LATER, NASEM_ENERGY_SOURCE, NASEM_INFANT_CALORIES, NEEDS_CODES, NEED_SUPPLIES, NIST_SI_GUIDE_SOURCE, NO_COOK, NWS_ALARMS_SOURCE, NWS_RECEIVERS_SOURCE, STORED_WATER, SUNRISE_EQUATION_SOURCE, SUN_POSITION_SOURCE, THERMAL_TRANSMITTANCE_SOURCE, USGS_WATER_DENSITY_SOURCE, WARMTH_NEED, WATER_DENSITY_MAX, WATER_DENSITY_MIN, WATER_NEED, WATER_SPECIFIC_HEAT, WIC_INFANT_SOURCE, calorieChange, calorieNeed, calorieRow, calorieRowOf, checkCalorieChain, checkCalorieTable, checkDailyNeeds, checkJoins, cookFragment, deviceFragment, formulaMixCheck, formulaMixFragment, formulaMixWater, hasNeedsError, heatLossFromUse, heatLossOf, householdFragment, isActivityLevel, lightHours, lightNeed, warmthHeat, warmthNeed };
2581
2682
 
2582
2683
  //# sourceMappingURL=index.js.map