fork/numbat

git clone https://git.julia.blue/fork/numbat

David PeterAdd examples to the documentatione157883

v1.6.1
610 B24 linesraw
1# This script shows how to set up practical units for
2# doing workhour and employee-count computations.
3
4@aliases(workhours)
5unit workhour
6
7@aliases(workdays)
8unit workday = 8 workhours
9
10@aliases(workyears)
11unit workyear = 200 workdays
12
13unit FTE = 1 workyear per year
14
15let rate = 1000 € / workday
16print(0.5 million € / rate)
17assert_eq(0.5 million € / rate, 500 workday)
18
19let budget = 0.5 million €
20let duration = 0.5 year
21print(3 FTE * 0.5 years -> workdays)
22print(budget / rate / duration -> FTE)
23assert_eq(3 FTE * 0.5 years -> workdays, 300 workday)
24assert_eq(budget / rate / duration -> FTE, 5 FTE)