ASHRAE Journal - September 2024 - 56
TECHNICAL FEATURE
Listing 1), and it is almost unavoidable to not include
such metadata directly or indirectly. As one can see in
Listing 1, clear names and values are used throughout
the sample, making the code relatively specific to the
system for which it is built.
In other words, the more metadata included in the
code, the less portable and less standard it becomes.
Namely, context of a particular situation is embedded
into the code, making it inapplicable to other contexts.
Even different naming conventions pose a challenge.
Hence, it is typically recommended to make code as
generic as possible and avoid " hardcoding " metadata.
Early and Late Binding of Metadata
The above, in which metadata is directly encoded
and the result is a control system that is tailor-made to
the specific context it belongs to, can be said to rely on
early binding coding principles. All information and
functions are known at compile time, and all metadata
and context is directly embedded in the code. This tends
to result in efficient code for the considered case and
simpler code, yet also low levels of portability-the code
cannot adapt to different systems or different buildings,
for example. In other words, other contexts and other
input data streams are very difficult to support.
def getAllPumps(self,g,hvacComp,atts):
complist=getattr(hvacComp,atts)
for comps in complist:
try:
pump=Pump(name=comps.name,
medium=comps.medium,
massflow=comps.massflow,
port_a=comps.port_a,
port_b=comps.port_b,
localPressure=comps.localPressure,
pipeResistance=comps.pipeResistance)
self.pumps.append(pump)
pump.printSelf()
#Add the connection information to the entire list
if {comps.name+'.port_a',comps.port_a} not in self.connections:
self.connections.append({comps.name+'.port_a',comps.port_a})
if {comps.name+'.port_b',comps.port_b} not in self.connections:
self.connections.append({comps.name+'.port_b',comps.port_b})
except:
print( " Warning: " +pump.name+ " not listed before. Least information missing! " )
56
ASHRAE JOURNAL ashrae.org S E PTEM B ER 2024
This can be alleviated by relying on late binding
coding principles instead and transferring metadata
and context outside the control algorithm. In this case,
code becomes more generic, and context is ported to a
place independent of the applicable code. Therefore, the
code can adapt at run-time to different contexts. This
code is much more flexible, yet also more difficult to
create, as all sorts of contexts (metadata schemas) need
to be considered as potential inputs without breaking
the code. This coding principle also makes the resulting
algorithm less efficient (more time needed) and less
safe (more exceptions possible). In other words, the
portability comes at a cost. While late binding can be
pushed to the extreme, it can also be implemented to a
more limited extent. In our context of control systems,
these principles can be used, for example, simply to
separate incoming data structures from the control
algorithm itself; in other words, the control algorithm
can be applied to multiple data structures.
Listing 2 gives a brief example of how input data can
be divided from the algorithm that processes the data.
This is not a very extreme example of late binding, yet
it does give an impression of what is meant or hinted
at. The first part of this Python snippet lists a query
that retrieves data from an available data set, aiming
LISTING 1-EXAMPLE HARDCODED METADATA FOR MPC (PARTIAL)
http://www.ashrae.org
ASHRAE Journal - September 2024
Table of Contents for the Digital Edition of ASHRAE Journal - September 2024
Contents
ASHRAE Journal - September 2024 - Intro
ASHRAE Journal - September 2024 - Cover1
ASHRAE Journal - September 2024 - Cover2
ASHRAE Journal - September 2024 - 1
ASHRAE Journal - September 2024 - Contents
ASHRAE Journal - September 2024 - 3
ASHRAE Journal - September 2024 - 4
ASHRAE Journal - September 2024 - 5
ASHRAE Journal - September 2024 - 6
ASHRAE Journal - September 2024 - 7
ASHRAE Journal - September 2024 - 8
ASHRAE Journal - September 2024 - 9
ASHRAE Journal - September 2024 - 10
ASHRAE Journal - September 2024 - 11
ASHRAE Journal - September 2024 - 12
ASHRAE Journal - September 2024 - 13
ASHRAE Journal - September 2024 - 14
ASHRAE Journal - September 2024 - 15
ASHRAE Journal - September 2024 - 16
ASHRAE Journal - September 2024 - 17
ASHRAE Journal - September 2024 - 18
ASHRAE Journal - September 2024 - 19
ASHRAE Journal - September 2024 - 20
ASHRAE Journal - September 2024 - 21
ASHRAE Journal - September 2024 - 22
ASHRAE Journal - September 2024 - 23
ASHRAE Journal - September 2024 - 24
ASHRAE Journal - September 2024 - 25
ASHRAE Journal - September 2024 - 26
ASHRAE Journal - September 2024 - 27
ASHRAE Journal - September 2024 - 28
ASHRAE Journal - September 2024 - 29
ASHRAE Journal - September 2024 - 30
ASHRAE Journal - September 2024 - 31
ASHRAE Journal - September 2024 - 32
ASHRAE Journal - September 2024 - 33
ASHRAE Journal - September 2024 - 34
ASHRAE Journal - September 2024 - 35
ASHRAE Journal - September 2024 - 36
ASHRAE Journal - September 2024 - 37
ASHRAE Journal - September 2024 - 38
ASHRAE Journal - September 2024 - 39
ASHRAE Journal - September 2024 - 40
ASHRAE Journal - September 2024 - 41
ASHRAE Journal - September 2024 - 42
ASHRAE Journal - September 2024 - 43
ASHRAE Journal - September 2024 - 44
ASHRAE Journal - September 2024 - 45
ASHRAE Journal - September 2024 - 46
ASHRAE Journal - September 2024 - 47
ASHRAE Journal - September 2024 - 48
ASHRAE Journal - September 2024 - 49
ASHRAE Journal - September 2024 - 50
ASHRAE Journal - September 2024 - 51
ASHRAE Journal - September 2024 - 52
ASHRAE Journal - September 2024 - 53
ASHRAE Journal - September 2024 - 54
ASHRAE Journal - September 2024 - 55
ASHRAE Journal - September 2024 - 56
ASHRAE Journal - September 2024 - 57
ASHRAE Journal - September 2024 - 58
ASHRAE Journal - September 2024 - 59
ASHRAE Journal - September 2024 - 60
ASHRAE Journal - September 2024 - 61
ASHRAE Journal - September 2024 - 62
ASHRAE Journal - September 2024 - 63
ASHRAE Journal - September 2024 - 64
ASHRAE Journal - September 2024 - 65
ASHRAE Journal - September 2024 - 66
ASHRAE Journal - September 2024 - 67
ASHRAE Journal - September 2024 - 68
ASHRAE Journal - September 2024 - 69
ASHRAE Journal - September 2024 - 70
ASHRAE Journal - September 2024 - 71
ASHRAE Journal - September 2024 - 72
ASHRAE Journal - September 2024 - 73
ASHRAE Journal - September 2024 - 74
ASHRAE Journal - September 2024 - 75
ASHRAE Journal - September 2024 - 76
ASHRAE Journal - September 2024 - 77
ASHRAE Journal - September 2024 - 78
ASHRAE Journal - September 2024 - 79
ASHRAE Journal - September 2024 - 80
ASHRAE Journal - September 2024 - Cover3
ASHRAE Journal - September 2024 - Cover4
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_FYONLJ
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2024november_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2024november
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_BDMHLG
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_WJDGRY
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_ATMAHK
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_VHQRAW
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_XGMDXI
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_YELQLJ
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_QJLWMC
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_MCDEBX
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_WNYSQY
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_XATVOD
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_FJSHSS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_CCBZDS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_XDEFVG
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2023november_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2023november
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_VHGNBL
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_WPKBNJ
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_UUVCDE
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_RTGDEW
https://www.nxtbook.com/nxtbooks/ashrae/ashraemexico_2023
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_LKRFXS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_AZSOFG
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_ERCDBH
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_QWDFRV
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_JHGVDF
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_OPUYHG
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_SREIBM
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_LRTGLK
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_OKRFGH
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2022november_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2022november
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_TZSERA
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_LVRUIX
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_RPTVYZ
https://www.nxtbook.com/nxtbooks/ashrae/mini_pub_catalog
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_XIYTGD
https://www.nxtbook.com/nxtbooks/ashrae/ashraemexico_2022
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_RFGDOB
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_PABXNU
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_REMKLS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_PICVBT
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_AOYTVW
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_JQOPLS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_IOYTBC
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_SGAJJF
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_IGHYER
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_PDRKLS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2021november
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2021november_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_XCODFR
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_QSLFGO
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_ILKVNM
https://www.nxtbook.com/nxtbooks/ashrae/ashraemexico_2021
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_OPDJKD
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_VJKSRY
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_SDHUTC
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_JPPKRR
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_SDLTTH
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_CKLLES
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_SLDOX
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_HJETUK
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_OLUHGE
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2020october
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2020october_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_ZERDGH
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_QVMNEO
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_RTPOKE
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_BBATRE
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_STUBMW
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_TPEMPE
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_JNMKDS
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_FBTTPA
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_WQMMNE
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_TVBRYN
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_showguide2020
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_KTUZMA
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_ABEDGD
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201910
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201909
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2019septmeber_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2019september
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201908
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201907
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201906
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201905
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201904
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_2019april
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201903
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_2019march
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201902
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201901
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_showguide2019
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_2018december
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_2018november
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2018fall_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2018fall
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_2018october
https://www.nxtbook.com/nxtbooks/ashrae/ashraemexico_2018
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201810
https://www.nxtbook.com/nxtbooks/ashrae/ashraeinsights_201806
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201805
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201804
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201803
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201712
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201711
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201710
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2017fall_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2017fall
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201709
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201705
https://www.nxtbook.com/nxtbooks/ashrae/ashrae_meetinginsert_201610
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2016fall_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2016fall
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_acrexindia
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2015summer_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_amca_2015summer
https://www.nxtbook.com/nxtbooks/amca/2014summer2
https://www.nxtbook.com/nxtbooks/amca/2014summer
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_acma_2014summer
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201311
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201309
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_acmasupp_2013fall
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201305
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201303
https://www.nxtbook.com/nxtbooks/ashrae/pubcatalog_2013winter
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201211
https://www.nxtbook.com/nxtbooks/ashrae/achr_expo_mexico2012
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201209
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201208_v3
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201208_v2
https://www.nxtbook.com/nxtbooks/ashrae/pubcatalog_2012summer
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201205
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201203
https://www.nxtbook.com/nxtbooks/ashrae/pubcatalog_2012winter
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201111_v2
https://www.nxtbook.com/nxtbooks/ashrae/ashraejournal_201109_v2
https://www.nxtbook.com/nxtbooks/ashrae/pubcatalog_2011summer
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201105
https://www.nxtbook.com/nxtbooks/ashrae/meetingplanner_201103
https://www.nxtbookmedia.com