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

SOLVED
Highlighted

## 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

## Re: ODESolve with a limit

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

21 REPLIES 21

## Re: ODESolve with a limit

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. ## Re: ODESolve with a limit

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.

. ## Re: ODESolve with a limit

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.

## Re: ODESolve with a limit

Here's another approach to your motor:  Of course the solution(s) run much further to the right... Success!

Luc

## Re: ODESolve with a limit

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

## Re: ODESolve with a limit

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

## Re: ODESolve with a limit

After fixing the error Luc pointed out: ## Re: ODESolve with a limit

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

## Re: ODESolve with a limit

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?) 