Message Boards Message Boards

Find the symbolic equations of motion based on WSM model?

Dear All,

I have a principal question about the possibility of making mechanical many-body symbolic models in WSM and further determination of the equations of the motion using Mathematica.

So, first, I want to make some many-body mechanical system model in WSM without determination of the physical parameters of the bodies, joints and etc. For example, is it possible to make a model of inverted double pendulum with masses m1 and m2, lengths l1 and l2, applied torque q and etc., thus making a model with symbolic parameters.

Then, if the first one is realizable, is it possible to determine the equations of motion? One may do this with a model with determined physical parameters, but the question is how to get a general model.

I found out that the most recent version of WSM actually can somehow work with symbolic models, but I couldn't get info about it.

Thanks!

6 Replies

Tigran,

You must be using the Multibody elements -- you did not mention that. You must filter out the unnecessary equations. See this post by @Malte Lenz

Interpret results of Extracting System Equations in SystemModeler?

You should be able to remove all the equations that do not involve your dynamics.

Regards

POSTED BY: Neil Singer

BTW. If you want the parameter or the initial values you can get them this way:

values = WSMModelData["Oscillator", "ParameterValues"]
initial = WSMModelData["Oscillator", "InitialValues"]

WSM stores them separately from the equations.

POSTED BY: Neil Singer

Tigran,

While the oscillator mass is 1 and the damping is 10, etc. The equations derived this way do not have the values in them. The only numbers are from pi, and some factors of 2 that are part of the geometry of the model. The parameter values are kept separately as you can see below:

I am posting an image because the Mathematica form is not clear because of the DotName[] constructs.

enter image description here

You can use these equations in any mathematica expressions. Alternatively, You can replace the DotName[] variables in Mathematica with more "normal", non WSM variables -- I used a [UpPointer] character but you can use any valid character or nothing.

This results in normal equations with no values substituted:

enter image description here

If you want to see how I did the replacement, I can post the code but you can do it manually or I wrote a function to do it automatically. Note there are no values in these equations.

Regards

Neil

POSTED BY: Neil Singer

Dear Neil,

thank you so much!!! Your answer is comprehensive. I see that Mathematica simply does what I need, the problem was that I was getting a lot of connectivity equations (for example, for double inverted pendulum >1000): very hard to work with them. Thanks!

Tigran,

You can definitely do what you want. For example, To get the equations of the Oscillator example in WSM, do the following in Mathematica:

Needs["WSMLink`"]
eqns = WSMModelData["Oscillator", "SystemEquations", t];

The equations (25 of them) have many algebraic equations related to the connectivity of the elements (masses, springs,etc.). To get rid of these equations we can get the algebraic variables and eliminate them to simplify the equations:

alg = WSMModelData["Oscillator", "AlgebraicVariables"]

The algebraic variables appear as functions of time in the equations so lets eliminate them by first making a list.

final = Eliminate[eqns, Map[#[t] &, alg]]

final now holds the 4 remaining differential equations.

Regards,

Neil

POSTED BY: Neil Singer

Dear Neil,

Thank you for this rapid answer. However, my question is about derivation of eqs. of motion in general symbolic way without specification of physical parameters pf the mechanical model.

WSMModelData of course gives the eqs. of motion but there all the coefficients are some numbers. Of course, this are eqs. of motion of some special system (in the example of Oscillator the damping constant is 10, masses are 1, lengths of masses are 1 and etc.).

Is there a way of derivation of eqs. of motion in general case, not for some physical constant-specified case?

Thanks!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract