Some features in Thermal Desktop are programmable: heaters, trackers, and insulation are a few examples. The ability to program is indicated by either a button with “P” or “Program” on it. Clicking this button will open the Expression Editor (see Section 2.10.7 on page 2-41) where the user may enter an expression. Each programmable feature will have its own result-based behavior that is described in the Comment field of the Expression Editor. For example, a tracker can be programmed to change from sun tracking to star tracking, and the working mode can be programmed to change from “Always” working to “In sun only”. This feature can be extremely powerful with the use of parameterization (see Section 11 "Parameterization").
2.10.10 Network Element Logic
Expressions (instead of fixed numbers) inside of data input fields provide significant power, but there are limitations. For example, neither user-defined functions nor program library routines can be called, and multiple values cannot be set at once (e.g., both the UB and the UEDT of an HTU tie, whose values are often interrelated).
As a work-around, the user can write logic to be placed in SINDA/FLUINT logic blocks (e.g. FLOGIC 0 or VARIABLES 1) but this logic must then reference the nodes, conductors, ties, and paths that are defined in the network. Making sure that the IDs are correct and have not changed since the last model update can be problematic.
Network Element Logic provides a means for overcoming most of these limitations.
The Add Logic button (the text changes to Edit Logic when logic already exists) in the edit forms for conductors, lumps, paths, ties and pipes provide locations for an arbitrary listing of FORTRAN-based instructions that are associated with each conductor, lump, path, tie, or pipe. Figure 2-23 shows the basic form. Double-clicking in the text field, opens the advanced text editor (Section 2.10.14).
Important: User logic must be in the system of units written by Thermal Desktop into the SINDA/FLUINT files. If the model contains only thermal networks, then the system of units is de- fined by the units on the Units tab of the Preferences form; if the model contains a fluid network, the system of units is defined by the selection of SI or ENG on the Units tab of the Preferences form (see Section 2.7.1).
As can be seen in this figure, eight tabs are available for placing network element logic in different locations in the SINDA/FLUINT input file. Each location corresponds to a different point within the SINDA/FLUINT solution at which the logic is invoked. All of the locations can be used simultaneously for each element.
Important: The user should have a strong understanding of the SINDA/FLUINT logic blocks and the possible restrictions on certain operations within those logic blocks.
The key feature of Network Element Logic is indirect operators such as “#this” and “#up”. When the indirect operator is for an identifier, then it can be preceded by a processor variable. The code is translated like this:
• T#nodeA yields MAIN.T101 or T101, if the logic is in the MAIN submodel • FR#path yields FR61
The indirect operators are listed in Table 2-3, Indirect Operators for Network Element Logic. Unless otherwise noted in the table, the submodel name is added when referencing a processor variable outside of the current submodel (e.g. in the OPERATIONS block). While some indirect operators are never used with processor variables (noted in table), all can be used without processor variables to provide an ID but that use should be limited to submodel-based logic blocks.
Table 2-3 Indirect Operators for Network Element Logic
Element Operator Meaning
Conductor #this the ID of the current conductor #nodeA the ID of the first node
#nodeB the ID of the second node, typically on a surface
#num the ID number of the current conductor; not used with processor variables; does not return the submodel name
#sub the submodel name of the current conduc- tor; not used with a processor variable #sub_nodeA the submodel name of the first node; not
used with a processor variable
#sub_nodeB the submodel name of the second node; not used with a processor variable
#Garea the area of nodeB; not used with a proces- sor variable
Lump #this the ID of the current lump
#twin the ID of the twinned tank (if applicable) #num the ID number of the current lump; not
used with processor variables; does not return the submodel name
#sub the submodel name of the current fluid submodel; not used with processor vari- ables
Path #this the ID of the current path; includes sub- model name, when appropriate
#up the ID of the defined upstream lump (does not change with flow reversal); includes submodel name, when appropriate #down the ID of the defined downstream lump
(does not change with flow reversal); includes submodel name, when appropri- ate
#twin the ID of the twinned path (if applicable); includes submodel name, when appropri- ate
#uptwin the ID of the defined upstream twinned tank (does not change with flow reversal); includes submodel name, when appropri- ate
#downtwin the ID of the defined downstream twinned tank (does not change with flow reversal); includes submodel name, when appropri- ate
#num the ID number of the current path; not used with processor variables; does not return the submodel name
#sub the submodel name of the current fluid submodel; not used with processor vari- ables
Table 2-3 Indirect Operators for Network Element Logic
Tie #this the ID of the current tie
#node the ID of the node connected by the cur- rent tie
#lump the ID of the lump connected by the cur- rent tie
#path the ID of the path used for heat transfer coefficient of the current tie
#path2 the ID for the second path used for heat transfer coefficient of the current tie #twin the ID of the twinned tie (if applicable) #lumptwin the ID of the connected lump’s twin (if
applicable)
#pathtwin the ID of the first path’s twin (if applica- ble)
#path2twin the ID of the second path’s twin (if appli- cable)
#num the ID number of the current tie; not used with processor variables; does not return the submodel name
#sub the submodel name of the current fluid submodel; not used with processor vari- ables
#sub_node the submodel name of the node connected to the current tie; not used with processor variables
Pipe #lentolump the distance from the pipe start to the cur- rent lump; not used with processor vari- ables
#lentonode the distance from the pipe start to the cur- rent node; not used with processor vari- ables
#pipelength total length of the current pipe; not used with processor variables
Table 2-3 Indirect Operators for Network Element Logic