# Towards Semi-Automatic Generation of a Steady State Digital Twin of a Brownfield Process Plant
## 3 Proposed Methodology
### Generating a Flowsheet of the Steady State Model  
This section presents rules for step 4 of the methodology in Section 3.1. The rules are applied to the intermediate graph outputted by the algorithm in Figure 4. The rules (Table 1) are valid for the selected steady state simulation tool, Balas(r) ([[https://info.vtfresearch.com/balas](https://info.vtfresearch.com/balas)]([https://info.vtfresearch.com/balas](https://info.vtfresearch.com/balas))). Balas(r) is a steady state simulation package for chemical processes with emphasis on pulp and paper, food processing and biochemical processes. If another simulation tool was selected, a new set of rules should be created to correspond with the symbols of that simulation tool. Figure 5 presents some symbols in Balas(r) that are used to simulate different process equipment. Each symbol has one to several ports that are connected to either inlet or outlet streams. The implementation of the rules must ensure that each port of the symbol in the simulation tool is used at most once.  
The rules are realized according to the object-oriented paradigm. Figure 6 shows a UML class diagram to capture these structures. Italics in the class diagram denote abstract classes and methods (i.e., the 'Component' class and its methods), so all inheriting classes (i.e., 'Pump', 'Heater', 'Splitter', 'Tank' and 'Valve') must implement these methods. The implementation of these methods should ensure that the ports are assigned according to the rules in Table 1 and that each port is used at most once.  
Figure 4: A UML activity diagram representation of an algorithm for manipulating heating elements in the intermediate graph.  
The rules in Table 1 are implemented by algorithms that map the intermediate graph outputted by the algorithm in Figure 4 to the object model in Figure 6. The creation of the various types of components is trivial as the type label of the node is used to determine whether to create an object of type 'Pump', 'Heater', 'Splitter', 'Tank' or 'Valve'. However, the connection of valves to the appropriate ports is not as straightforward. Figure 7 shows an algorithm for this purpose. The algorithm is general in the  
\begin{table}
\begin{tabular}{c c} \hline
**Graph Structure** & **Mapping to Balas®** \\ \hline A node of type tank, with one outgoing edge and one & Replace all tank nodes with a symbol “MDTank#1” (See Figure 5a). Add a stream from port#1 of symbol “Terminal in” (See Figure 5b) to port \#2 \\  & of symbol “MDTank#1”. From port \#1 of symbol “MDTank#1”, add a stream to nowhere. Ports \#3-\#12 of the symbol “MDTank#1” can be used either for feed or outlet. \\ \hline A node of type valve, pump or heater with one & The relevant symbols are “Valve” (See Figure 5c), “Pump” (See \\   incoming and one outgoing edge & Figure 5d), “Heater/cooler#1” (See Figure 5e). For each of these symbols, port \#1 is for inlet and port \#2 is for outlet. \\ \hline A node of type tee with one incoming and two & Replace tees with symbol “Splitter” (See Figure 5f) with port \#3 for inlet \\   outgoing edges & and ports \#1 and \#2 for outlet. \\ \hline \end{tabular}
\end{table}
Table 1: Rules for a one-to-one mapping from an intermediate graph to a steady state model.  
Figure 5: Different symbols in the Balas® simulation software for simulating process equipment.  
Figure 6: UML class diagram of the steady state model structure.  
sense that changes are not required if more component types are added or if the port mapping rules are changed to meet the requirements of a specific steady state simulator. This generality was achieved by using abstraction and inheritance in Figure 6. Any changes are limited to the implementation of the methods 'assignInflowPort()' and 'assignOutflowPort()'.