@@ -4548,12 +4548,20 @@ def style_it(sheet, row, col_start, col_end, fill_color="FFFF00"):
4548
4548
platform_sheet .merge_cells (start_row = 1 , start_column = 4 , end_row = 2 , end_column = 4 )
4549
4549
platform_sheet .merge_cells (start_row = 1 , start_column = 5 , end_row = 2 , end_column = 5 )
4550
4550
excMax = float ('-inf' )
4551
- surgeMax = float ('-inf' )
4552
- swayMax = float ('-inf' )
4553
- rollMax = float ('-inf' )
4554
- pitchMax = float ('-inf' )
4555
- nacAccMax = float ('-inf' )
4556
- twrBendMax = float ('-inf' )
4551
+ avg_surgeMax = float ('-inf' )
4552
+ avg_swayMax = float ('-inf' )
4553
+ avg_rollMax = float ('-inf' )
4554
+ avg_pitchMax = float ('-inf' )
4555
+ avg_nacAccMax = float ('-inf' )
4556
+ avg_twrBendMax = float ('-inf' )
4557
+
4558
+ std_surgeMax = float ('-inf' )
4559
+ std_swayMax = float ('-inf' )
4560
+ std_rollMax = float ('-inf' )
4561
+ std_pitchMax = float ('-inf' )
4562
+ std_nacAccMax = float ('-inf' )
4563
+ std_twrBendMax = float ('-inf' )
4564
+
4557
4565
for pf in self .platformList .values ():
4558
4566
depth_at_pf = self .getDepthAtLocation (pf .r [0 ], pf .r [1 ])
4559
4567
if hasattr (pf , 'raftResults' ):
@@ -4576,9 +4584,13 @@ def style_it(sheet, row, col_start, col_end, fill_color="FFFF00"):
4576
4584
round (pf .raftResults [iCase ]['AxRNA_std' ][0 ], 3 ), round (pf .raftResults [iCase ]['Mbase_std' ][0 ]/ 1e3 , 3 )]) #, round(pf.raftResults[iCase]['omega_avg'][0], 3), round(pf.raftResults[iCase]['torque_avg'][0], 3), round(pf.raftResults[iCase]['power_avg'][0]*1e-6, 3)])
4577
4585
# Update min and max values
4578
4586
excMax = max (excMax , np .sqrt (pf .raftResults [iCase ]['surge_avg' ]** 2 + pf .raftResults [iCase ]['sway_avg' ]** 2 ))
4579
- surgeMax = max (surgeMax , abs (pf .raftResults [iCase ]['surge_avg' ])); swayMax = max (swayMax , abs (pf .raftResults [iCase ]['sway_avg' ]))
4580
- rollMax = max (rollMax , abs (pf .raftResults [iCase ]['roll_avg' ])); pitchMax = max (pitchMax , abs (pf .raftResults [iCase ]['pitch_avg' ]))
4581
- nacAccMax = max (nacAccMax , abs (pf .raftResults [iCase ]['AxRNA_avg' ][0 ])); twrBendMax = max (twrBendMax , abs (pf .raftResults [iCase ]['Mbase_avg' ][0 ]/ 1e3 ))
4587
+ avg_surgeMax = max (avg_surgeMax , abs (pf .raftResults [iCase ]['surge_avg' ])); avg_swayMax = max (avg_swayMax , abs (pf .raftResults [iCase ]['sway_avg' ]))
4588
+ avg_rollMax = max (avg_rollMax , abs (pf .raftResults [iCase ]['roll_avg' ])); avg_pitchMax = max (avg_pitchMax , abs (pf .raftResults [iCase ]['pitch_avg' ]))
4589
+ avg_nacAccMax = max (avg_nacAccMax , abs (pf .raftResults [iCase ]['AxRNA_avg' ][0 ])); avg_twrBendMax = max (avg_twrBendMax , abs (pf .raftResults [iCase ]['Mbase_avg' ][0 ]/ 1e3 ))
4590
+
4591
+ std_surgeMax = max (std_surgeMax , abs (pf .raftResults [iCase ]['surge_std' ])); std_swayMax = max (std_swayMax , abs (pf .raftResults [iCase ]['sway_std' ]))
4592
+ std_rollMax = max (std_rollMax , abs (pf .raftResults [iCase ]['roll_std' ])); std_pitchMax = max (std_pitchMax , abs (pf .raftResults [iCase ]['pitch_std' ]))
4593
+ std_nacAccMax = max (std_nacAccMax , abs (pf .raftResults [iCase ]['AxRNA_std' ][0 ])); std_twrBendMax = max (std_twrBendMax , abs (pf .raftResults [iCase ]['Mbase_std' ][0 ]/ 1e3 ))
4582
4594
4583
4595
platform_sheet .merge_cells (start_row = platform_sheet .max_row - nCases + 1 , start_column = 1 , end_row = platform_sheet .max_row , end_column = 1 )
4584
4596
platform_sheet .merge_cells (start_row = platform_sheet .max_row - nCases + 1 , start_column = 2 , end_row = platform_sheet .max_row , end_column = 2 )
@@ -4587,20 +4599,38 @@ def style_it(sheet, row, col_start, col_end, fill_color="FFFF00"):
4587
4599
else :
4588
4600
platform_sheet .append ([pf .id , round (pf .r [0 ], 3 ), round (pf .r [1 ], 3 ), round (depth_at_pf , 3 )])
4589
4601
4590
- platform_sheet .append (["----------------------" ])
4591
- platform_sheet .append (["Highest average values" ])
4592
- for cell in platform_sheet [platform_sheet .max_row ]:
4593
- cell .font = openpyxl .styles .Font (bold = True )
4602
+ if hasattr (pf , 'raftResults' ):
4603
+ platform_sheet .append (["----------------------" ])
4604
+ platform_sheet .append (["Highest average values" ])
4605
+ for cell in platform_sheet [platform_sheet .max_row ]:
4606
+ cell .font = openpyxl .styles .Font (bold = True )
4594
4607
4595
- platform_sheet .append (["Surge (m)" , "Sway (m)" , "Excursion (m)" , "Roll (deg)" , "Pitch (deg)" , "NacAcc (m/s^2)" , "TwrBend (Nm)" ])
4596
- platform_sheet .append ([round (surgeMax , 3 ), round (swayMax , 3 ), round (excMax , 3 ), round (rollMax , 3 ), round (pitchMax , 3 ), round (nacAccMax , 3 ), round (twrBendMax , 3 )])
4597
- # style maximum values (bold and italic)
4598
- for cell in platform_sheet [platform_sheet .max_row ]:
4599
- cell .font = openpyxl .styles .Font (bold = True , italic = True )
4608
+ platform_sheet .append (["Surge (m)" , "Sway (m)" , "Roll (deg)" , "Pitch (deg)" , "NacAcc (m/s^2)" , "TwrBend (Nm)" , "Excursion (m)" ])
4609
+ platform_sheet .append ([round (avg_surgeMax , 3 ), round (avg_swayMax , 3 ), round (avg_rollMax , 3 ), round (avg_pitchMax , 3 ), round (avg_nacAccMax , 3 ), round (avg_twrBendMax , 3 ), round (excMax , 3 )])
4610
+ # style maximum values (bold and italic)
4611
+ for cell in platform_sheet [platform_sheet .max_row ]:
4612
+ cell .font = openpyxl .styles .Font (bold = True , italic = True )
4613
+
4614
+ platform_sheet .append (["----------------------" ])
4615
+ platform_sheet .append (["Highest std values" ])
4616
+ for cell in platform_sheet [platform_sheet .max_row ]:
4617
+ cell .font = openpyxl .styles .Font (bold = True )
4618
+
4619
+ platform_sheet .append (["Surge (m)" , "Sway (m)" , "Roll (deg)" , "Pitch (deg)" , "NacAcc (m/s^2)" , "TwrBend (Nm)" ])
4620
+ platform_sheet .append ([round (std_surgeMax , 3 ), round (std_swayMax , 3 ), round (std_rollMax , 3 ), round (std_pitchMax , 3 ), round (std_nacAccMax , 3 ), round (std_twrBendMax , 3 )])
4621
+ # style maximum values (bold and italic)
4622
+ for cell in platform_sheet [platform_sheet .max_row ]:
4623
+ cell .font = openpyxl .styles .Font (bold = True , italic = True )
4600
4624
4601
4625
# Create a sheet for mooring lines
4602
4626
mooring_sheet = workbook .create_sheet (title = "Mooring Lines" )
4603
4627
mooring_sheet .append (["ID" , "endA" , "endB" , "Shrd" , "chain dnom [mm]" , "rope dnom [mm]" , "Safety Factors" , "Fid Level" , "Case" , "Avg EndA Tension (kN)" , "Std EndA Tension (kN)" , "Avg EndB Tension (kN)" , "Std EndB Tension (kN)" ])
4628
+
4629
+ avg_Tmoor_endA = float ('-inf' )
4630
+ avg_Tmoor_endB = float ('-inf' )
4631
+ std_Tmoor_endA = float ('-inf' )
4632
+ std_Tmoor_endB = float ('-inf' )
4633
+
4604
4634
for moor in self .mooringList .values ():
4605
4635
# Find nominal diameters in moor
4606
4636
ch_dnom = '-'
@@ -4627,6 +4657,11 @@ def style_it(sheet, row, col_start, col_end, fill_color="FFFF00"):
4627
4657
round (moor .raftResults [iCase ]['Tmoor_avg' ][1 ], 3 )/ 1e3 , round (moor .raftResults [iCase ]['Tmoor_std' ][1 ], 3 )/ 1e3 ])
4628
4658
if np .any (moor .raftResults [iCase ]['Tmoor_avg' ]/ 1e3 < 100 ):
4629
4659
style_it (mooring_sheet , mooring_sheet .max_row , 9 , mooring_sheet .max_column , fill_color = "FFFF00" )
4660
+
4661
+ # Update min and max values
4662
+ avg_Tmoor_endA = max (avg_Tmoor_endA , moor .raftResults [iCase ]['Tmoor_avg' ][0 ]); avg_Tmoor_endB = max (avg_Tmoor_endB , moor .raftResults [iCase ]['Tmoor_avg' ][1 ])
4663
+ std_Tmoor_endA = max (std_Tmoor_endA , moor .raftResults [iCase ]['Tmoor_std' ][0 ]); std_Tmoor_endB = max (std_Tmoor_endB , moor .raftResults [iCase ]['Tmoor_std' ][1 ])
4664
+
4630
4665
mooring_sheet .merge_cells (start_row = mooring_sheet .max_row - nCases + 1 , start_column = 1 , end_row = mooring_sheet .max_row , end_column = 1 )
4631
4666
mooring_sheet .merge_cells (start_row = mooring_sheet .max_row - nCases + 1 , start_column = 2 , end_row = mooring_sheet .max_row , end_column = 2 )
4632
4667
mooring_sheet .merge_cells (start_row = mooring_sheet .max_row - nCases + 1 , start_column = 3 , end_row = mooring_sheet .max_row , end_column = 3 )
@@ -4638,6 +4673,29 @@ def style_it(sheet, row, col_start, col_end, fill_color="FFFF00"):
4638
4673
else :
4639
4674
mooring_sheet .append ([moor .id , moor .attached_to [0 ].id , moor .attached_to [1 ].id , moor .shared , ch_dnom , rp_dnom , round (moor .safety_factors ['tension' ], 3 ), moor .safety_factors ['analysisType' ]])
4640
4675
4676
+ if hasattr (moor , 'raftResults' ):
4677
+ mooring_sheet .append (["----------------------" ])
4678
+ mooring_sheet .append (["Highest average values" ])
4679
+ for cell in mooring_sheet [mooring_sheet .max_row ]:
4680
+ cell .font = openpyxl .styles .Font (bold = True )
4681
+
4682
+ mooring_sheet .append (["Tmoor_endA (kN)" , "Tmoor_endB (kN)" ])
4683
+ mooring_sheet .append ([round (avg_Tmoor_endA , 3 )/ 1e3 , round (avg_Tmoor_endB , 3 )/ 1e3 ])
4684
+ # style maximum values (bold and italic)
4685
+ for cell in mooring_sheet [mooring_sheet .max_row ]:
4686
+ cell .font = openpyxl .styles .Font (bold = True , italic = True )
4687
+
4688
+ mooring_sheet .append (["----------------------" ])
4689
+ mooring_sheet .append (["Highest std values" ])
4690
+ for cell in mooring_sheet [mooring_sheet .max_row ]:
4691
+ cell .font = openpyxl .styles .Font (bold = True )
4692
+
4693
+ mooring_sheet .append (["Tmoor_endA (kN)" , "Tmoor_endB (kN)" ])
4694
+ mooring_sheet .append ([round (std_Tmoor_endA , 3 )/ 1e3 , round (std_Tmoor_endB , 3 )/ 1e3 ])
4695
+ # style maximum values (bold and italic)
4696
+ for cell in mooring_sheet [mooring_sheet .max_row ]:
4697
+ cell .font = openpyxl .styles .Font (bold = True , italic = True )
4698
+
4641
4699
# Create a sheet for a 2D Plot
4642
4700
plot_sheet_2D = workbook .create_sheet (title = "2D Plot" )
4643
4701
fig , ax = plt .subplots ()
0 commit comments