tbd 3.4.4 → 3.4.5
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.
- checksums.yaml +4 -4
- data/.github/workflows/pull_request.yml +16 -48
- data/LICENSE.md +1 -1
- data/README.md +29 -35
- data/lib/measures/tbd/LICENSE.md +1 -1
- data/lib/measures/tbd/measure.rb +1 -1
- data/lib/measures/tbd/measure.xml +11 -11
- data/lib/measures/tbd/resources/geo.rb +1 -1
- data/lib/measures/tbd/resources/oslog.rb +43 -25
- data/lib/measures/tbd/resources/psi.rb +1 -1
- data/lib/measures/tbd/resources/tbd.rb +1 -1
- data/lib/measures/tbd/resources/ua.rb +2 -2
- data/lib/measures/tbd/resources/utils.rb +390 -245
- data/lib/measures/tbd/tests/tbd_tests.rb +1 -1
- data/lib/tbd/geo.rb +1 -1
- data/lib/tbd/psi.rb +1 -1
- data/lib/tbd/ua.rb +2 -2
- data/lib/tbd/version.rb +2 -2
- data/lib/tbd.rb +1 -1
- data/tbd.gemspec +1 -1
- data/v291_MacOS.md +19 -28
- metadata +6 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '088489dd7b5163709bef87c140b053593cca33f27fff736a553ec2c734ace460'
|
4
|
+
data.tar.gz: 0e5a5ed2af0d1d4c9d0b50d625147bd519b5944b923ae12d0ef414d88818c0a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 708b50fde62e4990344e51eb46390607ee193338d59e3539c61f80fd53850acfb37dc6659bfe77ef23a3820f1339266fa02425ad719f9f940b948b6564bc6d22
|
7
|
+
data.tar.gz: 69c846ef8d3663436b726566dfc3b78e44e6a9ba30431d00b724c6c5778150a8e6b950abdbf18af6bf5e8ed0276d0fa008e683f1c6ee3656c2ca6436c0c74af3
|
@@ -6,22 +6,6 @@ on:
|
|
6
6
|
- develop
|
7
7
|
|
8
8
|
jobs:
|
9
|
-
test_300x:
|
10
|
-
runs-on: ubuntu-22.04
|
11
|
-
steps:
|
12
|
-
- name: Check out repository
|
13
|
-
uses: actions/checkout@v2
|
14
|
-
- name: Run Tests
|
15
|
-
run: |
|
16
|
-
echo $(pwd)
|
17
|
-
echo $(ls)
|
18
|
-
docker pull nrel/openstudio:3.0.0
|
19
|
-
docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.0.0
|
20
|
-
docker exec -t test pwd
|
21
|
-
docker exec -t test ls
|
22
|
-
docker exec -t test bundle update
|
23
|
-
docker exec -t test bundle exec rake
|
24
|
-
docker kill test
|
25
9
|
test_321x:
|
26
10
|
runs-on: ubuntu-22.04
|
27
11
|
steps:
|
@@ -38,38 +22,6 @@ jobs:
|
|
38
22
|
docker exec -t test bundle update
|
39
23
|
docker exec -t test bundle exec rake
|
40
24
|
docker kill test
|
41
|
-
test_330x:
|
42
|
-
runs-on: ubuntu-22.04
|
43
|
-
steps:
|
44
|
-
- name: Check out repository
|
45
|
-
uses: actions/checkout@v2
|
46
|
-
- name: Run Tests
|
47
|
-
run: |
|
48
|
-
echo $(pwd)
|
49
|
-
echo $(ls)
|
50
|
-
docker pull nrel/openstudio:3.3.0
|
51
|
-
docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.3.0
|
52
|
-
docker exec -t test pwd
|
53
|
-
docker exec -t test ls
|
54
|
-
docker exec -t test bundle update
|
55
|
-
docker exec -t test bundle exec rake
|
56
|
-
docker kill test
|
57
|
-
test_340x:
|
58
|
-
runs-on: ubuntu-22.04
|
59
|
-
steps:
|
60
|
-
- name: Check out repository
|
61
|
-
uses: actions/checkout@v2
|
62
|
-
- name: Run Tests
|
63
|
-
run: |
|
64
|
-
echo $(pwd)
|
65
|
-
echo $(ls)
|
66
|
-
docker pull nrel/openstudio:3.4.0
|
67
|
-
docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.4.0
|
68
|
-
docker exec -t test pwd
|
69
|
-
docker exec -t test ls
|
70
|
-
docker exec -t test bundle update
|
71
|
-
docker exec -t test bundle exec rake
|
72
|
-
docker kill test
|
73
25
|
test_351x:
|
74
26
|
runs-on: ubuntu-22.04
|
75
27
|
steps:
|
@@ -150,3 +102,19 @@ jobs:
|
|
150
102
|
docker exec -t test bundle update
|
151
103
|
docker exec -t test bundle exec rake
|
152
104
|
docker kill test
|
105
|
+
test_3100x:
|
106
|
+
runs-on: ubuntu-22.04
|
107
|
+
steps:
|
108
|
+
- name: Check out repository
|
109
|
+
uses: actions/checkout@v2
|
110
|
+
- name: Run Tests
|
111
|
+
run: |
|
112
|
+
echo $(pwd)
|
113
|
+
echo $(ls)
|
114
|
+
docker pull nrel/openstudio:3.10.0
|
115
|
+
docker run --name test --rm -d -t -v $(pwd):/work -w /work nrel/openstudio:3.10.0
|
116
|
+
docker exec -t test pwd
|
117
|
+
docker exec -t test ls
|
118
|
+
docker exec -t test bundle update
|
119
|
+
docker exec -t test bundle exec rake
|
120
|
+
docker kill test
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2020-
|
3
|
+
Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -5,13 +5,11 @@ An [OpenStudio Measure](https://nrel.github.io/OpenStudio-user-documentation/ref
|
|
5
5
|
## Guide & Downloads
|
6
6
|
|
7
7
|
Building professionals and energy modellers are encouraged to first consult the online [Guide](https://rd2.github.io/tbd/) - it provides an overview of the underlying theory, references, suggested OpenStudio workflows, etc. Users can download the latest _TBD_ version directly from the Guide itself, or under [releases](https://github.com/rd2/tbd/releases), or via NREL's [BCL](https://bcl.nrel.gov) (search for "bridging" or "rd2"). Questions can be posted on [UnmetHours](https://unmethours.com) - a very useful online resource for OpenStudio users. TBD is also available as a Ruby gem - add:
|
8
|
-
|
9
8
|
```
|
10
9
|
gem "tbd", git: "https://github.com/rd2/tbd", branch: "master"
|
11
10
|
```
|
12
11
|
|
13
|
-
... in a
|
14
|
-
|
12
|
+
... in a [bundled](https://bundler.io) _Measure_ development environment "Gemfile" (or preferably as a _gemspec_ dependency), and then run:
|
15
13
|
```
|
16
14
|
bundle install (or 'bundle update')
|
17
15
|
```
|
@@ -24,11 +22,11 @@ Bugs or new feature requests for _TBD_ should be submitted [here](https://github
|
|
24
22
|
|
25
23
|
The installation and testing instructions in this section are for developers interested in exploring/tweaking a cloned/forked version of the source code. In an effort to _lighten_ TBD as a Ruby gem, only the most basic tests are deployed in this repository. More detailed tests are housed in a dedicated TBD [testing](https://github.com/rd2/tbd_tests) repo.
|
26
24
|
|
27
|
-
TBD is systematically tested against updated OpenStudio versions (since v3.0.0). The following instructions refer to OpenStudio v3.
|
25
|
+
TBD is systematically tested against updated OpenStudio versions (since v3.0.0). The following instructions refer to OpenStudio v3.8.0, which requires Ruby v3.2.2. Earlier OpenStudio versions require Ruby v2.7.2. Adapt instructions for older (or newer) versions - see OpenStudio's [compatibility matrix](https://github.com/NREL/OpenStudio/wiki/OpenStudio-SDK-Version-Compatibility-Matrix).
|
28
26
|
|
29
27
|
### Windows Installation
|
30
28
|
|
31
|
-
Either install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 2.
|
29
|
+
Either install Ruby using the [RubyInstaller](https://rubyinstaller.org/downloads/archives/) for [Ruby 3.2.2 (x64)](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.2.2-1/rubyinstaller-3.2.2-1-x64.exe), or preferably under a [WSL2](https://gist.github.com/brgix/0d968d8f32c41f13300dc6769414df79) environment. Run the following steps if going down the _RubyInstaller_ route. From the command line, check that the ruby installation returns the correct Ruby version:
|
32
30
|
```
|
33
31
|
ruby -v
|
34
32
|
```
|
@@ -39,12 +37,11 @@ bundler -v
|
|
39
37
|
gem install bundler -v 2.1
|
40
38
|
```
|
41
39
|
|
42
|
-
Install
|
43
|
-
|
44
|
-
Create a new file ```C:\Ruby27-x64\lib\ruby\site_ruby\openstudio.rb``` (path may be different depending on the environment), and edit it so it _points_ to your new OpenStudio installation:
|
40
|
+
Install OpenStudio [3.10.0](https://github.com/NREL/OpenStudio/releases/tag/v3.10.0), or the OpenStudioApplication [1.10.0](https://github.com/openstudiocoalition/OpenStudioApplication/releases/tag/v1.10.0).
|
45
41
|
|
42
|
+
Create a new file ```C:\Ruby32-x64\lib\ruby\site_ruby\openstudio.rb``` (path may be different depending on the environment), and edit it so it _points_ to your new OpenStudio installation:
|
46
43
|
```
|
47
|
-
require 'C:\openstudio-3.
|
44
|
+
require 'C:\openstudio-3.10.0\Ruby\openstudio.rb'
|
48
45
|
```
|
49
46
|
|
50
47
|
Verify your OpenStudio and Ruby configuration:
|
@@ -54,65 +51,62 @@ ruby -e "require 'openstudio'" -e "puts OpenStudio::Model::Model.new"
|
|
54
51
|
|
55
52
|
### MacOS Installation
|
56
53
|
|
57
|
-
MacOS already comes with Ruby, but likely not the right Ruby version for the desired OpenStudio measure development [environment](https://github.com/NREL/OpenStudio/wiki/OpenStudio-SDK-Version-Compatibility-Matrix). Instructions here show how to install Ruby
|
54
|
+
MacOS already comes with Ruby, but likely not the right Ruby version for the desired OpenStudio measure development [environment](https://github.com/NREL/OpenStudio/wiki/OpenStudio-SDK-Version-Compatibility-Matrix). Instructions here show how to install Ruby v3.2.2 alongside MacOS's own Ruby version. Although no longer officially supported, instructions for an OpenStudio v2.9.1 setup is described [here](https://github.com/rd2/tbd/blob/master/v291_MacOS.md).
|
58
55
|
|
59
56
|
From a Terminal, install [Homebrew](https://brew.sh/index) - nice for package distribution and management. Using Homebrew, install _rbenv_ (which allows users to manage multiple Ruby versions) and finally Ruby:
|
60
|
-
|
61
57
|
```
|
62
58
|
brew install rbenv
|
63
59
|
rbenv init
|
64
|
-
rbenv install 2.
|
65
|
-
```
|
66
|
-
Install [bundler](https://bundler.io) (if not already installed), great for managing Ruby gems and dependencies:
|
67
|
-
|
68
|
-
```
|
69
|
-
bundler -v
|
70
|
-
gem install bundler -v 2.1
|
60
|
+
rbenv install 3.2.2
|
71
61
|
```
|
72
62
|
|
73
63
|
In the Terminal, check the Ruby version:
|
74
|
-
|
75
64
|
```
|
76
65
|
ruby -v
|
77
66
|
```
|
78
67
|
|
79
|
-
... should still report the current Ruby version used by MacOS. To ensure the right version is used for developing OpenStudio Measures, instruct _rbenv_ to switch Ruby version _locally_ within a user’s chosen directory (e.g. "
|
80
|
-
|
68
|
+
... should still report the current Ruby version used by MacOS. To ensure the right version is used for developing OpenStudio Measures, instruct _rbenv_ to switch Ruby version _locally_ within a user’s chosen directory (e.g. "sandbox380"):
|
81
69
|
```
|
82
|
-
mkdir ~/Documents/
|
83
|
-
cd ~/Documents/
|
84
|
-
rbenv local 2.
|
70
|
+
mkdir ~/Documents/sandbox380
|
71
|
+
cd ~/Documents/sandbox380
|
72
|
+
rbenv local 3.2.2
|
85
73
|
ruby -v
|
86
74
|
```
|
87
|
-
… should report the desired _local_ Ruby version, to be used by default for anything under the "sandbox361" directory tree. To ensure both Ruby versions are operational and safe, run the following checkup twice - once from a user’s home (or ~/), then from within e.g. "sandbox361":
|
88
75
|
|
76
|
+
… should now report the desired _local_ Ruby version, to be used by default for anything under the "sandbox380" directory tree. To ensure both Ruby versions are operational and safe, run the following checkup twice - once from a user’s home (or ~/), then from within e.g. "sandbox380":
|
89
77
|
```
|
90
78
|
cd ~/
|
91
79
|
ruby -ropen-uri -e 'eval URI.open("https://git.io/vQhWq").read'
|
92
|
-
cd ~/Documents/
|
80
|
+
cd ~/Documents/sandbox380
|
93
81
|
ruby -ropen-uri -e 'eval URI.open("https://git.io/vQhWq").read'
|
94
82
|
```
|
95
83
|
|
96
84
|
If successful, one should get a ```Hooray!``` from both Ruby versions confirming valid communication with [Rubygems](https://rubygems.org/).
|
97
85
|
|
98
|
-
|
86
|
+
[Bundler](https://bundler.io) is also required for managing Ruby gems and dependencies. With _rbenv_, the right _Bundler_ version should have been installed. If for whatever reason it wasn't installed:
|
87
|
+
```
|
88
|
+
bundler -v
|
89
|
+
gem install bundler -v 2.4.10
|
90
|
+
```
|
99
91
|
|
100
|
-
|
92
|
+
Install OpenStudio [3.10.0](https://github.com/NREL/OpenStudio/releases/tag/v3.10.0), or the OpenStudio Application [1.10.0](https://github.com/openstudiocoalition/OpenStudioApplication/releases/tag/v1.10.0).
|
101
93
|
|
94
|
+
Create a new file ```~/.rbenv/versions/3.2.2/lib/ruby/site_ruby/openstudio.rb``` (path may be different depending on the environment), and edit it so it _points_ to your new OpenStudio installation:
|
102
95
|
```
|
103
|
-
require '/Applications/OpenStudio-3.
|
96
|
+
require '/Applications/OpenStudio-3.10.0/Ruby/openstudio.rb'
|
104
97
|
```
|
105
98
|
|
106
99
|
Verify your local OpenStudio and Ruby configuration:
|
107
|
-
|
108
100
|
```
|
109
|
-
cd ~/Documents/
|
101
|
+
cd ~/Documents/sandbox310
|
110
102
|
ruby -e "require 'openstudio'" -e "puts OpenStudio::Model::Model.new"
|
111
103
|
```
|
112
104
|
|
105
|
+
Make sure you have latest version of _git_ (e.g. through Homebrew).
|
106
|
+
|
113
107
|
## Clone TBD
|
114
108
|
|
115
|
-
Once done with either the Windows or MacOS setup,
|
109
|
+
Once done with either the Windows or MacOS setup, ```git clone``` the TBD repo, e.g. under "sandbox380". Run the basic tests below to ensure the measure operates as expected.
|
116
110
|
|
117
111
|
## Complete list of test commands
|
118
112
|
|
@@ -127,14 +121,14 @@ bundle exec rake
|
|
127
121
|
|
128
122
|
Install [Docker](https://docs.docker.com/desktop/#download-and-install).
|
129
123
|
|
130
|
-
Pull the OpenStudio v3.
|
124
|
+
Pull the OpenStudio v3.10.0 Docker image:
|
131
125
|
```
|
132
|
-
docker pull nrel/openstudio:3.
|
126
|
+
docker pull nrel/openstudio:3.10.0
|
133
127
|
```
|
134
128
|
|
135
129
|
In the root repository:
|
136
130
|
```
|
137
|
-
docker run --name test --rm -d -t -v ${PWD}:/work -w /work nrel/openstudio:3.
|
131
|
+
docker run --name test --rm -d -t -v ${PWD}:/work -w /work nrel/openstudio:3.10.0
|
138
132
|
docker exec -t test bundle update
|
139
133
|
docker exec -t test bundle exec rake
|
140
134
|
docker kill test
|
data/lib/measures/tbd/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2020-
|
3
|
+
Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/measures/tbd/measure.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# MIT License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2020-
|
3
|
+
# Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<schema_version>3.1</schema_version>
|
4
4
|
<name>tbd_measure</name>
|
5
5
|
<uid>8890787b-8c25-4dc8-8641-b6be1b6c2357</uid>
|
6
|
-
<version_id>
|
7
|
-
<version_modified>
|
6
|
+
<version_id>7a2d773a-7a50-4c69-aa1f-93ed796e9ace</version_id>
|
7
|
+
<version_modified>2025-08-15T13:39:31Z</version_modified>
|
8
8
|
<xml_checksum>99772807</xml_checksum>
|
9
9
|
<class_name>TBDMeasure</class_name>
|
10
10
|
<display_name>Thermal Bridging and Derating - TBD</display_name>
|
@@ -464,7 +464,7 @@
|
|
464
464
|
<filename>LICENSE.md</filename>
|
465
465
|
<filetype>md</filetype>
|
466
466
|
<usage_type>license</usage_type>
|
467
|
-
<checksum>
|
467
|
+
<checksum>3EBCA5DB</checksum>
|
468
468
|
</file>
|
469
469
|
<file>
|
470
470
|
<filename>README.md</filename>
|
@@ -493,13 +493,13 @@
|
|
493
493
|
<filename>measure.rb</filename>
|
494
494
|
<filetype>rb</filetype>
|
495
495
|
<usage_type>script</usage_type>
|
496
|
-
<checksum>
|
496
|
+
<checksum>3FBDA0C2</checksum>
|
497
497
|
</file>
|
498
498
|
<file>
|
499
499
|
<filename>geo.rb</filename>
|
500
500
|
<filetype>rb</filetype>
|
501
501
|
<usage_type>resource</usage_type>
|
502
|
-
<checksum>
|
502
|
+
<checksum>EF3BA8F7</checksum>
|
503
503
|
</file>
|
504
504
|
<file>
|
505
505
|
<filename>geometry.rb</filename>
|
@@ -517,19 +517,19 @@
|
|
517
517
|
<filename>oslog.rb</filename>
|
518
518
|
<filetype>rb</filetype>
|
519
519
|
<usage_type>resource</usage_type>
|
520
|
-
<checksum>
|
520
|
+
<checksum>586805C4</checksum>
|
521
521
|
</file>
|
522
522
|
<file>
|
523
523
|
<filename>psi.rb</filename>
|
524
524
|
<filetype>rb</filetype>
|
525
525
|
<usage_type>resource</usage_type>
|
526
|
-
<checksum>
|
526
|
+
<checksum>71AED953</checksum>
|
527
527
|
</file>
|
528
528
|
<file>
|
529
529
|
<filename>tbd.rb</filename>
|
530
530
|
<filetype>rb</filetype>
|
531
531
|
<usage_type>resource</usage_type>
|
532
|
-
<checksum>
|
532
|
+
<checksum>9E26251E</checksum>
|
533
533
|
</file>
|
534
534
|
<file>
|
535
535
|
<filename>transformation.rb</filename>
|
@@ -541,13 +541,13 @@
|
|
541
541
|
<filename>ua.rb</filename>
|
542
542
|
<filetype>rb</filetype>
|
543
543
|
<usage_type>resource</usage_type>
|
544
|
-
<checksum>
|
544
|
+
<checksum>022F6D10</checksum>
|
545
545
|
</file>
|
546
546
|
<file>
|
547
547
|
<filename>utils.rb</filename>
|
548
548
|
<filetype>rb</filetype>
|
549
549
|
<usage_type>resource</usage_type>
|
550
|
-
<checksum>
|
550
|
+
<checksum>3CD8019A</checksum>
|
551
551
|
</file>
|
552
552
|
<file>
|
553
553
|
<filename>version.rb</filename>
|
@@ -565,7 +565,7 @@
|
|
565
565
|
<filename>tbd_tests.rb</filename>
|
566
566
|
<filetype>rb</filetype>
|
567
567
|
<usage_type>test</usage_type>
|
568
|
-
<checksum>
|
568
|
+
<checksum>9C76CD98</checksum>
|
569
569
|
</file>
|
570
570
|
</files>
|
571
571
|
</measure>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# MIT License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2020-
|
3
|
+
# Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# BSD 3-Clause License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2022-
|
3
|
+
# Copyright (c) 2022-2025, Denis Bourgeois
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -102,9 +102,9 @@ module OSlg
|
|
102
102
|
end
|
103
103
|
|
104
104
|
##
|
105
|
-
# Returns whether current status is
|
105
|
+
# Returns whether current status is WARNING.
|
106
106
|
#
|
107
|
-
# @return [Bool] whether current log status is
|
107
|
+
# @return [Bool] whether current log status is WARNING
|
108
108
|
def warn?
|
109
109
|
@@status == WARN
|
110
110
|
end
|
@@ -159,19 +159,20 @@ module OSlg
|
|
159
159
|
end
|
160
160
|
|
161
161
|
##
|
162
|
-
# Converts object to String
|
162
|
+
# Converts object to String, trims if requested.
|
163
163
|
#
|
164
164
|
# @param txt [#to_s] a stringable object
|
165
|
-
# @param
|
165
|
+
# @param len [Numeric] requested maximum string length (optional)
|
166
166
|
#
|
167
|
-
# @return [String] a trimmed
|
168
|
-
def trim(txt = "",
|
169
|
-
length = 60 unless length.respond_to?(:to_i)
|
170
|
-
length = length.to_i if length.respond_to?(:to_i)
|
167
|
+
# @return [String] a (trimmed) string (empty unless stringable)
|
168
|
+
def trim(txt = "", len = nil)
|
171
169
|
return "" unless txt.respond_to?(:to_s)
|
172
170
|
|
173
171
|
txt = txt.to_s.strip
|
174
|
-
|
172
|
+
|
173
|
+
if len.is_a?(Numeric)
|
174
|
+
txt = txt[0...len.to_i] + " ..." if txt.length > len.to_i
|
175
|
+
end
|
175
176
|
|
176
177
|
txt
|
177
178
|
end
|
@@ -193,21 +194,28 @@ module OSlg
|
|
193
194
|
end
|
194
195
|
|
195
196
|
##
|
196
|
-
# Logs a new entry
|
197
|
+
# Logs a new entry. Overall log status is raised if new level is greater
|
198
|
+
# than current level (e.g. FATAL > ERROR). Candidate log entry is ignored and
|
199
|
+
# status remains unchanged if the new level cannot be converted to an integer,
|
200
|
+
# if not an OSlg constant (once converted), or if new level is below the
|
201
|
+
# current log level. Relies on OSlg method 'trim()': candidate log message is
|
202
|
+
# ignored and status unchanged if message is not a valid string.
|
197
203
|
#
|
198
204
|
# @param lvl [#to_i] DEBUG, INFO, WARN, ERROR or FATAL
|
199
205
|
# @param message [#to_s] user-provided log message
|
206
|
+
# @param len [Numeric] maximum log message length (optional)
|
200
207
|
#
|
201
208
|
# @example A user warning
|
202
209
|
# log(WARN, "Surface area < 100cm2")
|
203
210
|
#
|
204
211
|
# @return [DEBUG, INFO, WARN, ERROR, FATAL] updated/current status
|
205
|
-
def log(lvl = DEBUG, message = "")
|
212
|
+
def log(lvl = DEBUG, message = "", len = nil)
|
206
213
|
return @@status unless lvl.respond_to?(:to_i)
|
207
214
|
return @@status unless message.respond_to?(:to_s)
|
208
215
|
|
209
216
|
lvl = lvl.to_i
|
210
|
-
message = message
|
217
|
+
message = trim(message, len)
|
218
|
+
return @@status if message.empty?
|
211
219
|
return @@status if lvl < DEBUG
|
212
220
|
return @@status if lvl > FATAL
|
213
221
|
return @@status if lvl < @@level
|
@@ -220,19 +228,24 @@ module OSlg
|
|
220
228
|
|
221
229
|
##
|
222
230
|
# Logs template 'invalid object' message, if provided arguments are valid.
|
231
|
+
# Relies on OSlg method 'log()': first check out its own operation, exit
|
232
|
+
# conditions and module side effects. Candidate log entry is ignored and
|
233
|
+
# status remains unchanged if 'ord' cannot be converted to an integer.
|
234
|
+
# Argument 'ord' is ignored unless > 0.
|
223
235
|
#
|
224
236
|
# @param id [#to_s] 'invalid object' identifier
|
225
237
|
# @param mth [#to_s] calling method identifier
|
226
238
|
# @param ord [#to_i] calling method argument order number of obj (optional)
|
227
239
|
# @param lvl [#to_i] DEBUG, INFO, WARN, ERROR or FATAL (optional)
|
228
240
|
# @param res what to return (optional)
|
241
|
+
# @param len [Numeric] maximum log message length (optional)
|
229
242
|
#
|
230
243
|
# @example An invalid argument, logging a FATAL error, returning FALSE
|
231
244
|
# return invalid("area", "sum", 0, FATAL, false) if area > 1000000
|
232
245
|
#
|
233
246
|
# @return user-provided object
|
234
247
|
# @return [nil] if user hasn't provided an object to return
|
235
|
-
def invalid(id = "", mth = "", ord = 0, lvl = DEBUG, res = nil)
|
248
|
+
def invalid(id = "", mth = "", ord = 0, lvl = DEBUG, res = nil, len = nil)
|
236
249
|
return res unless id.respond_to?(:to_s)
|
237
250
|
return res unless mth.respond_to?(:to_s)
|
238
251
|
return res unless ord.respond_to?(:to_i)
|
@@ -250,7 +263,7 @@ module OSlg
|
|
250
263
|
msg = "Invalid '#{id}' "
|
251
264
|
msg += "arg ##{ord} " if ord > 0
|
252
265
|
msg += "(#{mth})"
|
253
|
-
log(lvl, msg)
|
266
|
+
log(lvl, msg, len)
|
254
267
|
|
255
268
|
res
|
256
269
|
end
|
@@ -266,13 +279,14 @@ module OSlg
|
|
266
279
|
# @param mth [#to_s] calling method identifier (optional)
|
267
280
|
# @param lvl [#to_i] DEBUG, INFO, WARN, ERROR or FATAL (optional)
|
268
281
|
# @param res what to return (optional)
|
282
|
+
# @param len [Numeric] maximum log message length (optional)
|
269
283
|
#
|
270
284
|
# @example A mismatched argument instance/class
|
271
285
|
# mismatch("area", area, Float, "sum") unless area.is_a?(Numeric)
|
272
286
|
#
|
273
287
|
# @return user-provided object
|
274
288
|
# @return [nil] if user hasn't provided an object to return
|
275
|
-
def mismatch(id = "", obj = nil, cl = nil, mth = "", lvl = DEBUG, res = nil)
|
289
|
+
def mismatch(id = "", obj = nil, cl = nil, mth = "", lvl = DEBUG, res = nil, len = nil)
|
276
290
|
return res unless id.respond_to?(:to_s)
|
277
291
|
return res unless mth.respond_to?(:to_s)
|
278
292
|
return res unless cl.is_a?(Class)
|
@@ -287,7 +301,7 @@ module OSlg
|
|
287
301
|
return res if lvl < DEBUG
|
288
302
|
return res if lvl > FATAL
|
289
303
|
|
290
|
-
log(lvl, "'#{id}' #{obj.class}? expecting #{cl} (#{mth})")
|
304
|
+
log(lvl, "'#{id}' #{obj.class}? expecting #{cl} (#{mth})", len)
|
291
305
|
|
292
306
|
res
|
293
307
|
end
|
@@ -302,13 +316,14 @@ module OSlg
|
|
302
316
|
# @param mth [#to_s] calling method identifier
|
303
317
|
# @param lvl [#to_i] DEBUG, INFO, WARN, ERROR or FATAL (optional)
|
304
318
|
# @param res what to return (optional)
|
319
|
+
# @param len [Numeric] maximum log message length (optional)
|
305
320
|
#
|
306
321
|
# @example A missing Hash key
|
307
322
|
# hashkey("floor area", floor, :area, "sum") unless floor.key?(:area)
|
308
323
|
#
|
309
324
|
# @return user-provided object
|
310
325
|
# @return [nil] if user hasn't provided an object to return
|
311
|
-
def hashkey(id = "", hsh = {}, key = "", mth = "", lvl = DEBUG, res = nil)
|
326
|
+
def hashkey(id = "", hsh = {}, key = "", mth = "", lvl = DEBUG, res = nil, len = nil)
|
312
327
|
return res unless id.respond_to?(:to_s)
|
313
328
|
return res unless hsh.is_a?(Hash)
|
314
329
|
return res if hsh.key?(key)
|
@@ -323,7 +338,7 @@ module OSlg
|
|
323
338
|
return res if lvl < DEBUG
|
324
339
|
return res if lvl > FATAL
|
325
340
|
|
326
|
-
log(lvl, "Missing '#{key}' key in '#{id}' Hash (#{mth})")
|
341
|
+
log(lvl, "Missing '#{key}' key in '#{id}' Hash (#{mth})", len)
|
327
342
|
|
328
343
|
res
|
329
344
|
end
|
@@ -335,13 +350,14 @@ module OSlg
|
|
335
350
|
# @param mth [#to_s] calling method identifier
|
336
351
|
# @param lvl [#to_i] DEBUG, INFO, WARN, ERROR or FATAL (optional)
|
337
352
|
# @param res what to return (optional)
|
353
|
+
# @param len [Numeric] maximum log message length (optional)
|
338
354
|
#
|
339
355
|
# @example An uninitialized variable, logging an ERROR, returning FALSE
|
340
356
|
# empty("zone", "conditioned?", FATAL, false) if space.thermalZone.empty?
|
341
357
|
#
|
342
358
|
# @return user-provided object
|
343
359
|
# @return [nil] if user hasn't provided an object to return
|
344
|
-
def empty(id = "", mth = "", lvl = DEBUG, res = nil)
|
360
|
+
def empty(id = "", mth = "", lvl = DEBUG, res = nil, len = nil)
|
345
361
|
return res unless id.respond_to?(:to_s)
|
346
362
|
return res unless mth.respond_to?(:to_s)
|
347
363
|
return res unless lvl.respond_to?(:to_i)
|
@@ -354,7 +370,7 @@ module OSlg
|
|
354
370
|
return res if lvl < DEBUG
|
355
371
|
return res if lvl > FATAL
|
356
372
|
|
357
|
-
log(lvl, "Empty '#{id}' (#{mth})")
|
373
|
+
log(lvl, "Empty '#{id}' (#{mth})", len)
|
358
374
|
|
359
375
|
res
|
360
376
|
end
|
@@ -366,13 +382,14 @@ module OSlg
|
|
366
382
|
# @param mth [#to_s] calling method identifier
|
367
383
|
# @param lvl [#to_i] DEBUG, INFO, WARN, ERROR or FATAL (optional)
|
368
384
|
# @param res what to return (optional)
|
385
|
+
# @param len [Numeric] maximum log message length (optional)
|
369
386
|
#
|
370
387
|
# @example A near-zero variable
|
371
388
|
# zero("floor area", "sum") if floor[:area].abs < TOL
|
372
389
|
#
|
373
390
|
# @return user-provided object
|
374
391
|
# @return [nil] if user hasn't provided an object to return
|
375
|
-
def zero(id = "", mth = "", lvl = DEBUG, res = nil)
|
392
|
+
def zero(id = "", mth = "", lvl = DEBUG, res = nil, len = nil)
|
376
393
|
return res unless id.respond_to?(:to_s)
|
377
394
|
return res unless mth.respond_to?(:to_s)
|
378
395
|
return res unless lvl.respond_to?(:to_i)
|
@@ -386,7 +403,7 @@ module OSlg
|
|
386
403
|
return res if lvl < DEBUG
|
387
404
|
return res if lvl > FATAL
|
388
405
|
|
389
|
-
log(lvl, "Zero '#{id}' (#{mth})")
|
406
|
+
log(lvl, "Zero '#{id}' (#{mth})", len)
|
390
407
|
|
391
408
|
res
|
392
409
|
end
|
@@ -398,13 +415,14 @@ module OSlg
|
|
398
415
|
# @param mth [String] calling method identifier
|
399
416
|
# @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional)
|
400
417
|
# @param res [Object] what to return (optional)
|
418
|
+
# @param len [Numeric] maximum log message length (optional)
|
401
419
|
#
|
402
420
|
# @example A negative variable
|
403
421
|
# negative("floor area", "sum") if floor[:area] < 0
|
404
422
|
#
|
405
423
|
# @return user-provided object
|
406
424
|
# @return [nil] if user hasn't provided an object to return
|
407
|
-
def negative(id = "", mth = "", lvl = DEBUG, res = nil)
|
425
|
+
def negative(id = "", mth = "", lvl = DEBUG, res = nil, len = nil)
|
408
426
|
return res unless id.respond_to?(:to_s)
|
409
427
|
return res unless mth.respond_to?(:to_s)
|
410
428
|
return res unless lvl.respond_to?(:to_i)
|
@@ -417,7 +435,7 @@ module OSlg
|
|
417
435
|
return res if lvl < DEBUG
|
418
436
|
return res if lvl > FATAL
|
419
437
|
|
420
|
-
log(lvl, "Negative '#{id}' (#{mth})")
|
438
|
+
log(lvl, "Negative '#{id}' (#{mth})", len)
|
421
439
|
|
422
440
|
res
|
423
441
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# MIT License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2020-
|
3
|
+
# Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# MIT License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2020-
|
3
|
+
# Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# MIT License
|
2
2
|
#
|
3
|
-
# Copyright (c) 2020-
|
3
|
+
# Copyright (c) 2020-2025 Denis Bourgeois & Dan Macumber
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1000,7 +1000,7 @@ module TBD
|
|
1000
1000
|
model = "* modèle : #{ua[:file]}" if ua.key?(:file) && lang == :fr
|
1001
1001
|
model += " (v#{ua[:version]})" if ua.key?(:version)
|
1002
1002
|
report << model unless model.empty?
|
1003
|
-
report << "* TBD : v3.4.
|
1003
|
+
report << "* TBD : v3.4.5"
|
1004
1004
|
report << "* date : #{ua[:date]}"
|
1005
1005
|
|
1006
1006
|
if lang == :en
|