How to use input_value method in Playwright Python

Best Python code snippet using playwright-python

Run Playwright Python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

prepare_slave_param_csv_vtest2.py

Source: prepare_slave_param_csv_vtest2.py Github

copy
1##This function writes the parameters and master decision variables into a csv file for the slave to read
2
3def prepare_slave_param_csv_vtest2 (var_converted, demand, weather_data, piecewise_steps):
4
5    ##var_converted     --- essentially just the master decision variables 
6    ##demand            --- demand data 
7    ##weather_data      --- weather data 
8    ##piecewise_steps   --- the piecewise linear steps
9    
10    mdv_slave_param = nwk_choice_3_mdv (var_converted, demand, weather_data, piecewise_steps)
11        
12    return mdv_slave_param
13
14############################################################################################################################################################################
15############################################################################################################################################################################
16############################################################################################################################################################################
17##Additional functions 
18
19##A function to prepare the return values if the network choice is 3
20def nwk_choice_3_mdv (var_converted, demand, weather_and_ct_coeff, piecewise_steps):
21
22    ##var_converted     --- essentially just the master decision variables 
23    ##demand            --- demand data 
24    ##weather_data      --- weather data 
25    ##piecewise_steps   --- the piecewise linear steps
26    
27    import pandas as pd
28  
29    ##Initiate dataframe to hold the written values 
30    mdv_slave_param = pd.DataFrame(columns = ['Name', 'Value', 'Unit'])
31    
32    ##############################################################################################################
33    ##chiller_evap_flow_consol_4nc    
34    input_value = {}
35    input_value['Name'] = 'chiller_evap_flow_consol_4nc_tenwkflow' 
36    input_value['Value'] = var_converted[1]
37    input_value['Unit'] = 'm3/h'
38    
39    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
40    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
41    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)              
42    
43    ##############################################################################################################    
44    ##chiller_ret_4nc
45    input_value = {}
46    input_value['Name'] = 'chiller_ret_4nc_etret' 
47    input_value['Value'] = var_converted[0]
48    input_value['Unit'] = 'K'
49    
50    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
51    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
52    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
53    
54    ##############################################################################################################
55    ##chiller1_evap_4nc    
56    input_value = {}
57    input_value['Name'] = 'chiller1_evap_4nc_etret' 
58    input_value['Value'] = var_converted[0]
59    input_value['Unit'] = 'K'
60    
61    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
62    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
63    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)    
64    
65    input_value = {}
66    input_value['Name'] = 'chiller1_evap_4nc_ctin' 
67    input_value['Value'] = var_converted[2]
68    input_value['Unit'] = 'K'
69    
70    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
71    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
72    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)      
73    
74    input_value = {}
75    input_value['Name'] = 'chiller1_evap_4nc_tenwkflow' 
76    input_value['Value'] = var_converted[1]
77    input_value['Unit'] = 'm3/h'
78    
79    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
80    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
81    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
82    
83    input_value = {}
84    input_value['Name'] = 'chiller1_evap_4nc_piecewise_steps' 
85    input_value['Value'] = piecewise_steps
86    input_value['Unit'] = '-'
87    
88    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
89    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
90    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
91    
92    ##############################################################################################################    
93    ##chiller1_evap_nwk_4nc
94    input_value = {}
95    input_value['Name'] = 'chiller1_evap_nwk_4nc_piecewise_steps' 
96    input_value['Value'] = piecewise_steps
97    input_value['Unit'] = '-'
98    
99    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
100    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
101    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
102
103    input_value = {}
104    input_value['Name'] = 'chiller1_evap_nwk_4nc_tenwkflow' 
105    input_value['Value'] = var_converted[1]
106    input_value['Unit'] = 'm3/h'
107    
108    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
109    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
110    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)
111
112    ##############################################################################################################
113    ##chiller1_evap_pump_4nc        
114    input_value = {}
115    input_value['Name'] = 'chiller1_evap_pump_4nc_piecewise_steps' 
116    input_value['Value'] = piecewise_steps
117    input_value['Unit'] = '-'
118    
119    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
120    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
121    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)    
122    
123    ##############################################################################################################    
124    ##chiller2_evap_4nc
125    input_value = {}
126    input_value['Name'] = 'chiller2_evap_4nc_etret' 
127    input_value['Value'] = var_converted[0]
128    input_value['Unit'] = 'K'
129    
130    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
131    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
132    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
133
134    input_value = {}
135    input_value['Name'] = 'chiller2_evap_4nc_ctin' 
136    input_value['Value'] = var_converted[2]
137    input_value['Unit'] = 'K'
138    
139    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
140    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
141    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)      
142    
143    input_value = {}
144    input_value['Name'] = 'chiller2_evap_4nc_tenwkflow' 
145    input_value['Value'] = var_converted[1]
146    input_value['Unit'] = 'm3/h'
147    
148    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
149    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
150    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
151    
152    input_value = {}
153    input_value['Name'] = 'chiller2_evap_4nc_piecewise_steps' 
154    input_value['Value'] = piecewise_steps
155    input_value['Unit'] = '-'
156    
157    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
158    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
159    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
160    
161    ##############################################################################################################    
162    ##chiller2_evap_nwk_4nc
163    input_value = {}
164    input_value['Name'] = 'chiller2_evap_nwk_4nc_piecewise_steps' 
165    input_value['Value'] = piecewise_steps
166    input_value['Unit'] = '-'
167    
168    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
169    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
170    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
171
172    input_value = {}
173    input_value['Name'] = 'chiller2_evap_nwk_4nc_tenwkflow' 
174    input_value['Value'] = var_converted[1]
175    input_value['Unit'] = 'm3/h'
176    
177    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
178    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
179    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)
180    
181    ##############################################################################################################
182    ##chiller2_evap_pump_4nc        
183    input_value = {}
184    input_value['Name'] = 'chiller2_evap_pump_4nc_piecewise_steps' 
185    input_value['Value'] = piecewise_steps
186    input_value['Unit'] = '-'
187    
188    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
189    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
190    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)        
191    
192    ##############################################################################################################    
193    ##chiller3_evap_4nc
194    input_value = {}
195    input_value['Name'] = 'chiller3_evap_4nc_etret' 
196    input_value['Value'] = var_converted[0]
197    input_value['Unit'] = 'K'
198    
199    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
200    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
201    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
202
203    input_value = {}
204    input_value['Name'] = 'chiller3_evap_4nc_ctin' 
205    input_value['Value'] = var_converted[2]
206    input_value['Unit'] = 'K'
207    
208    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
209    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
210    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)      
211    
212    input_value = {}
213    input_value['Name'] = 'chiller3_evap_4nc_tenwkflow' 
214    input_value['Value'] = var_converted[1]
215    input_value['Unit'] = 'm3/h'
216    
217    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
218    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
219    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
220    
221    input_value = {}
222    input_value['Name'] = 'chiller3_evap_4nc_piecewise_steps' 
223    input_value['Value'] = piecewise_steps
224    input_value['Unit'] = '-'
225    
226    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
227    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
228    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
229    
230    ##############################################################################################################    
231    ##chiller3_evap_nwk_4nc
232    input_value = {}
233    input_value['Name'] = 'chiller3_evap_nwk_4nc_piecewise_steps' 
234    input_value['Value'] = piecewise_steps
235    input_value['Unit'] = '-'
236    
237    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
238    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
239    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
240
241    input_value = {}
242    input_value['Name'] = 'chiller3_evap_nwk_4nc_tenwkflow' 
243    input_value['Value'] = var_converted[1]
244    input_value['Unit'] = 'm3/h'
245    
246    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
247    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
248    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)
249    
250    ##############################################################################################################
251    ##chiller3_evap_pump_4nc        
252    input_value = {}
253    input_value['Name'] = 'chiller3_evap_pump_4nc_piecewise_steps' 
254    input_value['Value'] = piecewise_steps
255    input_value['Unit'] = '-'
256    
257    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
258    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
259    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)
260    
261    ##############################################################################################################
262    ##cp_nwk_4nc    
263    input_value = {}
264    input_value['Name'] = 'cp_nwk_4nc_tenwkflow' 
265    input_value['Value'] = var_converted[1]
266    input_value['Unit'] = 'm3/h'
267    
268    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
269    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
270    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)    
271    
272    ##############################################################################################################
273    ##dist_nwk_pump_4nc    
274    input_value = {}
275    input_value['Name'] = 'dist_nwk_pump_4nc_nwk_choice' 
276    input_value['Value'] = 3
277    input_value['Unit'] = '-'
278    
279    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
280    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
281    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)       
282    
283    input_value = {}
284    input_value['Name'] = 'dist_nwk_pump_4nc_piecewise_steps' 
285    input_value['Value'] = piecewise_steps
286    input_value['Unit'] = '-'
287    
288    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
289    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
290    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
291    
292    ##############################################################################################################
293    ##gv2_nwk_4nc   
294    input_value = {}
295    input_value['Name'] = 'gv2_nwk_4nc_piecewise_steps' 
296    input_value['Value'] = piecewise_steps
297    input_value['Unit'] = '-'
298    
299    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
300    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
301    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
302    
303    input_value = {}
304    input_value['Name'] = 'gv2_nwk_4nc_tenwkflow' 
305    input_value['Value'] = var_converted[1]
306    input_value['Unit'] = 'm3/h'
307    
308    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
309    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
310    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)  
311
312    ##############################################################################################################
313    ##gv2_substation_4nc  
314    input_value = {}
315    input_value['Name'] = 'gv2_substation_4nc_demand' 
316    input_value['Value'] = demand['ss_gv2_demand'][0]
317    input_value['Unit'] = 'kWh'
318    
319    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
320    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
321    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
322
323    input_value = {}
324    input_value['Name'] = 'gv2_substation_4nc_tenwkflow' 
325    input_value['Value'] = var_converted[1]
326    input_value['Unit'] = 'm3/h'
327    
328    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
329    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
330    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
331
332    ##############################################################################################################
333    ##hsb_nwk_4nc   
334    input_value = {}
335    input_value['Name'] = 'hsb_nwk_4nc_piecewise_steps' 
336    input_value['Value'] = piecewise_steps
337    input_value['Unit'] = '-'
338    
339    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
340    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
341    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
342    
343    input_value = {}
344    input_value['Name'] = 'hsb_nwk_4nc_tenwkflow' 
345    input_value['Value'] = var_converted[1]
346    input_value['Unit'] = 'm3/h'
347    
348    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
349    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
350    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)  
351
352    ##############################################################################################################
353    ##hsb_substation_4nc  
354    input_value = {}
355    input_value['Name'] = 'hsb_substation_4nc_demand' 
356    input_value['Value'] = demand['ss_hsb_demand'][0]
357    input_value['Unit'] = 'kWh'
358    
359    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
360    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
361    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
362
363    input_value = {}
364    input_value['Name'] = 'hsb_substation_4nc_tenwkflow' 
365    input_value['Value'] = var_converted[1]
366    input_value['Unit'] = 'm3/h'
367    
368    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
369    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
370    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
371
372    ##############################################################################################################
373    ##ice_nwk_4nc   
374    input_value = {}
375    input_value['Name'] = 'ice_nwk_4nc_piecewise_steps' 
376    input_value['Value'] = piecewise_steps
377    input_value['Unit'] = '-'
378    
379    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
380    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
381    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
382    
383    input_value = {}
384    input_value['Name'] = 'ice_nwk_4nc_tenwkflow' 
385    input_value['Value'] = var_converted[1]
386    input_value['Unit'] = 'm3/h'
387    
388    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
389    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
390    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
391    
392    ##############################################################################################################
393    ##pfa_nwk_4nc   
394    input_value = {}
395    input_value['Name'] = 'pfa_nwk_4nc_piecewise_steps' 
396    input_value['Value'] = piecewise_steps
397    input_value['Unit'] = '-'
398    
399    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
400    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
401    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
402    
403    input_value = {}
404    input_value['Name'] = 'pfa_nwk_4nc_tenwkflow' 
405    input_value['Value'] = var_converted[1]
406    input_value['Unit'] = 'm3/h'
407    
408    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
409    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
410    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)  
411
412    ##############################################################################################################
413    ##pfa_substation_4nc  
414    input_value = {}
415    input_value['Name'] = 'pfa_substation_4nc_demand' 
416    input_value['Value'] = demand['ss_pfa_demand'][0]
417    input_value['Unit'] = 'kWh'
418    
419    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
420    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
421    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
422
423    input_value = {}
424    input_value['Name'] = 'pfa_substation_4nc_tenwkflow' 
425    input_value['Value'] = var_converted[1]
426    input_value['Unit'] = 'm3/h'
427    
428    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
429    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
430    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
431    
432    ##############################################################################################################
433    ##ser_nwk_4nc   
434    input_value = {}
435    input_value['Name'] = 'ser_nwk_4nc_piecewise_steps' 
436    input_value['Value'] = piecewise_steps
437    input_value['Unit'] = '-'
438    
439    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
440    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
441    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
442    
443    input_value = {}
444    input_value['Name'] = 'ser_nwk_4nc_tenwkflow' 
445    input_value['Value'] = var_converted[1]
446    input_value['Unit'] = 'm3/h'
447    
448    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
449    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
450    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)  
451
452    ##############################################################################################################
453    ##ser_substation_4nc  
454    input_value = {}
455    input_value['Name'] = 'ser_substation_4nc_demand' 
456    input_value['Value'] = demand['ss_ser_demand'][0]
457    input_value['Unit'] = 'kWh'
458    
459    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
460    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
461    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True) 
462
463    input_value = {}
464    input_value['Name'] = 'ser_substation_4nc_tenwkflow' 
465    input_value['Value'] = var_converted[1]
466    input_value['Unit'] = 'm3/h'
467    
468    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
469    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
470    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)    
471    
472    ##############################################################################################################
473    ##tro_nwk_4nc   
474    input_value = {}
475    input_value['Name'] = 'tro_nwk_4nc_piecewise_steps' 
476    input_value['Value'] = piecewise_steps
477    input_value['Unit'] = '-'
478    
479    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
480    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
481    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)     
482    
483    input_value = {}
484    input_value['Name'] = 'tro_nwk_4nc_tenwkflow' 
485    input_value['Value'] = var_converted[1]
486    input_value['Unit'] = 'm3/h'
487    
488    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
489    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
490    mdv_slave_param = mdv_slave_param.append(temp_df, ignore_index=True)
491         
492    return mdv_slave_param
493 
494
Full Screen

mrs_manual_edit.py

Source: mrs_manual_edit.py Github

copy
1##This script contains functions which need to be manually edited for the solver to run 
2
3##This function takes in manual inputs from the used to build the parameters for the MILP solver 
4def mrs_manual_edit_milp_param (cooling_load_data, weather_condition, ga_inputs, piecewise_linear_steps):
5    
6    ##cooling_load_data                 --- the associated cooling load data 
7    ##weather_condition                 --- the associated weather condition
8    ##ga_inputs                         --- inputs from the genetic algorithm
9    ##piecewise_linear_steps            --- the number of pieces used to linearize the models 
10
11    import pandas as pd 
12    
13    ##Manually some input parameters  
14    cond_temp = weather_condition['T_WB'][0] + 5 + 273.15                   ##Just an assumption for the condenser temperature 
15    
16    ##Initiate a dataframe to hold values 
17    milp_param = pd.DataFrame(columns = ['Name', 'Value', 'Unit'])
18    
19    ##############################################################################################################
20    ##chiller_evap_flow_consol    
21    input_value = {}
22    input_value['Name'] = 'chiller_evap_flow_consol_tenwkflow'                      ##Name of the parameter format = <model name>_<parameter name>
23    input_value['Value'] = ga_inputs['evap_flow'][0]                                ##Value of the parameter
24    input_value['Unit'] = 'm3/h'                                                    ##Units of the parameter
25    
26    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
27    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
28    milp_param = milp_param.append(temp_df, ignore_index=True)       
29    
30    ##############################################################################################################    
31    ##chiller_ret
32    input_value = {}
33    input_value['Name'] = 'chiller_ret_etret' 
34    input_value['Value'] = ga_inputs['tin_evap'][0]
35    input_value['Unit'] = 'K'
36    
37    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
38    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
39    milp_param = milp_param.append(temp_df, ignore_index=True)  
40       
41    ##############################################################################################################
42    ##chiller1_evap    
43    input_value = {}
44    input_value['Name'] = 'chiller1_evap_etret' 
45    input_value['Value'] = ga_inputs['tin_evap'][0]
46    input_value['Unit'] = 'K'
47    
48    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
49    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
50    milp_param = milp_param.append(temp_df, ignore_index=True)    
51    
52    input_value = {}
53    input_value['Name'] = 'chiller1_evap_ctin' 
54    input_value['Value'] = cond_temp
55    input_value['Unit'] = 'K'
56    
57    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
58    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
59    milp_param = milp_param.append(temp_df, ignore_index=True)      
60    
61    input_value = {}
62    input_value['Name'] = 'chiller1_evap_tenwkflow' 
63    input_value['Value'] = ga_inputs['evap_flow'][0]
64    input_value['Unit'] = 'm3/h'
65    
66    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
67    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
68    milp_param = milp_param.append(temp_df, ignore_index=True)     
69    
70    input_value = {}
71    input_value['Name'] = 'chiller1_evap_piecewise_steps' 
72    input_value['Value'] = piecewise_linear_steps
73    input_value['Unit'] = '-'
74    
75    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
76    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
77    milp_param = milp_param.append(temp_df, ignore_index=True)   
78    
79    ##############################################################################################################    
80    ##chiller1_evap_nwk
81    input_value = {}
82    input_value['Name'] = 'chiller1_evap_nwk_piecewise_steps' 
83    input_value['Value'] = piecewise_linear_steps
84    input_value['Unit'] = '-'
85    
86    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
87    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
88    milp_param = milp_param.append(temp_df, ignore_index=True) 
89
90    input_value = {}
91    input_value['Name'] = 'chiller1_evap_nwk_tenwkflow' 
92    input_value['Value'] = ga_inputs['evap_flow'][0]
93    input_value['Unit'] = 'm3/h'
94    
95    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
96    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
97    milp_param = milp_param.append(temp_df, ignore_index=True)
98
99    ##############################################################################################################
100    ##chiller1_evap_pump       
101    input_value = {}
102    input_value['Name'] = 'chiller1_evap_pump_piecewise_steps' 
103    input_value['Value'] = piecewise_linear_steps
104    input_value['Unit'] = '-'
105    
106    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
107    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
108    milp_param = milp_param.append(temp_df, ignore_index=True)    
109
110    ##############################################################################################################    
111    ##chiller2_evap
112    input_value = {}
113    input_value['Name'] = 'chiller2_evap_etret' 
114    input_value['Value'] = ga_inputs['tin_evap'][0]
115    input_value['Unit'] = 'K'
116    
117    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
118    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
119    milp_param = milp_param.append(temp_df, ignore_index=True) 
120
121    input_value = {}
122    input_value['Name'] = 'chiller2_evap_ctin' 
123    input_value['Value'] = cond_temp
124    input_value['Unit'] = 'K'
125    
126    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
127    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
128    milp_param = milp_param.append(temp_df, ignore_index=True)      
129    
130    input_value = {}
131    input_value['Name'] = 'chiller2_evap_tenwkflow' 
132    input_value['Value'] = ga_inputs['evap_flow'][0]
133    input_value['Unit'] = 'm3/h'
134    
135    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
136    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
137    milp_param = milp_param.append(temp_df, ignore_index=True)     
138    
139    input_value = {}
140    input_value['Name'] = 'chiller2_evap_piecewise_steps' 
141    input_value['Value'] = piecewise_linear_steps
142    input_value['Unit'] = '-'
143    
144    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
145    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
146    milp_param = milp_param.append(temp_df, ignore_index=True) 
147
148    ##############################################################################################################    
149    ##chiller2_evap_nwk
150    input_value = {}
151    input_value['Name'] = 'chiller2_evap_nwk_piecewise_steps' 
152    input_value['Value'] = piecewise_linear_steps
153    input_value['Unit'] = '-'
154    
155    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
156    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
157    milp_param = milp_param.append(temp_df, ignore_index=True) 
158
159    input_value = {}
160    input_value['Name'] = 'chiller2_evap_nwk_tenwkflow' 
161    input_value['Value'] = ga_inputs['evap_flow'][0]
162    input_value['Unit'] = 'm3/h'
163    
164    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
165    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
166    milp_param = milp_param.append(temp_df, ignore_index=True)    
167    
168    ##############################################################################################################
169    ##chiller2_evap_pump       
170    input_value = {}
171    input_value['Name'] = 'chiller2_evap_pump_piecewise_steps' 
172    input_value['Value'] = piecewise_linear_steps
173    input_value['Unit'] = '-'
174    
175    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
176    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
177    milp_param = milp_param.append(temp_df, ignore_index=True) 
178    
179    ##############################################################################################################
180    ##cp_nwk    
181    input_value = {}
182    input_value['Name'] = 'cp_nwk_tenwkflow' 
183    input_value['Value'] = ga_inputs['evap_flow'][0]
184    input_value['Unit'] = 'm3/h'
185    
186    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
187    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
188    milp_param = milp_param.append(temp_df, ignore_index=True)   
189    
190    ##############################################################################################################
191    ##dist_nwk_pump  
192    input_value = {}
193    input_value['Name'] = 'dist_nwk_pump_choice'              ##There are 2 pumps to choose from pump 0 and pump 1
194    input_value['Value'] = 0
195    input_value['Unit'] = '-'
196    
197    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
198    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
199    milp_param = milp_param.append(temp_df, ignore_index=True)       
200    
201    input_value = {}
202    input_value['Name'] = 'dist_nwk_pump_piecewise_steps' 
203    input_value['Value'] = piecewise_linear_steps
204    input_value['Unit'] = '-'
205    
206    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
207    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
208    milp_param = milp_param.append(temp_df, ignore_index=True)  
209    
210    ##############################################################################################################
211    ##gv2_nwk   
212    input_value = {}
213    input_value['Name'] = 'gv2_nwk_piecewise_steps' 
214    input_value['Value'] = piecewise_linear_steps
215    input_value['Unit'] = '-'
216    
217    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
218    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
219    milp_param = milp_param.append(temp_df, ignore_index=True)     
220    
221    input_value = {}
222    input_value['Name'] = 'gv2_nwk_tenwkflow' 
223    input_value['Value'] = ga_inputs['evap_flow'][0]
224    input_value['Unit'] = 'm3/h'
225    
226    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
227    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
228    milp_param = milp_param.append(temp_df, ignore_index=True)  
229
230    ##############################################################################################################
231    ##gv2_substation
232    input_value = {}
233    input_value['Name'] = 'gv2_substation_demand' 
234    input_value['Value'] = cooling_load_data['gv2_ss'][0]
235    input_value['Unit'] = 'kWh'
236    
237    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
238    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
239    milp_param = milp_param.append(temp_df, ignore_index=True) 
240
241    input_value = {}
242    input_value['Name'] = 'gv2_substation_tenwkflow' 
243    input_value['Value'] = ga_inputs['evap_flow'][0]
244    input_value['Unit'] = 'm3/h'
245    
246    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
247    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
248    milp_param = milp_param.append(temp_df, ignore_index=True) 
249    
250    ##############################################################################################################
251    ##hsb_nwk 
252    input_value = {}
253    input_value['Name'] = 'hsb_nwk_piecewise_steps' 
254    input_value['Value'] = piecewise_linear_steps
255    input_value['Unit'] = '-'
256    
257    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
258    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
259    milp_param = milp_param.append(temp_df, ignore_index=True)     
260    
261    input_value = {}
262    input_value['Name'] = 'hsb_nwk_tenwkflow' 
263    input_value['Value'] = ga_inputs['evap_flow'][0]
264    input_value['Unit'] = 'm3/h'
265    
266    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
267    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
268    milp_param = milp_param.append(temp_df, ignore_index=True)      
269    
270    ##############################################################################################################
271    ##hsb_substation  
272    input_value = {}
273    input_value['Name'] = 'hsb_substation_demand' 
274    input_value['Value'] = cooling_load_data['hsb_ss'][0]
275    input_value['Unit'] = 'kWh'
276    
277    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
278    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
279    milp_param = milp_param.append(temp_df, ignore_index=True) 
280
281    input_value = {}
282    input_value['Name'] = 'hsb_substation_tenwkflow' 
283    input_value['Value'] = ga_inputs['evap_flow'][0]
284    input_value['Unit'] = 'm3/h'
285    
286    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
287    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
288    milp_param = milp_param.append(temp_df, ignore_index=True) 
289
290    ##############################################################################################################
291    ##ice_nwk 
292    input_value = {}
293    input_value['Name'] = 'ice_nwk_piecewise_steps' 
294    input_value['Value'] = piecewise_linear_steps
295    input_value['Unit'] = '-'
296    
297    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
298    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
299    milp_param = milp_param.append(temp_df, ignore_index=True)     
300    
301    input_value = {}
302    input_value['Name'] = 'ice_nwk_tenwkflow' 
303    input_value['Value'] = ga_inputs['evap_flow'][0]
304    input_value['Unit'] = 'm3/h'
305    
306    temp_values = [input_value['Name'], input_value['Value'], input_value['Unit']]
307    temp_df = pd.DataFrame(data = [temp_values], columns = ['Name', 'Value', 'Unit'])
308    milp_param = milp_param.append(temp_df, ignore_index=True) 
309
310    return milp_param
Full Screen

[C]015.py

Source: [C]015.py Github

copy
1# N 각 영수증의 수
2N = int(input())
3
4input_value = []
5for i in range(0, N):
6    input_value.append(input().split(" "))
7    
8
9point = 0
10for i in range(0, len(input_value)):
11    # if(list(input_value[i][0])[-1] == 3 or list(input_value[i][0])[-1] == 5):
12        # point += int( int(input_value[i][1]) / (100 * list(input_value[i][0])[-1]))
13    if "3" in list(input_value[i][0]):
14        # print("3")
15        point += int( int(input_value[i][1]) * 3 / 100)
16    elif "5" in list(input_value[i][0]):
17        # print("5")
18        point += int( int(input_value[i][1]) * 5 / 100)
19    else:
20        # print("else", int( int(input_value[i][1]) / 100))
21        point += int( int(input_value[i][1]) / 100)
22
23print(point)
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run Python Tests on LambdaTest Cloud Grid

Execute automation tests with Playwright Python on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)