Thread Subject: modifying simmechanics block parameters dynamically

Subject: modifying simmechanics block parameters dynamically

From: Juan

Date: 17 Feb, 2009 21:42:02

Message: 1 of 4

Hello,

I am trying to enable users of an interface I am developing to assemble mechanisms manually which will require the access and modification of some block parameters such as angle joints and body (links) lengths and such. this process should be the same for any mechanism topology (i.e. should be generic). Is there a way of having simmechanics dynamcally modify and make the necessary adjustments to the model such that the user will only have to worry about placing the bodies in the workspace and connecting them with one another?

thank you in advance for your help

Subject: modifying simmechanics block parameters dynamically

From: Arnaud Miege

Date: 17 Feb, 2009 22:04:02

Message: 2 of 4

"Juan " <jcar182@gmail.com> wrote in message <gnfava$r82$1@fred.mathworks.com>...
> Hello,
>
> I am trying to enable users of an interface I am developing to assemble mechanisms manually which will require the access and modification of some block parameters such as angle joints and body (links) lengths and such. this process should be the same for any mechanism topology (i.e. should be generic). Is there a way of having simmechanics dynamcally modify and make the necessary adjustments to the model such that the user will only have to worry about placing the bodies in the workspace and connecting them with one another?
>
> thank you in advance for your help

Hi Juan,

When you say "dynamically modify", do you mean as the model is running? If so, I don't think this is possible. As far as I know, the block parameters are fixed for the duration of the simulation. However, you can parameterize the model with MATLAB variables defined in a MATLAB script and change those from a GUI in between simulation, so yes it is possible to have a generic model and change its configuration using MATLAB variables, as long as they still result in a valid mechanical configuration. I would suggest you watch the following webinar, which goes through a very similar example (synthetizing a four-bar mechanism):

http://www.mathworks.com/company/events/webinars/wbnr30773.html

HTH,

Arnaud

Subject: modifying simmechanics block parameters dynamically

From: Juan

Date: 18 Feb, 2009 19:45:04

Message: 3 of 4


> Hi Juan,
>
> When you say "dynamically modify", do you mean as the model is running? If so, I don't think this is possible. As far as I know, the block parameters are fixed for the duration of the simulation. However, you can parameterize the model with MATLAB variables defined in a MATLAB script and change those from a GUI in between simulation, so yes it is possible to have a generic model and change its configuration using MATLAB variables, as long as they still result in a valid mechanical configuration. I would suggest you watch the following webinar, which goes through a very similar example (synthetizing a four-bar mechanism):
>
> http://www.mathworks.com/company/events/webinars/wbnr30773.html
>
> HTH,
>
> Arnaud



Hello Arnaud,

Thank you very much for your quick response. The webminar was certainly instructive. As a clarification for my question, I want to enable the user to generate conceptual design of any mechanism. where he/she will define bodies, grounds, joints, sensors, and actuators. during this process through mouse clicks, and key board inputs graphical representations of whatever is being defined will be loaded into the workspace of the gui, simultaneously a simulink model will be generated with the same properties as the graphical representations (ie, lengths, positions, orientations). and finally through an s function simulation data will be shared by the gui and simmechanics.
As a result when i say change block parameters i mean some of the initial user inputs for some parameters might not be the ones required for a valid assembly and to satisfy all constraints. For the user should assemble the mechanism before running the simulation. So I guess to be more precise I want to know if there is something such as a built in kinematic solver that can make the necessary adjustments to avoid erroneous configurations of the assembly due to users trial and error.

thanx once again!

Subject: modifying simmechanics block parameters dynamically

From: Arnaud Miege

Date: 19 Feb, 2009 10:20:33

Message: 4 of 4


>
> Hello Arnaud,
>
> Thank you very much for your quick response. The webminar was certainly
> instructive. As a clarification for my question, I want to enable the user
> to generate conceptual design of any mechanism. where he/she will define
> bodies, grounds, joints, sensors, and actuators. during this process
> through mouse clicks, and key board inputs graphical representations of
> whatever is being defined will be loaded into the workspace of the gui,
> simultaneously a simulink model will be generated with the same properties
> as the graphical representations (ie, lengths, positions, orientations).
> and finally through an s function simulation data will be shared by the
> gui and simmechanics.
> As a result when i say change block parameters i mean some of the initial
> user inputs for some parameters might not be the ones required for a valid
> assembly and to satisfy all constraints. For the user should assemble the
> mechanism before running the simulation. So I guess to be more precise I
> want to know if there is something such as a built in kinematic solver
> that can make the necessary adjustments to avoid erroneous configurations
> of the assembly due to users trial and error.
>
> thanx once again!

Hi Juan,

You can always update the Simulink diagram (equivalent to doing Edit ->
Update Diagram or CTRL+D) using the set_param command:
set_param('mymodel','SimulationCommand','Update')

For more details, see:
http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/set_param.html
http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/f23-7515.html#f23-32576

This would return an error if the mechanical assembly is not valid. Also,
have a look at the following chapters from the SimMechanics documentation:
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/mech/ug/f2-124997.html
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/mech/ug/bqlibpn-1.html

HTH,

Arnaud

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
simmechanics gui Arnaud Miege 17 Feb, 2009 17:05:23
joints Juan 17 Feb, 2009 16:45:09
mechanisms simu... Juan 17 Feb, 2009 16:45:09
simmechanics Juan 17 Feb, 2009 16:45:09
rssFeed for this Thread

Contact us at files@mathworks.com