Skip to content

Commit a49093d

Browse files
authored
Add the grams force unit (#1655)
Add the grams force unit
1 parent 041a6fb commit a49093d

14 files changed

Lines changed: 126 additions & 1 deletion

File tree

Common/UnitDefinitions/Force.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@
3131
}
3232
]
3333
},
34+
{
35+
"SingularName": "GramForce",
36+
"PluralName": "GramsForce",
37+
"FromUnitToBaseFunc": "{x} * 9.80665e-3",
38+
"FromBaseToUnitFunc": "{x} / 9.80665e-3",
39+
"XmlDocSummary": "The gram-force is a unit of force equal to the magnitude of force exerted by a gram of mass in standard gravity (9.80665 m/s²). It is equal to 9.80665 × 10⁻³ N.",
40+
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Kilogram-force",
41+
"Localization": [
42+
{
43+
"Culture": "en-US",
44+
"Abbreviations": [ "gf" ]
45+
},
46+
{
47+
"Culture": "ru-RU",
48+
"Abbreviations": [ "гс" ]
49+
}
50+
]
51+
},
3452
{
3553
"SingularName": "KilogramForce",
3654
"PluralName": "KilogramsForce",

Common/UnitEnumValues.g.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@
469469
"Poundal": 12,
470470
"PoundForce": 13,
471471
"ShortTonForce": 14,
472-
"TonneForce": 15
472+
"TonneForce": 15,
473+
"GramForce": 16
473474
},
474475
"ForceChangeRate": {
475476
"CentinewtonPerSecond": 1,

UnitsNet.NanoFramework/GeneratedCode/Quantities/Force.g.cs

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

UnitsNet.NanoFramework/GeneratedCode/Units/ForceUnit.g.cs

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

UnitsNet.NumberExtensions.CS14.Tests/GeneratedCode/NumberToForceExtensionsTest.g.cs

Lines changed: 4 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/NumberToForceExtensions.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.Tests/GeneratedCode/NumberToForceExtensionsTest.g.cs

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

UnitsNet.NumberExtensions/GeneratedCode/NumberToForceExtensions.g.cs

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

UnitsNet.Tests/CustomCode/ForceTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class ForceTests : ForceTestsBase
1010
protected override double DecanewtonsInOneNewton => 1E-1;
1111
protected override double DyneInOneNewton => 1E5;
1212

13+
protected override double GramsForceInOneNewton => 0.1019716e3;
1314
protected override double KilogramsForceInOneNewton => 0.1019716;
1415

1516
protected override double KilopoundsForceInOneNewton => 0.2248089e-3;
@@ -110,5 +111,12 @@ public void KilogramForceDividedByNewtonEqualsStandardGravity()
110111
var duration = Force.FromKilogramsForce(1) / Force.FromNewtons(1);
111112
Assert.Equal(9.80665, duration);
112113
}
114+
115+
[Fact]
116+
public void ThousandGramsForceEqualsOneKilogramForce()
117+
{
118+
var force = Force.FromGramsForce(1000);
119+
Assert.Equal(Force.FromKilogramsForce(1), force.ToUnit(ForceUnit.KilogramForce));
120+
}
113121
}
114122
}

0 commit comments

Comments
 (0)