Web Site for Chapter 4
Flowsheet Synthesis and Development of
Plant Design and Economics for Chemical Engineers
Fifth Edition

By Peters, Timmerhaus, and West

ALGORITHMIC FLOWSHEET GENERATION

A series of executable codes is provided in this section so that users can follow the implementation of an algorithmic method for flowsheet synthesis, i.e., process-network synthesis (PNS), based on process graphs (P-graphs) on a computer. The demonstration program for each algorithm of this method is provided in the website.


Fundamentals of Algorithmic Process-Network Synthesis

The framework of the method, as depicted in Figure 4-8 of the text, is reproduced below:



Figure 4-8.  Major steps for the algorithmic process-network synthesis based on graph theory.



Application of Algorithmic Process-Network Synthesis to Vinyl Chloride Production

The steps in Figure 4-8 can be demonstrated with the executable codes provided by applying them to corresponding steps of flowsheet synthesis for the manufacture of vinyl chloride according to the so-called balanced process described in the text.

The balanced process for vinyl-chloride synthesis involves three reactions r1, r2 and r3, which collectively lead to the overall reaction.




Reaction-Network Synthesis 

In the first major step, feasible reaction networks are synthesized as the precursors to process networks.  This first major step comprises three substeps. The maximal reaction network is synthesized in the first of these three substeps.

Generation of the Maximal Structure Corresponding to the Maximal Reaction Network with Algorithm MSG 

The maximal-reaction network is synthesized by means of algorithm MSG.  The information necessary for preparing the inputs is specified in conjunction with the problem definition and Figure 4-10 in the text. Figure WA-1 illustrates the flowchart for executing algorithm MSG to generate the maximal reaction network of the balanced process for synthesizing vinyl chloride. What follows describe the procedure.



Figure WA-1. Flowchart for algorithm MSG as applied to the generation of the maximal reaction network of the balanced process for vinyl-chloride synthesis.

Demonstration programs for algorithm MSG

Two implementations of algorithm MSG can be downloaded, the

Command-line implementation of algorithm MSG

A command-line implementation of algorithm MSG can be downloaded here.  The  input  to  this  program  is  a  plain  text  file including the formal definition of the synthesis problem. This input file can be created by any plain text-editor, e.g., Microsoft Notepad. Other examples together with the demonstration programs are available in www.p-graph.com.

The file has a clear hierarchical structure defined as follows:
At the highest level, a list of objects separated by commas is established; these objects may have attributes. If an object defined in this formal language has a single attribute, it is followed by a colon and the attribute. If the object has multiple attributes, the colon is followed by curly braces. In each of the braces, the attribute is separated by a comma. Any attribute can be regarded as an object and may also have its own attributes.

For the problem of concern, keyword “pns_problem” is at the highest level, i.e., level one, indicating that a synthesis problem is defined. The set of materials (reactants, or reacting species, for reaction-network synthesis, i.e., rns) and operating units, (individual reactions, or reaction steps, for rns) are at the second level as the attributes of the “pns_problem” at level one. A list of materials’ names defines the set of materials, each of which can be a desired product (final reaction product for rns) or raw material (starting reactant for rns) indicated by keywords “product” and “raw” as attributes of the material (reacting species for rns). The operating units (reactions steps for rns) are defined by the list of their input and output materials’ names. Note that letters, numbers, plus and minus signs, stars, and underscores, are allowed in names, e.g., O2-, Cl-, H+, hydrogen_chloride, CH3*. The input to the executable code for algorithm MSG for reaction-network synthesis (rns) is given in the following.

Input for implementation of algorithm MSG (file rns.in):

