1
$\begingroup$

This is actually a follow-up question to this one!

Assuming that I have a tf like:

ω = 2. Pi*50; Mag = 1; θ = 0;
Tαβ2dqInv22 = {{Cos[ω t], -Sin[ω t]}, \
{Sin[ω t], Cos[ω t]}};
Tαβ2dq22 = {{Cos[ω t], 
    Sin[ω t]}, {-Sin[ω t], Cos[ω t]}};
Inputαβ22 = {Mag Cos[ω t + θ], 
   Mag Cos[ω t + θ]};
(*Inputαβ22={Mag ,Mag};*)

Outαβ2dq22 = 
  FullSimplify[Tαβ2dq22.Inputαβ22] // 
    TrigReduce // Chop;

tf = TransferFunctionModel[(0.67/(0.0025 s + 1) + 1)/(0.0025 s), s];
res = Chop@
     Expand@OutputResponse[
       tf, #1, t] & /@ Outαβ2dq22;
Outdq2αβ22 = 
  FullSimplify[Tαβ2dqInv22.res] // TrigReduce // Chop;
Show[Plot[Outdq2αβ22, {t, 0, 0.1}], 
 Plot[res, {t, 0, 0.2}]]

enter image description here

Is there any way that I can set upper/lower limits on output and also initial output values?

Thanks in advance!

$\endgroup$
1
$\begingroup$

Starting from a non-zero initial output value

TransferFunctionModel assumes zero initial conditions. To start from non-zero initial conditions, it needs to be converted to a StateSpaceModel first.

ssm = StateSpaceModel[tf];

In StateSpaceModel, the initial states can be set. Suppose you want the initial output to be 0.5, then the corresponding output equation can be solved to determine the initial states.

yinit = 0.5;
sols = Solve[Normal[ssm][[3]].{x1, x2} == yinit, x1][[1]];
inits = {x1, x2} /. sols /. x2 -> 1;

(There are an infinite number of initial state choices, because the system has less outputs than states.)

Starting from these initial conditions, the response will start at the desired value:

Chop[yinit - OutputResponse[{ssm, inits}, #, t] /. 
t -> 0] & /@ Out\[Alpha]\[Beta]2dq22

{{0}, {0}}

Setting limits on the output

I don't know to what extent this is supported. But you can construct a clamp using NonlinearStateSpaceModel and put the two in series.

In what follows I limit the response between $\pm20$.

{umax, umin} = {20, -20};
sys = SystemsModelSeriesConnect[ssm, 
NonlinearStateSpaceModel[{{}, 
 Which[u > umax, umax, u < umin, umin, True, u]}, {}, u]];
Chop@Expand@OutputResponse[sys, #1, t] & /@ Out\[Alpha]\[Beta]2dq22;
Plot[%, {t, 0, 0.1}]

enter image description here

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thanks, Suba! I will add these into my codes this evening. In addition, as you can see, what I want to do is to have two inputs --> ab->dq transformation --> lag compensator+integrator --> dq->ab transformation-->output. Do you think if I can combine "ab->dq transformation --> lag compensator+integrator --> dq->ab transformation" with single system model rather than spitted like I did? $\endgroup$ – Peng Dec 15 '16 at 7:18
  • $\begingroup$ I am not fully understanding the notation you are using. However, I am guessing what you are proposing is something easily done. Also, take a look at the example ref/StateSpaceTransform#834745677 (StateSpaceTransform>Applications>5th example), where dq transformation is applied to a stepper motor model. $\endgroup$ – Suba Thomas Dec 15 '16 at 14:46
  • $\begingroup$ It seems state space has better usability over transfer function in mathematica...I have added limit with your suggestion, and it works, but slows down the computation a lot, so will leave it for now. $\endgroup$ – Peng Dec 16 '16 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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