First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
My Goal:Checking whether the voltage within the range of 0.9 to 1.05
**My_Code_1:**
ierr, volts = psspy.abusreal(1,1,string='PU')
x1.set_cell ((3, 'z'),'pass' if (0.9 < max(zip(*volts )) < 1.05 and 0.9 < min(zip(*volts ))
< 1.05) else 'Not Pass')*
**My_Code_1_Result:**
'Not Pass'
**My_Code_2:**
ierr, volts = psspy.abusreal(1,1,string='PU')
max_value = max(zip(*volts ))
min_value = min(zip(*volts ))
x1.set_cell ((3, 'z'),'pass' if (0.9 < max_value < 1.05 and 0.9 < min_value< 1.05) else
'Not Pass')*
**My_Code_2_Result:**
'Not Pass'
**My_Code_3:**
tolerance = 1e-6
ierr, volts = psspy.abusreal(1,1,string='PU')
x1.set_cell ((3, 'z'),'pass' if (0.9+tolerance < max(zip(*volts )) < 1.05-tolerance and 0.9+tolerance < min(zip(*volts)<1.05-tolerance) else 'Not Pass')*
**My_Code_3_Result:**
'Not Pass'
I checked all the value of max(zip(volts )) and min(zip(volts )).
They are all within 0.9~1.05. But why keep jumping into else shows 'Not Pass' ?
I did it wrong or can't do like this ?
Thank you for reading my question.