First you need to have the data on your reaction. You can configure this on the level of your unit operation (or hardcode it into your unit operation) but another way to do this is to use CAPE-OPEN Reaction Packages. Reaction Packages are much like Property Packages.
Unforunately the simulation environment you are working in must support Reaction Packages. There are not many Simulation Environments that do at this point. For the current status of the Reaction Packages this support is present in COCO, and I believe there is partial support in Aspen Plus (I cannot check the accuracy of this statement, if anybody has more information on the status of Reaction Package support please contribute to this discussion).
I do expect support for CAPE-OPEN Reaction Packages to get bigger in the next few years, as there are plans to integrate Reaction Packages with Thermodynamic Property Packages.
So, if you are going to use Reaction Packages, the story is more or less like this:
- you have to load a Reaction Package into your simulation
- your CAPE-OPEN Unit Operation has to implement a Reaction Context interface
- the simulation environment will assign a Reaction Object to your Reaction Context (this is the equivalent of a Material Object, but then for Reaction data calculations)
- you can obtain data on reactions, stoichiometry, phase, reaction type, rates, heat of reaction, etc, via the reaction context
The officially releases CAPE-OPEN Reaction document is "Chemical Reactions Interface Specification.pdf"; it is part of the CAPE-OPEN documentation set. I would recommend to ignore certain aspects of this document; for more information, see
http://cocosimulator.org/downloads/Cambridge_AGM_2008_with_notes.pdf.
Whether you use CAPE-OPEN Reaction Pacakges to define your reactions or you define your reactions on the level of your Unit Operation, the remainder of the implementation remains pretty much the same. In case of a PFR, you define a CAPE-OPEN Unit Operation (as all other Unit Operations); you assign a feed and product material port to it, you create the parameters that define the reaction conditions (e.g. reactor length, diameter, phase, thermal operation details (isothermal or adiabatic, or ...), integration parameters (tolerance, ...), pressure drop details, ...). In the Validation step you do the usual work (e.g. check that all ports are connected, check that the material definition connected to each port has consistent compound and phase lists, ...).
During Calculation you get your feed conditions; you integrate your mass and energy balances over the length of the reactor (usually by using some numerical integration method), and you end up with component flows at the end of your reactor, as well as pressure and either temperature or enthalpy. This is enough to define and flash the product material, as with any other CAPE-OPEN Unit Operation.
Special care has to be taken for the heat balance. You will not know for sure whether 'enthalpy' includes heat of formation or not. If it does, you should not take into account heat of reaction, as it is implicitly taken into account by the 'enthalpy' terms. If heat of formation is not included, heat of reaction should be accounted for.
Newer definitions of enthalpy, specifically 'enthaplyF' (which is sure to include heat of formation) and 'enthalpyNF' (which is sure not to include formation terms) will make life easier, but these new enthalpies are not (yet) widely supported.