@@ -422,11 +422,11 @@ def _create_pgm_input_lines(self):
422422 pgm_lines ["x1" ] = self ._get_pp_attr ("line" , "x_ohm_per_km" , expected_type = "f8" ) * multiplier
423423 pgm_lines ["c1" ] = c_nf_per_km * length_km * parallel * 1e-9
424424 # The formula for tan1 = R_1 / Xc_1 = (g * 1e-6) / (2 * pi * f * c * 1e-9) = g / (2 * pi * f * c * 1e-3)
425- pgm_lines ["tan1" ] = (
426- self ._get_pp_attr ("line" , "g_us_per_km" , expected_type = "f8" , default = 0 )
427- / c_nf_per_km
428- / ( 2 * np .pi * self . system_frequency * 1e-3 )
429- )
425+ pgm_lines ["tan1" ] = np . divide (
426+ self ._get_pp_attr ("line" , "g_us_per_km" , expected_type = "f8" , default = 0 ),
427+ c_nf_per_km * ( 2 * np . pi * self . system_frequency * 1e-3 ),
428+ where = np .not_equal ( c_nf_per_km , 0.0 ) )
429+ pgm_lines [ "tan1" ][ np . equal ( c_nf_per_km , 0.0 )] = 0.0
430430 pgm_lines ["i_n" ] = (
431431 (self ._get_pp_attr ("line" , "max_i_ka" , expected_type = "f8" , default = np .nan ) * 1e3 )
432432 * self ._get_pp_attr ("line" , "df" , expected_type = "f8" , default = 1 )
@@ -435,11 +435,11 @@ def _create_pgm_input_lines(self):
435435 pgm_lines ["r0" ] = self ._get_pp_attr ("line" , "r0_ohm_per_km" , expected_type = "f8" , default = np .nan ) * multiplier
436436 pgm_lines ["x0" ] = self ._get_pp_attr ("line" , "x0_ohm_per_km" , expected_type = "f8" , default = np .nan ) * multiplier
437437 pgm_lines ["c0" ] = c0_nf_per_km * length_km * parallel * 1e-9
438- pgm_lines ["tan0" ] = (
439- self ._get_pp_attr ("line" , "g0_us_per_km" , expected_type = "f8" , default = 0 )
440- / c0_nf_per_km
441- / ( 2 * np .pi * self . system_frequency * 1e-3 )
442- )
438+ pgm_lines ["tan0" ] = np . divide (
439+ self ._get_pp_attr ("line" , "g0_us_per_km" , expected_type = "f8" , default = 0 ),
440+ c0_nf_per_km * ( 2 * np . pi * self . system_frequency * 1e-3 )
441+ , where = np .not_equal ( c0_nf_per_km , 0.0 ) )
442+ pgm_lines [ "tan0" ][ np . equal ( c0_nf_per_km , 0.0 )] = 0.0
443443 assert ComponentType .line not in self .pgm_input_data
444444 self .pgm_input_data [ComponentType .line ] = pgm_lines
445445
@@ -1942,7 +1942,8 @@ def _pp_lines_output_3ph(self):
19421942 pp_output_lines_3ph ["loading_c_percent" ] = (
19431943 np .maximum (pp_output_lines_3ph ["i_c_from_ka" ], pp_output_lines_3ph ["i_c_to_ka" ]) / pgm_input_lines ["i_n" ]
19441944 ) * 1e5
1945- pp_output_lines_3ph ["loading_percent" ] = pgm_output_lines ["loading" ] * 1e2
1945+ pp_output_lines_3ph ["loading_percent" ] = np .maximum (np .maximum (pp_output_lines_3ph ["loading_a_percent" ], pp_output_lines_3ph ["loading_b_percent" ]),
1946+ pp_output_lines_3ph ["loading_c_percent" ])
19461947
19471948 assert "res_line_3ph" not in self .pp_output_data
19481949 self .pp_output_data ["res_line_3ph" ] = pp_output_lines_3ph
0 commit comments