SURFEX v8.1
General documentation of Surfex
bld_occ_calendar.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !#####################################################################################
6 SUBROUTINE bld_occ_calendar(TPTIME, PTSUN, T, B, PQIN_FRAC, PTCOOL_TARGET, PTHEAT_TARGET, PQIN)
7 !#####################################################################################
8 !! **** BLD_OCC_CALENDAR *
9 !!
10 !! PURPOSE
11 !! -------
12 !! BLD_OCC_CALENDAR defines the parameters relevant for BEM (TCOOL_TARGET, THEAT_TARGET and QIN)
13 !! depending on the building use type (hence the DOW and local French TOD) * based on MUSCADE scenarii *
14 !!
15 !! AUTHOR
16 !! ------
17 !! C. de Munck *Météo-France*
18 !!
19 !! MODIFICATIONS
20 !! -------------
21 !! Original 02/2013
22 !
23 USE modd_teb_n, ONLY : teb_t
24 USE modd_bem_n, ONLY : bem_t
25 !
27 !
28 USE modd_csts, ONLY : xtt
29 !
30 USE modi_day_of_week
31 !
32 USE yomhook ,ONLY : lhook, dr_hook
33 USE parkind1 ,ONLY : jprb
34 !
35 IMPLICIT NONE
36 !
37 !! 1. declaration of arguments
38 !
39 TYPE(date_time), INTENT(INOUT) :: TPTIME
40 REAL, DIMENSION(:) , INTENT(IN) :: PTSUN ! current solar time (s, UTC)
41 !
42 TYPE(teb_t), INTENT(INOUT) :: T
43 TYPE(bem_t), INTENT(INOUT) :: B
44 !
45 REAL, INTENT(IN) :: PQIN_FRAC ! Fraction of internal gains when unoccupied (-)
46 !
47 REAL, DIMENSION(:) , INTENT(OUT) :: PTCOOL_TARGET ! Cooling setpoint of HVAC system [K]
48 REAL, DIMENSION(:) , INTENT(OUT) :: PTHEAT_TARGET ! Heating setpoint of HVAC system [K]
49 REAL, DIMENSION(:) , INTENT(OUT) :: PQIN ! Internal heat gains [W m-2(floor)]
50 !
51 !! 2. declaration of local variables
52 !
53  CHARACTER(LEN = 6) :: CTIME ! Local time scheme (winter or summer time)
54 INTEGER :: JDOW ! day of week
55 INTEGER :: JJ
56 !
57 REAL, DIMENSION(SIZE(PQIN)) :: ZTOD_BEG ! first Time Of Day that building unoccupied (UTC, s)
58 REAL, DIMENSION(SIZE(PQIN)) :: ZTOD_END ! last Time Of Day that building unoccupied (UTC, s)
59 REAL, DIMENSION(SIZE(PQIN)) :: ZDT ! Target temperature change when unoccupied (K)
60 
61 REAL(KIND=JPRB) :: ZTODOOK_HANDLE
62 !
63 IF (lhook) CALL dr_hook('BLD_OCC_CALENDAR',0,ztodook_handle)
64 !
65 !--------------------------------------------------------------------------------------
66 ! 3. determine the day of the week and the local time scheme in France
67 !--------------------------------------------------------------------------------------
68 !
69  CALL day_of_week(tptime%TDATE%YEAR, tptime%TDATE%MONTH, tptime%TDATE%DAY, jdow)
70 !
71 ctime = 'WINTER'
72 IF (tptime%TDATE%MONTH >= 4 .AND. tptime%TDATE%MONTH <= 10) ctime = 'SUMMER'
73 !
74 !--------------------------------------------------------------------------------------
75 ! 4. initialisation of parameters
76 !--------------------------------------------------------------------------------------
77 !
78 ! Parameters assigned to the occupied values - read in namelist via BATI.csv :
79 !
80 ptheat_target(:) = b%XTHEAT_TARGET(:)
81 !
82 ptcool_target(:) = b%XTCOOL_TARGET(:)
83 !
84 pqin(:) = b%XQIN(:)
85 !
86 ztod_beg(:) = 0.
87 ztod_end(:) = 0.
88 !
89 !--------------------------------------------------------------------------------------
90 ! 5. computes beginning and end of unoccupied calendar based on building USE TYPE
91 !--------------------------------------------------------------------------------------
92 !
93 DO jj =1,SIZE(ptsun)
94 !
95  IF (t%XRESIDENTIAL(jj) > 0.5) THEN ! RESIDENTIAL
96  !
97  IF (jdow >= 2 .AND. jdow <=6) THEN ! week days
98  ztod_beg(jj) = 9. * 3600. ! 9 UTC - WINTER time
99  ztod_end(jj) = 17. * 3600. ! 17 UTC - WINTER time
100  END IF
101  zdt(jj) = t%XDT_RES
102  !
103  ELSE
104  !
105  IF (jdow >= 2 .AND. jdow <=7) THEN ! week days
106  ztod_beg(jj) = 17. * 3600. ! 17 UTC
107  ztod_end(jj) = 7. * 3600. ! 7 UTC
108  ELSE ! week-end
109  ztod_beg(jj) = 0. * 3600. ! 0 UTC
110  ztod_end(jj) = 24. * 3600. ! 24 UTC
111  END IF
112  zdt(jj) = t%XDT_OFF
113  !
114  END IF
115 ! adjustment of unoccupied TOD based on time scheme
116  IF (ctime == 'SUMMER') THEN
117  ztod_beg(jj) = ztod_beg(jj) - 3600.
118  ztod_end(jj) = ztod_end(jj) - 3600.
119  END IF
120 !
121 ENDDO
122 !
123 !--------------------------------------------------------------------------------------
124 ! 6. modulate BEM input values for unoccupied building calendar
125 !--------------------------------------------------------------------------------------
126 !
127 DO jj =1,SIZE(ptsun)
128 !
129  IF (( (ztod_beg(jj) < ztod_end(jj)) .AND. (ptsun(jj) > ztod_beg(jj) .AND. ptsun(jj) < ztod_end(jj)) ) &
130  .OR. &
131  ( (ztod_beg(jj) > ztod_end(jj)) .AND. ((ptsun(jj) > 0 .AND. ptsun(jj) < ztod_end(jj)) .OR. &
132  (ptsun(jj) > ztod_beg(jj) .AND. ptsun(jj) < 24 * 3600.)))) THEN
133  !
134  ptheat_target(jj) = b%XTHEAT_TARGET(jj) - zdt(jj)
135  ptcool_target(jj) = b%XTCOOL_TARGET(jj) + zdt(jj)
136  pqin(jj) = pqin_frac * pqin(jj)
137  ENDIF
138 !
139 ENDDO
140 !
141 !--------------------------------------------------------------------------------------
142 !
143 IF (lhook) CALL dr_hook('BLD_OCC_CALENDAR',1,ztodook_handle)
144 !
145 END SUBROUTINE bld_occ_calendar
subroutine bld_occ_calendar(TPTIME, PTSUN, T, B, PQIN_FRAC, PTCOOL_TARGET, PTHEAT_TARGET, PQIN)
subroutine day_of_week(PYEAR, PMONTH, PDAY, PDOW)
Definition: day_of_week.F90:7
integer, parameter jprb
Definition: parkind1.F90:32
logical lhook
Definition: yomhook.F90:15
real, save xtt
Definition: modd_csts.F90:66