📄 pid_sim.mdl
字号:
BlockType Outport
Name "uc"
Position [1020, 113, 1050, 127]
IconDisplay "Port number"
OutDataType "sfix(16)"
OutScaling "2^0"
}
Line {
Name "kp"
Labels [0, 0]
SrcBlock "kp_fixed_point"
SrcPort 1
Points [205, 0]
DstBlock "pid_sp_SFUN\ngenerated by LCT"
DstPort 3
}
Line {
SrcBlock "rounding to the nearest"
SrcPort 1
Points [15, 0; 0, 15]
DstBlock "Manual Switch"
DstPort 1
}
Line {
SrcBlock "no rounding"
SrcPort 1
Points [20, 0; 0, -25]
DstBlock "Manual Switch"
DstPort 2
}
Line {
Name "rounding"
Labels [0, 0]
SrcBlock "Manual Switch"
SrcPort 1
Points [105, 0; 0, -205]
DstBlock "pid_sp_SFUN\ngenerated by LCT"
DstPort 5
}
Line {
Name "ki"
Labels [0, 0]
SrcBlock "ki_fixed_point\nts = 0.1s"
SrcPort 1
Points [205, 0]
DstBlock "pid_sp_SFUN\ngenerated by LCT"
DstPort 4
}
Line {
Name "yr"
Labels [0, 0]
SrcBlock "yr"
SrcPort 1
DstBlock "Saturation"
DstPort 1
}
Line {
Name "ym"
Labels [0, 0]
SrcBlock "ym"
SrcPort 1
DstBlock "Saturation1"
DstPort 1
}
Line {
Name "u_fixed_point_sp"
Labels [0, 0]
SrcBlock "pid_sp_SFUN\ngenerated by LCT"
SrcPort 1
DstBlock "Gain2"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
DstBlock "Data Type Conversion"
DstPort 1
}
Line {
SrcBlock "Gain3"
SrcPort 1
DstBlock "Data Type Conversion1"
DstPort 1
}
Line {
Name "u_fxp_dp"
Labels [0, 0]
SrcBlock "Gain2"
SrcPort 1
DstBlock "uc"
DstPort 1
}
Line {
SrcBlock "Data Type Conversion"
SrcPort 1
Points [50, 0]
DstBlock "pid_sp_SFUN\ngenerated by LCT"
DstPort 1
}
Line {
SrcBlock "Data Type Conversion1"
SrcPort 1
Points [50, 0]
DstBlock "pid_sp_SFUN\ngenerated by LCT"
DstPort 2
}
Line {
SrcBlock "Saturation"
SrcPort 1
DstBlock "Gain1"
DstPort 1
}
Line {
SrcBlock "Saturation1"
SrcPort 1
DstBlock "Gain3"
DstPort 1
}
}
}
Block {
BlockType Sum
Name "Add"
Ports [2, 1]
Position [585, 142, 615, 173]
Inputs "+-"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^-10"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "z_flt_dbl"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Sum
Name "Add1"
Ports [2, 1]
Position [605, 332, 630, 363]
Inputs "+-"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^-10"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "z_fxp_sp"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Sum
Name "Add2"
Ports [2, 1]
Position [605, 537, 630, 568]
Inputs "+-"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^-10"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "z_fxp_dp"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Constant
Name "Constant"
Position [255, 735, 285, 765]
Value "yr_max"
OutDataType "sfix(16)"
OutScaling "2^0"
}
Block {
BlockType Gain
Name "Gain"
Position [360, 735, 390, 765]
Gain "+2^(-11)"
ParameterDataTypeMode "Inherit via internal rule"
ParameterDataType "sfix(16)"
ParameterScaling "2^0"
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "+1/2 lsb 10-bits ADC"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Gain
Name "Gain1"
Position [430, 765, 460, 795]
Gain "-2^(-11)"
ParameterDataTypeMode "Inherit via internal rule"
ParameterDataType "sfix(16)"
ParameterScaling "2^0"
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "-1/2 lsb 10-bits ADC"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Reference
Name "INFORMATIONS"
Ports []
Position [92, 90, 220, 126]
UserDataPersistent on
UserData "DataTag0"
SourceBlock "simulink/Model-Wide\nUtilities/DocBlock"
SourceType "DocBlock"
ShowPortLabels "FromPortIcon"
SystemSampleTime "-1"
FunctionWithSeparateData off
RTWMemSecFuncInitTerm "Inherit from model"
RTWMemSecFuncExecute "Inherit from model"
RTWMemSecDataConstants "Inherit from model"
RTWMemSecDataInternal "Inherit from model"
RTWMemSecDataParameters "Inherit from model"
DocumentType "Text"
}
Block {
BlockType Step
Name "Reference"
Position [345, 30, 375, 60]
BackgroundColor "magenta"
Time "0.1"
After "yr_max"
SampleTime "pidfix_ts "
Port {
PortNumber 1
Name "yr"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType SubSystem
Name "pid reference\n(continuous)"
Ports [2, 1]
Position [245, 214, 390, 276]
Orientation "left"
BackgroundColor "orange"
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
Port {
PortNumber 1
Name "u_flt_dbl"
PropagatedSignals "u_flt_dbl"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
System {
Name "pid reference\n(continuous)"
Location [548, 446, 1158, 653]
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 "pid_yr"
Position [545, 58, 575, 72]
Orientation "left"
IconDisplay "Port number"
}
Block {
BlockType Inport
Name "pid_ym"
Position [555, 133, 585, 147]
Orientation "left"
Port "2"
IconDisplay "Port number"
}
Block {
BlockType Sum
Name "pid_add"
Ports [2, 1]
Position [80, 25, 105, 180]
Orientation "left"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^-10"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "u_flt_dbl"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Sum
Name "pid_add1"
Ports [2, 1]
Position [495, 25, 520, 180]
Orientation "left"
Inputs "+-"
CollapseMode "All dimensions"
InputSameDT off
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^-10"
SaturateOnIntegerOverflow off
Port {
PortNumber 1
Name "pid_error"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
}
Block {
BlockType Integrator
Name "pid_int"
Ports [1, 1]
Position [180, 125, 210, 155]
Orientation "left"
}
Block {
BlockType Gain
Name "pid_ki"
Position [260, 111, 345, 169]
Orientation "left"
Gain "pid_ki"
ParameterDataTypeMode "Inherit via internal rule"
ParameterDataType "sfix(16)"
ParameterScaling "2^0"
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
}
Block {
BlockType Gain
Name "pid_kp"
Position [260, 36, 345, 94]
Orientation "left"
Gain "pid_kp"
ParameterDataTypeMode "Inherit via internal rule"
ParameterDataType "sfix(16)"
ParameterScaling "2^0"
OutDataTypeMode "Inherit via internal rule"
OutDataType "sfix(16)"
OutScaling "2^0"
SaturateOnIntegerOverflow off
}
Block {
BlockType Outport
Name "pid_v"
Position [15, 43, 45, 57]
Orientation "left"
IconDisplay "Port number"
}
Line {
SrcBlock "pid_ki"
SrcPort 1
DstBlock "pid_int"
DstPort 1
}
Line {
SrcBlock "pid_kp"
SrcPort 1
DstBlock "pid_add"
DstPort 1
}
Line {
SrcBlock "pid_int"
SrcPort 1
DstBlock "pid_add"
DstPort 2
}
Line {
Name "pid_error"
Labels [0, 0]
SrcBlock "pid_add1"
SrcPort 1
Points [-105, 0]
Branch {
Points [0, -40]
DstBlock "pid_kp"
DstPort 1
}
Branch {
Points [0, 35]
DstBlock "pid_ki"
DstPort 1
}
}
Line {
SrcBlock "pid_ym"
SrcPort 1
DstBlock "pid_add1"
DstPort 2
}
Line {
SrcBlock "pid_yr"
SrcPort 1
DstBlock "pid_add1"
DstPort 1
}
Line {
Name "u_flt_dbl"
Labels [0, 0]
SrcBlock "pid_add"
SrcPort 1
Points [-15, 0]
DstBlock "pid_v"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "plant"
Ports [1, 1]
Position [245, 134, 390, 196]
BackgroundColor "cyan"
MinAlgLoopOccurrences off
RTWSystemCode "Auto"
FunctionWithSeparateData off
Port {
PortNumber 1
Name "ym_flt_dbl"
PropagatedSignals "ym_flt_dbl"
RTWStorageClass "Auto"
DataLoggingNameMode "SignalName"
}
System {
Name "plant"
Location [402, 297, 1073, 449]
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 "u"
Position [40, 53, 70, 67]
IconDisplay "Port number"
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -