Add Port to SimMechanics Body Block programmatically
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, currently I am trying to add new CS Ports or the CG Port to a SimMechanics Body block programmatically. Therefore I type into the command line of Matlab: set_param('mdl/Body','CG','Left$CG$[0 0 0]$WORLD$WORLD$m$[0 0 0]$Euler X-Y-Z$deg$WORLD$true$none'). After setting the parameter, there is no error or something. But the parameter change is not taking any effect visually. Only if I open the block parameters and press OK the new Port shows up in the diagram (the hook of "show port" is already set, due to the parameter change).
Does anyone know how the parameter change takes effect (visually) immediately without manual action?
Thank you very much for your help!
0 comentarios
Respuestas (2)
Ryan G
el 17 de Mayo de 2013
This is a tough one for me, but I'll try to get you started. I should mention that SimMechanics 2G is now available too.
If you use the function:
get(gcbh,'Ports')
It will display the ports on each side as part of this vector. For me it was
[0 0 0 0 0 1 1 0]
When I updated the block it was
[0 0 0 0 0 2 1 0]
So you would think you could just update this. Unfortunately it appears to be read-only. So I'm not sure how to bypass that. You can modify the xml, which I assume you know about since the set_param command you gave could only be figured out if you understand the model xml. That being said, I highly suggest you avoid doing that if at all possible.
0 comentarios
Christopher
el 21 de Mayo de 2013
3 comentarios
Ryan G
el 19 de Jun. de 2013
What is the problem with simulating friction? How are you doing it in 1G that 2G can't do (I'm confident it can). I took a look at more options for the 1G port, but no luck.
Ver también
Categorías
Más información sobre Simscape Multibody en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!