📄 c9mbbr.mdl
字号:
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
IgnoreLimit off
ZeroCross on
}
Block {
BlockType Outport
Port "1"
UseBusObject off
BusObject "BusObject"
BusOutputAsStruct off
PortDimensions "-1"
SampleTime "-1"
DataType "auto"
OutDataType "sfix(16)"
OutScaling "2^0"
SignalType "auto"
SamplingMode "auto"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Block {
BlockType Saturate
UpperLimit "0.5"
LowerLimit "-0.5"
LinearizeAsGain on
ZeroCross on
SampleTime "-1"
}
Block {
BlockType Scope
ModelBased off
TickLabels "OneTimeTick"
ZoomMode "on"
Grid "on"
TimeRange "auto"
YMin "-5"
YMax "5"
SaveToWorkspace off
SaveName "ScopeData"
LimitDataPoints on
MaxDataPoints "5000"
Decimation "1"
SampleInput off
SampleTime "-1"
}
Block {
BlockType "S-Function"
FunctionName "system"
SFunctionModules "''"
PortCounts "[]"
}
Block {
BlockType SignalGenerator
WaveForm "sine"
TimeSource "Use simulation time"
Amplitude "1"
Frequency "1"
Units "Hertz"
VectorParams1D on
}
Block {
BlockType SubSystem
ShowPortLabels on
Permissions "ReadWrite"
PermitHierarchicalResolution "All"
SystemSampleTime "-1"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
SimViewingDevice off
DataTypeOverride "UseLocalSettings"
MinMaxOverflowLogging "UseLocalSettings"
}
Block {
BlockType Sum
IconShape "rectangular"
Inputs "++"
InputSameDT on
OutDataTypeMode "Same as first input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
SampleTime "-1"
}
Block {
BlockType ToWorkspace
VariableName "simulink_output"
MaxDataPoints "1000"
Decimation "1"
SampleTime "0"
FixptAsFi off
}
Block {
BlockType TransferFcn
Numerator "[1]"
Denominator "[1 2 1]"
AbsoluteTolerance "auto"
Realization "auto"
}
}
AnnotationDefaults {
HorizontalAlignment "center"
VerticalAlignment "middle"
ForegroundColor "black"
BackgroundColor "white"
DropShadow off
FontName "Helvetica"
FontSize 10
FontWeight "normal"
FontAngle "normal"
}
LineDefaults {
FontName "Helvetica"
FontSize 9
FontWeight "normal"
FontAngle "normal"
}
System {
Name "c9mbbr"
Location [-7, 116, 1005, 730]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "portrait"
PaperPositionMode "auto"
PaperType "a4letter"
PaperUnits "centimeters"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType "S-Function"
Name "Analog Output To Amplifier\nDriving the Motor"
Ports [1]
Position [850, 126, 925, 164]
ShowName off
LoadFcn "set_param(gcb,'MaskEnables',{'on','on','on','on"
"','on','on','on','on','on'});"
StartFcn "set_param(gcb,'MaskEnables',{'off','off','off',"
"'off','off','on','off','on','off'});"
StopFcn "set_param(gcb,'MaskEnables',{'on','on','on','on"
"','on','on','on','on','on'});"
FontName "Times New Roman"
FontSize 12
FunctionName "q4da"
Parameters "boardNumber, channels, modes, ranges, initialOu"
"tputs, finalOutputs, sampleTime, inputVolts, simulationOutput"
MaskType "Q4 Analog Output"
MaskDescription "Writes to the selected analog output channels o"
"f the Q4 Series I/O Boards"
MaskHelp "web(fullfile(qcdocroot, 'Q4', 'AnalogOutput.htm"
"l'));"
MaskPromptString "Board number:|Channel(s) to use:|Mode(s): (0 ="
" bipolar, 1 = unipolar)|Range(s): (5 or 10)|Initial output(s):|Final output("
"s):|Sample time (sec):|Input Volts|Simulation output"
MaskStyleString "edit,edit,edit,edit,edit,edit,edit,checkbox,che"
"ckbox"
MaskTunableValueString "on,on,on,on,on,on,on,on,on"
MaskCallbackString "||||||||"
MaskEnableString "on,on,on,on,on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on,on,on,on,on"
MaskToolTipString "on,on,on,on,on,on,on,on,on"
MaskVarAliasString ",,,,,,,,"
MaskVariables "boardNumber=@1;channels=@2;modesVect=@3;rangesV"
"ect=@4;initialVect=@5;finalVect=@6;sampleTime=@7;inputVolts=@8;simulationOutp"
"ut=@9;"
MaskInitialization "modes = expand(modesVect, length(channels));\nr"
"anges = expand(rangesVect, length(channels));\ninitialOutputs = expand(initia"
"lVect, length(channels));\nfinalOutputs = expand(finalVect, length(channels))"
";\n\naddpath(qcdevroot);\n"
MaskDisplay "disp('Quanser\\nQ4 DAC')"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0|0|0|10|0|0|-1|on|off"
MaskTabNameString ",,,,,,,,"
}
Block {
BlockType Gain
Name "Aplha to Theta"
Position [485, 118, 530, 172]
ShowName off
FontName "Times New Roman"
FontSize 12
Gain "L/r"
}
Block {
BlockType "S-Function"
Name "Ball Sensor Input"
Ports [0, 1]
Position [475, 304, 550, 346]
Orientation "left"
ShowName off
AncestorBlock "qctools/Quanser\nQ4 Series/Analog Input"
LoadFcn "set_param(gcb,'MaskEnables',{'on','on','on','on"
"','on','on'});"
StartFcn "set_param(gcb,'MaskEnables',{'off','off','off',"
"'off','on','off'});"
StopFcn "set_param(gcb,'MaskEnables',{'on','on','on','on"
"','on','on'});"
FontName "Times New Roman"
FontSize 12
FunctionName "q4ad"
Parameters "boardNumber, channels, useBusy, outputVolts, sa"
"mpleTime, simulationInput"
MaskType "Q4 Analog Input"
MaskDescription "Reads the selected analog input channels of the"
" Q4 Series I/O Boards"
MaskHelp "web(fullfile(qcdocroot, 'Q4', 'AnalogInput.html"
"'));"
MaskPromptString "Board number:|Channel(s) to use:|Sample time (s"
"ec):|Read after conversions complete|Output Volts|Simulation input"
MaskStyleString "edit,edit,edit,checkbox,checkbox,checkbox"
MaskTunableValueString "on,on,on,on,on,on"
MaskCallbackString "|||||"
MaskEnableString "on,on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on,on"
MaskToolTipString "on,on,on,on,on,on"
MaskVarAliasString ",,,,,"
MaskVariables "boardNumber=@1;channels=@2;sampleTime=@3;useBus"
"y=@4;outputVolts=@5;simulationInput=@6;"
MaskInitialization "addpath(qcdevroot);"
MaskDisplay "disp('Quanser\\nQ4 ADC')"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0|2|simget(bdroot,'FixedStep')|on|on|off"
MaskTabNameString ",,,,,"
}
Block {
BlockType Gain
Name "Cable Gain\nPre-Compensation"
Position [760, 129, 800, 161]
ShowName off
FontName "Times New Roman"
FontSize 12
Gain "-1"
}
Block {
BlockType Gain
Name "Calibrate Postion \nto read in centimeters\n(-2"
"0 to 20) "
Position [300, 302, 360, 348]
Orientation "left"
ShowName off
FontName "Times New Roman"
FontSize 12
Gain "-L/10"
}
Block {
BlockType Gain
Name "Command \nin \ncentimeters"
Position [225, 126, 255, 164]
ShowName off
FontName "Times New Roman"
FontSize 12
Gain "5"
}
Block {
BlockType Gain
Name "Conversion to Radians"
Position [750, 288, 820, 332]
Orientation "left"
ShowName off
FontName "Times New Roman"
FontSize 12
Gain "0.0015"
}
Block {
BlockType TransferFcn
Name "Derivative\nw/ filter"
Position [425, 225, 485, 265]
Orientation "up"
NamePlacement "alternate"
ShowName off
FontName "Times New Roman"
FontSize 12
Numerator "[20 0]"
Denominator "[1 20]"
}
Block {
BlockType TransferFcn
Name "Derivative\nw/ filter1"
Position [705, 235, 765, 275]
Orientation "up"
NamePlacement "alternate"
ShowName off
FontName "Times New Roman"
FontSize 12
Numerator "[50 0]"
Denominator "[1 50]"
}
Block {
BlockType SubSystem
Name "Encoder Input"
Ports [0, 1]
Position [845, 290, 930, 330]
Orientation "left"
ShowName off
AncestorBlock "qctools/Quanser\nQ4 Series/Encoder Input"
LoadFcn "run(fullfile(qcdevroot,'q4encCallback'));"
StartFcn "set_param(gcb,'MaskEnables',{'off','off','off',"
"'off','off','off','off','off','off','off','off','off','off','off','off','off'"
"});"
StopFcn "q4encCallback"
FontName "Times New Roman"
FontSize 12
TreatAsAtomicUnit off
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
MaskHideContents off
MaskType "Q4 Encoder Input"
MaskDescription "Reads from the selected encoder channels of the"
" Q4 Series I/O Boards"
MaskHelp "web(fullfile(qcdocroot, 'Q4', 'EncoderInput.htm"
"l'));"
MaskPromptString "Board number:|Channel(s) to use:|Initial value("
"s):|Do not initialize counts|Sample time (sec):|Quadrature:|Count mode:|Inter"
"rupt flags:|Filter clock prescaling: (1-256)|Filter clock frequency (Hz):|Use"
" 33MHz clock|Binary-coded decimal (BCD)|Enable index|Index polarity (on=posit"
"ive, off=negative)|Reload count on index pulse|Simulation input"
MaskStyleString "edit,edit,edit,checkbox,edit,popup(Non-quadratu"
"re|1X|2X|4X),popup(Normal|Range limit|Non-recycle|Modulo-N),popup(FLG1 is CAR"
"RY and FLG2 is BORROW|FLG1 is COMPARE and FLG2 is BORROW|FLG1 is CARRY/BORROW"
" and FLG2 is UP/DOWN|FLG1 is IDX and FLG2 is E),edit,edit,checkbox,checkbox,c"
"heckbox,checkbox,checkbox,checkbox"
MaskTunableValueString "on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
MaskCallbackString "|||q4encCallback|||||str2num(get_param(gcb,'pre"
"scale'));if ans > 0;if strcmp(get_param(gcb,'use33MHzClock'),'on');set_param("
"gcb,'frequency',num2str(1/30e-9/ans));else set_param(gcb,'frequency',num2str("
"1/60e-9/ans));end;end;||str2num(get_param(gcb,'prescale'));if ans > 0;if strc"
"mp(get_param(gcb,'use33MHzClock'),'on');set_param(gcb,'frequency',num2str(1/3"
"0e-9/ans));else set_param(gcb,'frequency',num2str(1/60e-9/ans));end;end;||q4e"
"ncCallback|||"
MaskEnableString "on,on,on,on,on,on,on,on,on,off,on,on,on,on,on,o"
"n"
MaskVisibilityString "on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
MaskToolTipString "on,on,on,on,on,on,on,on,on,on,on,on,on,on,on,on"
MaskVarAliasString ",,,,,,,,,,,,,,,"
MaskVariables "boardNumber=@1;channels=@2;initial=@3;preserveC"
"ounts=@4;sampleTime=@5;quadratureStr=&6;modeStr=&7;flagString=&8;prescale=@9;"
"frequency=@10;use33MHzClock=@11;bcd=@12;enableIndex=@13;indexPolarity=@14;rel"
"oadOnIndex=@15;simulationInput=@16;"
MaskInitialization "initialValues = expand(initial, length(channels"
"));\n\nswitch lower(quadratureStr)\n case 'non-quadrature'\n quadrature ="
" 0;\n case '1x'\n quadrature = 1;\n case '2x'\n quadrature = 2;\n ca"
"se '4x'\n quadrature = 3;\nend;\n\nswitch lower(modeStr)\n case 'normal'"
"\n mode = 0;\n case 'range limit'\n mode = 1;\n case 'non-recycle'\n "
" mode = 2;\n case 'modulo-n'\n mode = 3;\nend;\n\nswitch flagString\n "
" case 'FLG1 is CARRY and FLG2 is BORROW'\n flags = 0;\n case 'FLG1"
" is COMPARE and FLG2 is BORROW'\n flags = 1;\n case 'FLG1 is CARRY/"
"BORROW and FLG2 is UP/DOWN'\n flags = 2;\n case 'FLG1 is IDX and FL"
"G2 is E'\n flags = 3;\n otherwise\n flags = 3;\nend\n\naddpa"
"th(qcdevroot);\n"
MaskDisplay "disp('Quanser\\nQ4 ENC')"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0|0|0|off|simget(bdroot,'FixedStep')|4X|Normal|"
"FLG1 is IDX and FLG2 is E|1|16666666.6667|off|off|on|on|off|off"
MaskTabNameString ",,,,,,,,,,,,,,,"
System {
Name "Encoder Input"
Location [617, 300, 912, 377]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType "S-Function"
Name "Configure I/O"
Ports []
Position [176, 20, 240, 44]
FunctionName "q4cfgencio"
Parameters "boardNumber, channels, flags, reloadOnIndex"
}
Block {
BlockType "S-Function"
Name "Encoder Input"
Ports [0, 1]
Position [35, 18, 75, 42]
FunctionName "q4en"
Parameters "boardNumber, channels, initialValues, sampl"
"eTime, prescale, quadrature, mode, bcd, enableIndex, indexPolarity, preserveC"
"ounts, use33MHzClock, simulationInput"
}
Block {
BlockType Outport
Name "Out1"
Position [110, 23, 140, 37]
IconDisplay "Port number"
}
Line {
SrcBlock "Encoder Input"
SrcPort 1
DstBlock "Out1"
DstPort 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -