Skip to main content
16-Pearl
March 21, 2018
Solved

ODESolve with a limit

  • March 21, 2018
  • 21 replies
  • 7186 views

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)

2018-03-20_19-36-24.jpg

Thanks,

Best answer by Fred_Kohlhepp

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

21 replies

25-Diamond I
March 21, 2018

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.

Bild.png

DJF16-PearlAuthor
16-Pearl
March 21, 2018

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.  

.2018-03-21_7-40-53.jpg

25-Diamond I
March 21, 2018

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:

Bild.png

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 IV
March 21, 2018

Here's another approach to your motor:

LM_20130321_Odesolve1.png

LM_20130321_Odesolve2.png

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

LM_20130321_Odesolve3.png

Success!

Luc

23-Emerald IV
March 21, 2018

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
March 21, 2018

After fixing the error Luc pointed out:

Capture.PNG

23-Emerald IV
March 21, 2018

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