Coverage for teaser/examples/e8_change_boundary_conditions.py: 93%

28 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2025-04-29 16:01 +0000

1"""This module contains an example how to change time dependent profiles.""" 

2 

3import teaser.examples.e1_generate_archetype as e1 

4 

5 

6def example_change_boundary_conditions(): 

7 """Demonstrate changes to time dependent profiles.""" 

8 # In e1_generate_archetype we created a Project with three archetype 

9 # buildings to get this Project we rerun this example 

10 

11 prj = e1.example_generate_archetype() 

12 

13 # Now we want to set the ahu profile of the office building with another 

14 # profil that reduces the ahu during the weekends. First we create the 

15 # workfay profile and then run a for loop for one week to decrease the 

16 # value at weekends. 

17 

18 office = [ 

19 bldg for bldg in prj.buildings if bldg.name == "OfficeBuilding"][0] 

20 

21 v_flow_workday = [ 

22 0.0, 

23 0.0, 

24 0.0, 

25 0.0, 

26 0.0, 

27 0.0, 

28 1.0, 

29 1.0, 

30 1.0, 

31 1.0, 

32 1.0, 

33 1.0, 

34 1.0, 

35 1.0, 

36 1.0, 

37 1.0, 

38 1.0, 

39 1.0, 

40 0.0, 

41 0.0, 

42 0.0, 

43 0.0, 

44 0.0, 

45 0.0, 

46 ] 

47 

48 v_flow_week = [] 

49 for day in range(7): 

50 for val in v_flow_workday: 

51 if day < 5: 

52 ratio = val 

53 else: 

54 if val == 1: 

55 ratio = 0.2 

56 else: 

57 ratio = 0.0 

58 v_flow_week.append(ratio) 

59 

60 # Here we set the new profile to the AHU profile of TEASER. TEASER will 

61 # automatically copy this profile for a whole year. 

62 

63 office.central_ahu.v_flow_profile = v_flow_week 

64 

65 heating_profile_workday = [ 

66 293, 

67 293, 

68 293, 

69 293, 

70 293, 

71 293, 

72 293, 

73 293, 

74 293, 

75 293, 

76 293, 

77 293, 

78 293, 

79 293, 

80 293, 

81 293, 

82 293, 

83 293, 

84 293, 

85 293, 

86 293, 

87 293, 

88 293, 

89 293, 

90 ] 

91 

92 # We can apply this also to profiles in UseConditions (e.g. set temperature 

93 # profile for heating (heating_profile)). We assume on weeksends a lower 

94 # heating setpoint. 

95 

96 heating_profile_week = [] 

97 for day in range(7): 

98 for val in heating_profile_workday: 

99 if day < 5: 

100 set_point = val 

101 else: 

102 set_point = 290.0 

103 heating_profile_week.append(set_point) 

104 for zone in office.thermal_zones: 

105 zone.use_conditions.heating_profile = heating_profile_week 

106 

107 

108if __name__ == '__main__': 

109 

110 example_change_boundary_conditions() 

111 

112 print("Example 8: That's it! :)")