# Towards Semi-Automatic Generation of a Steady State Digital Twin of a Brownfield Process Plant
## 3 Proposed Methodology
### Graph processing  
This section presents algorithms for step 3 of the methodology in Section 3.1. Figure 2 shows a Unified Modeling Language (UML) class diagram of the graph representation of the information extracted from the digitalized P&ID. This methodology assumes that such a graph has been previously generated, e.g., according to the approach presented in [6].  
Dynamic modelling captures the time dependency of the process; it predicts all the transient states when the process moves from state A to state B [14]. Thus, the flowsheet of the dynamic simulation  
Figure 1: Proposed methodology for the semi-automatic generation of a steady state digital twin for a brownfield plant.  
Figure 2: UML class diagram of the graph representation of the information extracted from the digitalized P&ID.  
model is almost one-to-one with the P&ID including all the control loops with their control and binary valves. Steady state modelling, on the other hand, assumes that all variables are constant in spite of the ongoing process that tends to change them. Thus, the modelling of the binary valves of the control loops is irrelevant and it should not be included in the steady state simulation model. Control valves, on the other hand, are captured in the steady state simulation model to adjust the flows, temperatures, pressures, consistencies, etc. of the steady state. Figure 3, UML activity diagram represenation of an algorithm that removes binary valves from the intermediate graph representation of a process, shows an algorithm for removing the binary valves present in the P&ID from the intermediate graph presentation of the process. The algorithm iterates through all the nodes in the graph and uses node types to identify the binary valves. For each binary valve, the algorithm iterates through all of the edges in the graph to find the edges representing the outgoing and incoming flows of the valve, 'eDownstream' and 'eUpstream', respectively, in Figure 3. UML activity diagram represenation of an algorithm that removes binary valves from the intermediate graph representation of a process. The node and 'eDownstream' are removed. The target of 'eUpstream' is changed to the target of 'eDownstream'.  
The binary valve removal algorithm in Figure 3 is relevant for all steady state simulation tools. In contrast, there are differences between how tools model tanks with internal heaters. In some tools, such as the tool used in our case study, the library of equipment symbols does not have a tank with an internal heater. In such cases, the tank with an internal heater can be modelled by adding the heater to the outgoing flow of the tank. Figure 4 shows an activity diagram for this purpose. The source information for this algorithm is the graph outputted by the algorithm in Figure 3, UML activity diagram represenation of an algorithm that removes binary valves from the intermediate graph representation of a process. The algorithm iterates through all nodes in the graph and looks for tanks with heaters ('heater' in Figure 4). For all such nodes, the algorithm iterates through all of the edges to find the outgoing edge. A node representing a heating element is added to the outgoing flow.  
Figure 3: UML activity diagram represenation of an algorithm that removes binary valves from the intermediate graph representation of a process.