# $Revision: 1.1.8.1 $ Model { Name "pendcart_pid" Version 4.00 SampleTimeColors off LibraryLinkDisplay "none" WideLines on ShowLineDimensions off ShowPortDataTypes off ShowStorageClass off ExecutionOrder off RecordCoverage off CovPath "/" CovSaveName "covdata" CovMetricSettings "dw" CovNameIncrementing off CovHtmlReporting on BlockNameDataTip off BlockParametersDataTip off BlockDescriptionStringDataTip off ToolBar on StatusBar on BrowserShowLibraryLinks off BrowserLookUnderMasks off PreLoadFcn "initpend" Created "Tue Sep 14 01:24:40 2004" Creator "The MathWorks Inc." UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" LastModifiedBy "Administrator" ModifiedDateFormat "%" LastModifiedDate "Thu Jun 11 18:53:48 2009" ModelVersionFormat "1.%" ConfigurationManager "None" SimParamPage "Solver" StartTime "0" StopTime "Tfin" SolverMode "SingleTasking" Solver "ode45" RelTol "1e-3" AbsTol "1e-6" Refine "1" MaxStep "0.02" MinStep "auto" MaxNumMinSteps "-1" InitialStep "auto" FixedStep "auto" MaxOrder 5 OutputOption "RefineOutputTimes" OutputTimes "[]" LoadExternalInput off ExternalInput "[]" SaveTime off TimeSaveName "tout" SaveState off StateSaveName "xout" SaveOutput off OutputSaveName "yout" LoadInitialState off InitialState "[]" SaveFinalState off FinalStateName "xFinal" SaveFormat "Array" LimitDataPoints off MaxDataPoints "1000" Decimation "1" AlgebraicLoopMsg "warning" MinStepSizeMsg "warning" UnconnectedInputMsg "warning" UnconnectedOutputMsg "warning" UnconnectedLineMsg "warning" InheritedTsInSrcMsg "warning" SingleTaskRateTransMsg "none" MultiTaskRateTransMsg "error" IntegerOverflowMsg "warning" CheckForMatrixSingularity "none" UnnecessaryDatatypeConvMsg "none" Int32ToFloatConvMsg "warning" InvalidFcnCallConnMsg "error" SignalLabelMismatchMsg "none" LinearizationMsg "none" VectorMatrixConversionMsg "none" SfunCompatibilityCheckMsg "none" BlockPriorityViolationMsg "warning" ArrayBoundsChecking "none" ConsistencyChecking "none" ZeroCross on Profile off SimulationMode "normal" RTWSystemTargetFile "grt.tlc" RTWOptions "-aEnforceIntegerDowncast=1 -aFoldNonRolledExpr=1 -a" "InlineInvariantSignals=1 -aInlineParameters=0 -aLocalBlockOutputs=1 -aRollThr" "eshold=5 -aZeroInternalMemoryAtStartup=1 -aZeroExternalMemoryAtStartup=1 -aIn" "itFltsAndDblsToZero=1 -aGenerateReport=0 -aGenCodeOnly=0 -aRTWVerbose=1 -aInc" "ludeHyperlinkInReport=0 -aLaunchReport=0 -aForceParamTrailComments=0 -aGenera" "teComments=1 -aIgnoreCustomStorageClasses=1 -aIncHierarchyInIds=0 -aMaxRTWIdL" "en=31 -aShowEliminatedStatements=0 -aPrefixModelToSubsysFcnNames=1 -aIncDataT" "ypeInIds=0 -aInsertBlockDesc=0 -aSimulinkBlockComments=1 -aInlinedPrmAccess=" "\"Literals\" -aSuppressErrorStatus=0 -aModelReferenceCompliant=1 -aSupportNo" "nInlinedSFcns=1 -aSupportContinuousTime=1 -aSupportComplex=1 -aSupportNonFini" "te=1 -aSupportAbsoluteTime=1 -aTargetFcnLib=\"ansi_tfl_tmw.mat\" -aMultiInsta" "nceERTCode=0 -aLogVarNameModifier=\"rt_\" -aIsPILTarget=0 -aCombineOutputUpda" "teFcns=0 -aGenerateASAP2=0 -aGenerateSampleERTMain=0 -aGenerateFullHeader=1 -" "aUtilityFuncGeneration=\"Auto\" -aIncludeFileDelimiter=\"Auto\" -aIncludeMdlT" "erminateFcn=1 -aPurelyIntegerCode=0 -aERTCustomFileBanners=0 -aRTWCAPIStates=" "0 -aRTWCAPIParams=0 -aRTWCAPISignals=0 -aMatFileLogging=1 -aGenFloatMathFcnCa" "lls=\"ANSI_C\" -aExtModeMexFile=\"ext_comm\" -aExtModeTransport=0 -aExtModeSt" "aticAllocSize=1000000 -aExtModeTesting=0 -aExtModeStaticAlloc=0 -aExtMode=0 " "-aInitFltsAndDblsToZero=1 " RTWInlineParameters off RTWRetainRTWFile off RTWTemplateMakefile "grt_default_tmf" RTWMakeCommand "make_rtw" RTWGenerateCodeOnly off TLCProfiler off TLCDebug off TLCCoverage off AccelSystemTargetFile "accel.tlc" AccelTemplateMakefile "accel_default_tmf" AccelMakeCommand "make_rtw" TryForcingSFcnDF off ExtModeMexFile "ext_comm" ExtModeBatchMode off ExtModeTrigType "manual" ExtModeTrigMode "normal" ExtModeTrigPort "1" ExtModeTrigElement "any" ExtModeTrigDuration 1000 ExtModeTrigHoldOff 0 ExtModeTrigDelay 0 ExtModeTrigDirection "rising" ExtModeTrigLevel 0 ExtModeArchiveMode "off" ExtModeAutoIncOneShot off ExtModeIncDirWhenArm off ExtModeAddSuffixToVar off ExtModeWriteAllDataToWs off ExtModeArmWhenConnect on ExtModeSkipDownloadWhenConnect off ExtModeLogAll on ExtModeAutoUpdateStatusClock on OptimizeBlockIOStorage on BufferReuse on ParameterPooling on BlockReductionOpt off RTWExpressionDepthLimit 5 BooleanDataType off BlockDefaults { Orientation "right" ForegroundColor "black" BackgroundColor "white" DropShadow off NamePlacement "normal" FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" ShowName on } 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 "pendcart_pid" Location [202, 304, 1156, 652] Open on ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" ReportName "simulink-default.rpt" Block { BlockType Clock Name "Clock" Position [780, 140, 800, 160] ShowName off DisplayTime off Decimation "10" } Block { BlockType DiscretePulseGenerator Name "Disturbo\n(botte all'asta..)1" Position [490, 141, 520, 169] PulseType "Time-based" Amplitude "Botta" Period "PeriodoBotta" PulseWidth "PWBotta" PhaseDelay "DelayBotta" SampleTime "1" VectorParams1D on } Block { BlockType SubSystem Name "Double click here" Ports [] Position [96, 227, 135, 258] BackgroundColor "yellow" DropShadow on OpenFcn "plotpend" ShowPortLabels on TreatAsAtomicUnit off RTWSystemCode "Auto" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" MaskDisplay "disp('PLOT');" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "Double click here" Location [158, 172, 656, 472] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "A4" PaperUnits "centimeters" ZoomFactor "100" } } Block { BlockType SubSystem Name "Init PID" Ports [] Position [96, 142, 135, 173] BackgroundColor "yellow" DropShadow on OpenFcn "load pend_PID_good" ShowPortLabels on TreatAsAtomicUnit off RTWSystemCode "Auto" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" MaskDisplay "disp('INIT');" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "Init PID" Location [158, 172, 656, 472] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "A4" PaperUnits "centimeters" ZoomFactor "100" } } Block { BlockType SubSystem Name "More Info" Ports [] Position [430, 280, 457, 305] DropShadow on ShowName off ShowPortLabels on TreatAsAtomicUnit off RTWSystemCode "Auto" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" MaskDisplay "disp('?')" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "More Info" Location [127, 169, 475, 352] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" Annotation { Position [162, 22] Text "This system simulates a cart carrying an in" "verted\npendulum and displays an animation." } Annotation { Position [162, 67] Text "The animation is created using MATLAB's \nH" "andle Graphics. The animation block is \njust a masked S-function." } Annotation { Position [162, 122] Text "For more information on what the S-function" " \ndoes, look at the functions pendan.m, pend0.m, \nand pendsets.m." } } } Block { BlockType Mux Name "Mux" Ports [4, 1] Position [760, 22, 790, 68] ShowName off Inputs "4" DisplayOption "none" } Block { BlockType SubSystem Name "Pendulum" Ports [2, 4] Position [540, 86, 670, 174] ShowPortLabels on TreatAsAtomicUnit off RTWSystemCode "Auto" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" MaskType "Inverted pendulum on cart" MaskDescription "Look under mask to see dynamics" MaskHelp "Nonlinear dynamics of inverted pendulum on cart" "." MaskDisplay "plot([-10 10],[0 0],[-2 -2 2 2],[0 1 1 0],[0 -2" "],[1 5])" MaskIconFrame on MaskIconOpaque off MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "Pendulum" Location [113, 142, 717, 458] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "A4" PaperUnits "centimeters" ZoomFactor "100" Block { BlockType Inport Name "Force" Position [15, 20, 35, 40] Port "1" LatchInput off Interpolate on } Block { BlockType Inport Name "Torque" Position [25, 200, 45, 220] Port "2" LatchInput off Interpolate on } Block { BlockType Sum Name "Add" Ports [2, 1] Position [260, 150, 280, 170] IconShape "round" Inputs "|++" SaturateOnIntegerOverflow off } Block { BlockType Fcn Name "Fcn1" Position [210, 30, 250, 50] ShowName off Expr "(u[1]/m - g*sin(u[3])*cos(u[3]) + l*power(u" "[2],2)*sin(u[3]))/(M/m + power(sin(u[3]),2))" } Block { BlockType Fcn Name "Fcn2" Position [205, 150, 245, 170] ShowName off Expr "(-u[1]*cos(u[3])/m + (M+m)*g*sin(u[3])/m - " "l*power(u[2],2)*sin(u[3])*cos(u[3]))/(l*(M/m + power(sin(u[3]),2)))" } Block { BlockType Integrator Name "Integrator1" Ports [1, 1] Position [385, 30, 405, 50] ShowName off ExternalReset "none" InitialConditionSource "internal" InitialCondition "x0" LimitOutput off UpperSaturationLimit "inf" LowerSaturationLimit "-inf" ShowSaturationPort off ShowStatePort off AbsoluteTolerance "auto" } Block { BlockType Integrator Name "Integrator2" Ports [1, 1] Position [380, 150, 400, 170] ShowName off ExternalReset "none" InitialConditionSource "internal" InitialCondition "theta0" LimitOutput off UpperSaturationLimit "inf" LowerSaturationLimit "-inf" ShowSaturationPort off ShowStatePort off AbsoluteTolerance "auto" } Block { BlockType Integrator Name "Integrator3" Ports [1, 1] Position [300, 150, 320, 170] ShowName off ExternalReset "none" InitialConditionSource "internal" InitialCondition "0" LimitOutput off UpperSaturationLimit "inf" LowerSaturationLimit "-inf" ShowSaturationPort off ShowStatePort off AbsoluteTolerance "auto" } Block { BlockType Integrator Name "Integrator4" Ports [1, 1] Position [305, 30, 325, 50] ShowName off ExternalReset "none" InitialConditionSource "internal" InitialCondition "0" LimitOutput off UpperSaturationLimit "inf" LowerSaturationLimit "-inf" ShowSaturationPort off ShowStatePort off AbsoluteTolerance "auto" } Block { BlockType Mux Name "Mux" Ports [3, 1] Position [135, 144, 165, 176] ShowName off Inputs "3" DisplayOption "none" } Block { BlockType Mux Name "Mux1" Ports [3, 1] Position [140, 24, 170, 56] ShowName off Inputs "3" DisplayOption "none" } Block { BlockType Outport Name "X" Position [470, 30, 490, 50] Port "1" OutputWhenDisabled "held" InitialOutput "0" } Block { BlockType Outport Name "Xdot" Position [470, 70, 490, 90] Port "2" OutputWhenDisabled "held" InitialOutput "0" } Block { BlockType Outport Name "Theta" Position [475, 150, 495, 170] Port "3" OutputWhenDisabled "held" InitialOutput "0" } Block { BlockType Outport Name "ThetaDot" Position [475, 190, 495, 210] Port "4" OutputWhenDisabled "held" InitialOutput "0" } Line { SrcBlock "Integrator1" SrcPort 1 DstBlock "X" DstPort 1 } Line { SrcBlock "Mux" SrcPort 1 DstBlock "Fcn2" DstPort 1 } Line { SrcBlock "Mux1" SrcPort 1 DstBlock "Fcn1" DstPort 1 } Line { SrcBlock "Fcn1" SrcPort 1 DstBlock "Integrator4" DstPort 1 } Line { SrcBlock "Integrator4" SrcPort 1 Points [20, 0] Branch { DstBlock "Integrator1" DstPort 1 } Branch { Points [0, 40] DstBlock "Xdot" DstPort 1 } } Line { SrcBlock "Force" SrcPort 1 Points [30, 0] Branch { DstBlock "Mux1" DstPort 1 } Branch { Points [0, 120] DstBlock "Mux" DstPort 1 } } Line { SrcBlock "Integrator3" SrcPort 1 Points [0, 0; 20, 0] Branch { DstBlock "Integrator2" DstPort 1 } Branch { Points [0, -35; -270, 0] Branch { Points [0, -85] DstBlock "Mux1" DstPort 2 } Branch { Points [0, 35] DstBlock "Mux" DstPort 2 } } Branch { Points [0, 40] DstBlock "ThetaDot" DstPort 1 } } Line { SrcBlock "Integrator2" SrcPort 1 Points [20, 0] Branch { DstBlock "Theta" DstPort 1 } Branch { Points [0, -50; -335, 0] Branch { Points [0, -60] DstBlock "Mux1" DstPort 3 } Branch { Points [0, 60] DstBlock "Mux" DstPort 3 } } } Line { SrcBlock "Torque" SrcPort 1 Points [220, 0] DstBlock "Add" DstPort 2 } Line { SrcBlock "Add" SrcPort 1 DstBlock "Integrator3" DstPort 1 } Line { SrcBlock "Fcn2" SrcPort 1 DstBlock "Add" DstPort 1 } } } Block { BlockType Reference Name "Position\nController" Ports [1, 1] Position [305, 80, 335, 110] SourceBlock "simulink_extras/Additional\nLinear/PID Controll" "er" SourceType "PID Controller" P "KPx" I "KIx" D "KDx" } Block { BlockType Reference Name "Position\nController1" Ports [1, 1] Position [305, 140, 335, 170] SourceBlock "simulink_extras/Additional\nLinear/PID Controll" "er" SourceType "PID Controller" P "KPa" I "KIa" D "KDa" } Block { BlockType RandomNumber Name "Random\nNumber" Position [345, 170, 375, 200] Mean "0" Variance "0.05" Seed "0" SampleTime "0.1" VectorParams1D on } Block { BlockType Saturate Name "Saturation" Position [430, 94, 460, 126] UpperLimit "Fmax" LowerLimit "-Fmax" LinearizeAsGain on } Block { BlockType Scope Name "Scope" Ports [1] Position [565, 197, 595, 213] Floating off Location [5, 49, 1285, 997] Open off NumInputPorts "1" TickLabels "OneTimeTick" ZoomMode "on" List { ListType AxesTitles axes1 "%" } Grid "on" TimeRange "auto" YMin "-20" YMax "20" SaveToWorkspace off SaveName "ScopeData" DataFormat "StructureWithTime" LimitDataPoints off MaxDataPoints "5000" Decimation "1" SampleInput off SampleTime "0" } Block { BlockType Scope Name "Scope1" Ports [1] Position [335, 17, 365, 33] Floating off Location [5, 49, 1285, 997] Open off NumInputPorts "1" TickLabels "OneTimeTick" ZoomMode "on" List { ListType AxesTitles axes1 "%" } Grid "on" TimeRange "auto" YMin "-20" YMax "20" SaveToWorkspace off SaveName "ScopeData1" DataFormat "StructureWithTime" LimitDataPoints off MaxDataPoints "5000" Decimation "1" SampleInput off SampleTime "0" } Block { BlockType Step Name "Step" Position [130, 75, 160, 105] Time "TstepX" Before "0" After "StepX" SampleTime "0" VectorParams1D on } Block { BlockType Sum Name "Sum1" Ports [3, 1] Position [380, 115, 400, 135] ShowName off IconShape "round" Inputs "++-" SaturateOnIntegerOverflow on } Block { BlockType Sum Name "Sum2" Ports [2, 1] Position [260, 85, 280, 105] ShowName off IconShape "rectangular" Inputs "+-" SaturateOnIntegerOverflow on } Block { BlockType Terminator Name "Terminator" Position [690, 152, 705, 168] } Block { BlockType Terminator Name "Terminator1" Position [690, 112, 705, 128] } Block { BlockType ToWorkspace Name "To Workspace" Position [845, 96, 880, 114] ShowName off VariableName "ypid" MaxDataPoints "inf" Decimation "1" SampleTime "0" SaveFormat "Array" } Block { BlockType ToWorkspace Name "To Workspace1" Position [845, 141, 880, 159] ShowName off VariableName "tpid" MaxDataPoints "inf" Decimation "1" SampleTime "0" SaveFormat "Array" } Line { SrcBlock "Mux" SrcPort 1 Points [10, 0; 0, 60] DstBlock "To Workspace" DstPort 1 } Line { SrcBlock "Clock" SrcPort 1 DstBlock "To Workspace1" DstPort 1 } Line { SrcBlock "Pendulum" SrcPort 1 Points [5, 0] Branch { Points [0, -60] DstBlock "Mux" DstPort 2 } Branch { Points [50, 0; 0, 135; -525, 0; 0, -135] DstBlock "Sum2" DstPort 2 } } Line { SrcBlock "Pendulum" SrcPort 3 Points [65, 0] Branch { Points [0, -110] DstBlock "Mux" DstPort 1 } Branch { Points [0, 115; -510, 0; 0, -100] DstBlock "Position\nController1" DstPort 1 } } Line { SrcBlock "Saturation" SrcPort 1 Points [5, 0] Branch { Points [0, 95] DstBlock "Scope" DstPort 1 } Branch { Points [0, -60] DstBlock "Mux" DstPort 3 } Branch { DstBlock "Pendulum" DstPort 1 } } Line { SrcBlock "Sum1" SrcPort 1 Points [0, -15] DstBlock "Saturation" DstPort 1 } Line { SrcBlock "Disturbo\n(botte all'asta..)1" SrcPort 1 DstBlock "Pendulum" DstPort 2 } Line { SrcBlock "Step" SrcPort 1 Points [50, 0] Branch { Points [0, -30] DstBlock "Mux" DstPort 4 } Branch { DstBlock "Sum2" DstPort 1 } } Line { SrcBlock "Sum2" SrcPort 1 Points [5, 0] Branch { DstBlock "Position\nController" DstPort 1 } Branch { Points [0, -70] DstBlock "Scope1" DstPort 1 } } Line { SrcBlock "Pendulum" SrcPort 4 DstBlock "Terminator" DstPort 1 } Line { SrcBlock "Pendulum" SrcPort 2 DstBlock "Terminator1" DstPort 1 } Line { SrcBlock "Position\nController" SrcPort 1 Points [50, 0] DstBlock "Sum1" DstPort 1 } Line { SrcBlock "Position\nController1" SrcPort 1 Points [10, 0; 0, -30] DstBlock "Sum1" DstPort 2 } Line { SrcBlock "Random\nNumber" SrcPort 1 Points [10, 0] DstBlock "Sum1" DstPort 3 } Annotation { Position [313, 292] Text "Inverted pendulum on cart with Animation\n(Doub" "le click on the \"?\" for more info)" } } }