Skip to content

Add ai generated quantities - #112

Merged
atmoos merged 43 commits into
mainfrom
addAiGeneratedQuantities
Aug 22, 2026
Merged

Add ai generated quantities#112
atmoos merged 43 commits into
mainfrom
addAiGeneratedQuantities

Conversation

@atmoos

@atmoos atmoos commented Mar 30, 2026

Copy link
Copy Markdown
Owner

Add 21 new quantities and 31 new units. See the readme.md files for an exact list. This also includes many new operators that represent physical laws.

Here's an AI generated summary of other changes


Structural Improvements

  • Refactored dimension composition around reusable IMultiplicity, product, quotient, and power constraints, improving compile-time dimensional correctness.
  • Expanded creator APIs so Scalar, Product, Quotient, and Power can be chained with .Times(...) and .Per(...).
  • Reworked dimension equality and hashing to use fully expanded dimensions, avoiding differences caused by non-canonical grouping or outer exponents.
  • Added dedicated dimensionless modelling for angles and solid angles.
  • Added reusable physics-law operator groups for mechanical and electrical relationships.
  • Added AI-generated code conventions, annotations, agent guidance, and corresponding documentation.

Bug Fixes

  • Fixed loss of named dimensionless measures such as radians during arithmetic.
  • Fixed incorrect cancellation of dimensionless measures in division.
  • Fixed inverse exponent handling for dimensions whose declared exponent is positive, such as electrical conductance.
  • Corrected electrical dimension definitions and related creator constraints.
  • Added parser and serialization coverage for newly supported base and derived quantities.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Expands the type-safe quantities library with additional mechanical, electrical, photometric and fluid-dynamic quantities and units.

Changes:

  • Adds 20 quantity types and associated dimensional contracts.
  • Adds SI, metric and non-standard units plus cross-quantity operators.
  • Extends documentation, parsing, serialisation and unit coverage.

Reviewed changes

Copilot reviewed 78 out of 78 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
source/Atmoos.Quantities/readme.md Lists the new quantities.
source/Atmoos.Quantities/Quantities/VolumetricFlowRate.ai.cs Adds volumetric flow rate.
source/Atmoos.Quantities/Quantities/Torque.ai.cs Adds torque.
source/Atmoos.Quantities/Quantities/SpecificEnergy.ai.cs Adds specific energy.
source/Atmoos.Quantities/Quantities/Momentum.ai.cs Adds momentum.
source/Atmoos.Quantities/Quantities/MassFlowRate.ai.cs Adds mass flow rate.
source/Atmoos.Quantities/Quantities/MagneticFluxDensity.ai.cs Adds magnetic flux density.
source/Atmoos.Quantities/Quantities/MagneticFlux.ai.cs Adds magnetic flux.
source/Atmoos.Quantities/Quantities/LuminousIntensity.ai.cs Adds luminous intensity.
source/Atmoos.Quantities/Quantities/LuminousFlux.ai.cs Adds luminous flux.
source/Atmoos.Quantities/Quantities/Impulse.ai.cs Adds impulse.
source/Atmoos.Quantities/Quantities/Illuminance.ai.cs Adds illuminance.
source/Atmoos.Quantities/Quantities/ElectricCharge.ai.cs Adds electric charge.
source/Atmoos.Quantities/Quantities/ElectricalConductance.ai.cs Adds electrical conductance.
source/Atmoos.Quantities/Quantities/DynamicViscosity.ai.cs Adds dynamic viscosity.
source/Atmoos.Quantities/Quantities/Density.ai.cs Adds density.
source/Atmoos.Quantities/Quantities/Capacitance.ai.cs Adds capacitance.
source/Atmoos.Quantities/Quantities/AngularVelocity.ai.cs Adds angular velocity.
source/Atmoos.Quantities/Quantities/AngularAcceleration.ai.cs Adds angular acceleration.
source/Atmoos.Quantities/Quantities/Angle.ai.cs Adds angle.
source/Atmoos.Quantities/Quantities/AmountOfSubstance.ai.cs Adds amount of substance.
source/Atmoos.Quantities/Physics/MechanicalEngineering.cs Adds mechanical, fluid and photometric operators.
source/Atmoos.Quantities/Physics/ElectricalEngineering.cs Adds electrical and magnetic operators.
source/Atmoos.Quantities/Dimensions/Markers.cs Updates marker guidance.
source/Atmoos.Quantities/Dimensions/IDimension.cs Introduces multiplicity contracts.
source/Atmoos.Quantities/Dimensions/ElectricalDimesions.cs Adds electrical dimensions.
source/Atmoos.Quantities/Dimensions/Dimensionless.cs Adds dimensionless angle support.
source/Atmoos.Quantities/Dimensions/DerivedDimensions.cs Adds derived dimensions.
source/Atmoos.Quantities/Dimensions/BaseDimensions.cs Supports new base quantities.
source/Atmoos.Quantities/Creation/Factory.cs Passes factory operands by reference.
source/Atmoos.Quantities/Creation/Creators.cs Enables chained compound measures.
source/Atmoos.Quantities/Core/IFactory.cs Strengthens dimensional constraints.
source/Atmoos.Quantities.Units/Si/Metric/Degree.ai.cs Adds degrees.
source/Atmoos.Quantities.Units/Si/Derived/Radian.ai.cs Adds radians.
source/Atmoos.Quantities.Units/Si/Derived/MagneticFluxDensity/Tesla.ai.cs Adds teslas.
source/Atmoos.Quantities.Units/Si/Derived/MagneticFlux/Weber.ai.cs Adds webers.
source/Atmoos.Quantities.Units/Si/Derived/LuminousFlux/Lumen.ai.cs Adds lumens.
source/Atmoos.Quantities.Units/Si/Derived/Illuminance/Lux.ai.cs Adds lux.
source/Atmoos.Quantities.Units/Si/Derived/ElectricalConductance/Siemens.ai.cs Adds siemens.
source/Atmoos.Quantities.Units/Si/Derived/Coulomb.ai.cs Adds coulombs.
source/Atmoos.Quantities.Units/Si/Derived/Capacitance/Farad.ai.cs Adds farads.
source/Atmoos.Quantities.Units/readme.md Catalogues the new units.
source/Atmoos.Quantities.Units/NonStandard/MagneticFluxDensity/Gauss.ai.cs Adds gauss.
source/Atmoos.Quantities.Units/NonStandard/MagneticFlux/Maxwell.ai.cs Adds maxwell.
source/Atmoos.Quantities.Units/NonStandard/Illuminance/FootCandle.ai.cs Adds foot-candles.
source/Atmoos.Quantities.Units/NonStandard/DynamicViscosity/Poise.ai.cs Adds poise.
source/Atmoos.Quantities.Units/NonStandard/Angle/Turn.ai.cs Adds turns.
source/Atmoos.Quantities.Units/NonStandard/Angle/Gradian.ai.cs Adds gradians.
source/Atmoos.Quantities.Units.Test/VolumetricFlowRateTest.ai.cs Tests flow-rate conversions.
source/Atmoos.Quantities.Units.Test/TorqueTest.ai.cs Tests torque measures.
source/Atmoos.Quantities.Units.Test/Operators/RotationalDynamicsTest.ai.cs Tests torque operators.
source/Atmoos.Quantities.Units.Test/Operators/PhotometryTest.ai.cs Tests photometric operators.
source/Atmoos.Quantities.Units.Test/Operators/KinematicsTest.ai.cs Tests angular kinematics.
source/Atmoos.Quantities.Units.Test/Operators/FluidDynamicsTest.ai.cs Tests fluid-dynamic operators.
source/Atmoos.Quantities.Units.Test/Operators/ElectrodynamicsTest.ai.cs Tests conductance operators.
source/Atmoos.Quantities.Units.Test/Operators/ElectricalEngineeringTest.ai.cs Tests electrical and magnetic laws.
source/Atmoos.Quantities.Units.Test/Operators/DynamicsTest.ai.cs Tests mechanical operators.
source/Atmoos.Quantities.Units.Test/MassFlowRateTest.ai.cs Tests mass flow rate.
source/Atmoos.Quantities.Units.Test/MagneticFluxTest.ai.cs Tests magnetic flux units.
source/Atmoos.Quantities.Units.Test/MagneticFluxDensityTest.ai.cs Tests flux-density units.
source/Atmoos.Quantities.Units.Test/LuminousIntensityTest.ai.cs Tests luminous intensity.
source/Atmoos.Quantities.Units.Test/LuminousFluxTest.ai.cs Tests luminous flux.
source/Atmoos.Quantities.Units.Test/IlluminanceTest.ai.cs Tests illuminance conversions.
source/Atmoos.Quantities.Units.Test/ElectricChargeTest.ai.cs Tests electric charge.
source/Atmoos.Quantities.Units.Test/ElectricalConductanceTest.ai.cs Tests conductance conversions.
source/Atmoos.Quantities.Units.Test/DynamicViscosityTest.ai.cs Tests viscosity conversions.
source/Atmoos.Quantities.Units.Test/DensityTest.ai.cs Tests density conversions.
source/Atmoos.Quantities.Units.Test/CapacitanceTest.ai.cs Tests capacitance conversions.
source/Atmoos.Quantities.Units.Test/AngleTest.ai.cs Tests angular units.
source/Atmoos.Quantities.Units.Test/AmountOfSubstanceTest.ai.cs Tests amount of substance.
source/Atmoos.Quantities.Test/SystemOfQuantitiesTest.cs Tests dimensional definitions.
source/Atmoos.Quantities.Test/Serialization/QuantityFactoryTest.cs Tests new scalar deserialisation.
source/Atmoos.Quantities.Test/Parsing/ModelParserTest.cs Tests parsing new base quantities.
source/Atmoos.Quantities.Test/Dimensions/ToolsTest.cs Updates dimension-interface ordering.
source/Atmoos.Quantities.Test/Core/DimensionConstraintTest.ai.cs Tests generic dimension contracts.
.github/copilot-instructions.md Adds repository domain guidance.
.github/agents/new-unit.agent.md Refines unit-generation guidance.
.github/agents/new-quantity.agent.md Refines quantity change classification.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/Atmoos.Quantities/Physics/MechanicalEngineering.cs Outdated
Comment thread source/Atmoos.Quantities/Physics/ElectricalEngineering.cs Outdated
Comment thread source/Atmoos.Quantities/Dimensions/ElectricalDimesions.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 80 out of 80 changed files in this pull request and generated no new comments.

