📄 qlib.mdl
字号:
DstBlock "Fcn3" DstPort 1 } Line { SrcBlock "Fcn" SrcPort 1 DstBlock "Gain" DstPort 1 } Line { SrcBlock "Fcn1" SrcPort 1 DstBlock "Gain1" DstPort 1 } Line { SrcBlock "Fcn3" SrcPort 1 DstBlock "Gain4" DstPort 1 } Line { SrcBlock "Fcn2" SrcPort 1 DstBlock "Gain3" DstPort 1 } Line { SrcBlock "Sum8" SrcPort 1 DstBlock "Sign 1" DstPort 1 } Line { SrcBlock "Fcn4" SrcPort 1 Points [70, 0; 0, -240] DstBlock "Product" DstPort 2 } Line { SrcBlock "Sign 1" SrcPort 1 DstBlock "Fcn4" DstPort 1 } Line { SrcBlock "Sum9" SrcPort 1 DstBlock "Sign 2" DstPort 1 } Line { SrcBlock "Fcn5" SrcPort 1 Points [80, 0; 0, -235] DstBlock "Product1" DstPort 2 } Line { SrcBlock "Sign 2" SrcPort 1 DstBlock "Fcn5" DstPort 1 } Line { SrcBlock "Sum10" SrcPort 1 DstBlock "Sign 3" DstPort 1 } Line { SrcBlock "Fcn6" SrcPort 1 Points [90, 0] DstBlock "Product2" DstPort 2 } Line { SrcBlock "Sign 3" SrcPort 1 DstBlock "Fcn6" DstPort 1 } Line { Name "A23" Labels [1, 0] SrcBlock "Bus\nSelector1" SrcPort 1 DstBlock "Sum8" DstPort 1 } Line { Name "A32" Labels [1, 0] SrcBlock "Bus\nSelector1" SrcPort 2 DstBlock "Sum8" DstPort 2 } Line { Name "A22" Labels [0, 1] SrcBlock "Bus\nSelector" SrcPort 2 Points [40, 0] Branch { Labels [-1, 1] DstBlock "Sum" DstPort 2 } Branch { Points [0, 55] Branch { Labels [-1, 1] DstBlock "Sum1" DstPort 2 } Branch { Points [0, 55] Branch { Labels [-1, 1] Points [0, 55] DstBlock "Sum3" DstPort 2 } Branch { Labels [-1, 1] DstBlock "Sum2" DstPort 2 } } } } Line { Name "A11" Labels [0, 1] SrcBlock "Bus\nSelector" SrcPort 1 Points [50, 0] Branch { Labels [-1, 1] DstBlock "Sum" DstPort 1 } Branch { Points [0, 55] Branch { Labels [-1, 1] DstBlock "Sum1" DstPort 1 } Branch { Points [0, 55] Branch { Labels [-1, 1] DstBlock "Sum2" DstPort 1 } Branch { Labels [-1, 1] Points [0, 55] DstBlock "Sum3" DstPort 1 } } } } Line { Name "A33" Labels [0, 1] SrcBlock "Bus\nSelector" SrcPort 3 Points [30, 0] Branch { Labels [-1, 1] DstBlock "Sum" DstPort 3 } Branch { Points [0, 55] Branch { Labels [-1, 1] DstBlock "Sum1" DstPort 3 } Branch { Points [0, 55] Branch { Labels [-1, 1] Points [0, 55] DstBlock "Sum3" DstPort 3 } Branch { Labels [-1, 1] DstBlock "Sum2" DstPort 3 } } } } Line { Name "A13" Labels [1, 0] SrcBlock "Bus\nSelector2" SrcPort 1 DstBlock "Sum9" DstPort 1 } Line { Name "A31" Labels [1, 0] SrcBlock "Bus\nSelector2" SrcPort 2 DstBlock "Sum9" DstPort 2 } Line { Name "A21" Labels [1, 0] SrcBlock "Bus\nSelector3" SrcPort 2 DstBlock "Sum10" DstPort 2 } Line { Name "A12" Labels [1, 0] SrcBlock "Bus\nSelector3" SrcPort 1 DstBlock "Sum10" DstPort 1 } Line { Name "A11" Labels [-1, 0] SrcBlock "Demux2" SrcPort 1 DstBlock "Mux1" DstPort 1 } Line { Name "A12" Labels [-1, 0] SrcBlock "Demux2" SrcPort 2 DstBlock "Mux1" DstPort 2 } Line { Name "A13" Labels [-1, 0] SrcBlock "Demux2" SrcPort 3 DstBlock "Mux1" DstPort 3 } Line { Name "A21" Labels [-1, 0] SrcBlock "Demux2" SrcPort 4 DstBlock "Mux1" DstPort 4 } Line { Name "A22" Labels [-1, 0] SrcBlock "Demux2" SrcPort 5 DstBlock "Mux1" DstPort 5 } Line { Name "A23" Labels [-1, 0] SrcBlock "Demux2" SrcPort 6 DstBlock "Mux1" DstPort 6 } Line { Name "A31" Labels [-1, 0] SrcBlock "Demux2" SrcPort 7 DstBlock "Mux1" DstPort 7 } Line { Name "A32" Labels [-1, 0] SrcBlock "Demux2" SrcPort 8 DstBlock "Mux1" DstPort 8 } Line { Name "A33" Labels [-1, 0] SrcBlock "Demux2" SrcPort 9 DstBlock "Mux1" DstPort 9 } Line { SrcBlock "DCM" SrcPort 1 DstBlock "Demux2" DstPort 1 } Line { Name "A" Labels [1, 1] SrcBlock "Mux1" SrcPort 1 Points [25, 0] Branch { Points [0, -105] DstBlock "Bus\nSelector" DstPort 1 } Branch { Points [0, 145] Branch { DstBlock "Bus\nSelector1" DstPort 1 } Branch { Points [0, 50] Branch { DstBlock "Bus\nSelector2" DstPort 1 } Branch { Points [0, 45] DstBlock "Bus\nSelector3" DstPort 1 } } } } Line { SrcBlock "Product" SrcPort 1 Points [5, 0; 0, 30] DstBlock "Mux" DstPort 1 } Line { SrcBlock "Product1" SrcPort 1 Points [5, 0; 0, 10] DstBlock "Mux" DstPort 2 } Line { SrcBlock "Product2" SrcPort 1 Points [5, 0; 0, -10] DstBlock "Mux" DstPort 3 } Line { SrcBlock "Gain4" SrcPort 1 Points [85, 0; 0, -20] DstBlock "Mux" DstPort 4 } Line { SrcBlock "Mux" SrcPort 1 DstBlock "q" DstPort 1 } Annotation { Position [636, 366] ForegroundColor "blue" Text "Used Fcn blocks here because\nI have found ""strange behavior\nfor the Relational block for\nvery small timesteps." } Annotation { Position [317, 458] Text "q1 = 1/2 sqrt( 1 + A_11 - A_22 - A_33 ) sg""n( A_23 - A_32 )" } Annotation { Position [317, 473] Text "q2 = 1/2 sqrt( 1 - A_11 + A_22 - A_33 ) sg""n( A_31 - A_13 )" } Annotation { Position [317, 488] Text "q3 = 1/2 sqrt( 1 - A_11 - A_22 + A_33 ) sg""n( A_12 - A_21 )" } Annotation { Position [267, 503] Text "q4 = 1/2 sqrt( 1 + A_11 + A_22 + A_33 ) " } Annotation { Position [126, 459] Text "Equations:" } Annotation { Position [570, 458] Text "Note that in this case, sgn(0) = 1" } Annotation { Position [574, 495] Text "Also note that in the implementation,\nfor ""sqrt(x), x<0, we are setting x=0.\nThis is arbitrary, but seemed to produce\n""the best results." } } } Block { BlockType SubSystem Name "Quaternion\nConjugate" Ports [1, 1, 0, 0, 0] Position [130, 89, 170, 121] ShowPortLabels on MaskType "Quaternion Conjugate" MaskDescription "q* = [ -q(1) -q(2) -q(3) q(4) ]" MaskDisplay "disp('q*')" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskIconUnits "pixels" System { Name "Quaternion\nConjugate" Location [348, 366, 662, 478] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" AutoZoom on Block { BlockType Inport Name "q" Position [25, 48, 55, 62] BackgroundColor "cyan" Port "1" PortWidth "4" SampleTime "-1" DataType "auto" SignalType "auto" Interpolate on } Block { BlockType Demux Name "Demux" Ports [1, 2, 0, 0, 0] Position [80, 36, 85, 74] BackgroundColor "black" ShowName off Outputs "[3 1]" Port { PortNumber 1 Name "[ q(1) q(2) q(3) ]" TestPoint off RTWStorageClass "Auto" } Port { PortNumber 2 Name "q(4)" TestPoint off RTWStorageClass "Auto" } } Block { BlockType Gain Name "Gain" Position [180, 30, 210, 60] NamePlacement "alternate" ShowName off Gain "-1" SaturateOnIntegerOverflow on } Block { BlockType Mux Name "Mux" Ports [2, 1, 0, 0, 0] Position [230, 36, 235, 74] ShowName off Inputs "2" DisplayOption "bar" } Block { BlockType Outport Name "q*" Position [255, 48, 285, 62] BackgroundColor "yellow" Port "1" OutputWhenDisabled "held" InitialOutput "0" } Line { SrcBlock "q" SrcPort 1 DstBlock "Demux" DstPort 1 } Line { Name "[ q(1) q(2) q(3) ]" Labels [0, 1] SrcBlock "Demux" SrcPort 1 DstBlock "Gain" DstPort 1 } Line { SrcBlock "Gain" SrcPort 1 DstBlock "Mux" DstPort 1 } Line { Name "q(4)" Labels [0, 1] SrcBlock "Demux" SrcPort 2 DstBlock "Mux" DstPort 2 } Line { SrcBlock "Mux" SrcPort 1 DstBlock "q*" DstPort 1 } } } Block { BlockType SubSystem Name "Quaternion\nDecomposition" Ports [1, 2, 0, 0, 0] Position [40, 237, 80, 273] ShowPortLabels on MaskType "Quaternion Decomposition" MaskDescription "Breaks down a quaternion into its unit vector a""nd total rotation angle about that vector. If the components of the quaterni""on are denoted:\n\n q = [ q(1) q(2) q(3) q(4) ]\n\nThen:\n\n q(1) ""= v1 sin(phi/2)\n q(2) = v2 sin(phi/2)\n q(3) = v3 sin(phi/2)\n q""(4) = cos(phi/2)\n\nWhere phi is the amount of rotation about the unit vector"" [ v1 v2 v3 ]." MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskIconUnits "pixels" System { Name "Quaternion\nDecomposition" Location [7, 117, 623, 329] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" AutoZoom on Block { BlockType Inport Name "q" Position [20, 68, 50, 82] BackgroundColor "cyan" Port "1" PortWidth "4" SampleTime "-1" DataType "auto" SignalType "auto" Interpolate on } Block { BlockType Demux Name "Demux" Ports [1, 2, 0, 0, 0] Position [145, 19, 150, 126] BackgroundColor "black" ShowName off Outputs "[3 1]" Port { PortNumber 1 Name "[ q(1) q(2) q(3) ]" TestPoint off RTWStorageClass "Auto" } Port { PortNumber 2 Name "q(4)" TestPoint off RTWStorageClass "Auto" } } Block { BlockType Fcn Name "Fcn" Position [340, 82, 435, 118] Expr "1/((u==0)+u)" } Block { BlockType Gain Name "Gain" Position [380, 145, 410, 175] Gain "2" SaturateOnIntegerOverflow on } Block { BlockType Product Name "Product" Ports [2, 1, 0, 0, 0] Position [485, 37, 515, 68] Inputs "2" SaturateOnIntegerOverflow on } Block { BlockType Reference Name "Quaternion\nNormalize" Ports [1, 1, 0, 0, 0] Position [80, 59, 120, 91] SourceBlock "qlib/Quaternion\nNormalize"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -