Skip to content

Commit 5cd35b6

Browse files
fischero19andreasfische-bhsangularsen
authored
Add PoundPerSquareFoot and PoundPerThousandSquareFeet (#1638)
Standard for paper grammage/base weight in North America is lbs/MSF (pound per 1000 square feet) instead of g/m². Conversion factor is standardized by TAPPI (free sample of TIP 0800-01 can be found [here](https://www.normsplash.com/Samples/TAPPI/145775521/TAPPI-TIP-0800-01-2012-en.pdf)). I also added lbs/ft² for completeness. --------- Co-authored-by: Andreas Fischer <andreasfische@bhs-intralogistics.com> Co-authored-by: Andreas Gullberg Larsen <andreas.larsen84@gmail.com>
1 parent 02f2fbd commit 5cd35b6

13 files changed

Lines changed: 253 additions & 2 deletions

File tree

‎.agents/criteria-for-adding-quantities-and-units.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ Ask for justification and use cases if this is not clear.
2222
- [x] Can be converted to other units of the same quantity
2323
- [x] The conversion function is well established without ambiguous competing standards
2424

25+
### Review test values for new units
26+
27+
- [x] Test values use literal constants, not expressions that repeat the JSON conversion functions
28+
- [x] Test values preferably cite a verifiable source, such as an online converter, standard, or reference table
29+
- [x] Test values have at least 7 significant figures where possible, but no more precision than `double` can usefully represent
30+
- [x] The expected value independently sanity-checks the conversion function instead of mirroring its implementation
31+
2532
### Avoid X-per-Y units
2633

2734
There are many variations of unit A over unit B, such as `LengthPerAngle` and we want to avoid adding these unless they are very common.

‎Common/UnitDefinitions/AreaDensity.json‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,38 @@
5656
"Abbreviations": [ "mg/m²" ]
5757
}
5858
]
59+
},
60+
{
61+
"SingularName": "PoundPerSquareFoot",
62+
"PluralName": "PoundsPerSquareFoot",
63+
"BaseUnits": {
64+
"L": "Foot",
65+
"M": "Pound"
66+
},
67+
"FromUnitToBaseFunc": "{x} * (0.45359237 / 0.09290304)",
68+
"FromBaseToUnitFunc": "{x} / (0.45359237 / 0.09290304)",
69+
"Localization": [
70+
{
71+
"Culture": "en-US",
72+
"Abbreviations": [ "lb/ft²", "lbs/ft²", "lb/SF", "lbs/SF" ]
73+
}
74+
]
75+
},
76+
{
77+
"SingularName": "PoundPerThousandSquareFeet",
78+
"PluralName": "PoundsPerThousandSquareFeet",
79+
"BaseUnits": {
80+
"L": "Foot",
81+
"M": "Pound"
82+
},
83+
"FromUnitToBaseFunc": "{x} * (0.45359237 / 0.09290304) / 1000",
84+
"FromBaseToUnitFunc": "{x} / (0.45359237 / 0.09290304) * 1000",
85+
"Localization": [
86+
{
87+
"Culture": "en-US",
88+
"Abbreviations": [ "lb/MSF", "lbs/MSF", "lb/1000ft²", "lbs/1000ft²", "lbm/MSF" ]
89+
}
90+
]
5991
}
6092
]
6193
}

‎Common/UnitEnumValues.g.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
"AreaDensity": {
8787
"KilogramPerSquareMeter": 1,
8888
"GramPerSquareMeter": 6,
89-
"MilligramPerSquareMeter": 10
89+
"MilligramPerSquareMeter": 10,
90+
"PoundPerThousandSquareFeet": 3,
91+
"PoundPerSquareFoot": 8
9092
},
9193
"AreaMomentOfInertia": {
9294
"CentimeterToTheFourth": 1,

‎UnitsNet.NumberExtensions.CS14.Tests/GeneratedCode/NumberToAreaDensityExtensionsTest.g.cs‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnitsNet.NumberExtensions.CS14/GeneratedCode/NumberToAreaDensityExtensions.g.cs‎

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToAreaDensityExtensionsTest.g.cs‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnitsNet.NumberExtensions/GeneratedCode/NumberToAreaDensityExtensions.g.cs‎

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎UnitsNet.Tests/CustomCode/AreaDensityTests.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public class AreaDensityTests : AreaDensityTestsBase
3434

3535
protected override double MilligramsPerSquareMeterInOneKilogramPerSquareMeter => 1000000;
3636

37+
/// <summary>https://www.kylesconverter.com/area-density/kilograms-per-square-meter-to-pounds-per-square-foot</summary>
38+
protected override double PoundsPerSquareFootInOneKilogramPerSquareMeter => 0.20481614362252172;
39+
40+
/// <summary>https://www.kylesconverter.com/area-density/grams-per-square-meter-to-pounds-per-thousand-square-feet</summary>
41+
protected override double PoundsPerThousandSquareFeetInOneKilogramPerSquareMeter => 204.81614362252172;
42+
3743
[Fact]
3844
public void AreaDensityTimesAreaEqualsMass()
3945
{

‎UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)