Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnitValues

Define the type. Define the quality.
Make numerical meaning explicit before computation begins.

Overview

Version License DSL

UnitValues is a set of two domain-specific languages that encode dimensional quantities as types. The first language, .ut, defines units from fundamental dimensions. The second, .uiv, imports .ut and uses those constructs to encode numerical quantities across integers, floats, arrays, and complex numbers.

Language specification for .ut and .uiv can be found within language.pdf


Implementation

UnitValues is implemented by PicoUnits.
You can try the language today by installing PicoUnits:

pip install PicoUnits

Example

Both are dimensionally aware formats: .ut defines custom units, while .uiv encodes quantities as:

attribute: value prefix(unit)

.ut

# Example Units - Derived from Fundamental Dimensions (kg, m, s, A, etc.)
[version]
format: 0.1.0
 
[units]
# name: unit
p: kg*m^-1*s^-2                       # Defines the unit for pressure (Pascal)
V: kg*m^2*s^-3*A^-1                   # Defines the unit for voltage

The fundamental unit semantics and prefixes (kg, m, s, A, etc.) & (u, m, k, M, etc.) is defined by the runtime environment.

.uiv

[version]
format: 0.1.2
unit_frame: units.ut

[model]
# name: value prefix(unit)
num_samples: 100                        # Implicitly dimensionless
sample_size: 10         (∅)             # Explicitly dimensionless
output_energy: 1.0      (kg*m^2*s^-2)   # Defines unit via construction
output_signal: 5.0      (V)             # Defined unit `V` for voltage
inlet_pressure: 101     k(p)            # Defined unit `p` for pressure with kilo prefix

Local Installation

To install the extension locally for Visual Studio Code:

From the Marketplace: VS Code Marketplace


Manual Installation

To install the UnitValues extension manually for Visual Studio Code:

Windows

npx @vscode/vsce package
code --install-extension .\UnitValues-0.0.3.vsix --force

MacOS/Linux

npx @vscode/vsce package
code --install-extension ./uiv-0.0.3.vsix --force

Documentation

For internal documentation, credits, and contributors, see docs.


About

A Typed Language For Dimensional Numerical Quantities.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors