Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

variable error and storing variable into single quote ' '

below is a portion of code where data is read from an excel file and is transferred into a psspy function. I am receiving an error about _i and _f not being variables. But I received this code by running an ibdev on PSSE. Is there any way to change this so the error is eliminated. I tried using the API's default variables but it didn't work as well. Also for the third element in the array, I'm trying to put a variable into a string so it can loop through multiple characters in my excel sheet. Is that the correct way of doing it? Attached are the API's for this particular function and capability.API 1API 2API 3

    for row in data:
    data_location, year_link, from_, to, max_value, min_value,digit = row[5:12]
    output = 'From Bus #: {}\tTo Bus #: {}\tVMAX: {} pu\tVMIN: {} pu\t'
      if year_link == year and data_location == location:
         print(output.format(from_, to, max_value, min_value))

   psspy.two_winding_chng_4(from_,to,'%s'%digit,[_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i]
   [_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f],[])