jsthermalcomfort 0.1.1 → 0.1.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.
- package/README.md +193 -5
- package/lib/cjs/models/clo_tout.js +3 -3
- package/lib/cjs/models/index.js +2 -2
- package/lib/cjs/types/models/index.d.ts +1 -1
- package/lib/cjs/types/models/index.d.ts.map +1 -1
- package/lib/esm/models/clo_tout.js +1 -1
- package/lib/esm/models/index.js +1 -1
- package/lib/esm/models/vertical_tmp_grad_ppd.js +91 -0
- package/lib/esm/types/models/index.d.ts +1 -0
- package/lib/esm/types/models/index.d.ts.map +1 -1
- package/lib/esm/types/models/vertical_tmp_grad_ppd.d.ts +58 -0
- package/lib/esm/types/models/vertical_tmp_grad_ppd.d.ts.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,11 +1,199 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Overview
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
| docs | [][docs_link] |
|
|
4
|
+
| :-----------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
5
|
+
| **build** | [][build_link] |
|
|
6
|
+
| **tests** | [][test_link] |
|
|
7
|
+
| **page deployment** | [][deploy_link] |
|
|
8
|
+
| **snyk security** | [][synk_link] |
|
|
9
|
+
| **license** | [](https://github.com/FedericoTartarini/jsthermalcomfort/blob/main/LICENSE) |
|
|
10
|
+
| **npm version** | [][npm_link] |
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
Package to calculate several thermal comfort indices (e.g. PMV, PPD, SET, adaptive) and convert physical variables.
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
Please cite us if you use this package: [Tartarini, F., Schiavon, S., 2020. pythermalcomfort: A Python package for thermal comfort research. SoftwareX 12, 100578. https://doi.org/10.1016/j.softx.2020.100578](https://www.sciencedirect.com/science/article/pii/S2352711020302910)
|
|
8
15
|
|
|
9
|
-
|
|
16
|
+
- Free software: MIT license
|
|
17
|
+
- Authors: [Omar Jesus Acuache Briceno](https://www.linkedin.com/in/omar-acuache), [Ruoshui Chen](https://github.com/ChristinChen233), [Jingyu Lu](https://github.com/Lu-Whale), [Yuchen Mu](https://github.com/YuchenMu), [Jordan Ocokoljic](https://github.com/JordanOcokoljic), [Santiago Zaldivar del Alba](https://github.com/szaldivar)
|
|
18
|
+
|
|
19
|
+
[docs_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/test_docs.yml
|
|
20
|
+
[build_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/build.yml
|
|
21
|
+
[test_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/test.yml
|
|
22
|
+
[deploy_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/pages/pages-build-deployment
|
|
23
|
+
[synk_link]: https://github.com/FedericoTartarini/jsthermalcomfort/actions/workflows/snyk.yml
|
|
24
|
+
[npm_link]: https://www.npmjs.com/package/jsthermalcomfort
|
|
25
|
+
|
|
26
|
+
# Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
10
29
|
npm install jsthermalcomfort
|
|
11
30
|
```
|
|
31
|
+
|
|
32
|
+
if you want to use jsthermalcomfort package without installing it on your local machine, you can import with:
|
|
33
|
+
|
|
34
|
+
[`https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/`](https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/)
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import {
|
|
40
|
+
models,
|
|
41
|
+
utilities,
|
|
42
|
+
pschymetrics,
|
|
43
|
+
} from "https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/index.js";
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also import it in the website directly, and caution that you need to mark the script as module:
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<script type="module">
|
|
50
|
+
import {
|
|
51
|
+
models,
|
|
52
|
+
utilities,
|
|
53
|
+
pschymetrics,
|
|
54
|
+
} from "https://cdn.jsdelivr.net/gh/FedericoTartarini/jsthermalcomfort/lib/esm/index.js";
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
# Examples and Tutorials
|
|
59
|
+
|
|
60
|
+
## [Examples](https://github.com/FedericoTartarini/jsthermalcomfort/tree/main/docs/examples) files on how to use some of the functions
|
|
61
|
+
|
|
62
|
+
Here is a list of examples running in the browser:
|
|
63
|
+
|
|
64
|
+
- [PHS](/jsthermalcomfort/examples/phs.html)
|
|
65
|
+
|
|
66
|
+
# Contributing
|
|
67
|
+
|
|
68
|
+
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
|
|
69
|
+
|
|
70
|
+
## Bug reports
|
|
71
|
+
|
|
72
|
+
When [reporting a bug](https://github.com/FedericoTartarini/jsthermalcomfort/issues) please include:
|
|
73
|
+
|
|
74
|
+
- Your operating system name and version.
|
|
75
|
+
- Any details about your local setup that might be helpful in troubleshooting.
|
|
76
|
+
- Detailed steps to reproduce the bug.
|
|
77
|
+
|
|
78
|
+
## Documentation improvements
|
|
79
|
+
|
|
80
|
+
jsthermalcomfort could always use more documentation, whether as part of the official jsthermalcomfort docs, in JSDocs, or even on the web in blog posts, articles, and such.
|
|
81
|
+
|
|
82
|
+
## Feature requests and feedback
|
|
83
|
+
|
|
84
|
+
The best way to send feedback is to file an issue at [https://github.com/FedericoTartarini/jsthermalcomfort/issues](https://github.com/FedericoTartarini/jsthermalcomfort/issues)
|
|
85
|
+
|
|
86
|
+
If you are proposing a feature:
|
|
87
|
+
|
|
88
|
+
- Explain in detail how it would work.
|
|
89
|
+
- Keep the scope as narrow as possible, to make it easier to implement.
|
|
90
|
+
- Remember that this is a volunteer-driven project, and that code contributions are welcome :)
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
To set up jsthermalcomfort for local development:
|
|
95
|
+
|
|
96
|
+
1. Fork jsthermalcomfort (look for the “Fork” button).
|
|
97
|
+
2. Clone your fork locally. Fetch and pull all the updates from the master branch before you do anything:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone git@github.com:FedericoTartarini/jsthermalcomfort.git
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
3. Create a branch for local development. The naming rule for new branch are, as follows:
|
|
104
|
+
|
|
105
|
+
- If this update is for a new feature Feature/feature_name_here
|
|
106
|
+
- If this update is for bug fix Fix/bug_name_here
|
|
107
|
+
- If this update is for documentation Documentation/doc_name_here
|
|
108
|
+
|
|
109
|
+
You can create a branch locally using the following command. Make sure you only push updates to this new branch only:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git checkout -b name-of-your-bugfix-or-feature
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Now you can make your changes locally.
|
|
116
|
+
|
|
117
|
+
4. When you’re done making changes run all tests using Jest:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run test
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
- Run prettier to format your code:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm run format
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- Commit your changes:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git add .
|
|
133
|
+
git commit -m "Your detailed description of your changes."
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- Update the docs:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm run docs
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- Commit your documentation changes:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git add .
|
|
146
|
+
git commit -m "Your detailed description of your changes."
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- Push your branch to GitHub:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
git push origin name-of-your-bugfix-or-feature
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
5. Submit a pull request after you have done all your modifications and tested your work. The pull request should include a detailed description of your work:
|
|
156
|
+
- What this pull request is about
|
|
157
|
+
- Have you tested your work
|
|
158
|
+
- Will this work affect other component in the product
|
|
159
|
+
|
|
160
|
+
### Pull Request Guidelines
|
|
161
|
+
|
|
162
|
+
If you need some code review or feedback while you’re developing the code just make the pull request.
|
|
163
|
+
|
|
164
|
+
For merging, you should:
|
|
165
|
+
|
|
166
|
+
- Include passing tests (run `npm run test`).
|
|
167
|
+
- Update documentation when there’s new API, functionality etc.
|
|
168
|
+
|
|
169
|
+
### Documentation
|
|
170
|
+
|
|
171
|
+
We are using [JSDoc](https://jsdoc.app/) and [documentation.js](https://github.com/documentationjs/documentation) to automatically build the documentation.
|
|
172
|
+
|
|
173
|
+
### To add a function
|
|
174
|
+
|
|
175
|
+
1. Add a file under `src/models/` with the name of the function/model and document it.
|
|
176
|
+
2. Add any related functions that are used by your function either in `src/utilities/utilities.js` or `src/psychrometrics/`. See existing code as example.
|
|
177
|
+
- In order to add a new function/API to the library you should mark that function as `@public`, add it to its corresponding category, for example for models you should do `@memberof models`, and lastly you should give it a proper name for the documentation with `@docname`, for example: `@docname Clothing prediction`. It is important to note that you should also add the `@public` tag to any types the function exposes/uses.
|
|
178
|
+
3. Test your function by writing a test in `tests/models/<name_of_model>.test.js`.
|
|
179
|
+
|
|
180
|
+
### Tips
|
|
181
|
+
|
|
182
|
+
To run a subset of tests you can do the following:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
npm run test -- '<path_to_test_file>' -t '<test_pattern/name>'
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If you are using VSCode you can use the [Jest Runner extension](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to easily run subset of tests.
|
|
189
|
+
|
|
190
|
+
### Releases
|
|
191
|
+
|
|
192
|
+
To create a new release do the following:
|
|
193
|
+
|
|
194
|
+
1. Update the `package.json` version to the new version (we use the semantic release system for versioning)
|
|
195
|
+
2. Run `npm run build` to update the `lib` directory (output with types of the library that gets published to NPM) and commit the updates
|
|
196
|
+
3. In GitHub go to Releases -> click `Draft a new release`
|
|
197
|
+
4. Click `Choose a tag` and type the new version, for example `v0.1,1`
|
|
198
|
+
5. Write the title and description and click `Publish release`
|
|
199
|
+
6. This will trigger a GitHub action that will publish the new version to NPM
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.clo_tout_array = exports.clo_tout = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utilities_js_1 = require("../utilities/utilities.js");
|
|
5
5
|
/**
|
|
6
6
|
* Representative clothing insulation Icl as a function of outdoor air
|
|
7
7
|
* temperature at 06:00 a.m {@link #ref_4|[4]}.
|
|
@@ -24,11 +24,11 @@ const utilities_1 = require("../utilities/utilities");
|
|
|
24
24
|
* @returns {number} Representative clothing insulation Icl, [clo]
|
|
25
25
|
*/
|
|
26
26
|
function clo_tout(tout, units = "SI") {
|
|
27
|
-
const t = units === "IP" ? (0,
|
|
27
|
+
const t = units === "IP" ? (0, utilities_js_1.units_converter)({ tmp: tout }).tmp : tout;
|
|
28
28
|
let clo = t < 26 ? Math.pow(10, (-0.1635 - 0.0066 * t)) : 0.46;
|
|
29
29
|
clo = t < 5 ? 0.818 - 0.0364 * t : clo;
|
|
30
30
|
clo = t < -5 ? 1 : clo;
|
|
31
|
-
return (0,
|
|
31
|
+
return (0, utilities_js_1.round)(clo, 2);
|
|
32
32
|
}
|
|
33
33
|
exports.clo_tout = clo_tout;
|
|
34
34
|
/**
|
package/lib/cjs/models/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const pmv_js_1 = require("./pmv.js");
|
|
|
20
20
|
const a_pmv_js_1 = require("./a_pmv.js");
|
|
21
21
|
const ankle_draft_js_1 = require("./ankle_draft.js");
|
|
22
22
|
const e_pmv_js_1 = require("./e_pmv.js");
|
|
23
|
-
const
|
|
23
|
+
const vertical_tmp_grad_ppd_js_1 = require("./vertical_tmp_grad_ppd.js");
|
|
24
24
|
const use_fans_heatwave_js_1 = require("./use_fans_heatwave.js");
|
|
25
25
|
const clo_tout_js_1 = require("./clo_tout.js");
|
|
26
26
|
const utci_js_1 = require("./utci.js");
|
|
@@ -46,7 +46,7 @@ exports.default = {
|
|
|
46
46
|
adaptive_en: adaptive_en_js_1.adaptive_en,
|
|
47
47
|
adaptive_en_array: adaptive_en_js_1.adaptive_en_array,
|
|
48
48
|
at: at_js_1.at,
|
|
49
|
-
vertical_tmp_grad_ppd:
|
|
49
|
+
vertical_tmp_grad_ppd: vertical_tmp_grad_ppd_js_1.vertical_tmp_grad_ppd,
|
|
50
50
|
set_tmp: set_tmp_js_1.set_tmp,
|
|
51
51
|
set_tmp_array: set_tmp_js_1.set_tmp_array,
|
|
52
52
|
adaptive_ashrae: adaptive_ashrae_js_1.adaptive_ashrae,
|
|
@@ -53,7 +53,7 @@ import { wc } from "./wc.js";
|
|
|
53
53
|
import { adaptive_en } from "./adaptive_en.js";
|
|
54
54
|
import { adaptive_en_array } from "./adaptive_en.js";
|
|
55
55
|
import { at } from "./at.js";
|
|
56
|
-
import { vertical_tmp_grad_ppd } from "./vertical_tmp_grad_ppd";
|
|
56
|
+
import { vertical_tmp_grad_ppd } from "./vertical_tmp_grad_ppd.js";
|
|
57
57
|
import { set_tmp } from "./set_tmp.js";
|
|
58
58
|
import { set_tmp_array } from "./set_tmp.js";
|
|
59
59
|
import { adaptive_ashrae } from "./adaptive_ashrae.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA2B,iBAAiB;oBACxB,UAAU;wBACN,cAAc;oBAClB,UAAU;qBACT,WAAW;yBAqBS,eAAe;+BAAf,eAAe;iCAjBjD,uBAAuB;uCAAvB,uBAAuB;0BACa,gBAAgB;gCAAhB,gBAAgB;mBAExC,SAAS;4BACmB,kBAAkB;kCAAlB,kBAAkB;mBAC9C,SAAS;sCAUU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA2B,iBAAiB;oBACxB,UAAU;wBACN,cAAc;oBAClB,UAAU;qBACT,WAAW;yBAqBS,eAAe;+BAAf,eAAe;iCAjBjD,uBAAuB;uCAAvB,uBAAuB;0BACa,gBAAgB;gCAAhB,gBAAgB;mBAExC,SAAS;4BACmB,kBAAkB;kCAAlB,kBAAkB;mBAC9C,SAAS;sCAUU,4BAA4B;wBAb3B,cAAc;8BAAd,cAAc;gCAKE,sBAAsB;sCAAtB,sBAAsB;2BAClD,iBAAiB;+BACb,qBAAqB;wBAHb,cAAc;8BAAd,cAAc;oBAKtB,UAAU;0BAAV,UAAU;qBADR,WAAW;2BAAX,WAAW;sBAET,YAAY;4BAAZ,YAAY;4BACnB,kBAAkB;sBACX,YAAY;4BAAZ,YAAY;mCAEZ,wBAAwB;qBAE1B,WAAW;2BAAX,WAAW;2BACjB,iBAAiB"}
|
package/lib/esm/models/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { pmv, pmv_array } from "./pmv.js";
|
|
|
18
18
|
import { a_pmv, a_pmv_array } from "./a_pmv.js";
|
|
19
19
|
import { ankle_draft } from "./ankle_draft.js";
|
|
20
20
|
import { e_pmv, e_pmv_array } from "./e_pmv.js";
|
|
21
|
-
import { vertical_tmp_grad_ppd } from "./vertical_tmp_grad_ppd";
|
|
21
|
+
import { vertical_tmp_grad_ppd } from "./vertical_tmp_grad_ppd.js";
|
|
22
22
|
import { use_fans_heatwaves } from "./use_fans_heatwave.js";
|
|
23
23
|
import { clo_tout, clo_tout_array } from "./clo_tout.js";
|
|
24
24
|
import { utci, utci_array } from "./utci.js";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { round, check_standard_compliance, units_converter, } from "../utilities/utilities.js";
|
|
2
|
+
import { pmv } from "../models/pmv.js";
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} VerTmpGradReturnType - a result set containing the predicted precentage of dissatisfied and the acceptability
|
|
5
|
+
* @property {number} PPD_vg Predicted Percentage of Dissatisfied occupants with vertical temperature gradient, [%]
|
|
6
|
+
* @property {boolean} Acceptability The ASHRAE 55 2020 standard defines that the value of air speed at the ankle level
|
|
7
|
+
* is acceptable if PPD_ad is lower or equal than 5 %
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Calculates the percentage of thermally dissatisfied people with a vertical temperature gradient between feet and head {@link #ref_1|[1]} .
|
|
12
|
+
* This equation is only applicable for vr < 0.2 m/s (40 fps).
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @memberof models
|
|
16
|
+
* @docname Vertical air temperature gradient
|
|
17
|
+
*
|
|
18
|
+
* @param {number} tdb dry bulb air temperature, default in [°C] in [°F] if "units" = 'IP'.
|
|
19
|
+
*
|
|
20
|
+
* Note: The air temperature is the average value over two heights: 0.6 m (24 in.) and 1.1 m (43 in.) for seated occupants and 1.1 m
|
|
21
|
+
* (43 in.) and 1.7 m (67 in.) for standing occupants.
|
|
22
|
+
* @param {number} tr mean radiant temperature, default in [°C] in [°F] if "units" = 'IP'.
|
|
23
|
+
* @param {number} vr relative air speed, default in [m/s] in [fps] if "units" = "IP"
|
|
24
|
+
*
|
|
25
|
+
* Note: vr is the relative air speed caused by body movement and not the air speed measured by the air speed sensor.
|
|
26
|
+
* The relative air speed is the sum of the average air speed measured by the sensor plus the activity-generated air speed (Vag).
|
|
27
|
+
* Where Vag is the activity-generated air speed caused by motion of individual body parts. vr can be calculated using the function
|
|
28
|
+
* pythermalcomfort.utilities.v_relative().
|
|
29
|
+
* @param {number} rh relative humidity, [%].
|
|
30
|
+
* @param {number} met metabolic rate, [met]
|
|
31
|
+
* @param {number} clo clothing insulation, [clo]
|
|
32
|
+
*
|
|
33
|
+
* Note: The activity as well as the air speed modify the insulation characteristics of the clothing and the adjacent air layer.
|
|
34
|
+
* Consequently the ISO 7730 states that the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects for the effect of
|
|
35
|
+
* the body movement for met equal or higher than 1.2 met using the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation,
|
|
36
|
+
* clo, can be calculated using the function pythermalcomfort.utilities.clo_dynamic().
|
|
37
|
+
* @param {number} vertical_tmp_grad vertical temperature gradient between the feet and the head, default in [°C/m] in [°F/ft] if units = ‘IP’
|
|
38
|
+
* @param {"SI" | "IP"} [units="SI"] - select the SI (International System of Units) or the IP (Imperial Units) system.
|
|
39
|
+
*
|
|
40
|
+
* @returns {VerTmpGradReturnType} Object with results of the PPD with vertical temprature gradient.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const result = vertical_tmp_grad_ppd(25, 25, 0.1, 50, 1.2, 0.5, 7); // returns {'PPD_vg': 12.6, 'Acceptability': false}
|
|
44
|
+
*/
|
|
45
|
+
export function vertical_tmp_grad_ppd(tdb, tr, vr, rh, met, clo, vertical_tmp_grad, units = "SI") {
|
|
46
|
+
if (units === "IP") {
|
|
47
|
+
({
|
|
48
|
+
tdb: tdb,
|
|
49
|
+
tr: tr,
|
|
50
|
+
vr: vr,
|
|
51
|
+
} = units_converter({ tdb: tdb, tr: tr, vr: vr }, "IP"));
|
|
52
|
+
vertical_tmp_grad = (vertical_tmp_grad / 1.8) * 3.28;
|
|
53
|
+
}
|
|
54
|
+
const warnings = check_standard_compliance("ASHRAE", {
|
|
55
|
+
tdb: tdb,
|
|
56
|
+
tr: tr,
|
|
57
|
+
v_limited: vr,
|
|
58
|
+
rh: rh,
|
|
59
|
+
met: met,
|
|
60
|
+
clo: clo,
|
|
61
|
+
});
|
|
62
|
+
warnings.forEach((warning) => console.warn(warning));
|
|
63
|
+
const tsv = pmv(tdb, tr, vr, rh, met, clo, 0, "ASHRAE");
|
|
64
|
+
const ppd_vg = calculate_ppd_vg(tsv, vertical_tmp_grad);
|
|
65
|
+
const acceptability = check_acceptability(ppd_vg);
|
|
66
|
+
return {
|
|
67
|
+
PPD_vg: ppd_vg,
|
|
68
|
+
Acceptability: acceptability,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Calculate Predicted Percentage of Dissatisfied (PPD) based on tsv and vertical temperature gradient.
|
|
73
|
+
*
|
|
74
|
+
* @param {number} tsv - PMV in ashrae standard
|
|
75
|
+
* @param {number} vertical_tmp_grad - Vertical temperature gradient between the feet and the head
|
|
76
|
+
* @returns {number} Predicted Percentage of Dissatisfied occupants with vertical temperature gradient
|
|
77
|
+
*/
|
|
78
|
+
function calculate_ppd_vg(tsv, vertical_tmp_grad) {
|
|
79
|
+
const numerator = Math.exp(0.13 * (tsv - 1.91) ** 2 + 0.15 * vertical_tmp_grad - 1.6);
|
|
80
|
+
const ppd_vg = round((numerator / (1 + numerator) - 0.345) * 100, 1);
|
|
81
|
+
return ppd_vg;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Check the acceptability based on ppd_vg
|
|
85
|
+
*
|
|
86
|
+
* @param {number} ppd_vg - PPD based on Vertical temperature gradient
|
|
87
|
+
* @returns {boolean} Acceptability
|
|
88
|
+
*/
|
|
89
|
+
function check_acceptability(ppd_vg) {
|
|
90
|
+
return ppd_vg <= 5;
|
|
91
|
+
}
|
|
@@ -53,6 +53,7 @@ import { wc } from "./wc.js";
|
|
|
53
53
|
import { adaptive_en } from "./adaptive_en.js";
|
|
54
54
|
import { adaptive_en_array } from "./adaptive_en.js";
|
|
55
55
|
import { at } from "./at.js";
|
|
56
|
+
import { vertical_tmp_grad_ppd } from "./vertical_tmp_grad_ppd.js";
|
|
56
57
|
import { set_tmp } from "./set_tmp.js";
|
|
57
58
|
import { set_tmp_array } from "./set_tmp.js";
|
|
58
59
|
import { adaptive_ashrae } from "./adaptive_ashrae.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA2B,iBAAiB;oBACxB,UAAU;wBACN,cAAc;oBAClB,UAAU;qBACT,WAAW;yBAqBS,eAAe;+BAAf,eAAe;iCAjBjD,uBAAuB;uCAAvB,uBAAuB;0BACa,gBAAgB;gCAAhB,gBAAgB;mBAExC,SAAS;4BACmB,kBAAkB;kCAAlB,kBAAkB;mBAC9C,SAAS;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA2B,iBAAiB;oBACxB,UAAU;wBACN,cAAc;oBAClB,UAAU;qBACT,WAAW;yBAqBS,eAAe;+BAAf,eAAe;iCAjBjD,uBAAuB;uCAAvB,uBAAuB;0BACa,gBAAgB;gCAAhB,gBAAgB;mBAExC,SAAS;4BACmB,kBAAkB;kCAAlB,kBAAkB;mBAC9C,SAAS;sCAUU,4BAA4B;wBAb3B,cAAc;8BAAd,cAAc;gCAKE,sBAAsB;sCAAtB,sBAAsB;2BAClD,iBAAiB;+BACb,qBAAqB;wBAHb,cAAc;8BAAd,cAAc;oBAKtB,UAAU;0BAAV,UAAU;qBADR,WAAW;2BAAX,WAAW;sBAET,YAAY;4BAAZ,YAAY;4BACnB,kBAAkB;sBACX,YAAY;4BAAZ,YAAY;mCAEZ,wBAAwB;qBAE1B,WAAW;2BAAX,WAAW;2BACjB,iBAAiB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} VerTmpGradReturnType - a result set containing the predicted precentage of dissatisfied and the acceptability
|
|
3
|
+
* @property {number} PPD_vg Predicted Percentage of Dissatisfied occupants with vertical temperature gradient, [%]
|
|
4
|
+
* @property {boolean} Acceptability The ASHRAE 55 2020 standard defines that the value of air speed at the ankle level
|
|
5
|
+
* is acceptable if PPD_ad is lower or equal than 5 %
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Calculates the percentage of thermally dissatisfied people with a vertical temperature gradient between feet and head {@link #ref_1|[1]} .
|
|
10
|
+
* This equation is only applicable for vr < 0.2 m/s (40 fps).
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @memberof models
|
|
14
|
+
* @docname Vertical air temperature gradient
|
|
15
|
+
*
|
|
16
|
+
* @param {number} tdb dry bulb air temperature, default in [°C] in [°F] if "units" = 'IP'.
|
|
17
|
+
*
|
|
18
|
+
* Note: The air temperature is the average value over two heights: 0.6 m (24 in.) and 1.1 m (43 in.) for seated occupants and 1.1 m
|
|
19
|
+
* (43 in.) and 1.7 m (67 in.) for standing occupants.
|
|
20
|
+
* @param {number} tr mean radiant temperature, default in [°C] in [°F] if "units" = 'IP'.
|
|
21
|
+
* @param {number} vr relative air speed, default in [m/s] in [fps] if "units" = "IP"
|
|
22
|
+
*
|
|
23
|
+
* Note: vr is the relative air speed caused by body movement and not the air speed measured by the air speed sensor.
|
|
24
|
+
* The relative air speed is the sum of the average air speed measured by the sensor plus the activity-generated air speed (Vag).
|
|
25
|
+
* Where Vag is the activity-generated air speed caused by motion of individual body parts. vr can be calculated using the function
|
|
26
|
+
* pythermalcomfort.utilities.v_relative().
|
|
27
|
+
* @param {number} rh relative humidity, [%].
|
|
28
|
+
* @param {number} met metabolic rate, [met]
|
|
29
|
+
* @param {number} clo clothing insulation, [clo]
|
|
30
|
+
*
|
|
31
|
+
* Note: The activity as well as the air speed modify the insulation characteristics of the clothing and the adjacent air layer.
|
|
32
|
+
* Consequently the ISO 7730 states that the clothing insulation shall be corrected {@link #ref_2|[2]}. The ASHRAE 55 Standard corrects for the effect of
|
|
33
|
+
* the body movement for met equal or higher than 1.2 met using the equation clo = Icl × (0.6 + 0.4/met) The dynamic clothing insulation,
|
|
34
|
+
* clo, can be calculated using the function pythermalcomfort.utilities.clo_dynamic().
|
|
35
|
+
* @param {number} vertical_tmp_grad vertical temperature gradient between the feet and the head, default in [°C/m] in [°F/ft] if units = ‘IP’
|
|
36
|
+
* @param {"SI" | "IP"} [units="SI"] - select the SI (International System of Units) or the IP (Imperial Units) system.
|
|
37
|
+
*
|
|
38
|
+
* @returns {VerTmpGradReturnType} Object with results of the PPD with vertical temprature gradient.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const result = vertical_tmp_grad_ppd(25, 25, 0.1, 50, 1.2, 0.5, 7); // returns {'PPD_vg': 12.6, 'Acceptability': false}
|
|
42
|
+
*/
|
|
43
|
+
export function vertical_tmp_grad_ppd(tdb: number, tr: number, vr: number, rh: number, met: number, clo: number, vertical_tmp_grad: number, units?: "SI" | "IP"): VerTmpGradReturnType;
|
|
44
|
+
/**
|
|
45
|
+
* - a result set containing the predicted precentage of dissatisfied and the acceptability
|
|
46
|
+
*/
|
|
47
|
+
export type VerTmpGradReturnType = {
|
|
48
|
+
/**
|
|
49
|
+
* Predicted Percentage of Dissatisfied occupants with vertical temperature gradient, [%]
|
|
50
|
+
*/
|
|
51
|
+
PPD_vg: number;
|
|
52
|
+
/**
|
|
53
|
+
* The ASHRAE 55 2020 standard defines that the value of air speed at the ankle level
|
|
54
|
+
* is acceptable if PPD_ad is lower or equal than 5 %
|
|
55
|
+
*/
|
|
56
|
+
Acceptability: boolean;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=vertical_tmp_grad_ppd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical_tmp_grad_ppd.d.ts","sourceRoot":"","sources":["../../../../src/models/vertical_tmp_grad_ppd.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,2CA3BW,MAAM,MAIN,MAAM,MACN,MAAM,MAMN,MAAM,OACN,MAAM,OACN,MAAM,qBAMN,MAAM,UACN,IAAI,GAAG,IAAI,GAET,oBAAoB,CA0ChC;;;;;;;;YA9Ea,MAAM;;;;;mBACN,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsthermalcomfort",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A JavaScript package to calculate thermal comfort indices (e.g., Predicted Mean Vote, Standard Effective Temperature, Predicted Heat Strain).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": {
|
|
12
12
|
"types": "./lib/esm/types/index.d.ts",
|
|
13
|
-
"default": "./lib/esm/index.
|
|
13
|
+
"default": "./lib/esm/index.js"
|
|
14
14
|
},
|
|
15
15
|
"require": {
|
|
16
16
|
"types": "./lib/cjs/types/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"build:cjs": "tsc -p ./configs/tsconfig.cjs.json",
|
|
26
26
|
"test": "node --experimental-vm-modules ./node_modules/.bin/jest",
|
|
27
27
|
"semantic-release": "semantic-release",
|
|
28
|
-
"docs": "npx documentation build ./src/index.js -f html --github --config documentation.yml -a public --theme docs_theme/index.js -o docs",
|
|
28
|
+
"docs": "npx documentation build ./src/index.js -f html --github --config documentation.yml -a public --theme docs_theme/index.js -o docs && ./create_readme.sh",
|
|
29
29
|
"format": "npx prettier . --write",
|
|
30
30
|
"check:format": "npx prettier . --check"
|
|
31
31
|
},
|