joeyame / Model-Based-Sim-Framework

This is a simulation framework I have created to try and determine what an effective model-based simulation framework might look like in the modern era of programming.
MIT License
1 stars 0 forks source link

Initial Cut of Unit-Aware Value System ( Length ) #5

Open joeyame opened 2 years ago

joeyame commented 2 years ago

Part of making a good, easy to use sim framework mandates a physical value-tracking system that ensures unit-safe operations.

Such a system should have 3 properties (for now just assume length):

  1. Lengths can be added, subtracted from each other.
  2. Lengths can be scaled by a given unitless factor.
  3. Trying to multiply lengths together causes an error ( no Area types exist yet )
  4. We can pull any length unit out of a Length object and it will automatically convert as needed (1m.get(feet) == 3.28084)
joeyame commented 2 years ago

Investigate:

  1. https://crates.io/crates/quantities
  2. https://crates.io/crates/fts_units
  3. https://crates.io/crates/dimensioned

These libraries either provide their own units, or give devs the ability to define their own.