Simulation of load position carried by simple hoisting mechanism

Hi, again.

The problem is this:

I want to simulate the motion of the load given the following Torque profile from the motor:

How do I define this parametric torque function (given the fact that it’s a function of angular velocity) and then use it to solve differential equations?

What I have tried so far: Defining M as parametric function and defining events for the values of M in DSolve environment:

Subscript[J, M] := 0.16
n := 5
r := 250/1000
Subscript[J, d] := 7.2
m := 180
g := 9.81
Subscript[M, M][Subscript[\[Theta], M]'[t_]] := 
  Piecewise[{{250, 
     Subscript[\[Theta], M]'[t] <= 151.84}, {250 - 
      47 Subscript[\[Theta], M]'[t], 
     151.84 < Subscript[\[Theta], M]'[t] < 162.316}, {-250, 
     Subscript[\[Theta], M]'[t] >= 162.316}}];
system = NDSolve[{(Subscript[J, M] + Subscript[J, d]/
       n^2) Subscript[\[Theta], M]''[t] == 
    Subscript[M, M] - (m g r)/n, 
   m y''[t] == (Subscript[M, M] n)/r - m g, y[0] == 0, y'[0] == 0, 
   Subscript[\[Theta], M]'[0] == 0, Subscript[\[Theta], M][0] == 0}, 
  y, {t, 0, 5}]
system = NDSolve[{(Subscript[J, M] + Subscript[J, d]/
       n^2) Subscript[\[Theta], M]''[t] == 
    Subscript[M, M] - (m g r)/n, 
   m y''[t] == (Subscript[M, M] n)/r - m g, y[0] == 0, y'[0] == 0, 
   Subscript[\[Theta], M]'[0] == 0, Subscript[\[Theta], M][0] == 0, 
   WhenEvent[Subscript[\[Theta], M]'[t] <= 151.84, 
    Subscript[M, M] -> 250], 
   WhenEvent[
    Subscript[\[Theta], M]'[t] > 151.84 && 
     Subscript[\[Theta], M]'[t] < 162.316, 
    Subscript[M, M] -> 250 - 47 Subscript[\[Theta], M]'[t]], 
   WhenEvent[Subscript[\[Theta], M]'[t] >= 162.316, 
    Subscript[M, M] -> -250]}, y, {t, 0, 5}]

Sorry about the messy code.

Screen:

Thanks for any help.

Possible causes for the error you show are given here

http://reference.wolfram.com/mathematica/ref/message/NDSolve/ndnum.html

You could easily solve this problem with Wolfram SystemModeler. In the attached diagram I have used a table block for capturing the torque profile of the motor, this signal is feed in to a torque block that applies the torque to the inertia (the angular speed is measured and feed back to the table). Then we use an ideal gear component for going from the rotational domain to the translational domain that acts on the load.

The problem, as far as i can tell, is that I cannot properly define the function M (motor torque) from figure 2 which i can then use inside the DSolve environment.

@Otto Tronarp, that’s awesome, however I am doing this for academic purposes and at this point I cannot use modeler

I kind of suspected that, but I just wanted to show how easy this would be in SystemModeler. Unfortunately I cannot help you with the original problem.

Yes, sure is much more convenient. Thank you!