Skip to content

Commit 3f8d9c7

Browse files
committed
Add plan for next 10 quantities & units
1 parent 2b77202 commit 3f8d9c7

2 files changed

Lines changed: 276 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Plan: Next 10 Quantities
2+
3+
## Existing Quantities (28)
4+
5+
Acceleration, AmountOfSubstance, Angle, Area, Data, DataRate, Density, ElectricalResistance, ElectricCharge, ElectricCurrent, ElectricPotential, Energy, Force, Frequency, Impulse, Length, LuminousIntensity, Mass, MassFlowRate, Momentum, Power, Pressure, SpecificEnergy, Temperature, Time, Velocity, Volume, VolumetricFlowRate.
6+
7+
---
8+
9+
## Theme 1: Rotational Mechanics (3 quantities)
10+
11+
These extend the existing kinematic/dynamic quantities into the rotational domain. `Angle` already exists as a dimensionless quantity, making these natural next steps.
12+
13+
| # | Quantity | Dimension | SI Unit | Rationale |
14+
|---|---------|-----------|---------|-----------|
15+
| 1 | **Torque** | Force × Length (M·L²·T⁻²) | N·m | Ubiquitous in mechanical engineering. Dimensionally identical to Energy but semantically distinct (rotational vs. translational). |
16+
| 2 | **AngularVelocity** | Angle / Time (T⁻¹) | rad/s | Fundamental rotational kinematic quantity. Bridges Angle and Time. |
17+
| 3 | **AngularAcceleration** | Angle / Time² (T⁻²) | rad/s² | Completes the rotational kinematic trio alongside Angle and AngularVelocity. |
18+
19+
**Dependencies:** Torque needs `IForce` × `ILength`; AngularVelocity and AngularAcceleration need `IAngle` and `ITime`. All dimension interfaces already exist.
20+
21+
**New dimension interfaces needed:**
22+
23+
- `ITorque : IProduct<IForce, ILength>, IMultiplicity<ITorque, One>, IDerivedQuantity`
24+
- `IAngularVelocity : IProduct<IAngle, IDimension<ITime, Negative<One>>>, IMultiplicity<IAngularVelocity, One>, IDerivedQuantity`
25+
- `IAngularAcceleration : IProduct<IAngle, IDimension<ITime, Negative<Two>>>, IMultiplicity<IAngularAcceleration, One>, IDerivedQuantity`
26+
27+
**Suggested implementation order:** AngularVelocity → AngularAcceleration → Torque
28+
29+
---
30+
31+
## Theme 2: Electromagnetic Quantities (4 quantities)
32+
33+
The library currently has ElectricCurrent, ElectricCharge, ElectricPotential, and ElectricalResistance. These four additions complete the core electromagnetic set, covering all remaining SI derived electromagnetic units with special names.
34+
35+
| # | Quantity | Dimension | SI Unit | Rationale |
36+
|---|---------|-----------|---------|-----------|
37+
| 4 | **ElectricalConductance** | 1 / Resistance | S (Siemens) | Inverse of ElectricalResistance. Commonly used in circuit analysis. Completes the resistance/conductance duality. |
38+
| 5 | **Capacitance** | Charge / Potential (I²·T⁴·M⁻¹·L⁻²) | F (Farad) | Fundamental passive circuit element quantity. |
39+
| 6 | **MagneticFlux** | Potential × Time (M·L²·T⁻²·I⁻¹) | Wb (Weber) | Prerequisite for MagneticFluxDensity. Fundamental electromagnetic quantity. |
40+
| 7 | **MagneticFluxDensity** | MagneticFlux / Area (M·T⁻²·I⁻¹) | T (Tesla) | Key quantity for electromagnetic applications (motors, sensors, MRI). |
41+
42+
**Dependencies:** ElectricalConductance is the inverse of ElectricalResistance (already exists). Capacitance needs ElectricCharge and ElectricPotential (both exist). MagneticFlux needs ElectricPotential and Time (both exist). MagneticFluxDensity needs MagneticFlux (new) and Area (exists).
43+
44+
**New dimension interfaces needed:**
45+
46+
- `IElectricalConductance : ILinear<IElectricalConductance>, IDerivedQuantity` (with `IInvertible` linking to `IElectricalResistance`)
47+
- `ICapacitance : ILinear<ICapacitance>, IDerivedQuantity`
48+
- `IMagneticFlux : IProduct<IElectricPotential, ITime>, IMultiplicity<IMagneticFlux, One>, IDerivedQuantity`
49+
- `IMagneticFluxDensity : IProduct<IMagneticFlux, IDimension<ILength, Negative<Two>>>, IMultiplicity<IMagneticFluxDensity, One>, IDerivedQuantity`
50+
51+
**Suggested implementation order:** ElectricalConductance → Capacitance → MagneticFlux → MagneticFluxDensity
52+
53+
---
54+
55+
## Theme 3: Photometry & Fluid Dynamics (3 quantities)
56+
57+
These fill important practical gaps: photometry builds on `LuminousIntensity` (which currently has no derived quantity using it), and dynamic viscosity extends the existing fluid mechanics quantities.
58+
59+
| # | Quantity | Dimension | SI Unit | Rationale |
60+
|---|---------|-----------|---------|-----------|
61+
| 8 | **LuminousFlux** | LuminousIntensity × SolidAngle (≈ cd) | lm (Lumen) | First derived photometric quantity. Makes `LuminousIntensity` practically useful. |
62+
| 9 | **Illuminance** | LuminousFlux / Area (cd·m⁻²) | lx (Lux) | Essential for lighting design and regulation. Builds on LuminousFlux. |
63+
| 10 | **DynamicViscosity** | Pressure × Time (M·L⁻¹·T⁻¹) | Pa·s | Fundamental fluid property. Extends the existing flow rate quantities (MassFlowRate, VolumetricFlowRate). |
64+
65+
**Dependencies:** LuminousFlux needs `ILuminousIntensity` (exists); since solid angle is dimensionless by SI definition (like `IAngle`), LuminousFlux is essentially linear in luminous intensity. Illuminance needs LuminousFlux (new) and Area (exists). DynamicViscosity needs Pressure and Time (both exist).
66+
67+
**New dimension interfaces needed:**
68+
69+
- `ILuminousFlux : ILinear<ILuminousFlux>, IDerivedQuantity`
70+
- `IIlluminance : IProduct<ILuminousFlux, IDimension<ILength, Negative<Two>>>, IMultiplicity<IIlluminance, One>, IDerivedQuantity`
71+
- `IDynamicViscosity : IProduct<IPressure, ITime>, IMultiplicity<IDynamicViscosity, One>, IDerivedQuantity`
72+
73+
**Suggested implementation order:** LuminousFlux → Illuminance → DynamicViscosity
74+
75+
---
76+
77+
## Overall Implementation Order
78+
79+
Taking inter-dependencies into account:
80+
81+
| Phase | Quantities | Notes |
82+
|-------|-----------|-------|
83+
| **Phase 1** | AngularVelocity, AngularAcceleration, ElectricalConductance | No new quantity dependencies; only existing dimension interfaces needed. |
84+
| **Phase 2** | Torque, Capacitance, LuminousFlux, DynamicViscosity | Independent of each other; can be done in parallel. |
85+
| **Phase 3** | MagneticFlux, MagneticFluxDensity, Illuminance | MagneticFluxDensity depends on MagneticFlux; Illuminance depends on LuminousFlux. |
86+
87+
## Per-Quantity Checklist
88+
89+
Each quantity requires:
90+
91+
1. **Dimension interface** — add to `DerivedDimensions.cs` or `ElectricalDimesions.cs`
92+
2. **Quantity struct** — new `.ai.cs` file in `Quantities/`
93+
3. **SI derived unit** — e.g. `NewtonMetre`, `Siemens`, `Farad`, `Weber`, `Tesla`, `Lumen`, `Lux` in `Atmoos.Quantities.Units`
94+
4. **Physics extensions** — operator relationships in `Physics/`
95+
5. **Tests** — unit tests for conversions and arithmetic
96+
6. **Update readme** — add the quantity to the list in `readme.md`
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# Plan: Units for Next 10 Quantities
2+
3+
Accompanies the [next 10 quantities plan](next-10-quantities-plan.md).
4+
5+
## Overview
6+
7+
Each new quantity needs at least one SI derived unit. Some quantities also benefit from metric, imperial, or non-standard units that are in common practical use.
8+
9+
Quantities marked with **(compound only)** have no universally recognised named unit; they are expressed as combinations of existing units (e.g. `N·m`, `Pa·s`). They still need to work with the existing `Scalar<TUnit>`, `Product<T1, T2>`, and `Quotient<TN, TD>` creation patterns but do not require a new unit struct.
10+
11+
---
12+
13+
## Theme 1: Rotational Mechanics
14+
15+
### 1. Torque — compound only
16+
17+
Torque is dimensionally identical to energy (M·L²·T⁻²) but semantically distinct. The SI unit is the **newton metre** (N·m), which is *not* given a special name to preserve this distinction.
18+
19+
| Unit | Symbol | Category | Conversion | Notes |
20+
|------|--------|----------|------------|-------|
21+
|| N·m | (compound) || Expressed as `Product<Newton, Metre>`. No dedicated unit struct needed. |
22+
|| lbf·ft | (compound) | 1 lbf·ft = 1.3558179483314 N·m | Expressed as `Product<PoundForce, Foot>`. Both units exist. |
23+
|| lbf·in | (compound) | 1 lbf·in ≈ 0.1129848290276 N·m | Expressed as `Product<PoundForce, Inch>`. Both units exist. |
24+
25+
**Implementation notes:**
26+
- The quantity struct uses `Product<TForce, TLength>` and `Quotient<TForce, TLength>` for `Of()` and `To()`.
27+
- All torque units are compound: `Product<Newton, Metre>`, `Product<PoundForce, Foot>`, and `Product<PoundForce, Inch>`. No dedicated unit structs needed.
28+
29+
### 2. AngularVelocity — compound only
30+
31+
All angular velocity units are expressible as quotients of existing angle and time units. No dedicated unit structs are needed.
32+
33+
| Unit | Symbol | Category | Conversion | Notes |
34+
|------|--------|----------|------------|-------|
35+
|| rad/s | (compound) | identity | Expressed as `Quotient<Radian, Second>`. Both units exist. |
36+
|| rev/min | (compound) | 1 rev/min = 2π/60 rad/s | Expressed as `Quotient<Turn, Minute>`. Both units exist (`Turn` has representation `"rev"`). |
37+
|| °/s | (compound) | 1 °/s = π/180 rad/s | Expressed as `Quotient<Degree, Second>`. Both units exist. |
38+
39+
**Implementation notes:**
40+
- The quantity struct uses `Quotient<TAngle, TTime>` for `Of()` and `To()`.
41+
- All angular velocity units are compound. The SI coherent form is `Quotient<Radian, Second>` (rad/s).
42+
- `Turn` already exists (in `NonStandard/Angle/Turn.ai.cs`) with `Representation => "rev"`, so `Quotient<Turn, Minute>` naturally produces "rev/min".
43+
44+
### 3. AngularAcceleration — compound only
45+
46+
Angular acceleration follows the same pattern as (linear) acceleration: it is expressed as a compound of existing units.
47+
48+
| Unit | Symbol | Category | Conversion | Notes |
49+
|------|--------|----------|------------|-------|
50+
|| rad/s² | (compound) | identity | Compound of `Radian` and `Second`. Both units exist. |
51+
52+
**Implementation notes:**
53+
- The quantity struct uses a compound creation pattern analogous to linear acceleration.
54+
- No dedicated unit struct is needed; the SI coherent form is composed from `Radian` and `Second`.
55+
- Additional non-standard compound forms can be added later as needed.
56+
57+
---
58+
59+
## Theme 2: Electromagnetic Quantities
60+
61+
### 4. ElectricalConductance — SI derived unit: siemens
62+
63+
| Unit | Symbol | Category | Conversion | Notes |
64+
|------|--------|----------|------------|-------|
65+
| **Siemens** | S | SI Derived | identity | Named SI unit. Reciprocal of ohm. |
66+
67+
**Implementation notes:**
68+
- `Siemens` implements `ISiUnit, IElectricalConductance, IInvertible<IElectricalResistance>`.
69+
- The `IInvertible` pattern mirrors how `Hertz` relates to `ITime`: `Siemens` is `1 / Ohm`.
70+
- Implements `ISystemInject<IElectricalResistance>` to inject `Ohm` as the base.
71+
72+
### 5. Capacitance — SI derived unit: farad
73+
74+
| Unit | Symbol | Category | Conversion | Notes |
75+
|------|--------|----------|------------|-------|
76+
| **Farad** | F | SI Derived | identity | Named SI unit for capacitance. |
77+
78+
**Implementation notes:**
79+
- `Farad` implements `ISiUnit, ICapacitance`.
80+
- Practical capacitance values are typically very small (pF, nF, µF), so metric prefix support (`Si<Pico, Farad>()`, `Si<Nano, Farad>()`, `Si<Micro, Farad>()`) is essential — this is handled automatically by the prefix system.
81+
82+
### 6. MagneticFlux — SI derived unit: weber
83+
84+
| Unit | Symbol | Category | Conversion | Notes |
85+
|------|--------|----------|------------|-------|
86+
| **Weber** | Wb | SI Derived | identity | Named SI unit for magnetic flux. |
87+
| **Maxwell** | Mx | NonStandard | 1 Mx = 10⁻⁸ Wb | CGS unit, still occasionally encountered. |
88+
89+
**Implementation notes:**
90+
- `Weber` implements `ISiUnit, IMagneticFlux`.
91+
- `Maxwell` implements `INonStandardUnit, IMagneticFlux` with `ToSi`: `self / 1e8` (rooted in `Weber`).
92+
93+
### 7. MagneticFluxDensity — SI derived unit: tesla
94+
95+
| Unit | Symbol | Category | Conversion | Notes |
96+
|------|--------|----------|------------|-------|
97+
| **Tesla** | T | SI Derived | identity | Named SI unit for magnetic flux density. |
98+
| **Gauss** | G | NonStandard | 1 G = 10⁻⁴ T | CGS unit, very widely used in practice. |
99+
100+
**Implementation notes:**
101+
- `Tesla` implements `ISiUnit, IMagneticFluxDensity`.
102+
- `Gauss` implements `INonStandardUnit, IMagneticFluxDensity` with `ToSi`: `self / 1e4` (rooted in `Tesla`).
103+
104+
---
105+
106+
## Theme 3: Photometry & Fluid Dynamics
107+
108+
### 8. LuminousFlux — SI derived unit: lumen
109+
110+
| Unit | Symbol | Category | Conversion | Notes |
111+
|------|--------|----------|------------|-------|
112+
| **Lumen** | lm | SI Derived | identity | Named SI unit. cd·sr, but sr is dimensionless. |
113+
114+
**Implementation notes:**
115+
- `Lumen` implements `ISiUnit, ILuminousFlux`.
116+
- Since steradian (solid angle) is dimensionless, `LuminousFlux` is effectively linear in luminous intensity with its own named unit.
117+
118+
### 9. Illuminance — SI derived unit: lux
119+
120+
| Unit | Symbol | Category | Conversion | Notes |
121+
|------|--------|----------|------------|-------|
122+
| **Lux** | lx | SI Derived | identity | Named SI unit. lm/m². |
123+
| **FootCandle** | fc | NonStandard | 1 fc ≈ 10.7639 lx | Common in North American lighting practice. |
124+
125+
**Implementation notes:**
126+
- `Lux` implements `ISiUnit, IIlluminance`.
127+
- `FootCandle` implements `INonStandardUnit, IIlluminance` with `ToSi`: `10.7639104167097 * self.RootedIn<Lux>()` (1 lumen per square foot).
128+
129+
### 10. DynamicViscosity — compound only (pascal second)
130+
131+
| Unit | Symbol | Category | Conversion | Notes |
132+
|------|--------|----------|------------|-------|
133+
|| Pa·s | (compound) || Expressed as `Product<Pascal, Second>`. No dedicated named SI unit. |
134+
| **Poise** | P | NonStandard | 1 P = 0.1 Pa·s | CGS unit; often used as centipoise (cP = mPa·s). |
135+
136+
**Implementation notes:**
137+
- Like Torque, DynamicViscosity has no special-name SI unit; it uses `Pa·s`.
138+
- `Poise` implements `INonStandardUnit, IDynamicViscosity` with `ToSi`: `self / 10`.
139+
- In practice, centipoise (cP) is extremely common. With `Poise` defined, `Si<Centi, Poise>()` would not work directly (Poise is non-standard, not metric). Consider also defining a metric `Poiseuille` (= 1 Pa·s) if prefix support is desired, though this name is rarely used.
140+
141+
---
142+
143+
## Summary Table
144+
145+
| Quantity | Named SI Unit | Additional Units | Notes |
146+
|----------|--------------|------------------|-------|
147+
| Torque | — (N·m) | — (lbf·ft, lbf·in) | Compound only; all units are compounds of existing units |
148+
| AngularVelocity | — (rad/s) | — (rev/min, °/s) | Compound only; all units are quotients of existing angle and time units |
149+
| AngularAcceleration | — (rad/s²) || Compound only; analogous to linear acceleration |
150+
| ElectricalConductance | Siemens || Invertible with Ohm |
151+
| Capacitance | Farad || Prefix support critical |
152+
| MagneticFlux | Weber | Maxwell | |
153+
| MagneticFluxDensity | Tesla | Gauss | |
154+
| LuminousFlux | Lumen || |
155+
| Illuminance | Lux | FootCandle | |
156+
| DynamicViscosity | — (Pa·s) | Poise | Compound only |
157+
158+
**Total new unit structs: 10** (6 SI derived + 4 non-standard)
159+
160+
Five units originally planned as discrete structs are now compound-only, as all their components already exist:
161+
- RadianPerSecond → `Quotient<Radian, Second>`
162+
- RadianPerSecondSquared → compound of `Radian` / `Second`²
163+
- RevolutionsPerMinute → `Quotient<Turn, Minute>` (`Turn` exists with representation `"rev"`)
164+
- DegreesPerSecond → `Quotient<Degree, Second>`
165+
- PoundForceFoot → `Product<PoundForce, Foot>`
166+
167+
## File Locations
168+
169+
| Unit | Path |
170+
|------|------|
171+
| Siemens | `Units/Si/Derived/ElectricalConductance/Siemens.ai.cs` |
172+
| Farad | `Units/Si/Derived/Capacitance/Farad.ai.cs` |
173+
| Weber | `Units/Si/Derived/MagneticFlux/Weber.ai.cs` |
174+
| Tesla | `Units/Si/Derived/MagneticFluxDensity/Tesla.ai.cs` |
175+
| Lumen | `Units/Si/Derived/LuminousFlux/Lumen.ai.cs` |
176+
| Lux | `Units/Si/Derived/Illuminance/Lux.ai.cs` |
177+
| Maxwell | `Units/NonStandard/MagneticFlux/Maxwell.ai.cs` |
178+
| Gauss | `Units/NonStandard/MagneticFluxDensity/Gauss.ai.cs` |
179+
| FootCandle | `Units/NonStandard/Illuminance/FootCandle.ai.cs` |
180+
| Poise | `Units/NonStandard/DynamicViscosity/Poise.ai.cs` |

0 commit comments

Comments
 (0)