logo资料库

西门子S7-300 STL编写PID例程(英文).pdf

第1页 / 共15页
第2页 / 共15页
第3页 / 共15页
第4页 / 共15页
第5页 / 共15页
第6页 / 共15页
第7页 / 共15页
第8页 / 共15页
资料共15页,剩余部分请下载后查看
S7-300/400 Tip SIMATIC PID Tip No. 2 S7-300/400 Tips Group Topic 1 Simple PID Controllers for the S7-300/400 Overview 1. What does the example program do? 2. Where do you use a PID controller? 3. Auto Mode vs. Manual Mode 4. What does a PID controller do, and how? 5. What are the Sample, Gain, Rate, and Reset? 6. How is the Error figured? 7. How is the Proportional term figured? 8. How is the Integral term figured? 9. How is the Derivative term figured? 10. What if the final Output is too high? 11. What should the user add to make the program work for his system? 12. Adjusting the Reset, Rate, Gain, Sample time and Mode during run-time Copyright Status: 11/96 1996 by SIEMENS page 1 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . T h i s p r o g r a m m i n g e x a m p l e s h o w s a m e t h o d f o r p r o g r a m m i n g a P r o p o r t i o n a l I n t e g r a l D e r i v a t i v e ( P I D ) c o n t r o l l e r o n a S 7 P L C . T h e e x a m p l e i s a l r e a d y a f u l l y f u n c t i o n i n g p r o g r a m , n e e d i n g o n l y f o r t h e u s e r t o t i e t h e a c t u a l i n p u t s a n d o u t p u t s t o a p p r o p r i a t e v a r i a b l e s t o b e a w o r k i n g c o n t r o l l e r . T h i s p r o g r a m i s s u i t a b l e f o r s i m p l e P I D a p p l i c a t i o n s . F o r c o m p l e x P I D a p p l i c a t i o n s , S i e m e n s o f f e r s t h e S I M A T I C S 7 S t a n d a r d C o n t r o l s o f t w a r e p a c k a g e , w h i c h o f f e r s n u m e r o u s f e a t u r e s t h a t t h i s a p p l i c a t i o n s t i p l a c k s . T h e s e f e a t u r e s i n c l u d e a l a r m i n g , s c a l i n g , d e a d b a n d c o n t r o l , f e e d - f o r w a r d c o n t r o l , r a n g e l i m i t i n g , r a m p / s o a k s t e p s , a n d a n i n t e g r a t e d s c h e d u l e r . T h e S t a n d a r d C o n t r o l p a c k a g e i n c l u d e s a W i n d o w s - b a s e d c o n f i g u r a t i o n t o o l t h a t g r e a t l y s i m p l i f i e s c o n f i g u r i n g a n d t u n i n g a P I D l o o p . T o p r e p a r e a u s e r t o m a k e t h e s e p r o g r a m m i n g c h a n g e s , t h e t e x t w i l l e x p l a i n t h e b a s i c s o f t h e P I D c o n t r o l l e r i m p l e m e n t e d i n t h e s a m p l e c o d e . B e l o w i s a b r i e f o u t l i n e f o r t h e r e s t o f t h i s d o c u m e n t :
S7-300/400 Tip PID Explored What does the example program do? PID Tip No. 2 Figure 2.1 When do you use a PID controller? Figure 2.2 Copyright Status: 11/96 1996 by SIEMENS page 2 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . T h i s p r o g r a m m i n g e x a m p l e i s a s k e l e t o n p r o g r a m f o r a t r u e P I D c o n t r o l l e r a n d , a s s u c h , r e q u i r e s t h a t t h e u s e r m a k e a f e w a d d i t i o n s ( i . e . r e a d / w r i t e i n p u t / o u t p u t v a r i a b l e s ) b e f o r e i t i s f u l l y f u n c t i o n a l . B e f o r e d i s c u s s i n g t h e s e , h o w e v e r , l e t ’ s g e t a b e t t e r f e e l f o r w h a t a P I D p r o g r a m a c t u a l l y d o e s t h r o u g h a b r i e f e x a m p l e . H o t P l a t e T e m p e r a t u r e C o n t r o l S t e a m S t e a m F l o w T u r b i n e W a t e r T a n k H o t P l a t e A n E x a m p l e S y s t e m F i g u r e 2 . 1 s h o w s a p i c t u r e o f a n e x a m p l e s y s t e m t o w h i c h a u s e r m i g h t c o n n e c t a P I D c o n t r o l l e r . T h e f i g u r e s h o w s a w a t e r t a n k s i t t i n g a t o p a h o t p l a t e , w i t h a t e m p e r a t u r e c o n t r o l d e v i c e f o r t h e h o t p l a t e a n d a s m a l l , m o n i t o r e d t u r b i n e f o r m e a s u r i n g t h e r a t e o f t h e s t e a m f l o w . T h i s i s a s y s t e m t h a t w i l l w o r k w i t h a P I D c o n t r o l l e r b e c a u s e o f t h e r e l a t i o n s h i p b e t w e e n t h e t w o v a r i a b l e s : Y o u c a n d i r e c t l y c o n t r o l t h e s t e a m f l o w r a t e b y a d j u s t i n g t h e t e m p e r a t u r e o f t h e h o t p l a t e . F i g u r e 2 . 2 s h o w s h o w b o t h v a r i a b l e s r e l a t e t o t h e P I D c o n t r o l l e r . S 7 - 3 0 0 r u n n i n g a P I D p r o g r a m . P r o c e s s V a r i a b l e O u t p u t S t e a m F l o w T u r b i n e T e m p e r a t u r e C o n t r o l A n E x a m p l e o f a P I D C o n t r o l l e d S y s t e m
S7-300/400 Tip PID Tip No. 2 Auto Mode vs. Manual Mode ,Auto What does the PID controller do, and how does it do it? Auto Manual Rate Reset Error Sample Gain Output = MP + MI + MD Formula 2.1 What are the Sample, Gain, Rate, and Reset, and where do they come from? sample rate gain reset rate Copyright Status: 11/96 1996 by SIEMENS page 3 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . T h e v a r i a b l e w h i c h r e p r e s e n t s t h e s t a t e o f t h e s y s t e m b e i n g c o n t r o l l e d i s c a l l e d t h e ‘ P r o c e s s V a r i a b l e . ’ I n o u r e x a m p l e a b o v e , y o u c a n s e e t h a t t h e r a t e a t w h i c h t h e s t e a m s p i n s t h e t u r b i n e i s a g o o d i n d i c a t o r o f t h e e v e n t t h a t w e a r e t r y i n g t o c o n t r o l : t h e s p e e d a t w h i c h t h e w a t e r i s b e i n g b o i l e d o f f . T h e o u t p u t i s t h e v a r i a b l e w h i c h , b e i n g a l t e r e d b y t h e c o n t r o l l e r , c a n a f f e c t t h e p r o c e s s v a r i a b l e b y d i f f e r e n t d e g r e e s b a s e d o n i t s i n t e n s i t y - - B y t u r n i n g t h e h o t p l a t e u p , t h e w a t e r b o i l s m o r e q u i c k l y , m o r e s t e a m i s p r o d u c e d , a n d t h e t u r b i n e ’ s s p e e d i n c r e a s e s . T h e r e f o r e , w h e n a v a r i a b l e t h a t a c c u r a t e l y r e f l e c t s t h e s t a t e o f t h e p r o c e s s a n d a n a d j u s t a b l e c o n t r o l w h i c h p r o p o r t i o n a l l y a f f e c t s t h e p r o c e s s v a r i a b l e , t h e n i t i s p o s s i b l e t o u s e a P I D c o n t r o l l e r . C o m m o n s y s t e m s u s i n g P I D c o n t r o l l e r s a r e a i r c o n d i t i o n i n g s y s t e m s , s o l u t i o n m i x i n g , h e a t e r s , e t c . T h e r e a r e t w o s e t t i n g s a v a i l a b l e o n o u r P I D c o n t r o l l e r . P u t t i n g a c o n t r o l l e r i n m o d e c a u s e s t h e P I D l o o p d o n o t h i n g , s o t h a t t h e u s e r c a n d i r e c t l y c o n t r o l t h e o u t p u t . T h e s e c o n d , i s t h e m o d e i n w h i c h t h e P I D l o o p i s a c t u a l l y c o n t r o l l i n g t h e s y s t e m . F o r t h e r e s t o f t h i s t e x t , i t w i l l b e a s s u m e d t h a t t h e c o n t r o l l e r i s i n m o d e . Q u i t e s i m p l y , a P I D c o n t r o l l e r a d j u s t s t h e v a l u e o f i t s o u t p u t t o t r y a n d b a l a n c e t h e v a l u e o f t h e p r o c e s s v a r i a b l e t o a g i v e n ‘ s e t p o i n t . ’ T o c a l c u l a t e t h e o u t p u t v a l u e f o r a g i v e n i n s t a n c e , t h e c o n t r o l l e r f i n d s t h e v a l u e o f t h r e e d i f f e r e n t t e r m s ( u s i n g i t s u s e r d e f i n e d t i m e , , , a n d v a l u e s a l o n g w i t h t h e c a l c u l a t e d v a l u e ) : a P r o p o r t i o n a l t e r m , a n I n t e g r a l t e r m , a n d a D e r i v a t i v e t e r m . T h e i s t h e c y c l e t i m e ( i n m i l l i s e c o n d s ) a t w h i c h t h e P I D l o o p r e c a l c u l a t e s t h e o u t p u t . T h e c o n t r o l s t h e s e n s i t i v i t y o f t h e o u t p u t c a l c u l a t i o n b y a f f e c t i n g t h e i n f l u e n c e o f a l l t h e t e r m s . T h e i s a t i m e g i v e n i n m i l l i s e c o n d s w h i c h i s u s e d t o i n c r e a s e o r d e c r e a s e t h e i n f l u e n c e o f t h e I n t e g r a l t e r m i n t h e e q u a t i o n . F i n a l l y , t h e v a l u e i s u s e d t o c o n t r o l t h e i n f l u e n c e o f t h e D e r i v a t i v e t e r m i n t h e e q u a t i o n . E a c h o f t h e s e v a l u e s n e e d s t o b e p r e s e t b y t h e u s e r b e f o r e t h e P I D c o n t r o l l e r s t a r t s . I f t h e u s e r d o e s n o t w a n t i n t e g r a l a c t i o n ( n o I i n t h e P I D c a l c u l a t i o n ) , t h e n a v a l u e o f i n f i n i t y o r a v a l u e o f 0 s h o u l d b e s p e c i f i e d f o r t h e i n t e g r a l t i m e . I f t h e u s e r d o e s n o t w a n t d e r i v a t i v e a c t i o n ( n o D i n t h e P I D c a l c u l a t i o n ) , t h e n a v a l u e o f 0 s h o u l d b e s p e c i f i e d f o r t h e d e r i v a t i v e t i m e . I f t h e u s e r d o e s n o t w a n t p r o p o r t i o n a l a c t i o n ( n o P i n t h e P I D ) , t h e n a v a l u e o f 0 s h o u l d b e s p e c i f i e d f o r t h e g a i n ( g a i n i s n o r m a l l y a m u l t i p l i e r i n t h e i n t e g r a l a n d d e r i v a t i v e c o e f f i c i e n t c a l c u l a t i o n , b u t i s r e m o v e d f r o m t h e c o e f f i c i e n t c a l c u l a t i o n , i f g a i n = 0 , t o a l l o w I , I D , o r D l o o p c o n t r o l ) .
S7-300/400 Tip PID Tip No. 2 How is the Error figured? SP = raw_SP / max_val PV = raw_PV / max_val Formulae 2.2 & 2.3 raw_SP raw_PV max_val raw_SP raw_PV max_val Error = SP - PV Formula 2.4 How is the Proportional term calculated? MP , MP = Gain * Error Formula 2.2 How is the Integral Term calculated? MI, MI = Bias + (CI * Error) Formula 2.3 Reset CI, CI = Gain * (Sample / Reset) Formula 2.4 Sample Reset Reset Sample Sample Copyright Status: 11/96 1996 by SIEMENS page 4 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . E r r o r i s f i g u r e d a s t h e d i f f e r e n c e b e t w e e n t h e n o r m a l i z e d v a l u e s o f t h e s e t p o i n t a n d t h e p r o c e s s v a r i a b l e . T h e c o n t r o l l e r c a l c u l a t e s t h i s v a l u e i n t h r e e s t e p s . T h e f i r s t t w o s t e p s a r e t o c h a n g e b o t h t h e s e t p o i n t a n d t h e p r o c e s s v a r i a b l e i n t o v a l u e s t h a t a r e b a s e d o n a 0 t o 1 ( n o r m a l i z e d ) s c a l e . T h i s i s d o n e u s i n g t h e f o r m u l a e : I n t h e a b o v e f o r m u l a e , t h e a n d v a l u e s a r e t h e a c t u a l v a l u e s t h a t c o m e i n t o t h e c o n t r o l l e r , a n d t h e t e r m i s t h e m a x i m u m v a l u e t h a t e i t h e r c a n t a k e o n . F o r e x a m p l e , i f t h e v a l u e s o f a n d w e r e b e i n g r e a d i n a s v a l u e s f r o m 0 t o 2 7 , 6 4 8 , t h e n t h e t e r m w o u l d h a v e t h e v a l u e 2 7 , 6 4 8 . A f t e r t h e s e t w o v a l u e s h a v e b e e n c a l c u l a t e d , t h e e r r o r t e r m i s f i g u r e d a s f o l l o w s : T h e p r o p o r t i o n a l t e r m , i s c a l c u l a t e d u s i n g t h e f o l l o w i n g e q u a t i o n : G o i n g b a c k t o o u r e a r l i e r e x a m p l e w i t h t h e w a t e r t a n k , t h e p r o p o r t i o n a l t e r m s a y s t h a t a s t h e s p e e d o f t h e t u r b i n e i n c r e a s e s f u r t h e r a b o v e t h e s e t p o i n t , t h e h e a t i s d e c r e a s e d p r o p o r t i o n a l l y t o b r i n g t h e s p e e d d o w n . A s t h e t u r b i n e s l o w s b e l o w t h e s e t p o i n t , t h e h e a t i s i n c r e a s e d t o p r o p o r t i o n a l l y t o b r i n g t h e s p e e d u p . T h e i n t e g r a l t e r m , i s c a l c u l a t e d u s i n g t h e f o l l o w i n g e q u a t i o n : I n t h i s e q u a t i o n , t w o n e w t e r m s a r e i n t r o d u c e d . T h e f i r s t , i s t h e c o e f f i c i e n t o f t h e I n t e g r a l t e r m , a n d i s c a l c u l a t e d f r o m t h e : B o t h t h e a n d t e r m s w e r e i n t r o d u c e d e a r l i e r , b u t i n t h i s e q u a t i o n t h e i r u s e s b e c o m e a p p a r e n t . T h e l a r g e r t h e v a l u e i s , t h e l e s s i m p a c t t h e i n t e g r a l t e r m w i l l h a v e o n t h e o u t p u t , w h i l e l a r g e r t i m e s g i v e i t a b i g g e r i n f l u e n c e ( t i m e a l s o a f f e c t s t h e D e r i v a t i v e t e r m , w h i c h w i l l b e e x p l a i n e d l a t e r ) .
S7-300/400 Tip PID Tip No. 2 Bias Bias Bias MP MD MI n MI Bias MI,n = Biasn-1 + (CI * Error) Biasn = MI,n Formula 2.5 How is the Derivative term calculated? n MD = CD * (PVn-1 - PVn) Formula 2.6 CD , CD = Gain * (Rate / Sample) Formula 2.7 CI) Sample Rate Sample What if the final output value is too high? Copyright Status: 11/96 1996 by SIEMENS page 5 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . T h e t e r m i n F o r m u l a 2 . 3 r e p r e s e n t s ( t e c h n i c a l l y s p e a k i n g ) t h e a r e a u n d e r t h e c u r v e o f a g r a p h p l o t t i n g t h e E r r o r v s . t i m e . A b s t r a c t l y , h o w e v e r , t h e v a l u e ( i d e a l l y ) g r o w s t o a n o u t p u t l e v e l t h a t k e e p s t h e s y s t e m s t a b l e , l e t t i n g t h e P r o p o r t i o n a l a n d D e r i v a t i v e t e r m s h a n d l e a n y s m a l l f l u c t u a t i o n s . I n r e l a t i o n t o o u r w a t e r t a n k e x a m p l e f r o m e a r l i e r , t h i s m e a n s t h a t e v e n t u a l l y t h e p o r t i o n o f w o u l d b e t h e o n l y s i g n i f i c a n t c o n t r i b u t i o n t o t h e f i n a l o u t p u t v a l u e , a n d t h e a n d t e r m s w o u l d o n l y b e a c t i v e ( n o n - z e r o ) w h e n a f l u c t u a t i o n o c c u r r e d . A t a t i m e t h e e q u a t i o n s f o r a n d t h e t e r m a r e : T h e d e r i v a t i v e f o r m u l a f o r a g i v e n t i m e i s c a l c u l a t e d w i t h t h e f o l l o w i n g e q u a t i o n : T h i s f o r m u l a o n l y i n t r o d u c e s 1 n e w t e r m , w h i c h i s c a l c u l a t e d u s i n g F o r m u l a 2 . 7 . T h e t e r m ( w h i c h i s a l s o u s e d i n f i g u r i n g i s t h e s a m p l e t i m e f r o m e a r l i e r . I n t h e D e r i v a t i v e t e r m , t h e t i m e i s i n d i r e c t l y p r o p o r t i o n a l t o t h e d e r i v a t i v e c o m p o n e n t , w h i l e t h e i s d i r e c t l y p r o p o r t i o n a l . D u r i n g m a n y p r o c e s s e s ( s u c h a s t h e w a t e r t a n k e x a m p l e e a r l i e r ) , t h e P r o c e s s v a r i a b l e d o e s n ’ t r e s p o n d i m m e d i a t e l y t o a c h a n g e i n t h e v a l u e o f t h e o u t p u t - - i f t h e w a t e r i n t h e t a n k w e r e i c e c o l d , t h e n e v e n a n o u t p u t o f 1 0 0 % i s n o t g o i n g t o c a u s e a n i n s t a n t a n e o u s i n c r e a s e i n s t e a m f l o w . L i k e w i s e , s e t t i n g t h e o u t p u t t o 0 % w h e n t h e w a t e r i s b o i l i n g d o e s n ’ t p r o v i d e a n i m m e d i a t e r e d u c t i o n i n s t e a m p r o d u c t i o n . B e c a u s e o f t h i s ‘ s y s t e m i n e r t i a , ’ t h e o u t p u t v a l u e f o r a g i v e t i m e c o u l d t a k e o n a v a l u e g r e a t e r t h a n 1 0 0 % o r l e s s t h a n 0 % . I n r e s p o n s e t o t h i s , t h e P I D p r o g r a m i m p l e m e n t s O u t p u t C l a m p i n g . I f t h e o u t p u t i s g r e a t e r t h a n 1 0 0 % , t h e n i t i s c l a m p e d t o 1 0 0 % . I f t h e o u t p u t f a l l s l o w e r t h a n 0 % , t h e n i t i s h e l d t o 0 % .
S7-300/400 Tip PID Bias Bias Tip No. 2 Bias If Output > 1 Bias = 1 - (MP + MD) Formula 2.8 If Output < 0 Bias = -(MP + MD) Formula 2.9 Output MD , MP , Bias Bias Bias Output Bias What should be added to make the program work for the system? Reset Rate Gain Sample Read in the Process Variable Write the Output Set the Setpoint Copyright Status: 11/96 1996 by SIEMENS page 6 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . T h e o n l y p r o b l e m l e f t t o s o l v e l i e s w i t h t h e p o r t i o n o f t h e I n t e g r a l t e r m . W h e n t h e o u t p u t f o r a s y s t e m r e m a i n s a t 1 0 0 % f o r a l o n g p e r i o d o f t i m e ( s u c h a s w h e n h e a t i n g u p c o l d w a t e r i n o u r t a n k f r o m e a r l i e r ) , t h e i n t e g r a l s u m ( w h i c h t h e t e r m r e p r e s e n t s ) c a n g r o w t o e x t r e m e l y l a r g e v a l u e s . T h i s m e a n s t h a t w h e n t h e v a r i a b l e s t a r t s r e s p o n d i n g , t h e t e r m w i l l b e k e e p i n g t h e c a l c u l a t e d o u t p u t w e l l o v e r 1 0 0 % u n t i l i t c a n b e w o u n d d o w n . T h i s g e n e r a l l y r e s u l t s i n t h e o u t p u t s w i n g i n g w i l d l y f r o m o n e l i m i t t o t h e o t h e r , b u t c a n b e a v o i d e d u s i n g B i a s C l a m p i n g . T h e r e a r e a f e w d i f f e r e n t t y p e s o f B i a s C l a m p i n g , b u t t h e o n l y p e r t i n e n t o n e h e r e i s t h e o n e u s e d i n t h e p r o g r a m . T h e r e a r e t w o d i f f e r e n t c o n d i t i o n s w h i c h c a u s e B i a s c l a m p i n g t o o c c u r a n d t w o f o r m u l a e a s w e l l : A s t h e f o r m u l a e s h o w , w h e n t h e g r o w s t o b e g r e a t e r t h a n 1 , t h e v a l u e o f t h e i s a d j u s t e d s o t h a t t h e s u m o f a n d t h e w i l l b e 1 . L i k e w i s e , w h e n t h e s l i p s b e l o w 0 , t h e v a l u e o f t h e i s a d j u s t e d s o t h a t t h e a b o v e s u m w i l l b e 0 . T h e a d j u s t e d v a l u e i s t h e n c l a m p e d s u c h t h a t i t s m a x i m u m v a l u e i s 1 a n d i t s m i n i m u m v a l u e i s 0 . 1 . R e a d i n t h e P r o c e s s V a r i a b l e 2 . W r i t e t h e O u t p u t 3 . S e t t h e S e t p o i n t 4 . A d j u s t t h e s c a l e f o r t h e I n p u t a n d S e t p o i n t 5 . A d j u s t t h e s c a l e f o r t h e O u t p u t 6 . A d j u s t t h e , , , a n d t i m e v a l u e s . T h e P r o c e s s v a r i a b l e ( t h e v a r i a b l e w h i c h a c c u r a t e l y r e f l e c t s t h e s t a t e o f t h e s y s t e m t o b e c o n t r o l l e d ) s h o u l d b e p a s s e d t o t h e P V p a r a m e t e r o f t h e f u n c t i o n b l o c k . T h e O U T p a r a m e t e r o f t h e P I D l o o p s h o u l d b e s e t t o t h e a n a l o g o u t p u t b e i n g c o n t r o l l e d i n t h e P I D f u n c t i o n b l o c k c a l l . T h e u s e r ’ s c o d e m u s t p a s s t h e S e t p o i n t v a l u e t o t h e P I D f u n c t i o n b l o c k v i a t h e S P p a r a m e t e r .
S7-300/400 Tip PID Tip No. 2 Adjust the scale for the Process Variable and Setpoint Adjust the scale for the Output Adjust the Reset, Rate, Gain, and Sample time values Sample Reset Rate Gain Sample n n n n Reset Rate Gain n Adjusting the Reset, Rate, Gain, and Sample time, and Mode during run-time Reset Rate Gain Sample Copyright Status: 11/96 1996 by SIEMENS page 7 / 15 Pid.doc Version 1.0 S I M A T I C S 7 - 3 0 0 / 4 0 0 c u s t o m e r s h a v e f r e e u s e o f t h e a p p l i c a t i o n t i p s . T h e s e t i p s a r e o n l y a g e n e r a l a p p r o a c h t o u s i n g t h e S 7 - 3 0 0 / 4 0 0 w i t h v a r i o u s a p p l i c a t i o n s . Y o u r s p e c i f i c a p p l i c a t i o n m a y b e d i f f e r e n t . I t i s y o u r r e s p o n s i b i l i t y t o u s e t h e S I M A T I C S 7 - 3 0 0 / 4 0 0 p r o p e r l y i n y o u r a p p l i c a t i o n s . I n n e t w o r k s 6 t h r o u g h 1 1 o f t h e P I D f u n c t i o n b l o c k , t h e p r o g r a m c o n v e r t s t h e ( r a w ) P V v a l u e i n t o a n o r m a l i z e d ( 0 - 1 ) v a l u e b a s e d o n a s c a l e o f 0 t o 2 7 , 6 4 8 . I f t h e v a l u e t h a t t h e u s e r i s r e a d i n g i n i s o n a d i f f e r e n t s c a l e , t h e u s e r h a s t o c h a n g e t h e 2 7 , 6 4 8 s i n t h e s e n e t w o r k s t o t h e n e w v a l u e . F o r e x a m p l e , i f t h e s c a l e w e r e 0 t o 1 0 0 , y o u w o u l d c h a n g e t h e 2 7 , 6 4 8 s t o 1 0 0 s . A n o t h e r a p p r o a c h w o u l d b e t o c h a n g e t h e s c a l e o f t h e P V a n d S P t o t h e 0 t o 2 7 , 6 4 8 s c a l e b e f o r e p a s s i n g t h e m t o t h e P I D f u n c t i o n b l o c k . T h i s c o u l d b e d o n e w i t h c o d e i n t h e c a l l i n g b l o c k , o r b y a s c a l i n g f u n c t i o n b l o c k . I n t h e l a s t n e t w o r k i n t h e p r o g r a m , t h e O u t p u t v a l u e i s c h a n g e d f r o m a n o r m a l i z e d v a l u e ( 0 - 1 ) i n t o a s c a l e d n u m b e r ( 0 - 2 7 , 6 4 8 ) . A s i n t h e a b o v e s e c t i o n , t o c h a n g e t h e s c a l e o f t h e o u t p u t , s i m p l y c h a n g e t h e 2 7 , 6 4 8 i n t o t h e n e w m a x i m u m v a l u e ( o r r e s c a l e t h e o u t p u t a f t e r t h e f u n c t i o n b l o c k r e t u r n s ) . T h e f i n a l t h i n g t h a t t h e u s e r ’ s c o d e n e e d s t o i m p l e m e n t i s t h e s e t t i n g o f t h e , , , a n d t i m e v a l u e s . I f t h e P I D l o o p ’ s i n s t a n c e D B i s c o n f i g u r e d a s r e t e n t i v e , t h i s n e e d o n l y b e d o n e o n c e , b y h a n d , a f t e r t h e i n s t a n c e D B i s c r e a t e d i n t h e P L C . I f t h e P I D l o o p ’ s i n s t a n c e D B i s n o t r e t e n t i v e , t h e l o o p t u n i n g p a r a m e t e r s m u s t b e s e t a f t e r e a c h P L C r e s t a r t . T h i s c o u l d b e d o n e i n O B 1 0 0 ( C o m p l e t e R e s t a r t O B ) . F o r a P I D l o o p i n s t a n c e d a t a b l o c k , t h e v a l u e s s h o u l d b e p l a c e d a s f o l l o w s : D B . D B D 1 8 ( r e a l ) , t i m e i n m i l l i s e c o n d s D B . D B D 1 4 ( r e a l ) , t i m e i n m i l l i s e c o n d s D B . D B D 1 0 ( r e a l ) , u n i t l e s s f a c t o r D B . D B D 2 2 ( r e a l ) , t i m e i n m i l l i s e c o n d s T h e s a m p l e t i m e s h o u l d b e s e t t o t h e s a m e p e r i o d a t w h i c h t h e P I D l o o p f u n c t i o n b l o c k c a l l e d . C h a n g e s i n t h e , , , a n d t i m e v a l u e s t a k e e f f e c t t h e n e x t t i m e t h e P I D l o o p f u n c t i o n b l o c k i s c a l l e d . T h e P I D l o o p m o d e i s c o n t r o l l e d v i a t h e m o d e _ r e q f u n c t i o n b l o c k p a r a m e t e r . W h e n m o d e _ r e q i s F A L S E ( 0 ) , t h e l o o p w i l l t r a n s i t i o n t o o r r e m a i n i n M a n u a l m o d e w h e n t h e f u n c t i o n b l o c k i s n e x t c a l l e d . W h e n m o d e _ r e q i s T R U E ( 1 ) , t h e l o o p w i l l t r a n s i t i o n t o o r r e m a i n i n A u t o m o d u l e w h e n t h e f u n c t i o n b l o c k i s n e x t c a l l e d .
###E###
分享到:
收藏