Python Facilitating Code Refactoring Using Python to Facilitate Code Refactoring Using Python to Facilitate Code Refactoring Code Refactoring 1 1 Ben Christenson Associate Scientist – Process Optimization Engineering Sciences – Core R&D Dow Chemical Company 7/14/2011 Process Automation Legacy Migration PALM Yahya Nazer M&E Consultant Engineering Solutions Technology Center Dow Chemical Company
26
Embed
Using Python to Facilitate Python Facilitating Code Refactoring
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Python Facilitating Code Refactoring
Using Python to Facilitate
Code Refactoring
Using Python to Facilitate
Code RefactoringCode Refactoring
11
Code RefactoringCode Refactoring
Ben ChristensonAssociate Scientist – Process Optimization
Engineering Sciences – Core R&D
Dow Chemical Company
7/14/2011
Process Automation Legacy Migration
PALM
Yahya NazerM&E Consultant
Engineering Solutions Technology Center
Dow Chemical Company
Background
Code Refactoring is a systematic way of restructuring code without changing the intent of the code.
Background
Code Refactoring is a systematic way of restructuring code without changing the intent of the code.
� Historically code refactoring has been used for:
� Compilers
� Military
� Finance
� Communication� Communication
� Process Control
Background
Code Refactoring is a systematic way of restructuring code without changing the intent of the code.
� Historically code refactoring has been used for:
� Compilers
� Military
� Finance
� Communication� Communication
� Process Control
� PALM worked on Process Control for:
� Translation
� Simulation
� Transition Logic
� Data Mining
� Code Analysis
� Migration
Background
Process Control, within Dow, refers to using computers to control the equipment for the purpose of manufacturing chemicals.
Background
Process Control, within Dow, refers to using computers to control the equipment for the purpose of manufacturing chemicals.
� Dow has been developing the MOD process control systems since 1960
� The MOD system is a state based system that looks similar to FORTRAN
� The MOD system is cutting edge with how it manages process automationprocess automation
� In MOD we have these global variables that tell what mode the process control is in.
� For migration these modes assignment statements need to be converted into transition logic between any two given modes.
� Transition logic were created by:
algebraic expansion and replacement
T3400_MWMaintance Wait
T3400_MW_PW T3400_PW_MW
� algebraic expansion and replacement
of the logic
� removing any logical paradoxes
� breaking the logic up into transitions
� And compressing the logic
T3400_PWProcess Wait
T3400_FILLFill
T3400_HEATHeat
T3400_RUNRun
T3400_CSHDNControl ShutDown
M
M
T3400_PW_FILL T3400_FILL_PW
T3400_FILL_HEAT
T3400_HEAT_RUN
T3400_HEAT_CSHDN
T3400_RUN_CSHDN
T3400_CSHDN_PW
COM & Excel
By using win32com and pythoncom, it was a very simple matter to control excel through python.� http://sourceforge.net/projects/pywin32/files/pywin32/Build%202