Simulationoptimizationbyautomationvia Python
Simulationoptimizationbyautomationvia Python
Simulationoptimizationbyautomationvia Python
One of
the easiest ways to simulate systems is to apply commercialized simulation software, such as
Aspen Plus and Aspen HYSYS, in which a lot of commonly used components are already
embedded. And the users also have the possibility to design their own components for some of
the simulation software.
However, the optimization problem is not always as easy as the design/simulation problem. In
general, researchers have two options, if they prefer simulating systems in simulation software:
1. using optimizer that is offered by the simulation software. However, sometimes it is not that
easy to achieve the goal the user wants to optimize; 2. linking external programs to automate
the simulation software and use simulation software as a calculation machine.
Here I use my research approach as an example to give some hints to those who want to
optimize their systems and bring some discussion, hopefully, about different approaches of
optimization for engineering problems, especially, chemical/process/power engineering. For
my research, first, I simulated some cases in Aspen HYSYS and then my interests go to the
optimization. I tried several times by using the optimizer offered by Aspen HYSYS, but I was
not satisfied with the results I got. Therefore, I was forced to connect HYSYS with
Matlab/Python to deal with the optimization problem.
I posted the code for connecting HYSYS with Matlab in my profile. And in this part, I will
more focus on the link between HYSYS with Python. The codes are very simple, please see
the attachment. However, the automation after linking two programs can be a little bit tricky.
In Matlab, you can check which variables are available for automation, but for Python, I have
not found any function that can do that yet. Nevertheless, the best way to discover all the
variables that the programmers left intentionally to be connected should be via COM browser.
There all the variable and the type of variables are listed.
For the optimization algorithm, I prefer, and I am using the stochastic algorithms, such as
genetic algorithm (GA) and differential evolution (DE). They do have their limitations, but
easy to be written and applied for almost all the chemical cases. As for as I know, only DE has
been included as a package in Scipy for minimalization. And some researchers state that DE is
faster than GA to converge.
However, connecting both of programs, knowing the variables for automating and choosing
the suitable optimization algorithm do not mean that the optimization will be carried out
smoothly. Because the optimization stops or goes in the wrong direction, if the simulation cases
are not well designed, which leads to error-prone simulations. Therefore, be aware of your
simulation inputs and calculation procedures when you design your systems, which will
definitely save a lot of time later if you are not only interested in the simulation but also the
optimization as well.
Thanks in advance for any comments and discussions about optimization problems.