-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestModule.py
More file actions
31 lines (26 loc) · 1.09 KB
/
Copy pathTestModule.py
File metadata and controls
31 lines (26 loc) · 1.09 KB
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
29
30
31
import PQR_optimizer
import opt_config
PQRs = {} #empty dictionary of PQRs
for system in opt_config.systems.keys():
try:
iters = 5
max_iters = 8
REDOpt = 0
redMargin = 5
tagetRED = 35
while not ((tagetRED-redMargin) <= REDOpt <= (tagetRED + redMargin)) and (iters < max_iters):
xOpt, REDOpt, PQROpt = PQR_optimizer.optimize(System=system,
targetRED=tagetRED,redMargin=redMargin,
iters=iters)
print('Iterations = ',iters) # Debug print
print(f'for system {system} the calculated RED is {REDOpt}')
iters += 1
if iters == max_iters:
raise Exception("not converging good enough")
PQRs[system] = round(PQROpt,1)
print(system,'',round(PQROpt,1))
print(system,'',round(REDOpt,1))
except:
print('Solution not found for ',system)
for system in sorted(PQRs, key=PQRs.get):
print(f'In system {system}, PQR = {PQRs[system]}[W/(m³/h)]')