FB42 PID, Need to reset sometimes ???

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Hello,

I have 31 FB42 blocks in an OB35.
This for the heating of resistors (digital out), connected on the Actuating_Up output of the block. This works, but...

The heatings can be shut off. In OB35 I jump over the PID block in that case and I set the output low.

After a download or CPU start-up it sometimes happens that the PID's don't work the way they should.... I ask 100 degrees and I get more then 200 and the PID doesn't set it's output low. After I resetted the PID block (COM_RST), the PID works fine again...

This is dangerous.
After a CPU startup I do an automatic reset of the PID's. But, still I've had a situation today where 1 PID went wrong...

Should I Reset everytime I activate a PID block ?

Why this happens, because of the Jump over it ?

Thanks,

Kind regards,
Combo
 
Dont jump over PID's, use manual mode instead. COM_RST is supposed to be used when you need to restart PID, in minimum set it at OB100 and reset after PID block is executed.

What kind of device is controlling heating? Solidstate relay or something else? Maybe FB41 (cont_c) & FB43 (pulsegen) would be more suitable. I think FB42 is intended for position control of actuator.
 
Last edited:
hello

Hi,

I was also thinking about the Jumps. The PID function calculates with the cycle time, by jumping over, this can be messed up I think. So I connected to the LMNS_ON now. This works.

About the heating, it does work with FB42, but, no duty cycle can be setted, I'll try FB41 + FB43.

Thanks,
Combo

Dont jump over PID's, use manual mode instead. COM_RST is supposed to be used when you need to restart PID, in minimum set it at OB100 and reset after PID block is executed.

What kind of device is controlling heating? Solidstate relay or something else? Maybe FB41 (cont_c) & FB43 (pulsegen) would be more suitable. I think FB42 is intended for position control of actuator.
 
Code:
ORGANIZATION_BLOCK "CYC_INT5"
TITLE = "Cyclic Interrupt"
//100ms
VERSION : 0.1


VAR_TEMP
  OB35_EV_CLASS : BYTE ;    //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
  OB35_STRT_INF : BYTE ;    //16#36 (OB 35 has started)
  OB35_PRIORITY : BYTE ;    //Priority of OB Execution
  OB35_OB_NUMBR : BYTE ;    //35 (Organization block 35, OB35)
  OB35_RESERVED_1 : BYTE ;    //Reserved for system
  OB35_RESERVED_2 : BYTE ;    //Reserved for system
  OB35_PHASE_OFFSET : WORD ;    //Phase offset (msec)
  OB35_RESERVED_3 : INT ;    //Reserved for system
  OB35_EXC_FREQ : INT ;    //Frequency of execution (msec)
  OB35_DATE_TIME : DATE_AND_TIME ;    //Date and time OB35 started
  AlwOn : BOOL ;    
  AlwOff : BOOL ;    
END_VAR
BEGIN
NETWORK
TITLE =

      SET   ; 
      S     #AlwOn; 
      R     #AlwOff; 
NETWORK
TITLE =
//Jump distributor for controlling OB35 segments to be executed. S1 to S4 are executed every 400ms when ob35 call is set to 100ms
      L     "OB35JL"; //also set this to zero at ob100
      JL    JLE; 
      JU    S1; 
      JU    S2; 
      JU    S3; 
      JU    S4; 
JLE:  JU    END; 


NETWORK
TITLE =
//400ms

S1: nop 0; //first set of pids here 

NETWORK
TITLE =
//reset com_rst's after pid is executed
      SET   ; 
      R     "xxx."COM_RST
      JU    END; 
NETWORK
TITLE =
//400ms
S2:   NOP   0; //second set of pids here 
               //reset com_rst's after pid is executed
      JU    END; 


NETWORK
TITLE =
//400ms
S3:   NOP   0; //third set of pids here 
               //reset com_rst's after pid is executed
      JU    END; 

NETWORK
TITLE =
//400ms
S4:   NOP   0; //fourth set of pids here 
               //reset com_rst's after pid is executed
      JU    END; 

NETWORK
TITLE =
//100ms
//Update jl and execute FB43's
END:  L     "OB35JL"; 
      L     1; 
      +I    ; 
      L     4; 
      MOD   ; 
      T     "OB35JL"; 

