cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

16-Pearl

## ODESolve with a limit

Here's a simple model of an electric motor.  It works fine but I'd like to solve it with an added complication - a limit that current can only be 10A or less.  I couldn't figure out how to do it.  Any ideas?.  (4.0 attached)

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald I
(To:LucMeekes)

That's the problem with typing in a problem from a picture.  Correct solution attached.

21 REPLIES 21
24-Ruby V
(To:DJF)

With the values given at the top table and the initial conditions you apply the solution you get is the only one possible, I guess.

So if you want a different outcome you will have to change a couple of those values or at least one of them. You will have to tell which values are possible candidates to be changed and which are not.

Then you can turn your odesolveblock into a function of those values, create a function giving you the maximal current for given values and use a solve block to optimize those values until the maximal current is 10 A.

Here is an example of what I am talking about. For simplicity I just make the inductance L a changeable value (which might not make sense for your model). If you can change more than one value, you would do it likewise, but you should throw in some additional constraints in the second solve block (otherwise Prime will only play with one of those values and leave the other unchanged.

BTW, you don't need to provide the guess value L=0.002 H in the second solve block as you already had defined a value for L at the top table, but I like to have all things nice and tidy where the are needed, so I added the guess for completeness.

16-Pearl
(To:Werner_E)

Thanks Werner.  I see I wasn't clear in my question (it's always harder to state than one would think.)  The situation would be that a device is added that actually restricts current to 10A.  So, it'd flatline like shown below.  Easy enough to do in another program (simulink) but I was trying to repeat it in mathcad - as a learning exercise.

.

24-Ruby V
(To:DJF)

Thats easy enough to achieve when its OK to simply apply this restriction on the result of the solve block using an if statement or the if function:

But I guess its not that easy as you would like to apply that restriction already in your solve block, also affecting the other functions, right?

So the differential equations would not apply for the full range of t and the result would be a function not differentiable at distinct points. Not sure how this would affect the differential equations in use.

23-Emerald III
(To:DJF)

What kind of (electrical?) component that should limit the current are you thinking of?

And what do you think will actually happen with the motor when you deprive it of current it (apparently) wants/needs?

Success!
Luc

23-Emerald III
(To:DJF)

Here's another approach to your motor:

Of course the solution(s) run much further to the right...

Success!

Luc

23-Emerald III
(To:DJF)

I though there was an error in your set of equations (I was wondering why you defined k.t and never used it.)

The 'error' is in the second equation.

T(t)=i(t)*n/k.s     should be T(t)=i(t) *n*k.t

If not the dimensions aren't correct. (You define a boundary condition where T(0) = 0 N m. That only happens when T(t)=i(t) *n*k.t,  not when T(t)=i(t)*n/k.s.

Glancing once more I found that k.t = 1/k.s, and the units come out correctly, sort of by accident: because N*m=W*s.

The correct unit for a torque (which is what T(t) should be, I guess) however is N*m, one should never use W*s (or J=Joule) for a torque.

Luc

23-Emerald I
(To:LucMeekes)

After fixing the error Luc pointed out:

23-Emerald III
(To:Fred_Kohlhepp)

Fred,

This result (as well as the simulink example of the OP) doesn't seem right.

Why would the current be 10 A right from the start, when, without the limiter, it reaches 10 A only after about 3 ms?

Your system behaves like motor that is started on 10 A current which is kept until it no longer needs it.

Luc

23-Emerald I
(To:LucMeekes)

Careful!  In order to capture the overshoot, I lengthened the time from 0.1 to 2 seconds.  If I expand the start on the current window, the current ramps to 10 amps in 3 msec.  (Difference is tolerance?)

23-Emerald III
(To:Fred_Kohlhepp)

OK  !

Sorry I missed that.

According to my solution the current reaches 10 A at t=2.848 ms.

Luc

23-Emerald I
(To:LucMeekes)

Whew!

Disagreeing with you is usually a losing bet!

23-Emerald III
(To:Fred_Kohlhepp)

I guess now your solve block models the current limitation correctly, assuming a(n ideal) current limiting device in series with the motor.

Luc

16-Pearl
(To:LucMeekes)

The current limiting 'device' is just academic at the moment.  I'm not much for electrons so won't even speculate on what it could be.  Also, at least for this problem, I'm told kt = 1/ks.  I believe this is derivable but haven't done it myself yet.  Also, I believe the simulink answer is actually per this picture - I'd previously been plucking the wrong current.

23-Emerald I
(To:DJF)

If kt = 1/ks the units don't balance.

23-Emerald III
(To:Fred_Kohlhepp)

Fred,

it's not the derivative of T (T'(t))  but T(t) itself that is equal to n*k.t*i(t)...

Luc

23-Emerald I
(To:LucMeekes)

That's the problem with typing in a problem from a picture.  Correct solution attached.

23-Emerald III
(To:Fred_Kohlhepp)

Now your curve matches the (corrected) curve of DJF. Two independent methods arriving at the same answer. That gives confidence.

Unfortunately (for me) Mathcad 11 doesn't like the construction with the min():

That is: it refuses to limit i(t) to 10   !

But strangely the w(t) curve resembles yours...

Luc

23-Emerald I
(To:LucMeekes)

Look familiar? Apparently Prime did the same thing, note that I truncated current in the plot.

A

Thanks Fred.  That's what I was looking for and it matches my simulink results.  I had tried similar min statements - but when using a comma instead of an array it didn't solve.  As usual, it's all about getting the syntax spot on.

23-Emerald III
(To:DJF)

{to DJF}

Ah, and then your simulation starts at t=0.1 s, rather than at t=0...?

Luc

16-Pearl
(To:LucMeekes)

yes, although that is completely arbitrary - just done to show what happens before voltage is applied.  Starting at t=0s is fine.

Announcements
Top Tags