forked from pocon/pyCocomo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcocomo.py
28 lines (24 loc) · 801 Bytes
/
cocomo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import math
def cocomo(sloc, project_class='O', eaf=1):
''' COCOMO II analysis based on: http://en.wikipedia.org/wiki/COCOMO '''
coefficients = {
'O': {'a': 2.4,
'b': 1.05,
'c': 2.5,
'd': 0.38,
},
'S': {'a': 3.0,
'b': 1.12,
'c': 2.5,
'd': 0.35,
},
'E': {'a': 3.6,
'b': 1.20,
'c': 2.5,
'd': 0.32,
},
}
result = {'E': coefficients[project_class]['a'] * math.pow(sloc/1000.0, coefficients[project_class]['b']) * eaf}
result['D'] = coefficients[project_class]['c'] * math.pow(result['E'], coefficients[project_class]['d'])
result['P'] = result['E'] / result['D']
return result