//call all fb43's, they get executed every scan

END_ORGANIZATION_BLOCK
You could use jl like this to get lesser impact on scan time when ob35 is called. This is just fast example, good execution intervals and execution ratio between fb41's & fb43's you need to find yourself.
 
Very unstable

I tried this, but very very very unstable, difficult to make the settings, lot's of code (20 PID's)... It works better with FB42 and a P of 100 and Ti of 20...
weird... even if FB42 is not ment to be used for this kind of regulation... hmmm



Code:
ORGANIZATION_BLOCK "CYC_INT5"
TITLE = "Cyclic Interrupt"
//100ms
VERSION : 0.1


VAR_TEMP
  OB35_EV_CLASS : BYTE ;    //Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
  OB35_STRT_INF : BYTE ;    //16#36 (OB 35 has started)
  OB35_PRIORITY : BYTE ;    //Priority of OB Execution
  OB35_OB_NUMBR : BYTE ;    //35 (Organization block 35, OB35)
  OB35_RESERVED_1 : BYTE ;    //Reserved for system
  OB35_RESERVED_2 : BYTE ;    //Reserved for system
  OB35_PHASE_OFFSET : WORD ;    //Phase offset (msec)
  OB35_RESERVED_3 : INT ;    //Reserved for system
  OB35_EXC_FREQ : INT ;    //Frequency of execution (msec)
  OB35_DATE_TIME : DATE_AND_TIME ;    //Date and time OB35 started
  AlwOn : BOOL ;    
  AlwOff : BOOL ;    
END_VAR
BEGIN
NETWORK
TITLE =

      SET   ; 
      S     #AlwOn; 
      R     #AlwOff; 
NETWORK
TITLE =
//Jump distributor for controlling OB35 segments to be executed. S1 to S4 are executed every 400ms when ob35 call is set to 100ms
      L     "OB35JL"; //also set this to zero at ob100
      JL    JLE; 
      JU    S1; 
      JU    S2; 
      JU    S3; 
      JU    S4; 
JLE:  JU    END; 


NETWORK
TITLE =
//400ms

S1: nop 0; //first set of pids here 

NETWORK
TITLE =
//reset com_rst's after pid is executed
      SET   ; 
      R     "xxx."COM_RST
      JU    END; 
NETWORK
TITLE =
//400ms
S2:   NOP   0; //second set of pids here 
               //reset com_rst's after pid is executed
      JU    END; 


NETWORK
TITLE =
//400ms
S3:   NOP   0; //third set of pids here 
               //reset com_rst's after pid is executed
      JU    END; 

NETWORK
TITLE =
//400ms
S4:   NOP   0; //fourth set of pids here 
               //reset com_rst's after pid is executed
      JU    END; 

NETWORK
TITLE =
//100ms
//Update jl and execute FB43's
END:  L     "OB35JL"; 
      L     1; 
      +I    ; 
      L     4; 
      MOD   ; 
      T     "OB35JL"; 

//call all fb43's, they get executed every scan

END_ORGANIZATION_BLOCK
You could use jl like this to get lesser impact on scan time when ob35 is called. This is just fast example, good execution intervals and execution ratio between fb41's & fb43's you need to find yourself.
 
In what whey unstable?

In siemens help files example FB41 was executed every 2sec while fb43 was executed every 100ms (or something like that). Did you try with ratios like that between fb's?

Care to post your ob35 in here with fb41 & 43?
 
Last edited:

Similar Topics

hey guys, i'm testing the FB42 from siemens simatic manager, i'm wondering why FB42 is not working accordingly? when i put values on PV_IN and...
Replies
9
Views
3,358
Dear Friends, I am vijaya kumar. Now i am trying to simulate PID controler block FB42 for temperature control action. but i am truble to fill...
Replies
0
Views
1,530
Hello everyone, I need help about FB42's symbol difinition. I don't understand what's it mean. Hope you can explain it or tell me where the manual...
Replies
3
Views
2,255
Hello! I use siemens cpu 312! I must measure 3 current about 100kA (producing FESi)! On primary side of transformator we are measuring the...
Replies
0
Views
1,690
Hi, I would like to assemble a simulator/practice booster pump system that uses PID to maintain steady water pressure under various outlet demands...
Replies
0
Views
82
Back
Top Bottom