Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:23:22+00:00 2026-05-30T07:23:22+00:00

I have a problem regarding putting a PID controller in my simulink file. In

  • 0

I have a problem regarding putting a PID controller in my simulink file.

In my simulink file, i used pid controller to control my process. I used s-function as my process block diagram.

According Ziegler-Nichols method, for the first step we set k equal to the smallest value (0.5) so I put 0.5 in my proportional value . but there is no different between the result with controller and without controller.Even i increase or decrease proportional value.

Why this problem occur? hope someone can help me.Thank you.

my block diagram is look like below picture.refer to this picture

http://s1009.photobucket.com/albums/af218/syarinazulkifeli/?action=view&current=Untitled-1.png

Here is my s-function file:

function [sys,x0,str,ts]= reactor_sfcn(t,x,u,flag)

switch flag

case 0
    [sys,x0,str,ts]=mdlInitializeSizes;
case 1,
    sys = mdlDerivatives(t,x,u);
case 3,
    sys = mdlOutputs(t,x,u);
case 9
    sys =[];
end

function [sys,x0,str,ts] = mdlInitializeSizes()

s = simsizes;
s.NumContStates   = 11;
s.NumDiscStates   = 0;
s.NumOutputs      = 11;
s.NumInputs       = 1;
s.DirFeedthrough  = 0;
s.NumSampleTimes  = 1;

sys = simsizes(s) ;
x0 = [0.0258,0,0,0,0,0,0,0,8.83,303.15,303.15];
str=[] ; 
ts = [0 0];

    function sys = mdlDerivatives (t,x,u)
Tjo = u;
sys = reactor(t,x,Tjo);


        function sys = mdlOutputs(t,x,u)
%                 sys(1)=x(1);
%                 sys(2)=x(2);
%                 sys(3)=x(3);
%                 sys(4)=x(4);
%                 sys(5)=x(5);
%                 sys(6)=x(6);
%                 sys(7)=x(7);
%                 sys(8)=x(8);
%                 sys(9)=x(9);
%                sys(10)=x(10);
%                sys(11)=x(11);
                 sys = x;  

Link of s-function file

function DXDT = reactor(t,x,Tjo)

% -------------------------------------------- %
%       Parameters definition
% -------------------------------------------- %  
I  = x(1);   X = x(2);   P0 = x(3);  
P1 = x(4);  P2 = x(5);   Q0 = x(6);  
Q1 = x(7);  Q2 = x(8);    M = x(9);
Tjo = x(10);  T = x(11); 

% ---------------------------------------
%               Constants
% =======================================

%constant
 M0 = 8.83;
 I0 = 0.0258;
 Qh = 60.44;
 MMWm = 100.3;
 U0 = 55.1;

% Densities
dp = 1200;                
dm = 968-1.225*(T-273.15);               
Rhoc = 998;                            

% volume expansion factor
Fev = (dm - dp)./dp ;                  

% volume fraction
 Fvm = (1 - X)./(1 + Fev*X);           
 Fvp = X*(1-Fev)./(1+Fev*X);

% Total reactant mixture density
 Rho = dm*Fvm + dp*Fvp;            
% Reactor and jacket volume
 Vc = 2;                            
  V = 2;                           
% Reactor dimension      
At =3.1416*0.15*0.113;    
% coolant flow rate
Mc = 0.41/18;                      
%   
 Cpc = 77.22;            
 Cp = 199.13;               
% Average coolant temperature
Tji = 303.15;
Tj =(Tji+Tjo)/2;     

% Overall heat transfer coeff   
 alpha = 0.4;  
 U = U0-alpha*X;        

 delHp = 57800;                        

% ---------------------------------------
%           Rates of reaction
% ======================================= 

% Fujita-Doolittle equation
Tgp = 114 +273.25   ;                      
A = 0.168-8.21e-6*(T-Tgp)^2;
B = 0.03;
g = exp(2.303*Fvm/(A + B*Fvm));          