pns_problem :
{
    materials :
    {
        
        C2H4 : raw,
        Cl2 : raw,
        O2 : raw,
        C2H3Cl : product,
        H2O,
        C2H4Cl2,
        HCl
    },

    operating_units :
    {

        r1 :    {
            input : {
                C2H4,
                Cl2
            },
            output : {
                C2H4Cl2
            }
        },

        r2  : {
            input : {
                C2H4,
                HCl,
                O2
            },
            output : {
                C2H4Cl2,
                H2O
            }
        },

        r3 : {
            input : {
                C2H4Cl2
            },
            output : {
                C2H3Cl,
                HCl
            }
        }
    }
}

The program can be executed in a command prompt by entering its name, i.e., pns, followed by MSG and the names of the input file and the output file, i.e., rns.in rnsmsg.out. Thus,

pns MSG rns.in rnsmsg.out

The parameters are separated by spaces.

The output from the program is the synthesis problem given in the input and the list of materials (reacting species) and operating units (reactions) included in the maximal structure representing the maximal reaction network shown in step 5 of Figure 4-12 in the text. Note that the input structure containing all the input information in the form of P-graphs as given in Figure 4-11 is internally generated. The output from the executable code for algorithm MSG for reaction-network synthesis is given in the following.

Output from the implementation of algorithm MSG (file rnsmsg.out):

#rns.in

pns_problem :
{
    materials :
    {
        C2H4 : raw,
        Cl2 : raw,
        O2 : raw,
        C2H3Cl : product,
        H2O,
        C2H4Cl2,
        HCl
    },
    operating_units :
    {
        r1 :
        {
            input :
            {
                C2H4,
                Cl2
            },
            output : C2H4Cl2
        },
        r2 :
        {
            input :
            {
                C2H4,
                HCl,
                O2
            },
            output :
            {
                C2H4Cl2,
                H2O
            }
        },
        r3 :
        {
            input : C2H4Cl2,
            output :
            {
                C2H3Cl,
                HCl
            }
        }
    }
},
#output
maximal_structure :
{
    materials :
    {
        C2H4,
        Cl2,
        O2,
        C2H3Cl,
        H2O,
        C2H4Cl2,
        HCl
    },
    operating_units :
    {
        r1,
        r2,
        r3
    }
}

 
As noted earlier, the output manifests itself as the maximal reaction network for vinyl-chloride synthesis according to the balanced process as given in step 5 on Figure 4-12 of the text.

Implementation of algorithm MSG with graphical user interface

A graphical user interface is also downloadable for manipulating a PNS problem and calling combinatorial algorithms, e.g., algorithms MSG and SSG. It is termed Combinatorial PNS Editor; the main window of this editor is divided into two parts; see Figure WA-1a.



Figure WA-1a

The upper part lists materials (starting reactants, final reaction products, and intermediates or reacting species, for reaction-network synthesis, i.e., rns) and the bottom part lists operating units (individual reaction steps for rns) defining a PNS problem. A material can be added to the list of materials by pressing button Add on the right-hand side of the list. A small window titled Material properties appears; see Figure WA-1b.



Figure WA-1b

After entering the name of the material and selecting whether it is a raw material (a starting reactant for rns), product (a final reaction product for rns), or neither, the material can be added to the problem by pressing button OK; see Figure WA-1c.



Figure WA-1c

The name and type of the material appears in the list of materials. All of the remaining materials can be defined similarly.

After having a list of materials the operating units can be added to the PNS problem being considered by pressing button Add.. on the right hand side of the list of operating units in the main window shown in Figure WA-1a. A window titled Operating unit properties appears; see Figure WA-1d.

 

Figure WA-1d

After entering the name of the operating unit (individual reaction step for rns) its input and output materials (reactants and products of an individual reaction step for rns) can be given one-by-one by selecting them in the list of materials on the right-hand side and pressing button << Add on the right-hand side of the lists of input and output materials labeled by Input and Output; see Figure WA-1e.



Figure WA-1e

When the name of an operating unit (individual reaction step for rns) and all of its input and output materials (reactants and products of individual reaction step for rns) are given, the operating unit can be added to the problem by pressing OK in the window; see Figure WA-1e. All of the remaining operating units can be defined similarly. At this stage, the problem is ready to be solved but it should be saved first by selecting menu item File/Save in the main window; see Figure WA-1f.



Figure WA-1f

Then, a filename, e.g., rns.in, is entered and Save is pressed in the window; see Figure WA-1g.



Figure WA-1g

As a result, the name of the problem appears in the title bar of the main window; see Figure WA-1h.




Figure WA-1h

To call algorithm MSG, menu item Generate/MSG is selected; see Figure WA-1i.



Figure WA-1i

Subsequently, the graphical interface calls the command line program, pns. The output from this program is converted into an easy-to-read format containing the lists of materials (reactants and products of individual reaction steps for rns) and operating units included in the maximal-structure, which appear in the succeeding window; see Figure WA-1j.



Figure WA-1j

Generation of the Solution-Structure Corresponding to the Combinatorially Feasible Reaction Networks with Algorithm SSG

The combinatorially feasible reaction networks, i.e., synthetic routes, for vinyl-chloride synthesis are generated by algorithm SSG with the aforementioned maximal reaction network in Figure 4-12 of the text as its input. The implementation of algorithm SSG for reaction-network synthesis (rns) is diagrammatically illustrated in Tables 4-2a through 4-2c of the text. Figure WA-2 shows the flowchart for executing this algorithm on a computer.



Figure WA-2. Flowchart for algorithm SSG as applied to the generation of the combinatorially feasible reaction networks of the balanced process for vinyl-chloride synthesis.

Algorithm SSG for reaction-network synthesis (rns) can be executed by the same program as that for algorithm MSG for reaction-network synthesis (rns) by entering the SSG instead of MSG as indicated below.

pns SSG rns.in rnsssg.out

The output from executing algorithm SSG for reaction-network synthesis (rns), as given in the following, contains three sets of materials (reacting species) and operating units (reactions) representing the three solution structures (combinatorially feasible reaction networks) illustrated in Figure 4-14 of the text.


Output from the implementation of algorithm SSG (file rnsssg.out):

#rns.in
pns_problem :
{
    materials :
    {
        C2H4 : raw,
        Cl2 : raw,
        O2 : raw,
        C2H3Cl : product,
        H2O,
        C2H4Cl2,
        HCl
    },
    operating_units :
    {
        r1 :
        {
            input :
            {
                C2H4,
                Cl2
            },
            output : C2H4Cl2
        },
        r2 :
        {
            input :
            {
                C2H4,
                HCl,
                O2
            },
            output :
            {
                C2H4Cl2,
                H2O
            }
        },
        r3 :
        {
            input : C2H4Cl2,
            output :
            {
                C2H3Cl,
                HCl
            }
        }
    }
},
#output
solution_structures :
{
    1 :
    {
        materials :
        {
            C2H4,
            Cl2,
            C2H3Cl,
            C2H4Cl2,
            HCl
        },
        operating_units :
        {
            r1,
            r3
        }
    },
    2 :
    {
        materials :
        {
            C2H4,
            O2,
            C2H3Cl,
            H2O,
            C2H4Cl2,
            HCl
        },
        operating_units :
        {
            r2,
            r3
        }
    },
    3 :
    {
        materials :
        {
            C2H4,
            Cl2,
            O2,
            C2H3Cl,
            H2O,
            C2H4Cl2,
            HCl
        },
        operating_units :
        {
            r1,
            r2,
            r3
        }
    }
}


As mentioned earlier, this output manifests itself as the three combinatorially feasible reaction networks for vinyl-chloride synthesis according to the balanced process as given in Figure 4-14 of the text.

Algorithm SSG can also be called by the Combinatorial PNS Editor by selecting menu item Generate/SSG.

Identification of the Feasible Reaction Network Among the Combinatorially Feasible Ones by Linear Programming  

