Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

pid control and constraining a variable

Please login with a confirmed email address before reporting spam

Hi,

i'm making a pid control of a heat exchanger and I need to constraining the inlet velocity of fluid. The inlet velocity is calculated by the pid control law, but need to be constrained between 3.5<u<10 How can I make this in comsol? For example:


if u < 3.5 m/s
u = 3.5

if u > 10 m/s
u = 10



best regards,


gustavo

10 Replies Last Post Oct 20, 2012, 3:11 p.m. EDT
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 17, 2012, 12:54 a.m. EDT
Hi

What about using a rect1() or perhaps a Gaussian function to shape your velocity within your limits ?

--
Good luck
Ivar
Hi What about using a rect1() or perhaps a Gaussian function to shape your velocity within your limits ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 17, 2012, 7:01 a.m. EDT
Hi Ivar,

thanks for help me. I don't explained very well. I need a bether way to make this, my inlet boundary need to be:


if u < 3.5 m/s
u = 3.5

if u > 10 m/s
u = 10


else
u = pid_Control_Law.


In the case that the velocity inlet don't be saturated the value is calculate with a PID controller. You can help with this case?


best regards,

Gustavo
Hi Ivar, thanks for help me. I don't explained very well. I need a bether way to make this, my inlet boundary need to be: if u < 3.5 m/s u = 3.5 if u > 10 m/s u = 10 else u = pid_Control_Law. In the case that the velocity inlet don't be saturated the value is calculate with a PID controller. You can help with this case? best regards, Gustavo

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 17, 2012, 2:38 p.m. EDT
Hi

well then cannt you try sometinh like if(u<3.5,3.5,if(u>10,10,yourfunction))

but you shoudl ensure that "yourfunction" is smooth during the transition around 3.5 and 10, i.e. using a rect and a "+u" to get the overall slope along

--
Good luck
Ivar
Hi well then cannt you try sometinh like if(u10,10,yourfunction)) but you shoudl ensure that "yourfunction" is smooth during the transition around 3.5 and 10, i.e. using a rect and a "+u" to get the overall slope along -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 18, 2012, 8:24 p.m. EDT
Hi Ivar,

I made the restrictions in the inlet velocity, but now my model has inconsistent initial values. I don't understant, because without the restrictions the simulation occurs well, but when the inlet velocity turns negative a convergence error occurs. So I think the solution for this is to put a saturation in the inlet velocity boundary (like you said me), but now a initial value error is occuring.

Hi Ivar, I made the restrictions in the inlet velocity, but now my model has inconsistent initial values. I don't understant, because without the restrictions the simulation occurs well, but when the inlet velocity turns negative a convergence error occurs. So I think the solution for this is to put a saturation in the inlet velocity boundary (like you said me), but now a initial value error is occuring.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 19, 2012, 1:24 a.m. EDT
Hi

COMSOL proposes all "0" as initial conditions, these are often far from optimum. Perhaps you should first runa stationary case to get your model into a correct starting point, then run a time series thereupon, starting from the stationary initial case (you link the 2nd study to the results of the first one, see the doc)

--
Good luck
Ivar
Hi COMSOL proposes all "0" as initial conditions, these are often far from optimum. Perhaps you should first runa stationary case to get your model into a correct starting point, then run a time series thereupon, starting from the stationary initial case (you link the 2nd study to the results of the first one, see the doc) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 19, 2012, 9:17 a.m. EDT
Hi Ivar,


I made this, the problem with initial conditions is solved, thanks. But know the problem is with the time dependent solver, the solver has convergence error in t = 0. Is this occuring because my initial conditions are wrong?

best regards
Hi Ivar, I made this, the problem with initial conditions is solved, thanks. But know the problem is with the time dependent solver, the solver has convergence error in t = 0. Is this occuring because my initial conditions are wrong? best regards

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 19, 2012, 9:23 a.m. EDT
Hi

Have you checked that all your t=0 BC conditions make sense, not forgotten somewhere a constant value or something. I.e. temperatures in Kelvin "0" K is not a good starting point 0[degC] (or 20) is better

--
Good luck
Ivar
Hi Have you checked that all your t=0 BC conditions make sense, not forgotten somewhere a constant value or something. I.e. temperatures in Kelvin "0" K is not a good starting point 0[degC] (or 20) is better -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 19, 2012, 6:46 p.m. EDT
Hi Ivar,

I think the problem is the controller parameter (proportional and integral term), I need to analise better this. I would like to ask you: This model that I need simulate has a industrial scale of 172 m long, but will need a high computational effort and maybe not work. Do you have any ideal how can I simulate this? I need to validate the temperature output of comsol model with the real system and the EDP model that already been done. Completing this step, I will put the PID control law in the inlet boundary condition to tracking the desired temperature and again validate with the real system and the EDP model. I really don't have an idea how to simulate 172 m long. As you have a great experience with this kind of simulation I would like to know your opinion.

obs: currently I just have simulated 3 m long and making some tests with the PID control.


best regards,

Gustavo
Hi Ivar, I think the problem is the controller parameter (proportional and integral term), I need to analise better this. I would like to ask you: This model that I need simulate has a industrial scale of 172 m long, but will need a high computational effort and maybe not work. Do you have any ideal how can I simulate this? I need to validate the temperature output of comsol model with the real system and the EDP model that already been done. Completing this step, I will put the PID control law in the inlet boundary condition to tracking the desired temperature and again validate with the real system and the EDP model. I really don't have an idea how to simulate 172 m long. As you have a great experience with this kind of simulation I would like to know your opinion. obs: currently I just have simulated 3 m long and making some tests with the PID control. best regards, Gustavo

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 19, 2012, 7:06 p.m. EDT
The recently introduced 'pipe flow module' could be of help. This model employs 1D models for flow for long channels, utilizes most of the correlations available in literature and can be coupled with heat transfer.

All of the above is written based on the mini-course that i attended in the recent Comsol conference. I have not used it myself and anyone using this particular module should be able to tell you better. More details are here:

www.comsol.com/products/pipe-flow/


Good Luck.
The recently introduced 'pipe flow module' could be of help. This model employs 1D models for flow for long channels, utilizes most of the correlations available in literature and can be coupled with heat transfer. All of the above is written based on the mini-course that i attended in the recent Comsol conference. I have not used it myself and anyone using this particular module should be able to tell you better. More details are here: http://www.comsol.com/products/pipe-flow/ Good Luck.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 20, 2012, 3:11 p.m. EDT
Thanks Mranal Jain, I think this is module will be better. This module don't have the boundary condition 'heat flux' . Am I sure? It's important to me, because I have the solar irradiation measured in W/m^2


best regards
Thanks Mranal Jain, I think this is module will be better. This module don't have the boundary condition 'heat flux' . Am I sure? It's important to me, because I have the solar irradiation measured in W/m^2 best regards

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.