SimscapeMultibody物理建模_第1页
SimscapeMultibody物理建模_第2页
SimscapeMultibody物理建模_第3页
SimscapeMultibody物理建模_第4页
SimscapeMultibody物理建模_第5页
已阅读5页,还剩42页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Simscape Multibody物理建模与刚体变换简介以一个单摆为例说明如何进行物理建模。一、创建模型1. 在MatLab命令行输入smnew打开一个新的simscapemultibody项目untitled - Simulink在命令行输入sm_lib打开Simscape Multibody block library选择自己想要添加的块UHiM3 Library ib - Simolirilc File Edit View Duplay Diagram Antslysis Help2 7,马看昌昌, 5,SlnrMApc MulHhcd/ topjilgmi: 2011 -2Mft I

2、hs MulhWo 巾& I heBdkajid aESI I_ FrirE!白闻 Trafu FeninsCouplir 炉斗二ESsm?RtfquBA创建机械连接1 .块类型说明- RigidTransform (刚体变换)块:提供端坐标系。- Solid (立体)块:提供几何(geometry),惯性(inertia),颜色 (color)特性。RigidTransform 块在 FrameandTransform 下,Solid 块在 BodyElement 下。2 .连接块图3 .设置Solid block特性1 .左键快速单击solid bloc!两次,在弹出的对话框中将参

3、数设置为如下 图所示:, Solid :Opacit),1u0OK Cancel Help ”":©Carwiot update visualization due to errors when eva lusting parameters. Click on this me-ssage to open the Diagnostic ViewerB VisuaJ Prape rties SimpleColor0日由QKWj|J-DescniptminRepresents 电 solid ccmbinMig a geometryj an inertia aivJ mass,

4、a graphics comporhent, and rigidly attached frames into 白 singk unit A mol id i? the Gem mon building block of rigid bodies. The Solid block obtains the inertia from the geometry andl density, from the geometry andl mass, or from an inertia tenwr that you specifyuIn the expandable nodes under Proper

5、ties select the typei of geometryi inertia, graphic features, and frames that you want and tfrieir parameterizations.Pert R is-日 frame port that represents a reference frame associated with the geometry. Each additional created frame generates another frame port.PropertiesFgrrt GeometryShapEDimensjl

6、ons.TypeBased on Density Derived ValuesBrkkL H WCalculate fiom GeometryUpdateDensitya inertia9. Geomet将长宽高用变量LHW代替,密度用rho代替,颜色用rgb代替,方便修改 参数。这里出现错误是因为我们输入的变量未定义,将在下面定义。4 .设置 Rigid Transform 块左键快速单击RigidTransformblock,在弹出的对话框中将参数设置为如下图 所示:将RigidTransform设置为如下图所示J4? Rigid Transform : Rigid Tra. 一 口 XD

7、escriptionDefines a fixed 3-D rigid transformation between two frames. Two components independently specify the translational andctmtionH parts of the transformation. Different translation& and rotations can be freely combined.In the expandable nodes under Prop肝甘已晶 choose the type and parameters

8、 cf the two transformaticn components.Ports B and F are frame ports that巳pB5ent the ba&e and follower frames, respectively. The trar&fcrmaticn repre&ents the follower fraire origin and axis crientatian in the base frame.Pre perties|ok|Cancel Help Apply- 将Rigid Transforml设置为如下图所示京 Rigid T

9、ransform : RigidTra. XD esc riptionDefines s fixed 3-D rigid transfonration between two frames. Two components independently specify the translational and rotational parts of the trar&fcrmatior. Different translations and rotations can be freely co mbined.In the expardable nodes under Properties

10、, choose the type and parameters of the two trarsformaticn components.Ports- B and F are frame ports that repre-s-ent the ba&e and follower frames, respectively. The transformation represents the follower frame origir and axis orientation in the base frame.0KCartel HelpPup 巳tiess RotationMethodN

11、one7=Translationh/lethodStandard Axis、¥AxisX7OffsetL/2cmv5 .生成子系统同时选中 RigidTransform , RigidTransforml 和 solidblock,在高亮的地 方右键选择CreateSubsystemfromSelectione网M BlocksCjreale S-ubsyrtem from Selection Ctri+GLog 5皿Sgm/FonnalRotate &l Flip ArrangeFtequireinenhQC+ + Code与电Q内nm 宅 PasteCommeoit Th

