Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
simmechanics:

Subject: simmechanics:

From: pietro

Date: 15 Nov, 2012 21:57:11

Message: 1 of 3

Hi all,

I'm creating a mechanism with simmechanics second generation libraries, that it is composed of several compounds body and the dimesion of each body is related to the length of one body (i.e. body_length). I created a body and I parameterized it through the creation of a subsystem and a mask. Now I have to create the second body, but I don't know to make the length of the first body as global so the second body can see it.
Hopefully to have explained correctly my question, if not, don't hesitate to ask me something.

Best regards

Michele

Subject: simmechanics:

From: Tony

Date: 15 Nov, 2012 23:03:18

Message: 2 of 3

Hi Michele,

I think I see what you want to do. If you have two or more subsystems that rely on the same parameter, you can define that parameter in the model workspace. This applies not only to geometry but also inertia, color, force constants, joint state targets, etc. In other words, you can use this approach for almost any situation where two different blocks rely on a common parameter.

To use the model workspace:

1. Click Tools -> Model Explorer
2. In the Model Hierarchy pane, click the name of your model, and then click "Model Workspace"
4. On the right side of Model Explorer, look for bold letters that say "Model Workspace".
5. In the Data Source drop-down menu, select "MATLAB Code".
6. A big white rectangle shows up. Use it to define your common parameters, and click "Reinitialize from Source" to apply the changes to the model.

Let me know if that works!
- Tony

"pietro " <bracardi82@email.it> wrote in message <k83ofn$mpn$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I'm creating a mechanism with simmechanics second generation libraries, that it is composed of several compounds body and the dimesion of each body is related to the length of one body (i.e. body_length). I created a body and I parameterized it through the creation of a subsystem and a mask. Now I have to create the second body, but I don't know to make the length of the first body as global so the second body can see it.
> Hopefully to have explained correctly my question, if not, don't hesitate to ask me something.
>
> Best regards
>
> Michele

Subject: simmechanics:

From: pietro

Date: 16 Nov, 2012 11:28:11

Message: 3 of 3

"Tony" wrote in message <k83sbm$6gq$1@newscl01ah.mathworks.com>...
> Hi Michele,
>
> I think I see what you want to do. If you have two or more subsystems that rely on the same parameter, you can define that parameter in the model workspace. This applies not only to geometry but also inertia, color, force constants, joint state targets, etc. In other words, you can use this approach for almost any situation where two different blocks rely on a common parameter.
>
> To use the model workspace:
>
> 1. Click Tools -> Model Explorer
> 2. In the Model Hierarchy pane, click the name of your model, and then click "Model Workspace"
> 4. On the right side of Model Explorer, look for bold letters that say "Model Workspace".
> 5. In the Data Source drop-down menu, select "MATLAB Code".
> 6. A big white rectangle shows up. Use it to define your common parameters, and click "Reinitialize from Source" to apply the changes to the model.
>
> Let me know if that works!
> - Tony
>
> "pietro " <bracardi82@email.it> wrote in message <k83ofn$mpn$1@newscl01ah.mathworks.com>...
> > Hi all,
> >
> > I'm creating a mechanism with simmechanics second generation libraries, that it is composed of several compounds body and the dimesion of each body is related to the length of one body (i.e. body_length). I created a body and I parameterized it through the creation of a subsystem and a mask. Now I have to create the second body, but I don't know to make the length of the first body as global so the second body can see it.
> > Hopefully to have explained correctly my question, if not, don't hesitate to ask me something.
> >
> > Best regards
> >
> > Michele




Hi Tony,

thanks for your reply. It works but:
1- the dimension of each element of a body is connected to the parameters with some formulas, many of them are not straightforward ones. To reuse all bodies in other models, I need to inizialize the body length in the subsystem and not in the model workspace. How could I do that?
2- I start the simulation in a objective function. How can I change the paramater though it?

Thanks

Best regards

Pietro

Tags for this Thread

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.

Contact us