1 / 29

Control Programming

Control Programming By Peter Woolf University of Michigan Michigan Chemical Process Dynamics and Controls Open Textbook version 1.0. Creative commons. Process from previous class. What more do we need?. • How do these controllers influence the valves and motors?

armen
Download Presentation

Control Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Control Programming By Peter WoolfUniversity of MichiganMichigan Chemical Process Dynamics and Controls Open Textbook version 1.0 Creative commons

  2. Process from previous class.. What more do we need? • How do these controllers influence the valves and motors? • What is the sequence of actions? • What happens in an emergency? Specify with a control program! TC1: V5 PC1: V6, V7, V8 LC3: V1, V2, V3, SV1, M3, M4 FC3: V3, M3 FC4: SV1 FC1: V1, V2, M1 FC2: V1, V2, M2 LC1: V1, V8, V2, M1 LC2: V1, V2, M2 TC2: V7

  3. What is a control program? • A detailed procedure identifying what every valve should be doing under each possible condition. • A computing language for expressing control relationships • Can be discrete (on/off or high/medium/low) or continuous (open % from 0% to 100%)

  4. Control Program Languages? Control specific languages: Ladder logic, Structured text, + many proprietary versions General computing languages: Basic, C, Pascal, and less commonly C++, Java, and Python Here we will use a composite pseudo code that has most of the features without the syntax issues.

  5. Control Programming Syntax • IF.. THEN .. ELSE • CASE • WHILE • GOTO • ALARM

  6. open closed : starts a sub block indent defines a sub block Tset+2 ELSE IF allows a series of conditionals Tset Tset-2 time time Control Programming Syntax IF T>Tset+2: open v1 ELSE IF T<Tset-2: close v1 • IF.. THEN .. ELSE IF T>Tset+2: open v1 ELSE: close v1

  7. Problem: Equals implies exactly equal to a controller. Thus temp=90°C is interpreted as temp=90.0000000°C at one of the sampled times which won’t happen! Solution: Use >, <, ≥, or ≤ instead of =

  8. indent note nested indents Tset+2 Tset Tset-2 time time IF T>Tset+1: IF T>Tset+2: v2=v2+0.1 ELSE: v2=v2+0.05 ELSE IF T<Tset-1: IF T<Tset-2: v2=v2-0.1 ELSE: v2=v2-0.05 • CASE: alternate syntax that can be cleaner than many IF.. THEN statements CASE: T>Tset+2: v2=v2+0.1 T>Tset +1: v2=v2+0.05 T<Tset-1: v2=v2-0.05 T<Tset-2: v2=v2-0.1

  9. WHILE: Creates loops for things that take an unknown number of iterations. WHILE LC1<LC1set: open v1 close v1 WHILE TC1<TC1set: heater on heater off

  10. FUNCTION: defines a function #: defines a comment • GOTO: Breaks out of current run to go to a different configuration. WHILE time<RxnTime: IF T>Trxn: close v1 ELSE: open v1 IF OR(T>Talarm, P>Palarm): GOTO FAILSAFE FUNCTION FAILSAFE: # an emergency condition to shut down the process close v1, open v2

  11. ALARM: Alerts the operators of a problem. Alarms may not be sufficient danger to shut down the process, but requires outside attention. Examples: • If storage tank of a reactant is low, then ALARM • If a reactor does not heat up in a normal time window, then ALARM • If no flow is detected even when the valve is open, then ALARM (might be cause for FAILSAFE if the valve is critical) • If redundant sensors disagree, then ALARM

  12. Common functions accessed using GOTO FUNCTION INITIALIZE: # runs at the start of a process to make sure all # valves and motors are in correct position. FUNCTION PROGRAM: # main run FUNCTION FAILSAFE: # emergency mode FUNCTION SHUTDOWN: # normal shutdown procedure FUNCTION IDLE: # power down process

  13. Common functions accessed using GOTO FUNCTION INITIALIZE: # runs at the start of a process to make sure all valves # and motors are in correct position. • Example operations: • Close all valves • Reset counters and timers • Turn off all motors • Turn off heaters

  14. Common functions accessed using GOTO FUNCTION FAILSAFE: # emergency mode • Example operations: • Open or close valves to stop the system • Quench reactions via cooling, dilution, mixing, or other method.

  15. What is the procedure for this process? TC1: V5 PC1: V6, V7, V8 LC3: V1, V2, V3, SV1, M3, M4 FC3: V3, M3 FC4: SV1 FC1: V1, V2, M1 FC2: V1, V2, M2 LC1: V1, V8, V2, M1 LC2: V1, V2, M2 TC2: V7

  16. A measured amount, QS, of solvent is added to the reactor A measured amount of solid B, QB, is added to the S and blended in for 5 minutes. A total quantity of A, QA is slowly added to the reactor. The A and B react quickly producing the product polymer in an endothermic reaction. The temperature must be maintained below TR+5 degrees to prevent forming a hard polymer. The pressure of the reaction is somewhat elevated due to the partial vaporization of S. However, the tank pressure must not exceed 3 atm. The product is held in the reactor for 30 minutes after the reaction has stopped to ensure complete conversion. 5. The S is then boiled off and recovered in an overhead condenser. This recycled S is then sent to storage for reuse. 6. The product is then cooled to ambient temperature and pumped to blending. Tamb<TR<TS<TA<Tprod<TB Procedures to write: FUNCTION INITALIZE FUNCTION FAILSAFE FUNCTION PROGRAM

  17. Counters used for measurement Note v4 is manual, so not controlled by program FUNCTION INITALIZE: turn off M1, M2, M3, M4 close v1,v2,v3,v5,v6,v7,v8, SV1 set all timers to zero set all totalizers to zero

  18. Keep agitator going if sufficient level in tank to avoid hot spots, otherwise turn off agitator Prevent pressure increase in reactor FUNCTION FAILSAFE: turn off M1, M2, M3 IF LC3>LC3min: turn on M4 ELSE: turn off M4 close v1, v2, v3, v5, SV1 open v6, v7, v8

  19. A measured amount, QS, of solvent is added to the reactor Open v1 to some control set point until charged FUNCTION PROGRAM # step 1 turn on M1 open v6, v7,v8 WHILE FC1tot<Qs: adjust v1 to FC1set IF LC1<LC1min: ALARM close v1 turn off M1

  20. A measured amount, QS, of solvent is added to the reactor A measured amount of solid B, QB, is added to the S and blended in for 5 minutes. FUNCTION PROGRAM (continued) # step 2 WHILE FC4tot<QB: adjust SV1 to FC4set IF FC4<FC4min: ALARM IF LC3>LC3min: Turn on M4 close SV1 WAIT 5 minutes

  21. 3. A total quantity of A, QA is slowly added to the reactor. The A and B react quickly producing the product polymer in an endothermic reaction. The temperature must be maintained below TR+5 degrees to prevent forming a hard polymer. The pressure of the reaction is somewhat elevated due to the partial vaporization of S. However, the tank pressure must not exceed 3 atm. FUNCTION PROGRAM (continued) # step 3 WHILE TC1<TR: adjust v5 to TR turn on M2 WHILE FC2tot<QA: adjust v2 to FC2set IF LC2<LC2min: ALARM adjust v5 to TR IF OR(TC1>TR+5, PC1>3 atm): GOTO FAILSAFE

  22. FUNCTION PROGRAM (continued) # step 3 WHILE TC1<TR: adjust v5 to TR turn on M2 WHILE FC2tot<QA: adjust v2 to FC2set IF LC2<LC2min: ALARM adjust v5 to TR IF OR(TC1>TR+5, PC1>3 atm): GOTO FAILSAFE IF PC1<PC1min: close v6, v7 ELSE: adjust v6 to PC1set adjust v7 to TC2set IF LC3>LC3max: close v2 FC2tot=QA ALARM close v2, turn off M2

  23. 4. The product is held in the reactor for 30 minutes after the reaction has stopped to ensure complete conversion. FUNCTION PROGRAM (continued) # step 4 WHILE timer<30 minutes: adjust v5 to TR IF OR(TC1>TR+5, PC1>3 atm): GOTO FAILSAFE IF PC1<PC1min: close v6, v7 ELSE: adjust v6 to PC1set adjust v7 to TC2set

  24. 5. The S is then boiled off and recovered in an overhead condenser. This recycled S is then sent to storage for reuse. • FUNCTION PROGRAM (continued) • # step 5 • open v5 • WHILE TC1<TS+1: • IF PC1>3 atm: • GOTO FAILSAFE • IF PC1<PC1min: • close v6, v7 • ELSE: • adjust v6 to PC1set • adjust v7 to TC2set

  25. FUNCTION PROGRAM (continued) • # step 6 • close v5 • WHILE TC1>Tamb+1: • IF PC1>3 atm: • GOTO FAILSAFE • IF PC1<PC1min: • close v6, v7 • ELSE: • adjust v6 to PC1set • adjust v7 to TC2set 6. The product is then cooled to ambient temperature and pumped to blending.

  26. FUNCTION PROGRAM (continued) • # step 6 • close v5 • WHILE TC1>Tamb+1: • IF PC1>3 atm: • GOTO FAILSAFE • IF PC1<PC1min: • close v6, v7 • ELSE: • adjust v6 to PC1set • adjust v7 to TC2set • close v7 • open v6 • turn M3 on • WHILE LC3>0: • adjust v3 to FC3set • IF LC3<LC3min: • turn M4 off • turn off M3 • close v3, v7, v8

  27. Programming Tips • Programs can quickly get very complicated, thus it helps to write out the program in words first, then syntax later • Remember that valves and motors stay in the state you left them • Beware of conflicts between objectives and infinite loops

  28. Take Home Messages • Control programs provide a detailed description of how a process behaves • Writing control programs requires a deep understanding of the process • Write out the program in words first, syntax second. • Break up the program into smaller steps, modules, and objects • Comment your code!

More Related