📄 e_pid_disc.mdl
字号:
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 Product
Inputs "2"
Multiplication "Element-wise(.*)"
InputSameDT on
OutDataTypeMode "Same as first input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Zero"
SaturateOnIntegerOverflow on
SampleTime "-1"
}
Block {
BlockType Quantizer
QuantizationInterval "0.5"
LinearizeAsGain on
SampleTime "-1"
}
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 SubSystem
ShowPortLabels on
Permissions "ReadWrite"
PermitHierarchicalResolution "All"
TreatAsAtomicUnit off
SystemSampleTime "-1"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
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 TransferFcn
Numerator "[1]"
Denominator "[1 2 1]"
AbsoluteTolerance "auto"
Realization "auto"
}
Block {
BlockType Trigonometry
Operator "sin"
OutputSignalType "auto"
SampleTime "-1"
}
Block {
BlockType UnitDelay
X0 "0"
SampleTime "1"
StateMustResolveToSignalObject off
RTWStateStorageClass "Auto"
}
Block {
BlockType ZeroOrderHold
SampleTime "1"
}
}
AnnotationDefaults {
HorizontalAlignment "center"
VerticalAlignment "middle"
ForegroundColor "black"
BackgroundColor "white"
DropShadow off
FontName "Arial"
FontSize 10
FontWeight "normal"
FontAngle "normal"
}
LineDefaults {
FontName "Arial"
FontSize 9
FontWeight "normal"
FontAngle "normal"
}
System {
Name "e_pid_disc"
Location [81, 124, 931, 377]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType SubSystem
Name "Amplifier"
Ports [1, 1]
Position [420, 74, 470, 136]
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
MaskHideContents off
System {
Name "Amplifier"
Location [837, 274, 1210, 453]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "control"
Position [25, 33, 55, 47]
IconDisplay "Port number"
}
Block {
BlockType Saturate
Name "Saturation2"
Position [205, 25, 230, 55]
UpperLimit "12"
LowerLimit "-12"
}
Block {
BlockType TransferFcn
Name "Transfer Fcn"
Position [90, 22, 170, 58]
Numerator "[5000*2*pi]"
Denominator "[1 5000*2*pi]"
}
Block {
BlockType Outport
Name "u"
Position [265, 33, 295, 47]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "control"
SrcPort 1
DstBlock "Transfer Fcn"
DstPort 1
}
Line {
SrcBlock "Saturation2"
SrcPort 1
DstBlock "u"
DstPort 1
}
Line {
SrcBlock "Transfer Fcn"
SrcPort 1
DstBlock "Saturation2"
DstPort 1
}
}
}
Block {
BlockType Constant
Name "Constant1"
Position [30, 125, 60, 155]
Value "48"
VectorParams1D on
SamplingMode "Sample based"
OutDataTypeMode "Inherit from 'Constant value'"
OutDataType "sfix(16)"
ConRadixGroup "Use specified scaling"
OutScaling "2^0"
SampleTime "Ts"
FramePeriod "inf"
Port {
PortNumber 1
Name "Vin"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType SubSystem
Name "Control Unit"
Ports [2, 1]
Position [275, 49, 370, 156]
BackgroundColor "lightBlue"
DropShadow on
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
MaskHideContents off
MaskDisplay "disp('Floating Point\\nProcessor')"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
System {
Name "Control Unit"
Location [482, 121, 951, 256]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "Uref"
Position [30, 38, 60, 52]
IconDisplay "Port number"
}
Block {
BlockType Inport
Name "y"
Position [15, 88, 45, 102]
Port "2"
IconDisplay "Port number"
}
Block {
BlockType Reference
Name "10bit"
Ports [1, 1]
Position [90, 78, 125, 112]
SourceBlock "dc_motor_lib/Misc/10bit"
SourceType ""
ShowPortLabels on
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
}
Block {
BlockType SubSystem
Name "A/D"
Ports [1, 1]
Position [90, 29, 120, 61]
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
MaskHideContents off
MaskDisplay "disp('A/D')\n"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
System {
Name "A/D"
Location [492, 122, 710, 239]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [25, 33, 55, 47]
IconDisplay "Port number"
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold"
Position [85, 25, 120, 55]
SampleTime "Ts"
}
Block {
BlockType Outport
Name "Out1"
Position [150, 33, 180, 47]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Zero-Order\nHold"
DstPort 1
}
Line {
SrcBlock "Zero-Order\nHold"
SrcPort 1
Points [0, 0]
DstBlock "Out1"
DstPort 1
}
}
}
Block {
BlockType Reference
Name "Discrete PID"
Ports [2, 1]
Position [220, 30, 260, 90]
ForegroundColor "red"
BackgroundColor "yellow"
SourceBlock "dc_motor_lib/Controllers/Discrete PID"
SourceType ""
ShowPortLabels on
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
K "0.1"
b "0.7"
Ti "0.01"
Td "1e-5"
N "4"
Tt "0.005"
Umax "12"
Umin "-12"
Ts "Ts"
}
Block {
BlockType Outport
Name "U"
Position [390, 53, 420, 67]
IconDisplay "Port number"
BusOutputAsStruct off
}
Line {
SrcBlock "10bit"
SrcPort 1
Points [60, 0; 0, -20]
DstBlock "Discrete PID"
DstPort 2
}
Line {
SrcBlock "A/D"
SrcPort 1
DstBlock "Discrete PID"
DstPort 1
}
Line {
SrcBlock "y"
SrcPort 1
DstBlock "10bit"
DstPort 1
}
Line {
SrcBlock "Uref"
SrcPort 1
Points [0, 0]
DstBlock "A/D"
DstPort 1
}
Line {
SrcBlock "Discrete PID"
SrcPort 1
Points [0, 0]
DstBlock "U"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Mechanics"
Ports [1, 2]
Position [545, 47, 660, 163]
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
MaskHideContents off
Port {
PortNumber 2
Name "dth_m_tacho"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
System {
Name "Mechanics"
Location [286, 462, 916, 887]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [25, 33, 55, 47]
IconDisplay "Port number"
}
Block {
BlockType Reference
Name "DC-Tacho"
Ports [2, 1]
Position [430, 25, 510, 85]
BackgroundColor "lightBlue"
DropShadow on
SourceBlock "dc_motor_lib/DC-Tacho"
SourceType ""
ShowPortLabels on
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
dth_gain "0.005"
th_gain "pi*0.0229"
rel_dth_gain "1/486.25"
}
Block {
BlockType SubSystem
Name "Load"
Ports [2, 3]
Position [160, 223, 240, 297]
Orientation "left"
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
MaskHideContents off
Port {
PortNumber 2
Name "dth_l"
PropagatedSignals "dth_l"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
Port {
PortNumber 3
Name "th_l"
PropagatedSignals "th_l"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
System {
Name "Load"
Location [270, 486, 821, 824]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000]
TiledPageScale 1
ShowPageBoundaries off
ZoomFactor "100"
Block {
BlockType Inport
Name "dth_m"
Position [260, 25, 290, 40]
Orientation "down"
IconDisplay "Port number"
}
Block {
BlockType Inport
Name "th_m"
Position [350, 105, 380, 120]
Orientation "down"
Port "2"
IconDisplay "Port number"
}
Block {
BlockType Integrator
Name "Integrator3"
Ports [1, 1]
Position [210, 165, 240, 195]
IgnoreLimit off
Port {
PortNumber 1
Name "dth_l"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Integrator
Name "Integrator4"
Ports [1, 1]
Position [300, 165, 330, 195]
IgnoreLimit off
Port {
PortNumber 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -