Home
Steam Net Simulation with Real Control System
Contents
1. e c eese eee etes etn setas etna sense setas ena 9 4 THE STEAM NET MODEL cccccsscsssossscssssenesssescocssssosssnessonnsosasscocsenesoes 11 5 CONTROL OF A STEAM NET issccsscssscccsscsessscsssensccsasensssotesssesssenseosasenssses 13 6 THE WHOLE SYSTEM RUNNING IN DYMOLA eeeeeeee 16 7 SIMATIC PCS 7 osiossissosssssossssssss asvasssossusss dss ensnssssesv ssos neesssocsasiser essesasss denr 22 7 1 O olegi LOI I Ee TOI evene us edidi ete tee dard adea E MEE 22 7 24 Engineering Statlonaoaccut eoe a Tie a edidi Bed 23 1 3 PEC saa uh P 23 7 4 MAR CETISIONS Aces eR P 24 8 THE REAL CONTROL SYSTEM sss ssssoooo0o00o00000000000000000000000000000000000000 0000 25 9 COMMUNICATION BETWEEN SIMULATED PROCESS AND CONTROL SYSTEM s vs0si s0 s ssdoos sa0 080s0ds000815005080603s0sssecss0o0s008o0050dssss0s4sses 28 9 1 The communication media the file sese 29 9 2 Communication between Dymola and the file sss 30 9 3 Communication between S7 PLCSIM and the file sssesssssrssessosrersrsrrs sne 32 10 PUTTING IT ALL TOGETHER ssoooo0o00o00000000000000000000000000000000000000000 0000 33 IO The delay of the Sy Stel svens pe das eerte eaten Ree r s sond v SERO QUY gas uae Cone a Ege 33 10 2 Runnme theSystem cer a unu tubi E 34 TU Pere SIDES e te Ada dada qut beide O o ctos edd 34 10 2 2 Performance of the communic
2. 250 500 Time s Process_HP2_pressure 8 20 o 7 198 a 19 6 0 250 500 Time s 12 Process_MP_pressure T 2 S 10 EA o al 8 5 D 250 500 Time s 4s Process LP pressure q o 4 3 d o 35 a a 25 0 250 500 Time s Figure 29 oscillations of the nets using the Dymola control system with unit delays at the control signals Those oscillations should of course not appear in real steam nets Whether they come from a too sensitive simulated steam net or a poor control system is hard to tell 38 The delay of one second due to the sampling seams to be a problem but this sampling time is often used in the paper process industry 13 and probably the problem comes from a too sensitively simulated process In this master thesis there was neither time nor data to make a really good model of the steam net Nevertheless it is desirable to have a better working system to demonstrate Making some small changes of the control system however makes it possible to get rid of the oscillations as will be explained below The valves between HP1 and MP LP have great capacities and fluctuating control signals of those will affect the whole net If they are put into manual control it is possible to get the whole system stable but when changed back to automatic mode the net starts to oscillate again This gave rise to the idea to include dead band on some of the controllers The dead band is used so that the control deviation used in
3. e The development time will decrease It takes time to build a simulator of an advanced control system e One source of error is eliminated The model of the control system often becomes inadequate Some special functions time delays etc are very hard to model accurately e A new control system can be tested and tuned before put into operation By doing this you can avoid expensive adjustments during production e Improved operators training The operators can be trained in exactly the same user interface as they are used to but on the simulated process 1 2 Purpose The purpose of this master thesis is to build an interface between the controller and the process so that the simulated process steam net can be controlled by the real regulator The process is modelled in Dymola which is a tool for the modelling language Modelica and is the program that Solvina uses to simulate steam nets The control system is developed by Siemens and is called Simatic PCS 7 To be able to build and test the interface a demo process will be written in Dymola simulating a real paper mill steam net However no validation or verification of the model will be done since the primary goal with this master thesis is not the model itself The primary goal is to get a control system that will be written in Simatic PCS7 to control the simulated process The reason for using PCS 7 is that this is a common process control system and that the mill from which the da
4. which is Windows NT The two applications communicate with each other by reading from and writing to a common file The simulated process in Dymola calls a C function that reads the control signals from the file and writes the process values to the file every sampling time A J program communicates with the control system and writes the control signals to the file and reads the process values from the file every sampling time The communication is synchronized and the applications access the file using mutual exclusion Keywords Classification system and or index terms if any Supplementary bibliographical information ISSN and key title ISBN 0280 5316 Language English Security classification Number of pages Recipient s notes The report may be ordered from the Department of Automatic Control or borrowed through University Library 2 Box 3 SE 221 00 Lund Sweden Fax 46 46 222 44 22 E mail ub2Qub2 se LUNDS TEKNISKA HOGSKOLA Lunds universitet Steam net simulation with real control system Examensarbete av Oscar Ljungkrantz for Solvina Sammanfattning Detta examensarbete har utf rts for Solvina Solvina r ett f retag 1 G teborg som bland annat simulerar ngn t f r pappersindustrin N r Solvina gjort s dana simulatorer har de varit tvungna att simulera inte bara sj lva ngn tet utan ven reglersystemet Syftet med examensarbetet var att programmera ett gr nssnitt mellan
5. HP1 pressure A 2 o 54 F 52 o 50 48 D 250 500 Time s Process LP pressure F e 2 32 2 a 2 8 0 250 500 Time s Figure 27 oscillations of the pressures of the net Dymola continuous control system used Doing a similar experiment using the real control system instead results in a very oscillating system as seen in Figure 28 36 Process HP1 pressure Pressure bar e em ce e m e Ce as e 250 500 Time s e Process HP2 pressure 20 9 6 uS Pressure bar e e 250 500 Time s e Process MP pressure Pressure bar A co E e 250 500 Time s er Process LP pressure Pressure bar N co gt en uo in m e 250 500 Time s Figure 28 oscillations of the nets using the PCS7 control system This control system is discrete with the sampling period one second and has a delay of one sample as mentioned above Is it the sampling that causes the oscillations To be able to answer this question unit delays that both samples and delays the signals were placed at every control signal in the Dymola control system Using this control system the same kind of oscillations appeared as seen in Figure 29 The steam net is started in the same state in both experiments but the integral parts of the controllers 37 are not the same so the two experiments are not expected two give exactly the same results Process HP1 pressure DAS q 2 o 54 3 53 5 a 53 52 8
6. Tekniska H gskola 1986 Gustafson B A Kompendium i Turbomaskiner M3 Institutionen f r Str mningsmaskinteknik Chalmers Tekniska H gskola 1986 United Nations Economic and Social Commission for Asia and the Pacific Guidebook on Cogeneration as a means of pollution control and energy efficiency in Asia part 1 http www unescap org enrd energy co gen October 24 2002 Arz n K E Real Time Control Systems Department of Automatic Control Lund Institute of Technology 2001 Siemens Simatic Process Control System PCS 7 Configuration Manual Edition 08 2001 Toijer D Distribuerade in och utgangar f r f ltbuss Automation 8 2002 Siemens Simatic S7 PLCSIM V5 0 User Manual Edition 06 2001 Siemens Simatic S7ProSim Version 5 0 User Manual Edition 06 2001 Mikael Borjesson Sales and Systems Engineer Automation and Drives Siemens AB personal contacts autumn 2002 Jonas Engblom Systems Engineer Industrial Solutions amp Services Metals Mining amp Paper Technologies Siemens AB personal contacts autumn 2002 Pagina se Paginas IT ordbok http www pagina se itord January 20 2003 45 Appendix A communicateProcessFile Hifndef communicateProcessFile define communicateProcessFile include lt fstream gt include lt windows h gt include lt stdio h gt include lt stdlib h gt include lt process h gt include lt tchar h gt include lt stdlib h gt include lt stdio h gt include
7. backpressure turbine the outlet steam has a relatively high pressure and temperature to be used in some process Condensing turbines are used when the electricity demand is higher than the steam demand Backpressure turbines are used when the primary purpose of the steam net is to produce steam and the electricity production is more or less a way to use the surplus steam and increase profitability This is the case for the paper process industry Both condensing and backpressure turbines can have more than one extraction point 5 7 Figure 3a Backpressure Turbine Figure 3b Condensing Turbine 2 3 Valve Figure 4 a simple sketch of a controllable valve In many of the components e g in the boiler and in the turbine and between the different nets there are valves used to control the flows The flow Q through the valve between nets with pressure P and P is Q K CP B Eon y Q 1 p h 3 where K M bar is the capacity of the valve p is the density of the steam p o is the density of the water approximately 1000 kg m and y y e 0 1 the opening parameter is the parameter to be controlled 6 In most of the components there are safety valves as well that simply lets the steam out to the surroundings if the pressure gets too high or some other condition is violated 2 4 Accumulator The accumulator is a large tank that contains both water and steam It can as indicated by the name be used to ac
8. basic structure of PCS 7 7 1 Operator Station The Operator Station OS is used by the operators to monitor and affect the control of the process The main program of the OS besides the operating system which is Windows NT 4 0 is WinCC Windows Control Center WinCC is the HMI Human Machine Interface of the system That means that WinCC is the interface between the operators humans and the process machine and makes communication in both directions possible WinCC provides tools for developing a graphical user interface for the operators The operator can observe the process on the screen where the process values are presented as plots values or in any other way e g bar charts As an extra help the system will automatically signal alarms in the event of critical process status The operator can affect the control of the process in two ways He can affect the automatic control of the system by changing for instance a set point or the gain of a controller He can also affect the process immediately by for instance opening a valve 22 7 2 Engineering Station The engineering station is used to develop the process control system The graphical user interface can be developed using tools in WinCC The regulator system can be programmed using different software e Simatic Manager Represents the platform for all the engineering station components and manages them centrally e HW Config Tools for configuring the hardware th
9. configured can be seen in Figure 18 as OS Client 1 OS Client 2 OS Client 3 C Terminal bus TCP IP protocol Engineerihg Station Oo OD Q 2 e 65 wn 2 N Industrial Ethernet Fast Ethernet or Profibus TUA TUN Fy EEN SF E SimaticS7 Profibus DP Simatic S7 ET T ET i ET 200M V0 VO 1 0 1 0 1 0 Figure 18 example of a PCS 7 configuration 24 8 The real control system Since this master thesis was not a part of a real project and no customer was involved there was no access to the real control system Hence the control system had to be built once more now in the real environment of Siemens Simatic PCS 7 This was possible thanks to a lot of help from people at Siemens As mentioned in section 7 2 above the engineering station provides tools for building control systems using CFC Continuous Function Charts Using this blocks representing PID controllers I O cards mathematical operations and many other things could be used and connected to each other En example of a controller can be seen in Figure 19 An analogue input and an analogue output card are used to convert signals from the desired range The block CTRL PP is the actual PID controller providing among others antiwindup and tracking of four different signals with different pr
10. from the net if the pressure gets high The main parts of the steam net can be seen in Figure 8 The whole steam net as modelled in Dymola can be seen in Figure 9 The blue squares are components that represent the volumes of the pipes The circles with the label PT inside are Pressure Indicators 11 HP1 E i Turbin diiisunsuo ss 4 I Feedwatenfank1 E d iisumsuo ce o par W Ad o v Figure 9 the demo steam net modelled in Dymola Almost all components are taken directly from Solvinas steam net and control system libraries with parameters and initial values changed to fit this steam net The only new component is the valve The valves in the existing library were described by a simple linearized equation while the valves in this master thesis is described by eq 2 1 in section 2 3 and has the capacity K as parameter 12 5 Control of a Steam net The control of such a steam net described in chapter 2 and 4 above is usually a quite complex control system with many collaborating controllers often PFcontrollers Typically the opening parameter y of a valve between two nets N1 and N2 where NI has the highest pressure is determined as the minimum of two PI controllers C1 and C2 see Figure 10 Cl controls the net N1 gets the process value from N1 s pressure indicator and has a set poin
11. l controlSignals 1 Processl Signal PV HP LP signal 1 controlSignals 2 Processl Signal PV Inlet Turbin signal 1 controlSignals 3 Processl Signal PV Discharge Turbin signal 1 controlSignals 4 Processl Signal PV HP1 Acc signal 1 controlSignals 5 Processl Signal PV HP2 Acc signal 1 controlSignals 6 Processl Signal PV HP2 MP signal 1 controlSignals 7 Processl Signal PV4 HP2 LP signal 1 controlSignals 8 Processl Signal PV Acc MP signal 1 controlSignals 9 Processl Signal PV Acc LP signal 1 controlSignals 10 Processl Signal PV Airblow LP signal 1 controlSignals 11 Processl Signal PV Oil2 signal 1 controlSignals 12 end when end SteamNet PCS7 On every call the external C function goes through a number of steps l Open the file in a totally unsafe mode i e it will be opened regardless of whether the file is open by another program and it allows the file to be opened by other programs after it is opened by this function Try to lock a region of the file that reaches from the beginning of the file pass the end of the file If the attempt is unsuccessful it means that the file is used by another program In this case the function waits for a while and tries again This is repeated until the region is successfully locked The label of the file is checked If the label is Process it means that this function used the file last the region is unlocked the file is clos
12. lAjsheet 4 OB 1000ms G R3i1 PICI 2112 Figure 19 some CFC components used in the control system 25 EL CFC Whole System SA7DCSA0_ 070400En SOLVINA rt Edt Insert PLC Debug View Options Window Help _ Dile Lole mels is eua xp xd EE FS lel jeto vel E Mor ly IN PIC 601 M4 Vour BLUE Output value Ww IN NPICI 602 a4 VOUT BLUE Output value ICI 603 A4 VOUT hu Output value ve1c2 601 A4 OUT pave Output value 14 MINZ I I INi I INZ PICZ 628 A4 Vour JALUE Output value 18 I IN fihol System A4 JIN 13 MINZ I 1 INI iz Iw I IN hole system A4 Jen ruts qus20 1 INZ hole System A6 n ju IN OUT I MAX2 I NPICI 601 a4 Vour nu Output value I mi 1 INZ PIC3 628 A4 OUT ALUE Output value Ere vy ET Press F1 for help lafSheet 1 tele JOB 1000ms G R311 PICA 21112 Figure 20 MIN and MAX selectors in PCS 7 Siemens Simatic PCS 7 also provides tools to build a graphical user interface that can be used by the operators in the Operator Station It is possible to c
13. length 3 7 1 23456789e 2 gt 1 23456 1 23e 2 gt 1 23 for int i 0 i lt 11 length i formattedString 0 adding zeros to the end if length 11 formattedString temp charAt 7 if length gt 11 formattedString String valueOf Math round Double valueOf temp substring 7 9 doubleValue 10 int exp Integer parseInt temp substring length 2 length 4 if exp gt 0 formattedString e 00 Integer toString exp assuming exponent is one digit else formattedString e 00 Integer toString exp substring 1 2 assuming exponent is one digit return formattedString Private method that takes the current row indicated by the integer rowPos of the file contents and replaces the part of the String that represents the value of the control signal with a String representing the value of the Variant output The method returns a String representing the new row private String writeNextOutput String fileContents Variant output int rowPos format the Variant to String of rigth format output changeType Variant VariantDouble to be able to get the double value String formattedString formatToScientificString double output getDouble range Construct a new String with the current number replaced String temp fileContents substring rowPos fileContents indexOf rowPos 2 temp formattedString 52 return temp Private method that connects t
14. of different controllers The design and the tuning setting the gain the integration time and the set point of each controller of the whole control system is an interesting and hard problem due to the way each 13 controllable valve influences the state of the involved subnets which in turn affects the whole steam net As mentioned above the controllers involved with one net have different set points As an example look at Figure 11 where some of the controllers that affects HP1 are outlined The controllers are described in Table 1 Most of the controllers that get their process values from HP1 are included In the complete system there will of course be other regulators controlling the valves but in this example the focus lies in controlling HP1 Assume that the pressure in HP1 is slightly more than 53 bar and that this pressure has been held for a long period Since the pressure is above 52 5 bar PC H1 has an output signal greater than zero and since this pressure has been held for a long period the integrator will have a large value and the output will be one In the same way the output signal of PC H2 will be one and the turbine will be fully activated The main target of the net is to produce steam to MP and LP This is taken care of by the controllers PC M1 and PC L1 respectively They will adjust the valves from HP1 so that the pressure in MP and LP lie around 11 0 bar and 3 2 bar respectively Assume now that the pressure in H
15. stream fscanf stream s n string token strtok string go to the character just before the process value strcat newString token strcat newString z if token NULL read through the double sprintf number ce d strcat newString number strcat newString n strcat nextFileContents newString Extern method that reads control signals from the file and writes process values to the file The vector fromProcess shall contain nbrFP numbers of doubles representing the process values The nbrTP number of control signals will be written to the vector toProcess 47 void communicateProcessFile const double fromProcess const int nbrFP double toProcess const int nbrTP sprintf nextFileContents waitForOur Turn print current process values to the file for int i 0 i lt nbrFP i printNextDouble fromProcess i read next control signals from the file for i 0 i lt nbrTP i toProcess i readNextDouble fseek stream 0L SEEK SET go to the beginning of the file fprintf stream 96s nextFileContents fflush stream locking fileId LK UNLCK 4000 unlock the file fclose stream endif 48 Appendix B CommunicatePLCFile import com ms activeX import com ms com import s7wspsmx import com ms wfc app import com ms wfc core import com ms wfc ui import com ms wfc html impor
16. the PID algorithms ER is set to zero if the real error SP PV is less than the limit DEADB W see Figure 30 DEADB Wi SP PV Figure 30 dead band used to generate the control deviation Dead band has the effect that the controller will not react upon small changes in the process value if the error is small and this could be useful to get rid of the oscillations Dead band also has the effect that the controller does not try to control the process value to the set point Thus dead bands should only be used if necessary they should be relatively small and only be used on some controllers The controller block CTRL PP used in this PCS7 control system provides the possibility of using dead bands which is something that are actually used in process control with the restrictions just mentioned 13 The reason for using dead bands on a real control system is often to get rid of measurement disturbances That is not the case here but yet it could be useful to get better control without making too big changes in the control system If a dead band of 0 2 bar is placed on PC M1 and PC L1 see Figure 31 the oscillations could be reduced 39 e i Ark i Viv IO ee Figure 31 some controllers affected by the dead bands An experiment in 10 000 seconds with dead bands on PC L1 and PC MI is presented in Figure 32 40 Process HP1 pressure Pressure bar D 5000 1E4 Time s 204 Process HP2 pressure
17. the valves can be controlled directly by simply putting the manual controllers into manual mode and selecting the desired value To avoid bumping when going back to automatic mode tracking signals has to be drawn back to the controllers see Figure 12 In manual mode the output signal of the manual controller can be adjusted by setting the manual value MV in the picture In automatic mode the manual controller sends out the value that corresponds to the set point of the manual controller The output is drawn back to the manual controller as a feed back signal FB to guarantee a bumpless change to manual mode This way the manual value of the controller always starts at the same value as the latest automatic value when changed from automatic to manual mode The change the other way from manual to automatic mode is also bumpless since all controllers involved have tracked the manual value 8 16 SP FB y Manual ud Controller R Out sz Figure 12 tracking when a manual controller is used to control a signal where several controllers are involved Using these manual controllers it is possible to test the behaviour of the steam net and the control systems both in the normal operational state and in other special cases for example if the turbine is put out of operation In Figure 13 the pressure of the main nets HP1 HP2 MP and LP are shown during normal operation in a test of 4 000 seconds After some fast changes due to t
18. 0 48 4000 8000 1 2E4 1 6E4 Time s Process_HP2_pressure 3 220 2 o 5 E o a 20 19 8 0 4000 8000 1 2E4 1 6E4 Time s Process MP pressure S 12 o 5 o 10 o al 8 5 4000 8000 1 2E4 1 6E4 Time s Process LP pressure 4 2 o 34 5 E o 32 a 3 2 8 0 4000 8000 1 2E4 1 6E4 Time s Figure 14 pressure of main nets during normal operation for 15 000 s Consider for instance the changes between 4 000 and 6 000 s Taking a closer look at the state of the steam net one sees that after about 4 700 s the pressure in the accumulator exceeds 12 5 bar This is the set point of a controller PC Al see Figure 15 and Table 2 controlling the valve between the accumulator and MP This 19 controller is coupled to the valve via a MIN selector and the valve is opened To this MIN selector another controller PC M2 is coupled that gets its process value from MP and has the set point 11 1 bar At the time about 4 800 s the pressure in MP is above 11 1 bar and now this controller limits the opening of the valve between the accumulator and MP and the pressure in MP stabilizes at slightly more than 11 1 bar The change in MP from 11 0 to 11 1 bar has the effect that PC M1 which has the set point 11 0 bar will close the valve between HP1 and MP This makes the pressure in HP1 increasing fast as seen at the top of Figure 14 after about 4 800 s PC H3 opens up the valve to the accumulator and PC H5 decreases the amount of oil used in th
19. 00000e 001 Valve Airblow LP 5 000000e 001 BarkBoiler_Oil 5 000000e 001 HP1 Pressurel back 4 000000e 001 OUTPUT PORT NUMBER new Integer 512 new Integer 514 new Integer 516 new Integer 518 new Integer 520 new Integer 522 new Integer 524 new Integer 526 new Integer 528 new Integer 530 new Integer 532 new Integer 534 new Integer 540 The constructor of the class which actually starts the communication using private methods public CommunicatePLCFile Thread myThread this myThread myThread s7ProSim1 new s7wspsmx S7ProSim S7ProSim createNewFile initControll performWriteandRead s7ProSim1 Disconnect never reached Private method that creates a the file Matrix txt with the contents according to fromProcessToPCS7 and toProcessFromPCS7 private void createNewFile file new com ms wfc io File fileName 49 new Integer 70 new Integer 15 new Integer 5 new Integer 40 new Integer 30 com ms wfc io FileMode CREATE com ms wfc io FileAccess READWRITE com ms wfc io FileShare READWRITE String contents PCS7 CR LF for inti 1 i lt fromProcessToPCS7 length i contents String fromProcessToPCS7 i 0 CR LF for int i 1 i lt toProcessFromPCS7 length i contents String toProcessFromPCS7 i 0 CR LF fileStartPosition file getPosition fi
20. ISSN 0280 5316 ISRN LUTFD2 TFRT 5701 SE Steam Net Simulation with Real Control System Oscar Ljungkrantz Department of Automatic Control Lund Institute of Technology January 2003 Department of Automatic Control Lund Institute of Technology Box 118 SE 221 00 Lund Sweden Author s Oscar Ljungkrantz Document name MASTER THESIS Date of issue January 2003 Document Number ISRN LUTFD2 TFRT 5701 SE Supervisor Anders Rantzer LTH Magnus Holmgren Solvina Sponsoring organization Title and subtitle Steam Net Simulation with Real Control System Angn tssimulering med verkligt styrsystem Abstract This master thesis has been conducted for Solvina Solvina is a firm in Gothenburg which among other things simulate steam nets for the paper process industry Doing this Solvina has had to simulate not only the steam net itself but also to simulate the control system The purpose of this master thesis was to try to build an interface between the controller and the simulated process so that the simulated steam net could be controlled by the real control system The process is modelled in Dymola Modelica The control system is built in Siemens process control system called Simatic PCS 7 and runs on a PC The simulated process and the control system run on the same PC and the communication between the process and the control system is a communication between two applications running on the same operative system
21. Matrix txt Figure 23 program structure of the communication 28 Since two applications running on the same operating system should communicate with each other they need to access the same data somehow A straightforward and general way to do this is to let the data be in a file an ordinary txt file This file can then be written to and read from by two different programs one transmitting data between the file and Dymola and one transmitting data between the file and PLCSIM Dymola supports linking C C libraries of one s own and using functions in those libraries Hence it is possible to write a function double communicateProcessFile double processOutput that takes the process output signals from the last sample period as an argument and returns the process input signals for the next sample The C function in turn writes the process output signals to the file and reads the next process input signals from the file Simatic PCS 7 on the other hand provides an ActiveX control called S7ProSim ActiveX is Microsoft s standard for making applications on the same net running on Windows operating system share information and interact with each other ProSim provides programmatic access to the process simulation interface of PLCSIM and has methods for connecting disconnecting writing input signals reading output signals executing scan cycles etc It also sends events to the user to report that e g a scan cycle is finished
22. P1 decreases for some reason for instance that one of the boilers cannot be run in full operation Then the pressure in HP1 starts to sink If the pressure decreases below 53 0 bar the output signal from PC H2 will also start decreasing trying to get the pressure back to the set point This measure could be enough in which case PC H2 will be controlling the pressure to 53 0 bar but assume that the amount of steam produced is so low that the pressure continues falling If the pressure decreases below 52 5 bar the output signal from PC H1 will also start decreasing When the output signal of PC H1 is less than the output signals of PC L1 or PC MI the opening of the valve concerned will be decreased The net will then end up in a state where the turbine is closed the output of PC H2 will be zero and PC H1 is controlling the pressure in HP1 to 52 5 bar Observe that in this state there is no way to keep the desired pressures in MP and LP The state should never be reached during operation but during start up the state is needed Assume now instead that the pressure in HP1 increases The reason for this could for instance be that the amount of MP steam used decreases so that PC M1 decreases the opening of the valve between HP1 and MP When the pressure in HP1 passes 53 8 bar PC H3 will start opening the valve to the accumulator If the pressure in HP1 still continues rising and passes 55 5 bar PC H4 will open up the airblow valve This will make the pr
23. Pressure bar 19 6 D 5000 1E4 Time s 14 Process MP pressure 12 10 Pressure bar 0 5000 1E4 Time s 45 Process LP pressure 4 Pressure bar D 5000 1E4 Time s Figure 32 pressures of the net using the PCS7 control system with dead bands on PC M1 and PCLI The set point of PC L1 is 3 2 bar but since the dead band is 0 2 bar the pressure of LP is instead 3 25 bar which is the set point of PC L3 see Figure 31 above After a little more than 7 000 seconds the pressure of LP starts to oscillate again This can be 41 avoided by putting a dead band on PC L3 The effect of putting a 0 2 bar dead band on PC L3 can be seen in Figure 33 where the dead band is activated after 7 750 s Pressure bar Pressure bar Pressure bar Pressure bar 56 Process HP1 pressure 54 52 50 48 D 5000 1E4 Time s Process HP2 pressure 20 19 18 D 5000 1E4 Time s 14 Process MP pressure 12 10 8 6 D 5000 1E4 Time s Process LP pressure 3 4 3 2 3 D 5000 1E4 Time s Figure 33 an 0 2 bar dead band on PC L3 is activated after 7 750 s 42 The oscillations are expired but the pressure in LP is 3 45 bar which is a little too high If the dead band on PC L3 is only 0 05 bar the pressure of LP is at a more tolerable level and the result of such an experiment can be seen in Figure 34 Process HP1 pressure wb G 8 g 2 52 o a 48 0 5000 1E4 Time s 20 4 Process HP2 p
24. This was used so that a new program a J program called CommunicatePLCFile was created that establishes a connection to the control system via the ActiveX control ProSim fetches the output signals from the control system which it writes to the file and reads next control inputs signals from the file and pushes them to the control system via ProSim 9 1 The communication media the file The file is called Matrix txt since it mainly is a matrix consisting of signals from the process to the control system and from the control system to the process It also contains a label for synchronization that tells which application used the file last It is left to the applications to access the file using mutual exclusion that is the applications shall only use the file if no other application is using it simultaneously When an application have got access to the file it should also check the label to assure that it was not this application that used the file last If it was it leaves the file and tries again later If it wasn t the application changes the label reads the input signals for the application from the file prints the output signals from the application to the file and then leaves the file The contents of the file can be seen in Figure 24 This file was used by PCS7 the last time as indicated by the label Otherwise the label would be Process The names of the signal are present just to increase legibility what s interesting are the
25. afe mode that it is will only be opened if no other process is using it and it will allow no other process to read or write to it while this process has access to it The problem it that the opening and the closing of the file take approximately 1 s for each operation and since both operations have to be performed every sample time this delay is intolerable Instead the file is opened only once in a totally unsafe mode and every time the file is to be used a region of the file that reaches from the beginning of the file pass the end of the file is tried to be locked just as explained in section 9 2 above This result is the same as if the file could be opened and closed fast in a safe mode The entire code of the J program CommunicatePLCFile can be seen in Appendix B CommunicatePLCFile 32 10 Putting it all together The overall communication between the process and the control system has to be performed every sample time As mentioned in section 9 2 above the simulation waits for the control system to tell that a new clock cycle has begun Hence the J program has to be able to get information about the clock cycle from the control system and communicate with the file when a new clock cycle has begun PLCSIM updates the output signals every clock cycle of course but it doesn t tell exactly when this happens To get this information a block that simply contains a counter and increases the counter with one every sample was added to one o
26. afioh ui aan acacia ek erede ee dona aida 22 10 2 3 Performance of the control System eee o t rct r ke pee ia ne ad rn nr 35 11 CONCLUSIONS AND SUGGESTIONS FOR FURTHER INVESTIGATIONS ioi casser teni eio p o FEM DRE IARE PESOMAT 44 12 REFERENCES 2255 riociTre oed core er hsta iba dor desde aaa sodeto rhon ud reae a anais 45 APPENDIX A COMMUNICATEPROCESSFILE ssoo0o000000000000000000000000000000 0000 46 APPENDIX B COMMUNICATEPLCFILE sssoo0000o0000008000000000000000000000000000000 0000 49 1 Introduction 11 Background Solvina is a firm in Gothenburg with customers mainly in the power and process industry Solvinas business concept is to provide systems engineering solutions for improved profitability to their customers One way to accomplish this is to build models primarily dynamic of the existing system and on the basis of those models perform different simulations to try to improve the quality productivity and reliability of the system Similar simulations are built of nonexistent systems as well to investigate how a new or rebuilt system would affect the current activity Solvina has had many customers during the last years who have wanted Solvina to simulate their steam nets To do this Solvina has been forced not only to simulate the steam net itself but to simulate also the control system Solvina wants to be able to use the real control system directly upon the simulated process Doing this would give several advantages
27. arVelocity w Absolute angular velocity of component SIunits ngular cceleration a Absolute angular acceleration of component Oo Modelica 7 ModelicaAdditions Unnamed 7 DriveLib equation w der phi a der w Jta flange a tau flange_b tau end Inertia MotorDrive MotorDriveT est ElectroMagnetiveForce Furuta Pendulum Te a el r DriveLib Motor Gi Resistor i lll OnePort Modelica Electrical An l Conductor i Hi OnePort Modelica Electrical An ElVoltageSource B E Ws OnePort Modelica Electrical An i fli Rigid Modelica Mechanics Rot gt Modeling y Simulation Z Figure 6 declarations and equations of the inertia in the motor Solvina has in past projects built up a quite extensive library with steam net components e g recovery boiler power boiler accumulator valves turbines and steam consumers Those models are based on ThermoFluid a thermo hydraulic Modelica library developed by Hubertus Tummescheit and Jonas Eborn at the Department of Automatic Control Lund Institute of Technology 2 Solvina has also a library with components for control systems PID controllers with anti windup and tracking min and max selectors etc 10 4 The Steam Net Model Most of the data in this demo steam net is taken from a steam net in a real paper process industry The demo process has paper machine
28. at is the arrangement of racks and modules e CFC CFC Continuous Function Chart is a graphical tool for building controllers from ready made blocks in a block diagram Blocks can easily be inserted into the CFC using drag and drop from libraries e SFC SFC Sequential Function Chart is a graphical programming language to describe sequential operations SFC is built of steps each step representing a state with conditions in between that has to be fulfilled to go to the next step e SCL SCL Structured Control Language is a programming language oriented on Pascal for programming complex automation tasks In the engineering station SCL is required for compiling the controllers built in CFC and SFC When a control system has been created in the engineering station it can easily be downloaded to the real hardware that is the PLC 7 3 PLC The PLC Programmable Logical Controller is the computer that runs the real control of the process The hardware of the PLC consists of a rack mounting backplane that handles the connections between the inserted modules a power supply unit and a CPU with a memory card inserted Normally the rack has one or more I O modules to connect the PLC to the process Instead of downloading your regulator system to the real PLC you could download it to Siemens Simatic S7 PLCSIM which is software that simulates the behaviour of the PLC It can be used to run and test the entire program and incl
29. cumulate steam when the pressure is high in both the high pressure net and in the low pressure net When the low pressure net needs more steam and the steam produced by the boilers isn t sufficient the accumulator can act as a supplementary steam source for a shorter period of time When the accumulator is loaded with steam the pressure in the tank is increased the steam condenses and the water level is increased When taking out steam the pressure is decreased and hence the water is boiling into steam 3 Introduction to Dymola Dymola Dynamic Modeling Laboratory is a tool for building dynamical models from physical objects Dymola uses the modelling language Modelica which is a language developed to describe complex physical systems from a multitude of different areas Modelica is object oriented and allows hierarchical model composition Thus one can easily reuse already written components from existing libraries 1 Every object in Dymola can be described by the inputs and outputs used to communicate with the surroundings along with the variables and the equations which describes the characteristics of the object No equations needs to be solved by the user Dymola does that automatically as long as the number of equations and the number of unknowns are equal To facilitate the model building Dymola has both a graphical editor and a text editor The graphical editor is used to join different components in a block diagram New compone
30. d with variable step size for instance DASSL is then often preferred Such an integration method is often faster than an integration method with fixed step size When the system is changing fast the method with variable step sizes might however be quite slow To avoid this change in integration time an integration method with fixed step size is used for real time simulations In the experiments done in this master thesis the integration method Euler was used with a step size of 0 01 s 1 10 2 2 Performance of the communication The J program should read the process values from the file and print the control signals to the file every sample time If this isn t done it writes a message to the standard output During normal operation this never happens The behaviour can be forced by for example dragging a window around really quickly for over a second but it hasn t occurred when not really forced 10 2 3 Performance of the control system When experimenting with the steam net and the continuous control system made in Dymola the pressures of the nets sometimes oscillates with a quite short period In the experiments presented in Figure 13 the pressures of both HP1 and LP oscillate in the beginning This can be seen in Figure 27 where the pressures of HP1 and LP are presented for the first 500 seconds of the experiment Similar oscillations have been seen in other experiments too indicating a certain sensitivity of the net 35 56 Process
31. e bark boiler This isn t sufficient at first so the PC H4 also opens up the airblow valve for a while The signals described can be seen in Figure 16 Figure 15 some controllers involved in the experiment presented in Figure 14 Controller Set Point Action PCMI 11 0 Reversed PC M2 11 1 Reversed PC AI 12 5 Direct PC L2 3 6 Direct PC H1 52 5 Direct PC H3 53 8 Direct PC H4 55 5 Direct PC H5 54 0 Reversed Table 2 the controllers in Figure 15 20 Pressure bar Pressure bar Pressure bar Pressure bar Comi POAT PY Como PCAT_SP O 1 2 Corto PECES oui 20 Fe oO 2 15 08 9 o a 04 10 D 5 0 4000 6000 2Ed 16E4 0 4000 6000 12Ea 16E4 Time s Time s 19 Domo PCAT oui 19 Een POPS oui t 12 2 0 8 5 0 8 0 4 a 04 D D 0 4000 Bon 1 2Ed 16E4 0 4000 6000 1 2Ed 16E4 Time s Time s 15 Coritol PCI our Coritol PCHA cui i T 2 0 2 0 8 B 2 ns 201 D D 4000 Boon 1 2Ed 16E4 0 4000 6000 12Ed 16E4 Time s Time s 1 2 Domroi PMI out 0 8 0 4 0 4000 6000 1 264 1 6E4 Time s Figure 16 some controllers involved during normal operation 21 7 Simatic PCS 7 Siemens Simatic Process Control System 7 PCS 7 is a control system with which you can both control and monitor the running of a process The basic structure of the system can be seen in Figure 17 Each of the components will be explained below 9 TUA DL a q Pa e Figure 17 the
32. ed the function waits for a while and then goes back to step 2 Otherwise the label is changed to Process and the function proceeds to step 4 The control signals are read from the file and the output signals process values from the process are written to the file The region is unlocked and the file is closed One might wonder why the file is not opened in a safe mode instead of opening the file in an unsafe mode and then lock the entire region of the file This will be explained below when describing the communication between the control system and 3l the file The entire code of the external function communicateProcessFile can be seen in Appendix A communicateProcessFile 9 3 Communication between S7 PLCSIM and the file As mentioned above S7 PLCSIM has an ActiveX control that can be used that provides programmatic access to S7 PLCSIM Although ordinary Java does not support the use of ActiveX J which is Microsoft s tool to create Java code does Using this all inputs and outputs of the PLC can be set and read from respectively One Java class called CommunicatePLCFile performs both the communication with PLCSIM and the communication with the file It makes use of some private help methods and of ActiveX classes and other classes for communication Microsoft provides a package for communication com ms wfc io which among other things contains a file class called File Using this class it is possible to open a file in a s
33. ents of the String nextFileContents to the file for int i 0 i lt nextFileLength i file write nextFileContents charA t i file flush file unlock 0 4000 Private method that returns a Variant representing the process value of the current row indicated by the integer rowPos of the file contents Since the process value is between low and high in the file but has to be between 0 and range before sent into the control system it is rescaled private Variant readNextInput String fileContents int rowPos int low int high String temp fileContents substring fileContents indexOf rowP os 2 fileContents indexOf CR rowPos int value int Math round double java lang Double valueOf temp double Value low high low range if value lt 0 value 0 if value gt range value range Variant k new Variant int value k changeType 2 return k Private method that formats the double d between 0 and 1 to a String presenting the value in scientific notation with 6 decimals and three digits representing the exponent E g 0 2345 is formatted to 2 345000e 0 001 private String formatToScientificString double d if d 0 return 0 000000e 000 String temp Double toString d 10000 toString creates string in scientific notation only if the double is lt 1e 3 and we need to deal with numbers lt 1 int length temp length String formattedString temp substring 0 Math min
34. essure in LP decreasing and PC L1 will increase the opening of the valve between HP1 and LP which in turn will affect the pressure in HP1 14 Figure 11 control of HP1 Controller Set Point Action PC LI 3 2 Reversed PC L2 3 6 Direct PC MI 11 0 Reversed PC H1 52 5 Direct PC H2 53 0 Direct PC H3 53 8 Direct PC H4 55 5 Direct Table 1 the controllers in Figure 11 15 6 The whole system running in Dymola One of the purposes of being able to use the real control system to control the simulated process is to get away from having to simulate the control system in Dymola Still it comes within the scope of this thesis to investigate the advantages and possible disadvantages of using the real control system instead of a simulated one Thus a control system was built in Dymola to verify the model and to be used later for comparison with the real control system The data in this demo control system is taken from a real paper process industry the same as from which the data to the demo steam net was taken As mentioned in chapter 3 above Solvina has built up a library with components for control systems This library contains Pl controllers and manual controllers developed to behave like the corresponding components in Siemens Simatic PCS7 Using those it was quite straightforward to build up the whole control system Manual controllers were placed after the min and max selectors so that the opening of
35. f the charts The value of the counter is placed as an output signal of the PLC the same way as the control signals and is used in the J program This block was kindly provided by Mikael B rjesson at Siemens AB 10 1 The delay of the system The real control system is discrete with the sampling period one second The input signals in the current sample are used to calculate the output signals in the next sample Hence the control signals are delayed one sample period compared to the continuous counterpart When experimenting with the real control system it seamed that the delay was even greater than one sample To determine how big the delay was some experiments were made where the pressure of HP1 was sent to the control system in through an input card and directly back through an output card Doing this the signal out from the control system should be delayed one sample compared to the signal sent into the control system but it was actually delayed two samples as seen in the left part of Figure 25 If the J program is changed so that at first it sends the process values to the PLC then waits for the next clock cycle and finally reads the control signals the delay can be decreased to the desired one sample as seen in the right part of Figure 25 56 Process HPT pressure Canetas HPI pressure 56 Process HPT pressure Conetsignas HA pressure so so 8 8 o o 54 5 5 m f 2 2 t A gg Th EL E o col ub ad ud T j a t n
36. he drum Steam is separated from the drum and led into a super heater that heats the steam to the desired temperature 3 The fuel can be black liquor from the paper production but usually the recovery boiler is complemented with a power boiler for instance an oil boiler or a bark boiler Usually the wood comes to the paper mill like logs First the bark is taken of the logs The bark is most likely burned in a bark boiler possibly together with oil if the bark is too damp The wood is chipped and cooked with NaOH which among other things give cellulose and black liquor The chemicals from the black liquor can be recovered in a boiler therefore the name recovery boiler och super heater combustion water fuel Figure 2 the basic components of a boiler 2 2 Steam Turbine In the steam turbine the thermal energy of the steam is transformed into rotational energy which in turn can be transformed into electrical energy in a generator by making the turbine blades rotating Steam turbines are used in various contexts and are built in many different ways One way to classify the different types is by looking at the state and the usage of the outflow of the steam Then two terms are often used condensing turbines and backpressure turbines see Figure 3 In a condensing turbine the steam from the outlet is led into a condenser The condenser has one or many outlets to reuse the pre heated water in the boiler In a
37. he initial conditions the pressures of the nets seams to stabilize around very reasonable values HP1 at almost 54 bar HP2 at 20 bar and more important MP at 11 bar and LP at slightly more than 3 2 bar The test is carried on for over an hour 4 000 s and one would probably not expect the behaviour to be any different when performing a longer test 17 Process HP1 pressure 5 2 54 o 5 p 2 52 a 50 0 1000 2000 3000 4000 Time s Process HP2 pressure T 2 o 20 1 2 E 20 a 19 8 19 5 0 1000 2000 3000 4000 Time s Process MP pressure T 2 AZ o 10 a 8 1000 2000 3000 4000 Time s Process LP pressure T 2 o 34 2 E o 3 2 a 3 2 8 0 1000 2000 3000 4000 Time s Figure 13 pressure of main nets during normal operation for 4 000 s Performing a longer test however shows an interesting and somewhat more unpredictable behaviour see Figure 14 Consider the pressure of the high pressure net HP1 The pressure of the net seams to stabilize around some value and then after a while the pressure changes and stabilizes around some new value This is typical for this kind of control system and is due to the different set points of the controllers of the system The changes of the pressure can be removed using a master regulator that changes the set points of the system but it was not used here Observe that this control system is not tuned to be optimal Process HP1 pressure 58 q zm o 54 5 2 o 52 al 5
38. iorities Every controller is built as a chart like in Figure 19 and they are then connected to another chart containing the MIN and MAX selectors as seen in Figure 20 The outputs at the right hand side of Figure 20 are in turn connected to manual controllers just as described in chapter 6 above EF CFC PICI 601 SA7DCSAO_VO70400EN SOLVINA Chart Edt Insert PLC Debug View Options Window Help Olla Frej male Al eli s ox n 38 EJE sa Semn vel Ga Aa vaoa izere IDE 00 Mode Channel 0 A4 VHS Valve HP LP AUTO O MANUAL node Aa VHS Valve HP MP o esr AUTO O MANUAL node EE ToBI aTe Du MODE DE 00 Mode Channel Ol W VALUE ing rusa VU 70 0 R CVERANGE RU VALUE q SOLVINA uhole Syst 100 0 QUALITY BY fem 0 0 R ULRANGE CL GUIAS NES input value A4 V HS Valve HP LP Y Output RA VHS Valve HP MP Y Output 30K 00K ICI SOI AS VES PHRANGE input value ICl 601 AS VLS ILRANGE input value ETE PA EI nsem M pi Press F1 for help
39. l time but is actually a little slower Process HP pressure Cartretskpws HP pressure z4 Process HP pressure ConbelEkposis HA pressure To so 2 n FAL 2 o 54 fl id ji g 5 j L gt o 1 f zm m 1 o 341 o on o col A J LL p i f o B equ br tij Wi p E r E 20 be u 48 T O 50 100 0 50 100 Time s Time s Figure 26 the delay of the control system when the PLCSIM runs in single scan mode In the experiment represented in the left graph the J program writes the inputs reads the outputs and then ticks to the next sample In the experiment represented in the right graph the J program writes the inputs ticks to the next sample and finally reads the outputs With this knowledge it was decided that the PLCSIM should be run in continuous scan mode and that the J program should write the process values to the control system then wait for the next clock cycle and finally read the control signals In this way the desired behaviour is achieved 10 2 Running the system 10 2 1 Prerequisites To make the entire system work several programs have to be running First the control system that is PLCSIM has to be running Second the J program has to be started The J program creates the file Matrix txt and then waits for the process to connect When finally the simulation in Dymola is started the whole system is running sending signals in both directions every sampling time and it s possible to experiment with the wh
40. le setPosition fileStartPosition file setLength contents length for int i 0 i lt contents length i file write contents char At i file flush file close Private method that returns a String with the components of the file Before reading from the file it tries to lock the contents of the file If the attempt is unsuccesfull it sleeps and tries again and so on private String getContentsFromFile boolean ourFile true try file lock 0 4000 catch Exception wioe System out printIn wioe ourFile false while ourFile ourFile true try myThread sleep 5 catch InterruptedException ie System out printIn ie try file lock 0 4000 catch Exception wioe System out println wioe ourFile false file setPosition fileStartPosition file flush String temp new String long fileLength file getLength for int i 0 i fileLength i temp char file read return temp Private method that performs the communication between the file and the control system It reads process values from the file waits for the control system to tick to the next sample and then writes the control signals to the file This is performed repeatedly private void perform WriteandRead file new com ms wfc io File fileName com ms wfc io FileMode OPEN com ms wfc io FileAccess READWRITE com ms wfc io FileShare READWRITE open the file unsafe fileStar
41. lem The J program could perhaps be extended to handle such signals or the control system could be extended using sequential function charts to handle acknowledgements of different signals S7 PLCSIM can only simulate the behaviour of a single PLC Since the paper process industry sometimes uses two or more PLC s to control their process it is desirable to investigate how to handle that situation Is it possible to divide the system into two investigating once at a time Another possibility is to try to communicate with real PLC s instead using OPC which is a standardized set of interfaces properties and methods to be used in applications for process control and automated production 9 15 This has to be investigated further if it is to be used in such an application 44 12 1 4 5 6 7 8 9 10 11 LL RR ee 13 14 15 References Dynasim AB Dymola Dynamic Modeling Laboratory User s Manual Version 5 0 Tummescheit H Design and implementation of Object Oriented Model Libraries using Modelica Department of Automatic Control Lund Institute of Technology 2002 Ekstr m F Dynamisk modellering av ngpanna Control and Automation Laboratory Department of Signals and Systems Chalmers University of Technology 2001 Alwarez H Energiteknik Studentlitteratur 1990 Gustafson B A and Nilsson E Kompendium i Str mningsmaskinteknik Institutionen for Str mningsmaskinteknik Chalmers
42. lt io h gt include lt sys types h gt include lt sys stat h gt include lt sys locking h gt include lt fentl h gt include lt share h gt include lt string gt int fileId FILE stream char nextFileContents 1000 Declaration that says that this method can be used from files other than the one in which it s defined extern C void communicateProcessFile const double fromProcess const int nbrFP double toProcess const int nbr TP Method that give us acces to the file Matrix txt if no other program is using it and if it is our time to use it checks the label of the file void waitForOur Turn stream NULL fileld sopen Matrix txt O RDWR SH DENYNO open the file unsafe if locking fileId LK NBRLCK 4000 0 tries to lock the file stream fdopen fileId r printf Now we have got access to the file else printf Seems like the file is locked while stream NULL close fileId Sleep 10 fileld sopen Matrix txt O RDWR SH DENYNO if locking fileId LK NBRLCK 4000 0 stream fdopen fileld r char string 255 fseek stream 0L SEEK_SET start at the top of the file fscanf stream os string copy the contents of the file to the string int equal stremp string Process check the label of the file while equal 0 _locking fileId LK_UNLCK 4000 unlock the file since its
43. m the left on the main window see Figure 21 27 9 Communication between Simulated Process and Control System To be able to control the Dymola process with the PCS 7 output signals from the simulated process has to be transmitted to the control system as input signals and output signals from the control system has to be transmitted back to the simulated process as input signals This transmission has to be synchronized and happen every sample time PLCSIM emulates the real PLC and can be run on the same computer as the process Letting PLCSIM run the control system thus makes it possible to get an integrated system on one computer It will not be the real control system that controls the simulated process from the point of view of hardware but it will indeed be the real control system when it comes to software and it will behave in the same way The four advantages of using the real control system listed in section 1 1 above will still be valid Hence the problem is reduced to communicate between two different applications running on the same operating system Windows NT This can be done in many different ways The way chosen in this master thesis is presented in Figure 23 and is explained below lt lt application gt gt lt lt application gt gt Dymola S7 PLCSIM lt lt ActiveX gt gt S7ProSim lt lt C function gt gt lt lt J program gt gt communicateProcessFile CommunicatePLCFile lt lt file gt gt
44. me No matter how much time the C function communicateProcessFile takes it will still appear as no time to the simulation The function communicateProcessFile makes use of functions for example to open and close the file and thus it includes different libraries To be able to use those libraries in the Dymola model as well a C library myLibrary lib has been built which includes the function communicateProcessFile plus the included libraries This library is used in the Dymola model in the following way 30 model SteamNet_PCS7 Process Processl the model of the process ControlSystem ControlSysteml the model of the control system constant Integer nbrPO 5 number of process outputs constant Integer nbrPI 12 number of process inputs control signals Real processValues nbrPO Real controlSignals nbrPI function communicateProcessFile annotation Library myLibrary input Real fromProcess nbrPO output Real toProcess nbrPI external C communicateProcessFile fromProcess nbrPO toProcess nbrPI end communicateProcessFile equation when sample 0 1 then processValues 1 Processl PI HPl signal 1 processValues 2 Process1 PI MP signal 1 processValues 3 Process1 PI LP signal 1 processValues 4 Process1 PI_HP2 signal 1 processValues 5 Process1 PI_Acc signal 1 controlSignals communicateProcessFile processValues Processl Signal PV HP MP signal
45. not our time to access it fclose stream stream NULL Sleep 50 fileld sopen Matrix txt O RDWR SH DENYNO if locking fileld LK NBRLCK 4000 0 stream fdopen fileId r 46 while stream NULL _close fileId Sleep 10 fileld sopen Matrix txt O RDWR SH DENYNO if locking fileld LK NBRLCK 4000 0 stream fdopen fileId r fseek stream 0L SEEK_SET fscanf stream Jos string equal strcmp string Process strcat nextFileContents Process write the new label to the file to the string nextFileContents temporarely strcat nextFileContents n Method that returns a double representing the control signal of the current row of the file contents double readNextDouble char string 255 char token char stopstring fscanf stream n string strcat nextFileContents string strcat nextFileContents n token strtok string if token NULL token strtok NULL n if token NULL return strtod token amp stopstring return 0 0 should never happen Method that takes the current row of the file contents and replaces the part of the string that represents the value of the process value with a string representing the double d void printNextDouble double d char string 1000 char newString 1000 char token char number 15 long currentPos ftell
46. nts can be added b the diagram using drag and drop from the package browser The text editor is used to write declarations and equations Hence new components can be created by reusing and changing components from the library as well as by creating totally new ones In Figure 5 an electrical motor is built up by library components All connections between the components are made in the graphical editor by simply drawing lines between the connectors Graphical editor SMetor Orivetib Motor Diagram Qth ok ees c ness dw reb she VPIXKOOPFAZ Sah E idi x Peck ge CJ Modetice FT od catddico Unrarrad Dime b Package browser Molte 1m Me hama EH s a D DO zanosa es ElectraMagrittrieFarce dL Ground amp ElecticM egret ce Components Drives Motor gem Figure 5 an electrical motor modelled in Dymola In Figure 6 the declarations and equations of the inertia in the motor can be seen The component inherits properties from another component extends Interfaces Rigid and adds some variables and equations specific for this component Text editor E Motor DriveLib Motor Modelica Text El File Edit simulation Plot Animation Window Help cBHexxM metv 1h model Inertia lD rotational component vith inertia extends Interfaces Rigid parameter SIunits Inertia J l Moment of inertia SIunits Angul
47. o the control system by using the ActiveX control S7ProSim private void initControll this setNewControls new Control s7ProSim1 s7ProSiml begin s7ProSiml setAutoConnect false s7ProSiml setScanMode 1 1 Continous Scan s7ProSiml Connect j ie The main entry point for the application public static void main String args CommunicatePLCFile controller new CommunicatePLCFile Thread currentThread 53
48. ole system monitoring and changing parameters in the operators station 34 If the system is to be used to tune the control system or performing other experiments with the system it might be a good idea to have the entire Dymola program running so the state of the process can be investigated in detail It might also be a good idea to have Microsoft Visual J run the J program to be able to get information about the communication If the system is to be used for operators training both the communication and the simulation can be started from the graphical user interface in the Operators Station As the reader might have noticed the graphical user interface as presented in Figure 21 on page 27 above contains two buttons at the bottom left with the labels Initiate Communication and Process Clicking on the button Initiate Communication starts the J program as an exe file Clicking on the button Process starts the simulation The simulation program Dymosim that is used to perform simulations in Dymola can actually be run as a stand alone program dymosim exe The program reads the experiment inputs from an input file and performs the simulation The program file dymosim exe and the file with the experiment inputs dsinit txt thus contain all information necessary to run the simulated steam net 1 When performing pure simulations in Dymola it is often desirable to run the simulation as quick as possible An integration metho
49. onnect pictures to the charts making it possible to interact with the control system in a very convenient way As mentioned in chapter 7 1 the operator has the ability to both monitor and affect the behaviour of the system in a real Operator Station The operator gets information about the current state of the steam net from among others indicators and plots If something is not normal the system will signal an alarm The operator can then affect the system by for instance changing a set point or putting a controller into manual operation All of this can be used even if the process is simulated so that the operators can be trained in exactly the same graphical interface as they are used to but on the simulated process A view of the graphical user interface can be seen in Figure 21 26 Figure 21 the graphical user interface for the control system Clicking on a PID controller opens a window a group display of the display block CTRL PP in which you can see the current state and settings of the controller and change for instance the gain the integration time and the levels on which to signal alarms see Figure 22 Figure 22 group display of the display block CTRL PP Parameters view The trends of the process values and the outputs of each controller can also be seen in the group display of the controller block in flap four It is possible to group many trends so that they can be displayed together by clicking on the fourth button fro
50. r i 48 1 T i o 50 100 0 50 100 Time s Time s Figure 25 the delay of the control system In the experiment represented in the left graph the J program writes the inputs reads the outputs and then waits for the next sample In the experiment represented in the right graph the J program writes the inputs waits for the next sample and finally reads the outputs A lot of work has been spent on investigating this extra delay but nothing has shed light on the cause of the delay 33 PLCSIM can be run in two different scan modes continuous scan and single scan A scan consists of the CPU reading the inputs executing the program and then writing the results to the outputs In continuous scan which was used in the previous example the CPU executes one complete scan and then automatically starts another scan In single scan the CPU executes one scan and then waits for the user to initiate another scan The manual for S7ProSim says that the S7 PLCSIM has to be in single scan mode if it is to be used with an attached process simulation 12 which is the case here but it doesn t explain why Letting the J program start new scans continually it is possible to let the PLCSIM be in single scan mode but the delay is the same as for continuous scan as seen in Figure 26 Using single scans the J program has to execute a new scan just after the previous one was executed This has the effect that the control system cannot be run in rea
51. ressure E o 20 2 E o 20 a 19 8 19 6 0 5000 1E4 Time s 14 Process MP pressure 5 o 12 F 10 a 8 5 0 5000 1E4 Time s 4 Process LP pressure 5 2 o 5 35 E o a 3 2 5 0 5000 1E4 Time s Figure 34 0 2 bar dead band on PC L1 and PC M1 0 05 bar dead band on PC L3 43 11 Conclusions and suggestions for further investigations In this master thesis it is shown that it is possible to use a real control system written in Siemens Simatic PCS 7 and with the sampling period one second to control a simulated process written in Dymola The control system and the process run on the same PC under Windows NT The simulated steam net and the control system has both been built to be used in the investigations in this master thesis but they are based on data from a real control system If the solutions presented should be used in a real project some improvements have to be made At first some work has to be spent on making a better model of the process and to validate and compare with the real process Solvina has done this in previous projects so it shouldn t be a problem although it takes some time In a real system much more signals than in this demo system are sent between the process and the control system for instance start signals to the motors acknowledgement signals and signals to lock the valves Such signals have not been included in the demo system presented here but they will probably not cause too much prob
52. s that demand steam with two different conditions and therefore they have two different consumer subnets one at a medium pressure MP approx 11 bar 200 C and one at low pressure LP approx 3 2 bar 150 C To produce steam the net has three different boilers one recovery boiler with black liquor as the fuel and two supplementary power boilers one two fuel bark boiler that runs on both bark and oil and one that runs on oil The recovery boiler and the bark boiler both produce steam to a high pressure subnet HP1 approx 54 bar 450 C The oil boiler produces steam to another high pressure subnet HP2 approx 20 bar 240 C The net has a backpressure turbine with two extraction points The turbine has an inlet valve that determines how much high pressure steam from HP1 that should pass the turbine on the whole The steam that doesn t go through the discharge valve to MP continues through the remainder of the turbine and onto the LP A simple sketch of the turbine can be seen in Figure 7 Figure 7 a sketch of the demo process turbine The steam from HP2 doesn t go though the turbine but goes directly to MP and LP via controllable valves HP1 is connected to MP and LP via controllable valves too Both HP1 and HP2 are also connected to an accumulator via controllable valves which in turn is connected to MP and LP via controllable valves The low pressure net LP has controllable airblow valves controlled to let out steam
53. styrsystemet och den simulerade processen s att det verkliga styrsystemet kan f s att reglera den simulerade processen Processen har modellerats i Dymola Modelica Styrsystemet har byggts i Siemens styrsystem Simatic PCS 7 och k rs p en PC Den simulerade processen och styrsystemet k rs p samma PC och kommunikationen dem emellan r en kommunikation mellan tv applikationer som k r under samma operativsystem vilket r Windows NT De tv applikationerna kommunicerar med varandra genom att l sa fr n och skriva till en gemensam fil Den simulerade processen i Dymola anropar en C funktion som l ser styrsignalerna fr n filen och skriver processv rdena till filen varje sampel Ett J program kommunicerar med styrsystemet och skriver styrsignaler till filen samt l ser processv rden fr n filen varje sampel Kommunikationen r synkroniserad och applikationerna utnyttjar msesidig uteslutning n r de tilltr der filen CONTENTS SAMNMIANFATTENIENG onriceoe tertii trei adeb odor Ine ph oi ordeo ea rei nda ado nd oc phat pintada 2 1 ENERO DUC TION etc Rn 4 1 1 Backeround dura titi cadsi a a aie o Saison da pa epu debit ege a 4 1 2 PUtDOSE reden tee tsm dpt ten Mete 4 2 SEEANENET ient RR AG itti aii Rb te T uie t 5 2 1 iol DER RE 5 2 2 Steam TE UTDING soc c OD Rib us cM E eU Me 6 2 3 NEALE ante Nase a cd aks Pd Da ds 7 2 4 Accumulator RP d NTE Nr KE 7 3 INTRODUCTION TO DYMOLA
54. t corresponding to the desired pressure of NI With too low pressure in N1 Cl will of course try to close the valve Hence the output of Cl is low when the process value is low and vice versa This is called direct action and is accomplished by having a negative gain in the controller C2 controls the net N2 and will try to open the valve when the pressure in N2 is too low This is the way a PI controller usually works and is called reversed action since a low process value will give rise to a high output and vice versa C1 PI pula Out controller SP pi Process Indicator N1 pressure p1 N2 pressure p2 Process dco PI Pla Out t T controler C2 SP LLL p2 Figure 10 an example of the control of a steam net valve The output of each controller is limited between two values Since the opening parameter y 0 1 the regulators controlling the valves are limited between O and 1 This means that for a reversed P controller the output will always be O if the process value is greater than the set point For a direct P controller the output will be O 1f the process value is less than the set point Adding the integral part this will of course not always be true but if the process value is less than the set point for a longer period a direct PI controller will also have the output signal zero and vice versa Some valves have a more difficult control signal where the signal is a combination of minimums and maximums
55. t java io import java lang Double import java text DecimalFormat import java text NumberFormat public class CommunicatePLCFile extends Form private s7wspsmx S7ProSim S7ProSim s7ProSiml private FileReader fileReader private FileWriter fileWriter private final String fileName C NDemoNMatrix txt private final int range 27648 private Thread myThread private String nextFileContents private com ms wfc io File file private static final char CR 13 Carriage Return private static final char LF 10 Line Feed private int lastClockCount 0 private long fileStartPosition private final Object fromProcessToPCS7 PROCESS VALUES INPUT PORT NUMBER HP1 Pressurel 0 000000e 000 new Integer 512 MP Pressure 0 000000e 000 new Integer 514 LP_Pressure1 0 000000e 000 new Integer 516 HP2 Pressurel 0 000000e 000 new Integer 518 Ack Pressurel 0 000000e 000 new Integer 520 LOWER BOUND UPPER BOUND new Integer 40 new Integer 0 new Integer 0 new Integer 0 new Integer 0 private final Object toProcessFromPCS7 CONTROL SIGNALS Valve_HP_MP 5 000000e 001 Valve HP LP 5 000000e 001 Valve Inlet Turbine 5 000000e 001 Valve Discharge Turbine 5 000000e 001 Valve HP1 Acc 5 000000e 001 Valve HP2 Acc 5 000000e 001 Valve HP2 MP 5 000000e 001 Valve HP2 LP 5 000000e 001 Valve Acc MP 5 000000e 001 Valve Acc LP 5 0
56. tPosition file getPosition while true String fileContents getContents FromFile int currentIndex 0 String wroteLast fileContents substring currentIndex fileContents indexOf CR currentIndex while wroteLast equals PCS7 file unlock 0 4000 try myThread sleep 80 catch InterruptedException ie System out printIn ie fileContents getContentsFromFile wroteLast fileContents substring currentIndex fileContents indexOf CR currentIndex 50 System out println Not yet our time to write Now it is our time Add the String that says that we entered the file the last time nextFileContents PCS7 nextFileContents CR currentIndex fileContents indexOf CR currentIndex currentIndex fileContents indexOf LF currentIndex Read the input values from the file int nbrOfInputs fromProcessToPCS7 length for int i 1 i lt nbrOfInputs i Variant input readNextInput fileContents currentIndex Integer fromProcessToPCS7 i 2 intValue Integer fromProcessToPCS7 i 3 intValue nextFileContents fileContents substring currentIndex fileContents indexOf CR currentIndex s7ProSim1 WriteInputPoint Integer fromProcessToPCS 7 i 1 intValue 0 input nextFileContents CR currentIndex fileContents indexOf CR currentIndex currentIndex fileContents indexOf LF currentIndex wait for the control system to tick
57. ta is taken is thinking about upgrading its older control system to Simatic PCS 7 2 Steam net Steam is a central part in the paper making process Steam is used in the paper machines to dry the paper but also in many other phases of the process for instance when cooking the wood and when drying black liquor The steam is produced in boilers The steam producers and the consumers are connected to each other with pipes The boilers produce steam at quite high pressure and temperature and the consumers often demand steam at different lower pressures and therefore the steam net is divided in different subnets with controllable valves in between The controllable valves controls the flow in the net and the opening of the valves are adjusted so that the pressures in the subnets are kept at the desired levels An example of a steam net can be seen in Figure 1 Every component will be explained in more detail below High Pressure Net HP Recovery Boer E zi a Controllable Av valve Medium Pressure Net MP Low Pressure Net LP Figure 1 an example of a steam net 2 1 Boiler The boiler is the steam producer A broad simplification can be seen in Figure 2 Water to the boiler is pumped into the drum The drum is a big tank which contains both water and steam The water is transported from the drum to the combustion where the water is partly vaporized The mix of water and steam is transported back to t
58. to the next sample so we can get the corresponding control signals boolean newClockCycle false while newClockCycle Variant clockCount_Variant new Variant 1 s7ProSim1 ReadOutputPoint 538 0 PointDataTypeConstants S7_Word clockCount_Variant int clockCount lastClockCount try clockCount clockCount_Variant toInt catch ClassCastException cce System out printIn cce if clockCount gt lastClockCount 1 if clockCount gt lastClockCount lastClockCount clockCount newClockCycle true System out printIn new ClockCycle lastClockCount j else try myThread sleep 10 catch InterruptedException ie System out printlIn ie Now it s time to get the next control signals Read the outputs from the control system and print to the file to the string temporarely int nbrOfOutputs toProcessFromPCS7 length for int i 1 i lt nbrOfOutputs i Variant output new Variant 1 s7ProSim1 ReadOutputPoint Integer toProcessFromPCS7 i 1 int Value 0 PointDataTypeConstants S7 Word output nextFileContents writeNextOutput fileContents output currentIndex nextFileContents CR currentIndex fileContents indexOf CR currentIndex currentIndex fileContents indexOf LF currentIndex nextFileContents LF file setPosition fileStartPosition 51 long nextFileLength nextFileContents length file setLength nextFileLength Write the cont
59. udes most features of the real PLC The major difference is that the PLCSIM doesn t run in real time due to the underlying operating system 11 23 7 4 Extensions The Simatic PCS 7 can be used to build full scale complex control systems Usually there is need for more than one Operator Station Using an OS server one can connect many 16 per server OS clients In the paper process industry it is often insufficient with one PLC and hence they divide the control system into two or more PLCs Unfortunately PLCSIM can only simulate the behaviour of one PLC The network is often an ordinary Industrial Ethernet but depending on the amount of data transferred the number of nodes and the need for expandability Fast Ethernet and Profibus could be used as well The connections to the process can be done in many ways too Using I O modules the process components are directly connected to the process transducers via conventional cabling This might be good with a simple process with a small number of transducers but with larger processes there is a better solution Instead of using central I O modules placed in the rack distributed I O modules e g ET 200M can be placed at strategical places in the factory The distributed modules are still connected to the process transducers via conventional cabling but all the I O modules can be connected to the PLC via a field bus e g Profibus DP An example of how a more complex and real Simatic PCS 7 can be
60. values The values are represented in an exponential notation with six decimals and three digits representing the power 29 label for synchronization Matrix txt PCS7 HP1 Pressure1 5 299534e 001 MP Pressure 9 510184e 000 LP Pressure1 3 100413e 000 HP2_Pressure1 1 999899e 001 Ack Pressure1 2 877380e 000 Valve HP MP 4 130859e 001 Valve HP LP 8 912040e 002 Valve Inlet Turbine 6 980600e 003 Valve Discharge Turbine 1 000000e 000 Valve HP1 Acc 0 000000e 000 Valve HP2 Acc 7 978880e 002 from PCS7 Valve HP2 MP 2 622249e 002 to Process Valve HP2 LP 2 622249e 002 Valve Acc MP 0 000000e 000 Valve Acc LP 5 889034e 001 Valve Airblow LP 0 000000e 000 BarkBoiler Oil 1 000000e 000 from Process to PCS7 Figure 24 the contents of the communication file Matrix txt 9 2 Communication between Dymola and the file The communication between the process in Dymola and the file takes some time In order to make it more realistic this time has to be approximately zero or at least make it appear as it is zero The latter is possible in Dymola The operator sample 0 T returns true at sample instants with sampling time T and used in a when clause like when sample 0 1 then ControlSignals communicateProcessFile ProcessValues end when the result will be the desired The equations inside the when clause are called at every sampling instant and the evaluation of the expressions is performed in zero simulated ti
Download Pdf Manuals
Related Search
Related Contents
CDF 35/45 - Dantherm 工事説明書 (1.34 MB/PDF) POLCOMS User Guide 取扱説明書 メタルジャケットガスケット - ニチアスガスケットNAVI Grandstream Multi Port FXS Gateway GXW400x Meridian Audio SRC-2010 User's Manual Betriebs- und Montage- anleitung Operation and assembly Copyright © All rights reserved.
Failed to retrieve file