12、rnughComment Oui:DeleteCtri+XCtdtCCtri+VCtri+ShifitCcrl+SJiifi+X得到如下所示子系统:6.定义前面的参数右键单击Subsystem,在弹出的对话框中选择Mask> CreateMaskGc>rinCormSubs 网ExploreOpenOpen In New TabOpen In New Window4 取Cutc°py p招伯Comment ThroughComment OutDeleteCtrl+XCtri+CCtrl+VCtrl 十 Shift CtH+ShiftbI/ Y4-XFind Referen

13、ce<i VariablesSubsystem & Model Reference卜Test HarnessFoimtRotate & Flip ArrangeMask卜Library Link*Signals & PortsRequirements Design Verifier CoverageModel AdvisorMetrics DashboardFixed-Pornt Tool.Identify Modelingi ClonesModel Transformer卜C/C + + Code HDLCdJe PLC CodekPolyspaceBlock

14、Parameters (Subsystem)PropeirtieE.HelpCreate MaskCtrl 十 MAdd Icon Iniagie.Mask Parameters.Look 'Under IvlarskCtrl + UCreate Model Ma&k,.Ctri+Shift-i-M在弹出的对话框中选择Parameters&Dialog,在左边的栏中添加五个一到 Parameters,然后将变量名改为前面输入的变量名型 Mas-k Editor: Subsystem Xicon & Ports Pranietersa Dialog irtlill

