fib-international / structuralcodes

A Python library for structural engineering calculations
https://fib-international.github.io/structuralcodes/
Apache License 2.0
86 stars 22 forks source link

Make units consistent #105

Open mortenengen opened 4 months ago

mortenengen commented 4 months ago

For the moment, the units in e.g. sections, constitutive laws and code equations, are not consistent. This means that the user could input e.g. MPa for stresses, and kN for forces, without any guarantee that an infered value will have meaningful unit. We should explore options for handling this.

There are several options, including:

  1. Not at all handling units, and letting it be up to the user to provide input in consistent units, and make sure that whenever unit dependent methods are implemented, the required unit is specified in the docstring.
  2. We could set a global set of units that the user can adjust, expect that the user inputs values that are consistent with this set of units, and whenever a conversion is needed, this is performed automatically based on the globally set units.
  3. We could set a global set of units like above, and all default values of input with units are handled automatically, such that in all calculations we are sure that the units are consistent, and that the result will have a consistent unit.

At least options 2 and 3 could required that we adapt some of the implemented design code equations to be compatible.