Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To generalize, you are looking for functionality to edit extensible fields in EnergyPlus. Essentially you want functionality that treats an extensible field like a list, where you can append, insert, remove elements in the list

The package witheppy has this functionality. Take a look at extensiblefields2list and list2extensiblefields. If the documentation is not clear, open an issue in here

Note: See Readme for witheppy to see why this functionality is not yet in eppy

JasonGlazer's answer is correct

This is a response to katsuya.obara's comment on ( Jan 14 '0 ) to JasonGlazer's answer

Thank you for your answer. So your answer is eppy does not have API to delete fields?

Response: eppy does not have that API. But you can get it from witheppy

To generalize, you are looking for functionality to edit extensible fields in EnergyPlus. Essentially you want functionality that treats an extensible field like a list, where you can append, insert, remove elements in the list

The package witheppy has this functionality. Take a look at extensiblefields2list and list2extensiblefields. If the documentation is not clear, open an issue in here

Note: See Readme for witheppy to see why this functionality is not yet in eppy

JasonGlazer's answer is correct

This is a response to katsuya.obara's comment on ( Jan 14 '0 ) to JasonGlazer's answer

Thank you for your answer. So your answer is eppy does not have API to delete fields?

Response: eppy does not have that API. But you can get it from witheppy

To generalize, you are looking for functionality to edit extensible fields in EnergyPlus. Essentially you want functionality that treats an extensible field like a list, where you can append, insert, remove elements in the list

The package witheppy has this functionality. Take a look at extensiblefields2list and list2extensiblefields. If the documentation is not clear, open an issue in here

here is an illustration of how this can work:

# assme you have opened idf file
idf = IDF(idffilename)
# get the first "Daylighting:Controls"
daycs = idf.idfobjects["Daylighting:Controls"]
dayc1 = daycs[0]
print(dayc1)

    DAYLIGHTING:CONTROLS,
        ,                         !- Name
        ,                         !- Zone Name
        SplitFlux,                !- Daylighting Method
        ,                         !- Availability Schedule Name
        Continuous,               !- Lighting Control Type
        0.3,                      !- Minimum Input Power Fraction for Continuous or ContinuousOff Dimming Control
        0.2,                      !- Minimum Light Output Fraction for Continuous or ContinuousOff Dimming Control
        1,                        !- Number of Stepped Control Steps
        1,                        !- Probability Lighting will be Reset When Needed in Manual Stepped Control
        ,                         !- Glare Calculation Daylighting Reference Point Name
        0,                        !- Glare Calculation Azimuth Angle of View Direction Clockwise from Zone yAxis
        22,                       !- Maximum Allowable Discomfort Glare Index
        ,                         !- DElight Gridding Resolution
        Ref point 1,              !- Daylighting Reference Point 1 Name
        0.5,                      !- Fraction of Zone Controlled by Reference Point 1
        500,                      !- Illuminance Setpoint at Reference Point 1
        Ref point 2,              !- Daylighting Reference Point 2 Name
        0.5,                      !- Fraction of Zone Controlled by Reference Point 2
        500;                      !- Illuminance Setpoint at Reference Point 2


# extract the reference points as a list (You are extracting the extensible fields in a nested format)
extlist = extfields.extensiblefields2list(dayc1, nested=True)
print(extlist)

    [('Ref point 1', 0.5, 500.0), ('Ref point 2', 0.5, 500.0)]

# Remove the first Reference Point from the list
extlist.pop(0)
print(extlist)

    [('Ref point 2', 0.5, 500.0)]

# put the updated list back into the idfobject
extfields.list2extensiblefields(dayc1, extlist)
print(dayc1)

    DAYLIGHTING:CONTROLS,
        ,                         !- Name
        ,                         !- Zone Name
        SplitFlux,                !- Daylighting Method
        ,                         !- Availability Schedule Name
        Continuous,               !- Lighting Control Type
        0.3,                      !- Minimum Input Power Fraction for Continuous or ContinuousOff Dimming Control
        0.2,                      !- Minimum Light Output Fraction for Continuous or ContinuousOff Dimming Control
        1,                        !- Number of Stepped Control Steps
        1,                        !- Probability Lighting will be Reset When Needed in Manual Stepped Control
        ,                         !- Glare Calculation Daylighting Reference Point Name
        0,                        !- Glare Calculation Azimuth Angle of View Direction Clockwise from Zone yAxis
        22,                       !- Maximum Allowable Discomfort Glare Index
        ,                         !- DElight Gridding Resolution
        Ref point 2,              !- Daylighting Reference Point 1 Name
        0.5,                      !- Fraction of Zone Controlled by Reference Point 1
        500;                      !- Illuminance Setpoint at Reference Point 1

