# Why the controller block diagram is not working (while tracking the reference and water level in tank 2 at specific level)?

조회 수: 2(최근 30일)
Sana Mohamed 2022년 11월 27일
댓글: Sam Chak 2022년 12월 6일
##### 댓글 수: 1표시숨기기 없음
Suvansh Arora 2022년 11월 30일
In order to understand this better, please send the following information:
• Your problem statement.
• Your solution approach to the above problem.
• Details about the issue you are encountering.

댓글을 달려면 로그인하십시오.

### 답변(1개)

Sam Chak 2022년 11월 30일
편집: Sam Chak 2022년 11월 30일
It seems that your equation for u causes the level of Tank #2 to dip below 0, thus term sqrt(x(2)) returns an error message related to the complex number. In the attached Simulink model, your original u is disabled and two lines are added in the "Level Controller" Function Block:
where and are the reference levels of Tank #1 and Tank #2, respectively.
Note: I didn't know how you derived your original equation for u. But from your scripts, the Dual Tank Liquid Level System is given by
with the initial condition
and you want to regulate the level of Tank #2 to . Since can only be affected by , I designed the reference level of Tank #1, so that
.
Then, I backstepped the process and designed the control equation for u so that
.
##### 댓글 수: 5표시숨기기 이전 댓글 수: 4
Sam Chak 2022년 12월 6일
If you find the MATLAB code and math explanation helpful, please consider accepting ✔ and voting 👍 the Answer. Thanks a bunch! 🙏
Back to your query, I actually used basic algebra manipulation and the exponential decay principle. No difficult math!
I started from your original error definition, where you want to track the tank #2 level
.
Taking the time derivative of
, because due to , a constant.
Making substitution to obtain the error dynamics
.
Following the principle that guarantees exponential decay
where , is chosen as the indirect manipulated variable because we can directly manipulate in dynamics through the direct manipulated variable u.
Thus, we can equate both equations where
and solve for
.
Making substitution for to obtain the reference where must track
.
Similarly, repeat the design steps to obtain for u:
.
Here, because I find it a little mathematical tedious to obtain the time derivative for , I let , and thus it is reduced to
.
By the way, how did you derive the original equation for u? Can you show me?
% -------------------------------------------
Afterthoughts: I think you can possibly design based on
and

댓글을 달려면 로그인하십시오.

### 범주

Find more on State-Space Control Design in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by