3
$\begingroup$

I'm working on a problem that involves a CUK converter. In control theory, a system is marginally stable if the real part of all eigenvalues are equal to zero. Actually, the eigenvalues of a matrix $A$ in a thing called the space-state model. Okay, so I have this matrix $A$ that depends of another matrices. Okay, when a system is unstable we would like to fix it using a controller. So I'm trying to figure out a gain $k_c$ that makes the system marginally stable. The code to do that is the following:

kst = 1/10;
ka = 1/20;
A = {{-64.383, 0, -22.35, 0}, {0, 0, 27.65, -50}, {1788, -2212, 0, 
    0}, {0, 4000, 0, -333.333}};
B = {3619.3, 3619.3, -29800, 0} ;
Cc = {0, 0, 0, 1} ;
NSolve[Re[Eigenvalues[A - Outer[Times, B ka kst kc, Cc]]] == 0, kc]
FindInstance[
 Re[Eigenvalues[A - Outer[Times, B ka kst kc, Cc]]] < 0, kc, Reals]

(The part about FindInstace is to know what values of kc makes the system stable).

Okay, the output for NSolve is a huge matrix. Since it is pretty large I will write a few elements of it.

{{Re[Root[System`ReduceDump`P$77107[1], 3]] -> 0, 
  Re[Root[System`ReduceDump`P$77107[1], 4]] -> 0, 
  Re[Root[System`ReduceDump`P$77107[1], 2]] -> 
   0}, {Re[Root[System`ReduceDump`P$77107[1], 3]] -> 0, 
  Re[Root[System`ReduceDump`P$77107[1], 4]] -> 0, 
  Re[Root[System`ReduceDump`P$77107[1], 2]] -> 
   0}, {Re[Root[System`ReduceDump`P$77107[1], 3]] -> 0, 
  Re[Root[System`ReduceDump`P$77107[1], 4]] -> 0, 
  Re[Root[System`ReduceDump`P$77107[1], 2]] -> 0},
  • That is the output for NSolve.Here is where the first question comes up: What does it mean that output? Mathematica was unable to solve the equation or the equation just hasn't any solutions?

  • The output for FindInstance says kc->0. But that isn't correct. Actually If I set kc=0.8 I get the real parts of the eigenvalues negative.

$\endgroup$
1
  • 1
    $\begingroup$ If you're just interested in numerical solutions for this problem have a look at NRoots. Also some of the functions specifically for Control theory calculations in guide/ControlSystems might be useful for your problem. $\endgroup$ Sep 8, 2017 at 18:36

1 Answer 1

5
$\begingroup$

If you are not very particular about using Solve/NSolve, you can determine that graphically using RootLocusPlot.

tfm = TransferFunctionModel[
      StateSpaceModel[{A, Transpose@{B} ka kst kc, {Cc}}], s]
RootLocusPlot[tfm, {kc, 0, 5}, AspectRatio -> Full]

enter image description here

It appears that the system will become marginally stable when $kc=2.5$.

Update

The manual way to obtain the marginally stable value.

Compute the characteristic polynomial. (The roots of this polynomial are the closed-loop eigenvalues.)

charPoly = Denominator[SystemsModelFeedbackConnect[tfm][s][[1, 1]]]==0

9.30495*10^9 + 5.41032*10^9 kc + 5.05222*10^7 s - 1.1819*10^7 kc s + 322585. s^2 + 72386. kc s^2 + 397.716 s^3 + s^4 == 0

The stability test.

stableQ[k_] := AllTrue[s /. NSolve[charPoly /. kc -> k, s], Re[#]<0 &]

TableForm[Table[{k, stableQ[k]}, {k, 2, 3, 0.1}], 
          TableHeadings -> {{}, {"kc", "stableQ"}}]

enter image description here

$\endgroup$
9
  • $\begingroup$ I'm not very familiar with Root Locus (I'm a student of control theory and we haven't seen that yet in class). It seems the graph is very clear but honestly I think I'm not getting it. Why do you say kc=2.5 makes the system M.S? Isn't it supposed to be kc=250? $\endgroup$ Sep 8, 2017 at 19:46
  • 1
    $\begingroup$ I'm sure it will be clear to you once you understand the root locus plot. It will be marginally stable at $kc=250$ when (for example) $kst=1/100$ and $ks=1/200$. For the values in the question it's 2.5. $\endgroup$ Sep 8, 2017 at 19:55
  • $\begingroup$ I did read a lot about Root Locus method and it makes sense but I'm still unclear about how to get the k value. Because what you have there as matrices aren't the ones I need. I tried to do the same with the correct matrices and I got a different plot but I'm unsure on how to get the k value. Is there any method in Mathematica to get that "k"? $\endgroup$ Sep 8, 2017 at 21:58
  • 1
    $\begingroup$ I suspect that you are mixing up the closed- and open-loop systems. I will update the answer on how to figure it out manually using NSolve. RootLocusPlot is also essentially using NSolve to get the plot. $\endgroup$ Sep 9, 2017 at 21:09
  • $\begingroup$ I tried using the correct matrices for my problem. That is, AA=A-B ka kc kstC ; BB=B ka kc ; C is the same matrix you used. When doing the same you did, I get a wrong table. Actually, it says "False" for every k value. If you think I should create a new post, please let me know. $\endgroup$ Sep 9, 2017 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.