The feasible reaction networks (synthetic routes) are to be determined among the three combinatorially feasible networks.  As described in the text, this is accomplished by minimizing the sum of the unknown multipliers for individual reactions in each of the three combinatorially feasible reaction networks by means of linear programming (LP), specifically integer linear programming (ILP).  The results indicate that only network (c) in Figure 4-14 of the text yields the solution, thus indicating that it is the only feasible reaction network (synthetic route).



Process-Network Synthesis 

The resultant feasible reaction network guides the initial selection of major operating units, which are reacting units. Each of these reacting units is followed by a separating unit.

Identification of the Plausible Operating Units

The initially selected operating units in conjunction with additional technical information available makes it possible to identify all plausible operating units whose P-graph representations are given in Figure  4-19 of the text. These operating units are designated as R1, R2, R3, S1, S2, S3and M1. Thus, process-network synthesis (pns) can now proceed as indicated in the second major block in Figure 4-8.

Generation of the Maximal Structure with Algorithm MSG

Figure WA-3 illustrates the flowchart for executing algorithm MSG for process-network synthesis to generate the maximal structure of the balanced process for vinyl-chloride synthesis. The procedure to execute this algorithm is identical to that for generating the maximal-reaction network, as shown in Figure WA-1, except that the input given in the following specifically indicates that it is for generating the maximal structure for process-network.



Figure WA-3. Flowchart for algorithm MSG as applied to the generation of the maximal structure of the balanced process for vinyl-chloride synthesis.

The program can be executed in a command prompt by entering its name, i.e., pns, followed by MSG and the names of the input file and the output file, i.e., pns.in and pnsmsg.out; thus,

            pns MSG pns.in pnsmsg.out

The parameters are separated by spaces. What follows is the input to executable code for algorithm MSG for process-network synthesis.

Input for the implementation of algorithm MSG (file pns.in):

pns_problem :
{
    materials :
    {
        S01 : raw,
        S02 : raw,
        S03 : raw,
        S04,
        S05,
        S06,
        S07,
        S08,
        S09,
        S10,
        S11,
        S12,
        S13,
        S14 : product
    },

    operating_units :
    {

        R-1 :    {
            input : {
                S01,
                S02
            },
            output : {
                S04
            }
        },

        R-2  : {
            input : {
                S02,
                S03,
                S12
            },
            output : {
                S05
            }
        },

        R-3 : {
            input : {
                S10
            },
            output : {
                S11
            }
        },
    
        S-1 : {
            input : {
                S08
            },
            output : {
                S09,
                S10
            }
        },

        S-2 : {
            input : {
                S05
            },
            output : {
                S06,
                S07
            }
        },

        S-3 : {
            input : {
                S11
            },
            output : {
                S12,
                S13,
                S14
            }
        },

        M-1 : {
            input : {
                S04,
                S06,
                S13
            },
            output : {
                S08
            }
        }
    }
}

 
The output from the program is the synthesis problem given in the input as well as the list of materials and operating units included in the maximal structure shown in Figure 4-6 of the text. The output from the executable code for algorithm MSG for process-network synthesis (pns) is given in the following.

Output from the implementation of algorithm MSG (file pnsmsg.out):

#pns.in
pns_problem :
{
    materials :
    {
        S01 : raw,
        S02 : raw,
        S03 : raw,
        S04,
        S05,
        S06,
        S07,
        S08,
        S09,
        S10,
        S11,
        S12,
        S13,
        S14 : product
    },
    operating_units :
    {
        R-1 :
        {
            input :
            {
                S01,
                S02
            },
            output : S04
        },
        R-2 :
        {
            input :
            {
                S02,
                S03,
                S12
            },
            output : S05
        },
        R-3 :
        {
            input : S10,
            output : S11
        },
        S-1 :
        {
            input : S08,
            output :
            {
                S09,
                S10
            }
        },
        S-2 :
        {
            input : S05,
            output :
            {
                S06,
                S07
            }
        },
        S-3 :
        {
            input : S11,
            output :
            {
                S12,
                S13,
                S14
            }
        },
        M-1 :
        {
            input :
            {
                S04,
                S06,
                S13
            },
            output : S08
        }
    }
},
#output
maximal_structure :
{
    materials :
    {
        S01,
        S02,
        S03,
        S04,
        S05,
        S06,
        S07,
        S08,
        S09,
        S10,
        S11,
        S12,
        S13,
        S14
    },
    operating_units :
    {
        R-1,
        R-2,
        R-3,
        S-1,
        S-2,
        S-3,
        M-1
    }
}


Generation of the Solution-Structure Corresponding to the Cominatorially Feasible Process Networks with Algorithm SSG

The combinatorially feasible process networks, i.e., flowsheets, for vinyl-chloride synthesis, are generated by algorithm SSG with the aforementioned maximal structure in Figure 4-16 of the text as its input. The implementation of algorithm SSG for process-network synthesis (pns) is  diagrammatically illustrated in Table 4-4 of the text. Figure WA-4 illustrates the flowchart for executing this algorithm on a computer.



Figure WA-4. Flowchart for algorithm SSG as applied to the generation of the solution structures (combinatorially feasible flowsheets) of the balanced process for vinyl-chloride synthesis.

Algorithm SSG for process-network synthesis (pns) can be executed by the same program as that for algorithm MSG for pns by selecting SSG instead of MSG as indicated below.

            pns SSG pns.in pnsssg.out

The output from executing algorithm SSG for process-network synthesis (pns) as given in the following contains one set of materials and operating units representing the single solution structure (cominatorially feasible process network, i.e., flowsheet) illustrated in Figure 4-18 of the text.

Output from the implementation of algorithm SSG (file pnsssg.out):

#pns.in
pns_problem :
{
    materials :
    {
        S01 : raw,
        S02 : raw,
        S03 : raw,
        S04,
        S05,
        S06,
        S07,
        S08,
        S09,
        S10,
        S11,
        S12,
        S13,
        S14 : product
    },
    operating_units :
    {
        R-1 :
        {
            input :
            {
                S01,
                S02
            },
            output : S04
        },
        R-2 :
        {
            input :
            {
                S02,
                S03,
                S12
            },
            output : S05
        },
        R-3 :
        {
            input : S10,
            output : S11
        },
        S-1 :
        {
            input : S08,
            output :
            {
                S09,
                S10
            }
        },
        S-2 :
        {
            input : S05,
            output :
            {
                S06,
                S07
            }
        },
        S-3 :
        {
            input : S11,
            output :
            {
                S12,
                S13,
                S14
            }
        },
        M-1 :
        {
            input :
            {
                S04,
                S06,
                S13
            },
            output : S08
        }
    }
},
#output
solution_structures : 1 :
    {
        materials :
        {
            S01,
            S02,
            S03,
            S04,
            S05,
            S06,
            S07,
            S08,
            S09,
            S10,
            S11,
            S12,
            S13,
            S14
        },
        operating_units :
        {
            R-1,
            R-2,
            R-3,
            S-1,
            S-2,
            S-3,
            M-1
        }
    }


As indicated earlier, the output manifests itself as the only combinatorially feasible process network (flowsheet) for vinyl-chloride synthesis according to the balanced process as given in Figure 4-18 of the text. Naturally, this combinatorially feasible flowsheet is expected to be the feasible flowsheet as can be verified through the material balances.

No demonstration programs are provided here for size and cost estimation of individual operating units or for the optimization of the objective function in terms of the annualized cost according to Eq. (4-2). These are subjects treated elsewhere in the text.

An additional example for vinyl-chloride synthesis is given in www.p-graph.com linked to this website to demonstrate process-network synthesis when the production of HCl is allowed. Readers can also carry out the flowsheet synthesis of a process with the executable code of the demonstration program given in this website as long as the synthesis does not involve more than 15 operating units. A wealth of information on P-graphs and their applications is contained in the latter website which will eventually include P-graph based treatment of some of the other topics covered in the text.