Automatic differentiation of the CapeML high-level language for process engineering

  • Automatische Differentiation von CapeML-Hochsprachmodellen der Verfahrenstechnik

Petera, Monika Anna; Bischof, Christian (Thesis advisor)

Aachen : Publikationsserver der RWTH Aachen University (2011, 2012)
Dissertation / PhD Thesis

Aachen, Techn. Hochsch., Diss., 2011


To perform computer simulations of the modeled phenomena the mathematical description the model needs to be implemented as a computer program, and often the choice of implementation language depends on the simulation environment chosen. This dependency of the programming language and the simulation environment hamper the exchange of model information between modelers who may use different simulation tools. The mathematical models motivating this thesis are specified in equation-based modeling languages. Rather than a procedural code, equation-based concept defines dependencies between model variables which is advantageous for building compound models in process engineering. Therefore, at Process Systems Engineering at RWTH Aachen University, CapeML, an XML based language definition has been proposed to provide an intermediate representation of a mathematical model description which is independent of a simulation environment. CapeML may be generated from a number of equation-based programming languages, thus making it possible to combine smaller model components to build more complex models. Additionally, XML, which is a standardized format, allows for syntax verifications, content validation and source transformations which may not only translate the contents of XML into another representation but even augment the enclosed data with additional information. The main goal of this thesis is to present the suitable and innovative facility to augment CapeML model descriptions with derivative information required for the selected optimization schemes. In the course of this thesis, a source transformation tool called ADiCape has been developed to provide automatically generated CapeML code for derivative computations. These derivatives are determined by means of Automatic Differentiation (AD) techniques. The transformation rules of ADiCape are implemented in eXtensible Style-sheet Language Transformation (XSLT), a template-based transformation language for structured XML-based data. As it turns out, its functional transformation paradigm fits well with an equation-based modeling approach. Customizable transformation in ADiCape allows for generation of first and second order code for calculation of derivatives in a form required by the employed optimization algorithms. During these transformations, the structure of the mathematical model is examined for possible increase in the efficiency of the derivative calculation. For instance, code optimization techniques such as constant folding, constant propagation and loop unrolling are employed to eliminate derivative-irrelevant expressions from the model description. Additionally, the sparsity of the Jacobian matrix is exploited to reduce the computational effort of derivative calculation. Furthermore, only a fraction of the derivative information may be extracted for computation to concentrate the investigations on a particular part of the model. ADiCape is designed to be a part of the dynamic optimization environment DyOS, providing accurate derivative information for the optimization of engineering models. To meet these requirements, ADiCape implements the forward and reverse mode of AD to supply the iterative solvers of DyOS with full Jacobian matrices, Jacobian and Hessian (multi-)vector products and symmetric projections of Hessian matrix. The results of the project investigations show that the automatic differentiation may also be employed in equation-based modeling approach. The preprocessing techniques derived from the code optimization field allow the preparation of the domain-specific code for the complex mathematical transformations. This thesis describes the specification for the transformation tool ADiCape, the implementation solution, as well as the employed methods for code optimization and sparsity exploitation. The impact on the computational time and memory requirement is shown in several test examples. The presented result of an optimization of a industrial process model proves the successful incorporation of ADiCape-generated derivatives of CapeML models in the engineering optimization environment. The performance of the transformation and evaluation of derivatives in the declarative language are also shown to concur with theoretical benchmarks.