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

Here is some example code on how to do this.

import eppy
from io import StringIO

txt = """
Version, 23.2;

People,
 189.1-2009 - Office - Corridor - CZ4-8 People,    !- Name
 189.1-2009 - Office - Corridor - CZ4-8,    !- Zone or ZoneList or Space or SpaceList Name
 Office Work Occ,          !- Number of People Schedule Name
 People/Area,              !- Number of People Calculation Method
 ,                         !- Number of People
 0.0107639104167097,       !- People per Floor Area
 ,                         !- Floor Area per Person
 0.3,                      !- Fraction Radiant
 ,                         !- Sensible Heat Fraction
 Office Activity;          !- Activity Level Schedule Name"""

idf = eppy.openidf(StringIO(txt))
peoples = idf.idfobjects["people"]
people = peoples[0]
print(people)

## OUTPUT

    People,
        189.1-2009 - Office - Corridor - CZ4-8 People,    !- Name
        189.1-2009 - Office - Corridor - CZ4-8,    !- Zone or ZoneList or Space or SpaceList Name
        Office Work Occ,          !- Number of People Schedule Name
        People/Area,              !- Number of People Calculation Method
        ,                         !- Number of People
        0.0107639104167097,       !- People per Floor Area
        ,                         !- Floor Area per Person
        0.3,                      !- Fraction Radiant
        ,                         !- Sensible Heat Fraction
        Office Activity;          !- Activity Level Schedule Name


# to see all the field names of people
fieldnames = people.fieldnames
for fieldname in fieldnames:
    print(fieldname)

## OUTPUT


    key
    Name
    Zone_or_ZoneList_or_Space_or_SpaceList_Name
    Number_of_People_Schedule_Name
    Number_of_People_Calculation_Method
    Number_of_People
    People_per_Floor_Area
    Floor_Area_per_Person
    Fraction_Radiant
    Sensible_Heat_Fraction
    Activity_Level_Schedule_Name
    Carbon_Dioxide_Generation_Rate
    Enable_ASHRAE_55_Comfort_Warnings
    Mean_Radiant_Temperature_Calculation_Type
    Surface_NameAngle_Factor_List_Name
    Work_Efficiency_Schedule_Name
    Clothing_Insulation_Calculation_Method
    Clothing_Insulation_Calculation_Method_Schedule_Name
    Clothing_Insulation_Schedule_Name
    Air_Velocity_Schedule_Name
    Thermal_Comfort_Model_1_Type
    Thermal_Comfort_Model_2_Type
    Thermal_Comfort_Model_3_Type
    Thermal_Comfort_Model_4_Type
    Thermal_Comfort_Model_5_Type
    Thermal_Comfort_Model_6_Type
    Thermal_Comfort_Model_7_Type
    Ankle_Level_Air_Velocity_Schedule_Name
    Cold_Stress_Temperature_Threshold
    Heat_Stress_Temperature_Threshold


# add a field name, say 'Air_Velocity_Schedule_Name'
people.Air_Velocity_Schedule_Name = "air vel. schedule"

print(people)

## OUTPUT

    People,
        189.1-2009 - Office - Corridor - CZ4-8 People,    !- Name
        189.1-2009 - Office - Corridor - CZ4-8,    !- Zone or ZoneList or Space or SpaceList Name
        Office Work Occ,          !- Number of People Schedule Name
        People/Area,              !- Number of People Calculation Method
        ,                         !- Number of People
        0.0107639104167097,       !- People per Floor Area
        ,                         !- Floor Area per Person
        0.3,                      !- Fraction Radiant
        ,                         !- Sensible Heat Fraction
        Office Activity,          !- Activity Level Schedule Name
        ,                         !- Carbon Dioxide Generation Rate
        ,                         !- Enable ASHRAE 55 Comfort Warnings
        ,                         !- Mean Radiant Temperature Calculation Type
        ,                         !- Surface NameAngle Factor List Name
        ,                         !- Work Efficiency Schedule Name
        ,                         !- Clothing Insulation Calculation Method
        ,                         !- Clothing Insulation Calculation Method Schedule Name
        ,                         !- Clothing Insulation Schedule Name
        air vel. schedule;        !- Air Velocity Schedule Name

Short answer: eppy CAN add fields into an existing object

Here is some example code on how to do this.

import eppy
from io import StringIO

txt = """
Version, 23.2;

People,
 189.1-2009 - Office - Corridor - CZ4-8 People,    !- Name
 189.1-2009 - Office - Corridor - CZ4-8,    !- Zone or ZoneList or Space or SpaceList Name
 Office Work Occ,          !- Number of People Schedule Name
 People/Area,              !- Number of People Calculation Method
 ,                         !- Number of People
 0.0107639104167097,       !- People per Floor Area
 ,                         !- Floor Area per Person
 0.3,                      !- Fraction Radiant
 ,                         !- Sensible Heat Fraction
 Office Activity;          !- Activity Level Schedule Name"""

idf = eppy.openidf(StringIO(txt))
peoples = idf.idfobjects["people"]
people = peoples[0]
print(people)

## OUTPUT

    People,
        189.1-2009 - Office - Corridor - CZ4-8 People,    !- Name
        189.1-2009 - Office - Corridor - CZ4-8,    !- Zone or ZoneList or Space or SpaceList Name
        Office Work Occ,          !- Number of People Schedule Name
        People/Area,              !- Number of People Calculation Method
        ,                         !- Number of People
        0.0107639104167097,       !- People per Floor Area
        ,                         !- Floor Area per Person
        0.3,                      !- Fraction Radiant
        ,                         !- Sensible Heat Fraction
        Office Activity;          !- Activity Level Schedule Name


# to see all the field names of people
fieldnames = people.fieldnames
for fieldname in fieldnames:
    print(fieldname)

## OUTPUT


    key
    Name
    Zone_or_ZoneList_or_Space_or_SpaceList_Name
    Number_of_People_Schedule_Name
    Number_of_People_Calculation_Method
    Number_of_People
    People_per_Floor_Area
    Floor_Area_per_Person
    Fraction_Radiant
    Sensible_Heat_Fraction
    Activity_Level_Schedule_Name
    Carbon_Dioxide_Generation_Rate
    Enable_ASHRAE_55_Comfort_Warnings
    Mean_Radiant_Temperature_Calculation_Type
    Surface_NameAngle_Factor_List_Name
    Work_Efficiency_Schedule_Name
    Clothing_Insulation_Calculation_Method
    Clothing_Insulation_Calculation_Method_Schedule_Name
    Clothing_Insulation_Schedule_Name
    Air_Velocity_Schedule_Name
    Thermal_Comfort_Model_1_Type
    Thermal_Comfort_Model_2_Type
    Thermal_Comfort_Model_3_Type
    Thermal_Comfort_Model_4_Type
    Thermal_Comfort_Model_5_Type
    Thermal_Comfort_Model_6_Type
    Thermal_Comfort_Model_7_Type
    Ankle_Level_Air_Velocity_Schedule_Name
    Cold_Stress_Temperature_Threshold
    Heat_Stress_Temperature_Threshold


# add a field name, say 'Air_Velocity_Schedule_Name'
people.Air_Velocity_Schedule_Name = "air vel. schedule"

print(people)

## OUTPUT

    People,
        189.1-2009 - Office - Corridor - CZ4-8 People,    !- Name
        189.1-2009 - Office - Corridor - CZ4-8,    !- Zone or ZoneList or Space or SpaceList Name
        Office Work Occ,          !- Number of People Schedule Name
        People/Area,              !- Number of People Calculation Method
        ,                         !- Number of People
        0.0107639104167097,       !- People per Floor Area
        ,                         !- Floor Area per Person
        0.3,                      !- Fraction Radiant
        ,                         !- Sensible Heat Fraction
        Office Activity,          !- Activity Level Schedule Name
        ,                         !- Carbon Dioxide Generation Rate
        ,                         !- Enable ASHRAE 55 Comfort Warnings
        ,                         !- Mean Radiant Temperature Calculation Type
        ,                         !- Surface NameAngle Factor List Name
        ,                         !- Work Efficiency Schedule Name
        ,                         !- Clothing Insulation Calculation Method
        ,                         !- Clothing Insulation Calculation Method Schedule Name
        ,                         !- Clothing Insulation Schedule Name
        air vel. schedule;        !- Air Velocity Schedule Name