15、zatlon DocumentadonControlsADialog boxProperty edito r日 Paiamet&rTypePromptName三 ProprtieE(23 Edit 鼻 Check box PopupECJl 口%-:MaskTyF»> %MaskDe£i riptlon、 P5famete<sCscGroupVarLiescTextVarParamecerGfoupVarNimeValuePrompt0l=B CoimbD boxa,Radio button:回社?wTypeedh7“ Sliderfi DialCffl

16、 SpinbcKHum-.nj DatiiTyprStr国Min向的 ;113*4 EI3-sgbH Attributes EwalwaceTun 册 Ie Read onlyHiddenor口7>| Max 弟 Promote:B Cantainer口 Group boxL=lTabffl TableNtever sawConstraint三 Dialog EnaWeVisibleNone巨Ccillps.iblcPantCalbackzJ PanelTooltip日 Display A TextOr39 at Clicik iitein& in left palette to

17、 add 3 dialog. Use CMlcMt key to remove kem$ from dWogrE LaF&ij 史ttem locationNew rowImageTutcriml - IrEmtiin一 日 Maik; PmraE日t旧rsmind 口匕1/ PmrwPrompt locptionleft-q -n,1V-PreviewConstraintManagerOK CancelHelpRpply在右边栏Properties>value中将各变量值设置为如下所示L(cm)20W(cm)1H(cm)1rho(kg/mA3)2700rgb0.25,0.40,

18、0.70确定,然后在simulink界面中选择SimulationUpdateDiagram,更新块 图,得到如下图的立体7 .添加旋转部件在matlab命令行输入smnew新建一个模型,删除不需要的块并将上述的Subsystem复制过来从 Simscape> Multibody> Joints 中添加一个 Revolute Joint (旋转节点)到图中,并连接成如下图所示鼠标左键快速单击图中的solidblock两次,在弹出的对话框中将其参数设置 为如图所示Solid : Solid!DescriptionRepresents a solid combcnhg a geoime

19、try, an inertia andl mass, a graphics comporKint, and rigidly attached frames into a single unit. A solid Is the common building block of rigid bodies. The Said bltxk obtains the inertia from the geoin&tiy and densityj from (lie geometry and "酬弱 o r fro m an inertia tensor that yow spechy,.

20、In the eKpaindiable nadle-s uindler Properties select the types of gEDimetry, inertia graphic featuresP and frames that you want and! their paramete rizations.h GeometryShapeGrkkyDiRuensIcfis44 4cnnH InertiaB GraphicTypeFrom Geometryi Visual PropertiesSimpleColor0,60 1145 0,0Opacity1.0口 FramesCancel

21、 Help ApplyPort R is a frame port that represents s reference frame associated with the geometry. Each additional created frame gerberates another frame port-Prope rtiE-s,1 Parameter values may have changed. Press the update t - Visualization button (FS) to update the visualization.点击确定。8 .设置重力旋转节点(

22、RevoluteJointblock)使用底座和从动件坐标系的公共Z轴作为旋 转轴,为了让从动件在重力的作用下旋转,需要使重力矢量偏移Z轴。鼠标 左键快速单击Mechanism Configuration block两次,在弹出的窗口中将重 力设置为0 -9.81 0(-y方向)。Mechanism Canfiguratior XD e&c ripticnsr.Sets mechanical and simulation parameters that apply to an entire machine, the target machine to which the block i

23、s connected. Ir the Properties section belcwr you can specify uniform gravity for the 已nti已 mechanism and also set the linearization delta. The linearization delta specifies the perturbation value that is used to compute numerical partial derivatives for linearization.Part C is frame node that you c

24、onnect to the target rnHchin已 by a ccrnecticn line at ary frame node of the machine.Properties9.设置单摆起始位置鼠标在左键快速单击RevoluteJoint两次,在弹出的对话框中选择StateTargets> Position进行设置,默认为水平。文tProperties十 Actuation+ SensingRevolute Joint: kevolute JointD escri ptionRepresents a revolute joint acting between two fra

25、mes. This joirt has oneot日ticn己I degreef己edom represented by(revolute primitive. The joint constrains the orighis of the tw( frames tc be coincident and the z-axes of the base and followerframes tc be coincident, while the followerx-axis and y-axis can rotate around the z-axis.In the expandable node

26、s under PrQpertiesF specify the state, actuation inethodr sensing capabilities and internal mechanics of the primitives of this-joint. After you apply these settings, the black displays the corresponding physical signal ports.Ports B and F are frame ports that represent the base and follower framesP

27、 respectively. The joint direction is defined by motion of the follower frame relative to the base frame.Specify Position Target 口Specify Velocity Target 口十 Internal Mecharics10.配置求解器在 simulink 中选择 SimulationModelConfigurationParameters,配置为如下图所示选择确定,11.组装模型选择SimulationUpdatediagram,得到如图所示的模型M-lf

28、5;i tEtei Ibl. zns*11* E«: I hrl-x Fw_ E_>l ,矗 ET3 ub-il-wu'i,I二 Ighp wain口Q雅! uy而Soda XKf麻热:部总耨p, hiw 心修Fim 0:制*力匡卜二 luwr9 fl £ H MMf/rHIlF 二国金小*J Data Own. tK.Klc-rtU SHF.出物>1*1向eMM汉*土呼 IdiharHf iwrmtn 甲 MllKd.小g d财中'T£*二,IHMw* b 击ErG* :% liiSEP,小阳田H,保证重力与屏幕垂直选择 Viewco

29、nvention 将其设置为丫 up (XY Front)对齐,选择view > standard view中的一项来刷新视图。选择一来保存设置。12.运行模型点击SimulationRun,运行模型,将会看到单摆摆动13.分析模型1 .测量单摆运动左键快速单击RevoluteJointblock两次,在弹出的对话框中选择Sensing 下的 Position 和 VelocityRevolute Joint: Revolute JointD esc ri pti c naiRepresents a revolute joint acting between two frames. 1

30、hi& joint has one rotational degree of freedom represented by one revolute primitive. The joint ccnslrains the origins of the two frames to be coincident and the z-axes of the base and follower ,frames to be 匕口 incident, while th e fol lower x-axi £ and y-axis car rotate around the z axis.I

31、n the expandable nodes under P|。p已1:i已s1, specify th已 state, actuation method, sensing capabilities and internal mechanics of the primitives of this joint. After you apply these settings the block displays the corresponding physical signal ports.Pods B and F are frame ports that represent The base a

32、nd follower framesJ respectively. Thejioint direction is defined by motion of the follower frame relative to the base frame.Prop erri IJJJ'A+ Internal Meclianics-ActuationrorqueNone7MorionAurcrnatically ComputedSensingPosition叵Velocity口7Accekration口Actuator Torquea Composite Force/Tcrque Sensing

33、OK Cancel Help Apply2 .添加以下块到模型 PS-SimulinkConverter :在 Simscape> UtilitiesToWorkspace :在 Simulink> Sinks如图O Pendulum "-SiifniuliinkFile Edr匕 View Display Diagram Simiulation Analysis Code Tools Help10.0Ponrdulunf:lReadyView 1 vuarningi100%cde15s将文件另存为一个新文件simplependulum analysis。3 .摆角、角速

34、度关于时间的函数打开刚刚的文件 simplependulum analysis,然后选择 SimulationRun,4 matlab命令行中输入以下命令figure; % Open a new figure hold on;plot(q); % Plot the pendulum angleplot(W); % Plot the pendulum angular velocity得出摆角(蓝色)与角速度(红色)关于时间的函数图像4 .无阻尼条件下摆角与角速度关系在matlab命令行中输入以下命令figure;plot(q.data, W.data);得到函数图像:纵轴为角速度,横轴为摆角。文

35、件(F)编辑旧 百看M 插入 工具TI桌面)窗口的 帮助(H)丁、薪货乂 - Q 园| 国在 RevoluteJointblock State 对话框的 Targets>Position 中设置不同 的起始角:-80,-40,0,40和80°,重复上述的命令得到不同起始角下摆角与角速度的关系5 .有阻尼下摆角与角速度关系 左键快速单击RevoluteJointblock,在弹出的对话框中将InternalMechanics > Damping coefficient 设为 8e- 5旭*皿)/施8/5),确保 StateTargets > specifyPositi

36、on Target> Value 为 0 (初始角为 0)。 在matlab命令行输入以下命令figure;hold on; plot(q);plot(w);得到如下图所示摆角(蓝色)、角速度(红色)与时间的函数关 系文件(F)笫期(E直看(V)插入工具CD 桌面)雷口皿帮助(H)口号H墙| U。紧/,|国口 在matlab命令行中输入以下命令figure;plot(q.data, W.data);得到摆角与角速度的关系文件用朝辑问查看M插入(I)工具桌面(D)窗口叽帮助(H)鼠,”黝、一' 4 口 / 一息改变初始角为-240,-180,-120,-60,01血60°

37、,重复上述命令可以得到如图:* Figure 13 X文件旧编楫旧/看M 插入(I)工具(T)桌面。)窗口的帮助(H)竹百日珞&&薪口目目6 .有阻尼和激励下的单摆 左键快速单击RevoluteJoint两次,在弹出来的对话框中设置ActuationTorque 为'ProvidedbyInput。 添加以下两个模块LibraryBlockSimscape> UtilitiesSimulink-PSConverterSimulink> SourcesSineWave连接成如下图所示 Pemdukjm-analyii - Simulnnk File Edit

38、View Display Diaq 左键快速单击SineWaveblock两次,在弹出的对话框中将Amplitude 设置为 0.06,在 RevoluteJointblock 对话框中将 确认 StateTargets > PositionValue 为 0。 运行仿真,在matlab命令行中输入以下命令画出摆角、角速度与时间的关系figure; hold on; plot(q); plot(w);如下图所示口目口0k、丁& 4 乂豆文件旧编辑(E)专看")插入fl)工具CT)桌面)窗口 (W)帮助H在matlab命令行中输入以下命令画出摆角与角速度的函数关系plot

39、(q.data, W.Data);如下图所示文件(F)编辑(E查看(V)插入田工层3桌面(D窗口 (W)帮助H)Simscape刚体变换一、创建坐标系以一个L梁作为示例,在matlab命令行输入smdoc_lbeam_inertia将会弹出一个L梁的坐标关系图:?mdoc Ibc?iH inprt L:aViev/ 1 errorVaria bleSteputo、si-ndoc_lbeam_inertid - SimulinfcFile Edit View Display Diagram Simulation Arulysis Cade Tools Help卜中小Sol网 Carifgural

40、iDn匡如m i Ldii ioeiLla左键快速点击图中的立方体两次,弹出立体对话框点击Frames左边的“+号,选择newframe右边的加号,From FileSTEPe Geoirtetin the HKpwid卡bit codcundtr PEpcrtie select Ihr types of geometry, inertia, qraptiic featur% jnd frames thflt you wflnl ard their pflrrnelcnzal»onis.淞w PCH R 应Pncr R is i3 framte part that cprMrnts

41、占 TrFercnw Framr associated uith the geometry. Each additkKul created frame grneratei dnoEher frame portPmpertle.Filz Marne_触白3m_8d 51号PDescriptionRepre&entt a slid ccwinbining a geometry, an inertia and e/5吊 a graphics cornponmlH Ed rigidty attached frarnes into a single unit A slid 汽 the cammo

42、n buiilding block of rigid bodies. The-Sdllid bloc k cbins tlhe inertia from the geometry and density from thegeaim航ry -and mass, or from 0n inertia trnsor that yuu specify.File TypeOK Cancel Help -Mew FiimeFrame Axes会弹出一个坐标对话框J Solid: SolidFrame Name: FlFranw CrigiriOAt Reference Frame Origin®

43、At Center of MassO Based on Geometric Featu rePrimary Axis: +z T 横1口门口曰*胴£!门匚2FrmEeKxlO Along Principal Inertia AxisO Based on Geometric FeatureI 二Secondary Axis: +X v 3Along Reference Frame Axis O Along Principal Inertia Axis O Based on Geometric FeatureSave Cancel从上到下依次为:1 .坐标名称2 .坐标原点3 .主轴4

44、.副轴按自己想要的设置即可。添加立体到模型中1 .打开 simulinkQ 同百多整馆闭总必 MDrphexxml 工I MwpheM_CialaFfcimMurpticz/tfin Pu4ojpfl_ri.dblbl4iTEP_j McjrpheM Fmtc Ekjtloir i隅"STEPMccphuH Frame Micracon1ro4lef Mount ipl 二商cxphicsc Frame- Pilarjpc_b&f&7ie-l5.S1 EP I岫yph”旧鹏Pill创网rg中H&dkUpT_布白 Mnrplirx if Mrnv T-cip_i

45、jit_ic4Fr41,1!i-.M fP *1 PlBrtfcrm (fatlcFY HcideO_ipt_WJb(lliSlS.T6PJ Rubber End Cap jpfc_5«323TEP,J Ecnw FrjrneJpil*ZcTf7117.ETEP_J Serw Gwred Tqq曲认 拈b6r<bT 5Tm口雷unw 文re jpt_WeJd?5f,5TPSize 2 NtJt_n_d:4KJ944STEPi 5泯 2 ScKkl Cdp S(«ew i Q«rr» liiih rp eJ. J Size SiCKkei C<

46、ip 5(r«w_ipH)7&J67.$TEP 比呼 3 Nut_?rf_2ddMl 3LS5 EP2 . 选择 Simscape 下的 Multibody:3" Fyq . 1172«Hliii:Lin(! i> F>:*finia EHocksd!> BieEbu蛹王正工法笠nH3 .将默认存在的块体删除,选择Library Browser >> Simscape >>Multibody >> Body Elements:13miER、War加 U|:. HotpiW a Ua:;Uu加E-'

47、;j UIWa flHuMi-n二 Maphn AmX M.pi.*.'AnninjftW上 'Wap*<i Pwr* MhFn "'Wo<F*n rwr« AhiDcntrE :Hm|Ah Fmiit R>w K 疗1 "jFkfaM Ma Mli,"UeapVv RwM-T<)_ijyi_r«- U Hi rt>Tfc I Moi*M _if<-;i 03好 二XmJrwH fri niT?mr.SI 二 L5itd r皿t Ri Wb _ hwkm? .pc fhJ$F.

48、5; _ Gw ,+n 卬 iKwOWICI .JbwdTm.«jrttwhmpi Jl b*r El91ftM 二 Shh-Srw i IsI b M 二4-hC»*HMLli 修 in wid ratou 显 jttt M Fim PiL i bUaaiu J3 献:1bsrrmzatariTdrTlTfiifiJiChiKksni"TS t NMpSrMEer HrEwctiM ulatRtfLIJThmChKtara.fTritt HbSi biMf drin ilfHflaDwickine9 iM器2费1-WErm-rrrrmmnmrm囱直 |qarn

49、il5q41.D* 1吉37HLJ_Mr将其中的solid拖到窗口中即可。建立坐标系及刚体变换1.刚体转动变换将两个立方体连接起来,使立方体的世界坐标系在空间上是重合的2.3.可视化立体坐标系:将 Simscape>>Utilities>>SolverConfguration 拖到模型中,并与一个立方体连接选择 SimulationUpdateDiagram 更新流程图,将会打开 Mechanics Explorer 窗口1泰人嘿型4 . 应用刚体变换:在 Multibody>FramesandTransforms 拖一个 rigidTransform,将它连接到两个立体的中间,左键快速单击两次,在弹出对话框 中选择RotationMethodto Standard Axis.Rotat

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论