Skip to content

Commit 0376c51

Browse files
committed
docs: yard_pound system documentation improved
1 parent 3cdc01b commit 0376c51

File tree

1 file changed

+35
-14
lines changed

1 file changed

+35
-14
lines changed

docs/users_guide/systems/yard_pound.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ using namespace mp_units;
119119
using namespace mp_units::imperial::unit_symbols;
120120
121121
// Imperial-specific units
122-
quantity volume = 5 * gal; // Imperial gallon (≈ 4.546 L)
123-
quantity weight = 12 * st; // Stone (14 lb)
124-
quantity heavy_mass = 2 * long_ton; // Long ton (2240 lb)
122+
quantity volume = 5 * gal; // Imperial gallon (≈ 4.546 L)
123+
quantity weight = 12 * st; // Stone (14 lb)
124+
quantity heavy_mass = 2 * imperial::long_ton; // Long ton (2240 lb)
125125
```
126126

127127
**Key imperial-specific units:**
@@ -147,9 +147,9 @@ using namespace mp_units::usc::unit_symbols;
147147

148148
// US-specific units
149149
quantity volume = 5 * gal; // US liquid gallon (≈ 3.785 L)
150-
quantity temp = point<deg_F>(72); // Fahrenheit temperature
150+
quantity_point temp = point<deg_F>(72); // Fahrenheit temperature
151151
quantity land_dist = 1000 * usc::survey1893::us_survey_foot; // Deprecated US survey foot
152-
quantity shipping = 3 * short_ton; // Short ton (2000 lb)
152+
quantity shipping = 3 * usc::short_ton; // Short ton (2000 lb)
153153
```
154154
155155
**Key US-specific units:**
@@ -193,12 +193,33 @@ quantity total_volume = uk_tank + us_tank; // Correctly converts and adds both
193193

194194
The word "ton" can refer to three completely different measurements:
195195

196-
- **Short ton** (US): 2000 lb ≈ 907 kg
197-
- **Long ton** (UK): 2240 lb ≈ 1016 kg
198-
- **Metric ton** (SI): 1000 kg = 2204.6 lb
196+
- **Short ton** (US): 2000 lb ≈ 907 kg - called simply "ton" in the United States
197+
- **Long ton** (UK): 2240 lb ≈ 1016 kg - called simply "ton" in the United Kingdom
198+
- **Metric ton** (SI): 1000 kg = 2204.6 lb - also called "tonne"
199199

200-
**mp-units** distinguishes these as `usc::short_ton`, `imperial::long_ton`,
201-
and `si::tonne` respectively.
200+
**Regional Usage:** In everyday speech, people in the UK say "ton" (meaning 2240 lb),
201+
while people in the US say "ton" (meaning 2000 lb). The qualifiers "long" and "short"
202+
are international technical terms used for disambiguation between regions.
203+
204+
**In mp-units:** Each system defines `ton` as its regional default:
205+
206+
```cpp
207+
using namespace mp_units;
208+
209+
// UK usage - "ton" means long ton (2240 lb)
210+
quantity uk_cargo = 5 * imperial::ton; // 2240 lb each
211+
quantity uk_cargo2 = 5 * imperial::long_ton; // Same thing (alias)
212+
213+
// US usage - "ton" means short ton (2000 lb)
214+
quantity us_cargo = 5 * usc::ton; // 2000 lb each
215+
quantity us_cargo2 = 5 * usc::short_ton; // Same thing (alias)
216+
217+
// Metric ton is different from both
218+
quantity metric_cargo = 5 * si::tonne; // 1000 kg each
219+
```
220+
221+
When working with both systems, use namespace qualification to be explicit:
222+
`imperial::ton` vs `usc::ton` vs `si::tonne`.
202223

203224
### US Survey Units
204225

@@ -408,7 +429,7 @@ quantity ground_speed = 450 * kn;
408429
quantity distance = 3500 * nmi;
409430
410431
// Convert to SI for presentation
411-
std::cout << "Cruising altitude: " << altitude.in(si::metre) << "\n";
432+
std::cout << "Cruising altitude: " << altitude.in<double>(si::metre) << "\n";
412433
```
413434

414435
### UK Recipe (Imperial Units)
@@ -436,12 +457,12 @@ using namespace mp_units::usc::unit_symbols;
436457
437458
quantity pipe_length = 100 * ft;
438459
quantity flow_rate = 50 * gal / si::minute;
439-
quantity ambient_temp = point<deg_F>(72);
440-
quantity material_weight = 3.5 * short_ton;
460+
quantity_point ambient_temp = point<deg_F>(72);
461+
quantity material_weight = 3.5 * usc::short_ton;
441462
442463
// Legacy land surveying (pre-2023) - use survey1893 units
443464
quantity old_plot_length = 660 * usc::survey1893::us_survey_foot; // 1 survey furlong
444-
quantity land_area = 1 * usc::acre; // Acre is based on survey chain
465+
quantity land_area = 1 * usc::acre; // Acre is based on survey chains
445466
```
446467

447468

0 commit comments

Comments
 (0)