Parametric Analysis using EPPY, EPPY unable to find field parameters? [closed]

asked 2022-01-29 15:22:51 -0500

Ross B.'s avatar

updated 2022-02-05 15:32:56 -0500

Hi all,

As the title says I am trying to generate parametric analysis however, when I pass the function my argument for "parameter" I am unable to assign it as an EPPY attribute and get this error:

"eppy.bunch_subclass.BadEPFieldError: unable to find field parameter"

In this case I am trying to tell it to select the "Tilt_Angle_from_WindowDoor" field in the "Shading:Overhang" Object but it doesn't seem to take. I know the field name is correct as it works outside of the function.

def single_valStudy(value_range,IDF,IDF_obj,obj_range,parameter,FileName,folder_path):
study=[]
for i in range(0,(len(value_range)),1):
    for b in range(0,obj_range,1):
        idf_l=IDF
        a=idf_l.idfobjects[IDF_obj][b]
        c=parameter
        d=a.c=value_range[i]
        study.append(idf_l)
        os.chdir(folder_path)
        idf_l.saveas(FileName.format(d))
return study
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Ross B.
close date 2022-01-30 14:08:33.976871

Comments

1

replace:

d=a.c=value_range[i]

with

d=a[c]=value_range[i]

see what happens

santoshphilip's avatar santoshphilip  ( 2022-01-29 16:39:43 -0500 )edit

Can you respond, and let me know if d=a[c]=value_range[i] is fixing the error. (I am not sure if that is the problematic line). If that is the error, I'll write an answer to this question, explaining why it threw that error

santoshphilip's avatar santoshphilip  ( 2022-01-30 11:04:34 -0500 )edit

Apologies, currently away from the desk right now. I can let you know in a couple hours.

Ross B.'s avatar Ross B.  ( 2022-01-30 11:47:43 -0500 )edit

Adding the brackets rather than the '.' worked and it accepted the passed the argument. Thank you for the help.

Ross B.'s avatar Ross B.  ( 2022-01-30 14:07:07 -0500 )edit

a.Tilt_Angle_from_WindowDoor

internally becomes:

a['Tilt_Angle_from_WindowDoor']

This is the reason a.c does not work since a.c becomes a['c'] internally. So you have to do a[c] which is really a['Tilt_Angle_from_WindowDoor'] since c= Tilt_Angle_from_WindowDoor

Unfortunately the question has been closed. This response should have been an answer rather than a comment.

santoshphilip's avatar santoshphilip  ( 2022-01-30 21:53:42 -0500 )edit