% Dissociation rate
F = 0.58; 
Kd = (6.32e16*exp(-15.43e3/T));            

% Propagation rate  
Tep = 5.4814e-16*exp(13982/T);               
Kp0 = 2.952e7*exp(-4353/(1.987*T));     
Kp = (Kp0*g)./(g + (Tep*P0.*Kp0));         

% Termination rate  
Tet = (1.1353e-22*exp(17420/T))./I0;      
Kt0 = 5.88e9*exp(-701/(1.987*T));        
Kt = (Kt0*g)./(g + (Tet*P0.*Kt0));        
Ktc = 0;
Ktd = Kt ;                                



% -------------------------------------------- %
%       ODE's
% -------------------------------------------- % 
 dIdt = -Kd*I - ((Fev*I.*P0.*(1 - X)*Kp)./(1 + Fev*X)); 
 dXdt = Kp*(1 - X).*P0;     
 dP0dt = (-Fev*P0.*P0.*(1 - X)./(1 + Fev*X)).*Kp + 2*F*Kd*I - Kt*P0.*P0; 
 dP1dt = (-Fev*P0.*P1.*(1 - X)./(1 + Fev*X)).*Kp + 2*F*Kd*I - Kt*P0.*P1 + (Kp*M0*(1 -   X)./(1 + Fev*X)).*P0;
dP2dt = (-Fev*P0.*P2.*(1 - X)./(1 + Fev*X)).*Kp + 2*F*Kd*I - Kt*P0.*P2 + (Kp*M0*(1 - X)./(1 + Fev*X)).*(2*P1 + P0);
dQ0dt = (-Fev*P0.*Q0.*(1 - X)./(1 + Fev*X)).*Kp + Ktd*P0.*P0 + 0.5*Ktc*P0.*P0;
dQ1dt = (-Fev*P0.*Q1.*(1 - X)./(1 + Fev*X)).*Kp + Ktd*P0.*P1 + Ktc*P0.*P1;
dQ2dt = (-Fev*P0.*Q2.*(1 - X)./(1 + Fev*X)).*Kp + Ktd*P0.*P2 + Ktc*(P1.*P0 + P1.^2);
dMdt = (-Kp*P0*M0*(1 - X)./(1 + Fev*X)).*((Fev*(1 - X)./(1 + Fev*X)) + 1);
  Rm = (-delHp)*dMdt;                  
dTjodt = (Mc*Cpc*(Tji-Tjo)+ U*At*(T-Tj))/(Vc*Rhoc*Cpc/18);
dTdt = (Qh+(Rm*V*MMWm)-(U*At*(T-Tj)))/(V*Rho*Cp);


DXDT =[dIdt;dXdt;dP0dt;dP1dt;dP2dt;dQ0dt;dQ1dt;dQ2dt;dMdt;dTjodt;dTdt];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:23:23+00:00Added an answer on May 30, 2026 at 7:23 am

    First I woult check if the s-function for the process is working as expected. Disconnect the PID controller and connect a step, ramp or a sin block. This could give you a hint if the block for the process is OK and how large the static coefficient is.

    A second hint: the Ziegler-Nichols method says one should increase the Kp until the system gets marginaly stable. Have you tested only one value for the proportional gain? Depending on the plant 0.5 can be really small value and way under the levels you need to control the system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem regarding getting the path of a user control. The scenario
I have a problem regarding the datediff MYSQL function, I can use it and
I am facing a problem regarding putting my custom log file into the android
I have a problem regarding the behaviour of the pthread function pthread_rwlock_wrlock . The
I have a problem regarding StartUp Url in WPF. I have a LoginView.xaml and
I have a question regarding a problem with L2S, Autogenerated DataContext and the use
I actually have two questions regarding the same problem but I think it is
I have a problem reading a txt file to insert in the mysql db
I have a problem regarding 'static const' member initialization. In a templated class I
I have a problem I don't understand regarding UIViews and Core Animation. Here's what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.