# Solving differential equation in simulink

15 views (last 30 days)
Muhammad Saqlain Haider on 10 Aug 2020
Commented: hosein Javan on 19 Aug 2020
Hello Everyone
I am solving a differential equation (attached) of greenhouse energy balance on SIMULINK which has basically two unknowns (Tin and qg). One of them (qg) is model output and other (Tin) is also not know from any means. Now I have to calculate both of these parameters from this differential equation. The only thing that I know is the 6 factors on rightside of the equation but all of them are dependent on Tin and there is a operating set point for temperature is given as 20 for day and 16 for night for greenhouse. Can someone help me to solve this equation?
My simulink model is also attached.Plzzzz guide me
Sam Chak on 19 Aug 2020
Hi Muhammad Saqlain Haider, I didn't study your system dynamics in the Simulink model. Perhaps Dr. hosein Javan can provide constructive insights on this matter because he has previously viewed and commented on your Simulink slx file.

hosein Javan on 19 Aug 2020
hello again. this should look like this:
by clicking on "Tune" an app opens and tries to first linearize the system and then choose the best coefficients.
hosein Javan on 19 Aug 2020
you're welcome Mr. Haider. many systems are nonlinear, that means they are not represantable by a linear differential equation. PID controller is only for linear systems, so in order to use that for a nonlinear system, the app tries to linearize the system first. meaning that for a small perturbation around the equilibrium, it is approximated by a linear system. as Mr. Chak said, the block tuning will work in certain condition, I might add that there could be other reasons why this fails like high nonlinearity and ofcourse the system ill definition. the PID is placed in the right place where after T compares with setpoint value and produces the qg necessary to acquire the wanted temperature. if tuning did not work, try to retune it yourself. first change the kP factor with having kI=0. remeber that kP certainly does not make your quantity to reach its setpoint but it should gets near. after that try to gradually increase kI, but before all these, I suggest that run the simulation once without controller, and try to manually change qg and see that the temperature reqires how much qg to estimate how much the controller should produce.

### Categories

Find more on PID Controller Tuning in Help Center and File Exchange

R2019b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!