# note how the idfobject has changed

Note: See Readme for witheppy to see why this functionality is not yet in eppy

JasonGlazer's answer is correct

This is a response to katsuya.obara's comment on ( Jan 14 '0 ) to JasonGlazer's answer

Thank you for your answer. So your answer is eppy does not have API to delete fields?

Response: eppy does not have that API. But you can get it from witheppy

To generalize, you are looking for functionality to edit extensible fields in EnergyPlus. Essentially you want functionality that treats an extensible field like a list, where you can append, insert, remove elements in the list

The package witheppy has this functionality. Take a look at extensiblefields2list and list2extensiblefields. If the documentation is not clear, open an issue in here

here is an illustration of how this can work:

# install witheppy by doing:
# pip intall witheppy
# witheppy will also install eppy
import witheppy
import eppy
import witheppy.eppyhelpers.extfields as extfields

# assme you have opened idf file
idf = IDF(idffilename)
# get the first "Daylighting:Controls"
daycs = idf.idfobjects["Daylighting:Controls"]
dayc1 = daycs[0]
print(dayc1)

    DAYLIGHTING:CONTROLS,
        ,                         !- Name
        ,                         !- Zone Name
        SplitFlux,                !- Daylighting Method
        ,                         !- Availability Schedule Name
        Continuous,               !- Lighting Control Type
        0.3,                      !- Minimum Input Power Fraction for Continuous or ContinuousOff Dimming Control
        0.2,                      !- Minimum Light Output Fraction for Continuous or ContinuousOff Dimming Control
        1,                        !- Number of Stepped Control Steps
        1,                        !- Probability Lighting will be Reset When Needed in Manual Stepped Control
        ,                         !- Glare Calculation Daylighting Reference Point Name
        0,                        !- Glare Calculation Azimuth Angle of View Direction Clockwise from Zone yAxis
        22,                       !- Maximum Allowable Discomfort Glare Index
        ,                         !- DElight Gridding Resolution
        Ref point 1,              !- Daylighting Reference Point 1 Name
        0.5,                      !- Fraction of Zone Controlled by Reference Point 1
        500,                      !- Illuminance Setpoint at Reference Point 1
        Ref point 2,              !- Daylighting Reference Point 2 Name
        0.5,                      !- Fraction of Zone Controlled by Reference Point 2
        500;                      !- Illuminance Setpoint at Reference Point 2


# extract the reference points as a list (You are extracting the extensible fields in a nested format)
extlist = extfields.extensiblefields2list(dayc1, nested=True)
print(extlist)

    [('Ref point 1', 0.5, 500.0), ('Ref point 2', 0.5, 500.0)]

# Remove the first Reference Point from the list
extlist.pop(0)
print(extlist)

    [('Ref point 2', 0.5, 500.0)]

# put the updated list back into the idfobject
extfields.list2extensiblefields(dayc1, extlist)
print(dayc1)

    DAYLIGHTING:CONTROLS,
        ,                         !- Name
        ,                         !- Zone Name
        SplitFlux,                !- Daylighting Method
        ,                         !- Availability Schedule Name
        Continuous,               !- Lighting Control Type
        0.3,                      !- Minimum Input Power Fraction for Continuous or ContinuousOff Dimming Control
        0.2,                      !- Minimum Light Output Fraction for Continuous or ContinuousOff Dimming Control
        1,                        !- Number of Stepped Control Steps
        1,                        !- Probability Lighting will be Reset When Needed in Manual Stepped Control
        ,                         !- Glare Calculation Daylighting Reference Point Name
        0,                        !- Glare Calculation Azimuth Angle of View Direction Clockwise from Zone yAxis
        22,                       !- Maximum Allowable Discomfort Glare Index
        ,                         !- DElight Gridding Resolution
        Ref point 2,              !- Daylighting Reference Point 1 Name
        0.5,                      !- Fraction of Zone Controlled by Reference Point 1
        500;                      !- Illuminance Setpoint at Reference Point 1

# note how the idfobject has changed

Note: See Readme for witheppy to see why this functionality is not yet in eppy