Suppressed comments (6)

source/Atmoos.Quantities/Creation/Creators.cs:94

  • The newly supported chaining from a Quotient has no tests; no test currently calls .Per(...).Times(...) or .Per(...).Per(...). Add coverage for all four methods, including powered terms, so numerator/denominator placement and conversion scaling are verified.
    source/Atmoos.Quantities/Creation/Creators.cs:121
  • The new Power chaining surface is also untested. Add tests for multiplying and dividing a powered measure by both scalar and powered measures, checking formatting and round-trip conversion; otherwise regressions such as applying an exponent twice would not be detected.
    source/Atmoos.Quantities/Quantities/Capacitance.ai.cs:8
  • ICapacitance is defined as charge per potential, but this quantity only implements the scalar contract. Consequently consumers cannot construct or convert capacitance with the natural C/V composite measure, unlike the other compound quantities added here. Implement IQuotient<Capacitance, ICapacitance, IElectricCharge, IElectricPotential>, add the corresponding Of/To overloads, and cover that representation in the tests.
    source/Atmoos.Quantities/Creation/Creators.cs:69
  • The new chaining behaviour for an existing Product is not exercised by the test suite: there are no chained .Times(...).Times(...) or .Times(...).Per(...) calls. Add tests that verify both the resulting representation and conversion factors, including a powered right-hand term, because errors here affect every higher-order composite measure.

This issue also appears in the following locations of the same file:

  • line 91
  • line 118
    .github/copilot-instructions.md:18
  • Use the adverb “exhaustively” here so the sentence is grammatical.
  - exhaustive lists all quantities

source/Atmoos.Quantities/Physics/MechanicalEngineering.cs:48

  • This and the other newly added operators in the pre-existing Kinematics type are not covered by a type-level AiAttribute, while the angular operators below are annotated individually. Add the required model metadata to each AI-generated public operator (momentum, impulse, torque, specific energy, and their inverse operations) so provenance is not lost.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 81 out of 81 changed files in this pull request and generated 3 comments.

Comment thread source/Atmoos.Quantities/Quantities/ElectricalConductance.ai.cs
Comment thread source/Atmoos.Quantities/Physics/MechanicalEngineering.cs
public interface IDimensionless<TSelf> : IDimension
where TSelf : IDimensionless<TSelf>
{
static Dimension IDimension.D { get; } = Unit.Identity;

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 83 out of 83 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

source/Atmoos.Quantities/Dimensions/Dimensionless.cs:8

  • Making the angle dimension Unit.Identity gives every angle measure an exponent of 0. Measure.Serialize forwards D.E, so radians, degrees and turns serialise with "exponent": 0; QuantityFactory does not support exponent 0 and therefore cannot deserialize them (the same affects angle terms in angular velocity/acceleration). The measure serialisation exponent needs to be decoupled from the physical dimension exponent before exposing this dimensionless quantity.

public interface ISpecificEnergy : IProduct<IEnergy, IDimension<IMass, Negative<One>>>, IMultiplicity<ISpecificEnergy, One>, IDerivedQuantity; // marker interface

[Ai(Model = "GPT", Version = "5.3", Variant = "Codex")]
public interface ILuminousFlux : ILinear<ILuminousFlux>, IDerivedQuantity; // marker interface

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 89 out of 89 changed files in this pull request and generated 2 comments.

Comment thread source/Atmoos.Quantities/Physics/MechanicalEngineering.cs
Comment thread source/Atmoos.Quantities/Measures/Arithmetic.cs Outdated
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
Atmoos.Quantities 85% 76%
Atmoos.Quantities.Units 100% 100%
Atmoos.Quantities.Serialization.Text.Json 98% 82%
Atmoos.Quantities.Serialization.Newtonsoft 99% 89%
Summary 87% (1499 / 1714) 78% (295 / 378)

Minimum allowed line rate is 60%

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 91 out of 91 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

source/Atmoos.Quantities/Measures/Measures.cs:146

  • This multiplies by the underlying dimension exponent even though the comment correctly says it must be divided back out. It only works for the current ±1 cases; an invertible unit whose underlying dimension has magnitude 2 would serialise its first power with exponent 4. Recover the declared measure power by dividing by TSelf.D.E.

Comment thread source/Atmoos.Quantities/Measures/Arithmetic.cs
@atmoos
atmoos merged commit 5eed991 into main Aug 22, 2026
3 checks passed
@atmoos
atmoos deleted the addAiGeneratedQuantities branch August 22, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants