Model { Name "balancingRobot_LQR" Version 7.5 MdlSubVersion 0 GraphicalInterface { NumRootInports 0 NumRootOutports 0 ParameterArgumentNames "" ComputedModelVersion "1.101" NumModelReferences 0 NumTestPointedSignals 0 } SavedCharacterEncoding "windows-949" SaveDefaultBlockParams on ScopeRefreshTime 0.035000 OverrideScopeRefreshTime on DisableAllScopes off DataTypeOverride "UseLocalSettings" MinMaxOverflowLogging "UseLocalSettings" MinMaxOverflowArchiveMode "Overwrite" MaxMDLFileLineLength 120 Created "Tue Jul 13 10:33:37 2010" Creator "JEoncy" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" LastModifiedBy "page365" ModifiedDateFormat "%" LastModifiedDate "Mon Jul 04 18:23:35 2011" RTWModifiedTimeStamp 231704540 ModelVersionFormat "1.%" ConfigurationManager "None" SampleTimeColors off SampleTimeAnnotations off LibraryLinkDisplay "none" WideLines off ShowLineDimensions off ShowPortDataTypes off ShowLoopsOnError on IgnoreBidirectionalLines off ShowStorageClass off ShowTestPointIcons on ShowSignalResolutionIcons on ShowViewerIcons on SortedOrder off ExecutionContextIcon off ShowLinearizationAnnotations on BlockNameDataTip off BlockParametersDataTip off BlockDescriptionStringDataTip off ToolBar on StatusBar on BrowserShowLibraryLinks off BrowserLookUnderMasks off SimulationMode "normal" LinearizationMsg "none" Profile off ParamWorkspaceSource "MATLABWorkspace" AccelSystemTargetFile "accel.tlc" AccelTemplateMakefile "accel_default_tmf" AccelMakeCommand "make_rtw" TryForcingSFcnDF off RecordCoverage off CovPath "/" CovSaveName "covdata" CovMetricSettings "dw" CovNameIncrementing off CovHtmlReporting on CovForceBlockReductionOff on covSaveCumulativeToWorkspaceVar on CovSaveSingleToWorkspaceVar on CovCumulativeVarName "covCumulativeData" CovCumulativeReport off CovReportOnPause on CovModelRefEnable "Off" CovExternalEMLEnable off ExtModeBatchMode off ExtModeEnableFloating on ExtModeTrigType "manual" ExtModeTrigMode "normal" ExtModeTrigPort "1" ExtModeTrigElement "any" ExtModeTrigDuration 1000 ExtModeTrigDurationFloating "auto" 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 BufferReuse on ShowModelReferenceBlockVersion off ShowModelReferenceBlockIO off Array { Type "Handle" Dimension 1 Simulink.ConfigSet { $ObjectID 1 Version "1.10.0" Array { Type "Handle" Dimension 9 Simulink.SolverCC { $ObjectID 2 Version "1.10.0" StartTime "0.0" StopTime "10" AbsTol "auto" FixedStep "auto" InitialStep "auto" MaxNumMinSteps "-1" MaxOrder 5 ZcThreshold "auto" ConsecutiveZCsStepRelTol "10*128*eps" MaxConsecutiveZCs "1000" ExtrapolationOrder 4 NumberNewtonIterations 1 MaxStep "auto" MinStep "auto" MaxConsecutiveMinStep "1" RelTol "1e-3" SolverMode "Auto" Solver "ode45" SolverName "ode45" SolverJacobianMethodControl "auto" ShapePreserveControl "DisableAll" ZeroCrossControl "UseLocalSettings" ZeroCrossAlgorithm "Nonadaptive" AlgebraicLoopSolver "TrustRegion" SolverResetMethod "Fast" PositivePriorityOrder off AutoInsertRateTranBlk off SampleTimeConstraint "Unconstrained" InsertRTBMode "Whenever possible" } Simulink.DataIOCC { $ObjectID 3 Version "1.10.0" Decimation "1" ExternalInput "[t, u]" FinalStateName "xFinal" InitialState "xInitial" LimitDataPoints on MaxDataPoints "1000" LoadExternalInput off LoadInitialState off SaveFinalState off SaveCompleteFinalSimState off SaveFormat "Array" SaveOutput on SaveState off SignalLogging on DSMLogging on InspectSignalLogs off SaveTime on ReturnWorkspaceOutputs off StateSaveName "xout" TimeSaveName "tout" OutputSaveName "yout" SignalLoggingName "logsout" DSMLoggingName "dsmout" OutputOption "RefineOutputTimes" OutputTimes "[]" ReturnWorkspaceOutputsName "out" Refine "1" } Simulink.OptimizationCC { $ObjectID 4 Version "1.10.0" Array { Type "Cell" Dimension 7 Cell "BooleansAsBitfields" Cell "PassReuseOutputArgsAs" Cell "PassReuseOutputArgsThreshold" Cell "ZeroExternalMemoryAtStartup" Cell "ZeroInternalMemoryAtStartup" Cell "OptimizeModelRefInitCode" Cell "NoFixptDivByZeroProtection" PropName "DisabledProps" } BlockReduction on BooleanDataType on ConditionallyExecuteInputs on InlineParams off UseIntDivNetSlope off InlineInvariantSignals off OptimizeBlockIOStorage on BufferReuse on EnhancedBackFolding off StrengthReduction off EnforceIntegerDowncast on ExpressionFolding on BooleansAsBitfields off BitfieldContainerType "uint_T" EnableMemcpy on MemcpyThreshold 64 PassReuseOutputArgsAs "Structure reference" ExpressionDepthLimit 2147483647 FoldNonRolledExpr on LocalBlockOutputs on RollThreshold 5 SystemCodeInlineAuto off StateBitsets off DataBitsets off UseTempVars off ZeroExternalMemoryAtStartup on ZeroInternalMemoryAtStartup on InitFltsAndDblsToZero off NoFixptDivByZeroProtection off EfficientFloat2IntCast off EfficientMapNaN2IntZero on OptimizeModelRefInitCode off LifeSpan "inf" MaxStackSize "Inherit from target" BufferReusableBoundary on SimCompilerOptimization "Off" AccelVerboseBuild off } Simulink.DebuggingCC { $ObjectID 5 Version "1.10.0" RTPrefix "error" ConsistencyChecking "none" ArrayBoundsChecking "none" SignalInfNanChecking "none" SignalRangeChecking "none" ReadBeforeWriteMsg "UseLocalSettings" WriteAfterWriteMsg "UseLocalSettings" WriteAfterReadMsg "UseLocalSettings" AlgebraicLoopMsg "warning" ArtificialAlgebraicLoopMsg "warning" SaveWithDisabledLinksMsg "warning" SaveWithParameterizedLinksMsg "warning" CheckSSInitialOutputMsg on UnderspecifiedInitializationDetection "Classic" MergeDetectMultiDrivingBlocksExec "none" CheckExecutionContextPreStartOutputMsg off CheckExecutionContextRuntimeOutputMsg off SignalResolutionControl "UseLocalSettings" BlockPriorityViolationMsg "warning" MinStepSizeMsg "warning" TimeAdjustmentMsg "none" MaxConsecutiveZCsMsg "error" SolverPrmCheckMsg "warning" InheritedTsInSrcMsg "warning" DiscreteInheritContinuousMsg "warning" MultiTaskDSMMsg "error" MultiTaskCondExecSysMsg "error" MultiTaskRateTransMsg "error" SingleTaskRateTransMsg "none" TasksWithSamePriorityMsg "warning" SigSpecEnsureSampleTimeMsg "warning" CheckMatrixSingularityMsg "none" IntegerOverflowMsg "warning" Int32ToFloatConvMsg "warning" ParameterDowncastMsg "error" ParameterOverflowMsg "error" ParameterUnderflowMsg "none" ParameterPrecisionLossMsg "warning" ParameterTunabilityLossMsg "warning" FixptConstUnderflowMsg "none" FixptConstOverflowMsg "none" FixptConstPrecisionLossMsg "none" UnderSpecifiedDataTypeMsg "none" UnnecessaryDatatypeConvMsg "none" VectorMatrixConversionMsg "none" InvalidFcnCallConnMsg "error" FcnCallInpInsideContextMsg "Use local settings" SignalLabelMismatchMsg "none" UnconnectedInputMsg "warning" UnconnectedOutputMsg "warning" UnconnectedLineMsg "warning" SFcnCompatibilityMsg "none" UniqueDataStoreMsg "none" BusObjectLabelMismatch "warning" RootOutportRequireBusObject "warning" AssertControl "UseLocalSettings" EnableOverflowDetection off ModelReferenceIOMsg "none" ModelReferenceVersionMismatchMessage "none" ModelReferenceIOMismatchMessage "none" ModelReferenceCSMismatchMessage "none" UnknownTsInhSupMsg "warning" ModelReferenceDataLoggingMessage "warning" ModelReferenceSymbolNameMessage "warning" ModelReferenceExtraNoncontSigs "error" StateNameClashWarn "warning" SimStateInterfaceChecksumMismatchMsg "warning" StrictBusMsg "ErrorLevel1" BusNameAdapt "WarnAndRepair" NonBusSignalsTreatedAsBus "none" LoggingUnavailableSignals "error" BlockIODiagnostic "none" } Simulink.HardwareCC { $ObjectID 6 Version "1.10.0" ProdBitPerChar 8 ProdBitPerShort 16 ProdBitPerInt 32 ProdBitPerLong 32 ProdIntDivRoundTo "Undefined" ProdEndianess "Unspecified" ProdWordSize 32 ProdShiftRightIntArith on ProdHWDeviceType "32-bit Generic" TargetBitPerChar 8 TargetBitPerShort 16 TargetBitPerInt 32 TargetBitPerLong 32 TargetShiftRightIntArith on TargetIntDivRoundTo "Undefined" TargetEndianess "Unspecified" TargetWordSize 32 TargetTypeEmulationWarnSuppressLevel 0 TargetPreprocMaxBitsSint 32 TargetPreprocMaxBitsUint 32 TargetHWDeviceType "Specified" TargetUnknown off ProdEqTarget on } Simulink.ModelReferenceCC { $ObjectID 7 Version "1.10.0" UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange" CheckModelReferenceTargetMessage "error" EnableParallelModelReferenceBuilds off ParallelModelReferenceMATLABWorkerInit "None" ModelReferenceNumInstancesAllowed "Multi" PropagateVarSize "Infer from blocks in model" ModelReferencePassRootInputsByReference on ModelReferenceMinAlgLoopOccurrences off PropagateSignalLabelsOutOfModel off SupportModelReferenceSimTargetCustomCode off } Simulink.SFSimCC { $ObjectID 8 Version "1.10.0" SFSimEnableDebug on SFSimOverflowDetection on SFSimEcho on SimBlas on SimCtrlC on SimExtrinsic on SimIntegrity on SimUseLocalCustomCode off SimBuildMode "sf_incremental_build" } Simulink.RTWCC { $BackupClass "Simulink.RTWCC" $ObjectID 9 Version "1.10.0" Array { Type "Cell" Dimension 6 Cell "IncludeHyperlinkInReport" Cell "GenerateTraceInfo" Cell "GenerateTraceReport" Cell "GenerateTraceReportSl" Cell "GenerateTraceReportSf" Cell "GenerateTraceReportEml" PropName "DisabledProps" } SystemTargetFile "grt.tlc" GenCodeOnly off MakeCommand "make_rtw" GenerateMakefile on TemplateMakefile "grt_default_tmf" GenerateReport off SaveLog off RTWVerbose on RetainRTWFile off ProfileTLC off TLCDebug off TLCCoverage off TLCAssert off ProcessScriptMode "Default" ConfigurationMode "Optimized" ConfigAtBuild off RTWUseLocalCustomCode off RTWUseSimCustomCode off IncludeHyperlinkInReport off LaunchReport off TargetLang "C" IncludeBusHierarchyInRTWFileBlockHierarchyMap off IncludeERTFirstTime off GenerateTraceInfo off GenerateTraceReport off GenerateTraceReportSl off GenerateTraceReportSf off GenerateTraceReportEml off GenerateCodeInfo off RTWCompilerOptimization "Off" CheckMdlBeforeBuild "Off" CustomRebuildMode "OnUpdate" Array { Type "Handle" Dimension 2 Simulink.CodeAppCC { $ObjectID 10 Version "1.10.0" Array { Type "Cell" Dimension 19 Cell "IgnoreCustomStorageClasses" Cell "IgnoreTestpoints" Cell "InsertBlockDesc" Cell "SFDataObjDesc" Cell "SimulinkDataObjDesc" Cell "DefineNamingRule" Cell "SignalNamingRule" Cell "ParamNamingRule" Cell "InlinedPrmAccess" Cell "CustomSymbolStr" Cell "CustomSymbolStrGlobalVar" Cell "CustomSymbolStrType" Cell "CustomSymbolStrField" Cell "CustomSymbolStrFcn" Cell "CustomSymbolStrFcnArg" Cell "CustomSymbolStrBlkIO" Cell "CustomSymbolStrTmpVar" Cell "CustomSymbolStrMacro" Cell "ReqsInCode" PropName "DisabledProps" } ForceParamTrailComments off GenerateComments on IgnoreCustomStorageClasses on IgnoreTestpoints off IncHierarchyInIds off MaxIdLength 31 PreserveName off PreserveNameWithParent off ShowEliminatedStatement off IncAutoGenComments off SimulinkDataObjDesc off SFDataObjDesc off IncDataTypeInIds off MangleLength 1 CustomSymbolStrGlobalVar "$R$N$M" CustomSymbolStrType "$N$R$M" CustomSymbolStrField "$N$M" CustomSymbolStrFcn "$R$N$M$F" CustomSymbolStrFcnArg "rt$I$N$M" CustomSymbolStrBlkIO "rtb_$N$M" CustomSymbolStrTmpVar "$N$M" CustomSymbolStrMacro "$R$N$M" DefineNamingRule "None" ParamNamingRule "None" SignalNamingRule "None" InsertBlockDesc off SimulinkBlockComments on EnableCustomComments off InlinedPrmAccess "Literals" ReqsInCode off UseSimReservedNames off } Simulink.GRTTargetCC { $BackupClass "Simulink.TargetCC" $ObjectID 11 Version "1.10.0" Array { Type "Cell" Dimension 17 Cell "GeneratePreprocessorConditionals" Cell "IncludeMdlTerminateFcn" Cell "CombineOutputUpdateFcns" Cell "SuppressErrorStatus" Cell "ERTCustomFileBanners" Cell "GenerateSampleERTMain" Cell "GenerateTestInterfaces" Cell "ModelStepFunctionPrototypeControlCompliant" Cell "CPPClassGenCompliant" Cell "MultiInstanceERTCode" Cell "PurelyIntegerCode" Cell "SupportNonFinite" Cell "SupportComplex" Cell "SupportAbsoluteTime" Cell "SupportContinuousTime" Cell "SupportNonInlinedSFcns" Cell "PortableWordSizes" PropName "DisabledProps" } TargetFcnLib "ansi_tfl_table_tmw.mat" TargetLibSuffix "" TargetPreCompLibLocation "" TargetFunctionLibrary "ANSI_C" UtilityFuncGeneration "Auto" ERTMultiwordTypeDef "System defined" ERTCodeCoverageTool "None" ERTMultiwordLength 256 MultiwordLength 2048 GenerateFullHeader on GenerateSampleERTMain off GenerateTestInterfaces off IsPILTarget off ModelReferenceCompliant on ParMdlRefBuildCompliant on CompOptLevelCompliant on IncludeMdlTerminateFcn on GeneratePreprocessorConditionals "Disable all" CombineOutputUpdateFcns off SuppressErrorStatus off ERTFirstTimeCompliant off IncludeFileDelimiter "Auto" ERTCustomFileBanners off SupportAbsoluteTime on LogVarNameModifier "rt_" MatFileLogging on MultiInstanceERTCode off SupportNonFinite on SupportComplex on PurelyIntegerCode off SupportContinuousTime on SupportNonInlinedSFcns on SupportVariableSizeSignals off EnableShiftOperators on ParenthesesLevel "Nominal" PortableWordSizes off ModelStepFunctionPrototypeControlCompliant off CPPClassGenCompliant off AutosarCompliant off UseMalloc off ExtMode off ExtModeStaticAlloc off ExtModeTesting off ExtModeStaticAllocSize 1000000 ExtModeTransport 0 ExtModeMexFile "ext_comm" ExtModeIntrfLevel "Level1" RTWCAPISignals off RTWCAPIParams off RTWCAPIStates off GenerateASAP2 off } PropName "Components" } } hdlcoderui.hdlcc { $ObjectID 12 Version "1.10.0" Description "HDL Coder custom configuration component" Name "HDL Coder" } PropName "Components" } Name "Configuration" CurrentDlgPage "Solver" ConfigPrmDlgPosition " [ 200, 85, 1080, 715 ] " } PropName "ConfigurationSets" } Simulink.ConfigSet { $PropName "ActiveConfigurationSet" $ObjectID 1 } BlockDefaults { ForegroundColor "black" BackgroundColor "white" DropShadow off NamePlacement "normal" FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" ShowName on BlockRotation 0 BlockMirror off } AnnotationDefaults { HorizontalAlignment "center" VerticalAlignment "middle" ForegroundColor "black" BackgroundColor "white" DropShadow off FontName "Helvetica" FontSize 10 FontWeight "normal" FontAngle "normal" UseDisplayTextAsClickCallback off } LineDefaults { FontName "Helvetica" FontSize 9 FontWeight "normal" FontAngle "normal" } BlockParameterDefaults { Block { BlockType Constant Value "1" VectorParams1D on SamplingMode "Sample based" OutMin "[]" OutMax "[]" OutDataTypeMode "Inherit from 'Constant value'" OutDataType "fixdt(1,16,0)" ConRadixGroup "Use specified scaling" OutScaling "[]" OutDataTypeStr "Inherit: Inherit from 'Constant value'" LockScale off SampleTime "inf" FramePeriod "inf" PreserveConstantTs off } Block { BlockType Demux Outputs "4" DisplayOption "none" BusSelectionMode off } Block { BlockType DiscretePulseGenerator PulseType "Sample based" TimeSource "Use simulation time" VectorParams1D on } Block { BlockType Fcn Expr "sin(u[1])" SampleTime "-1" } Block { BlockType Gain Gain "1" Multiplication "Element-wise(K.*u)" ParamMin "[]" ParamMax "[]" ParameterDataTypeMode "Same as input" ParameterDataType "fixdt(1,16,0)" ParameterScalingMode "Best Precision: Matrix-wise" ParameterScaling "[]" ParamDataTypeStr "Inherit: Same as input" OutMin "[]" OutMax "[]" OutDataTypeMode "Same as input" OutDataType "fixdt(1,16,0)" OutScaling "[]" OutDataTypeStr "Inherit: Same as input" LockScale off RndMeth "Floor" SaturateOnIntegerOverflow on SampleTime "-1" } Block { BlockType Inport Port "1" UseBusObject off BusObject "BusObject" BusOutputAsStruct off PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" OutMin "[]" OutMax "[]" DataType "auto" OutDataType "fixdt(1,16,0)" OutScaling "[]" OutDataTypeStr "Inherit: auto" LockScale off SignalType "auto" SamplingMode "auto" LatchByDelayingOutsideSignal off LatchInputForFeedbackSignals off Interpolate on } Block { BlockType Integrator ExternalReset "none" InitialConditionSource "internal" InitialCondition "0" LimitOutput off UpperSaturationLimit "inf" LowerSaturationLimit "-inf" ShowSaturationPort off ShowStatePort off AbsoluteTolerance "auto" IgnoreLimit off ZeroCross on ContinuousStateAttributes "''" } Block { BlockType Mux Inputs "4" DisplayOption "none" UseBusObject off BusObject "BusObject" NonVirtualBus off } Block { BlockType Outport Port "1" UseBusObject off BusObject "BusObject" BusOutputAsStruct off PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" OutMin "[]" OutMax "[]" DataType "auto" OutDataType "fixdt(1,16,0)" OutScaling "[]" OutDataTypeStr "Inherit: auto" LockScale off SignalType "auto" SamplingMode "auto" SourceOfInitialOutputValue "Dialog" OutputWhenDisabled "held" InitialOutput "[]" } Block { BlockType "S-Function" FunctionName "system" SFunctionModules "''" PortCounts "[]" SFunctionDeploymentMode off } Block { BlockType Saturate UpperLimit "0.5" LowerLimit "-0.5" LinearizeAsGain on ZeroCross on SampleTime "-1" OutMin "[]" OutMax "[]" OutDataTypeMode "Same as input" OutDataType "fixdt(1,16,0)" OutScaling "[]" OutDataTypeStr "Inherit: Same as input" LockScale off RndMeth "Floor" } 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 "FromPortIcon" Permissions "ReadWrite" PermitHierarchicalResolution "All" TreatAsAtomicUnit off CheckFcnCallInpInsideContextMsg 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 "++" CollapseMode "All dimensions" CollapseDim "1" InputSameDT on AccumDataTypeStr "Inherit: Inherit via internal rule" OutMin "[]" OutMax "[]" OutDataTypeMode "Same as first input" OutDataType "fixdt(1,16,0)" OutScaling "[]" OutDataTypeStr "Inherit: Same as first input" LockScale off RndMeth "Floor" SaturateOnIntegerOverflow on SampleTime "-1" } Block { BlockType Terminator } } System { Name "balancingRobot_LQR" Location [1588, 142, 2411, 543] Open on ModelBrowserVisibility off ModelBrowserWidth 212 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "a4letter" PaperUnits "centimeters" TiledPaperMargins [1.270000, 1.270000, 1.270000, 1.270000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" ReportName "simulink-default.rpt" SIDHighWatermark 145 Block { BlockType SubSystem Name "Balancing Robot\nSimulator" SID 124 Ports [2, 2] Position [585, 78, 665, 242] MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off System { Name "Balancing Robot\nSimulator" Location [1674, 335, 2368, 627] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "A4" PaperUnits "centimeters" TiledPaperMargins [1.270000, 1.270000, 1.270000, 1.270000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Inport Name "V_l" SID 125 Position [20, 183, 50, 197] IconDisplay "Port number" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Inport Name "V_r" SID 126 Position [20, 228, 50, 242] Port "2" IconDisplay "Port number" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Integrator Name "Integrator" SID 128 Ports [1, 1] Position [425, 130, 455, 160] } Block { BlockType Integrator Name "Integrator1" SID 129 Ports [1, 1] Position [505, 130, 535, 160] InitialCondition "[0 0 0]" } Block { BlockType SubSystem Name "Motor" SID 130 Ports [3, 1] Position [90, 123, 205, 257] LibraryVersion "1.31" PermitHierarchicalResolution "ExplicitOnly" TreatAsAtomicUnit on MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off Array { Type "Handle" Dimension 0 PropName "AvailSigsLoadSave" } RequestExecContextInheritance off MaskHideContents off MaskType "Stateflow" MaskDescription "Embedded MATLAB block" MaskDisplay "disp('Motor');" MaskSelfModifiable on MaskIconFrame on MaskIconOpaque off MaskIconRotate "none" MaskPortRotate "default" MaskIconUnits "autoscale" System { Name "Motor" Location [257, 457, 812, 717] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "A4" PaperUnits "centimeters" TiledPaperMargins [1.270000, 1.270000, 1.270000, 1.270000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" SIDHighWatermark 24 Block { BlockType Inport Name "Y_dot" SID 1 Position [20, 101, 40, 119] IconDisplay "Port number" OutDataType "sfix(16)" OutScaling "2^0" } Block { BlockType Inport Name "v_l" SID 23 Position [20, 136, 40, 154] Port "2" IconDisplay "Port number" } Block { BlockType Inport Name "v_r" SID 24 Position [20, 171, 40, 189] Port "3" IconDisplay "Port number" } Block { BlockType Demux Name " Demux " SID 15 Ports [1, 1] Position [270, 330, 320, 370] Outputs "1" } Block { BlockType "S-Function" Name " SFunction " SID 14 Tag "Stateflow S-Function balancingRobot_LQR 1" Ports [3, 2] Position [180, 121, 230, 329] FunctionName "sf_sfun" PortCounts "[3 2]" EnableBusSupport on Port { PortNumber 2 Name "Torque" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Terminator Name " Terminator " SID 17 Position [460, 341, 480, 359] } Block { BlockType Outport Name "Torque" SID 5 Position [460, 101, 480, 119] IconDisplay "Port number" OutDataType "sfix(16)" OutScaling "2^0" } Line { SrcBlock " SFunction " SrcPort 1 DstBlock " Demux " DstPort 1 } Line { SrcBlock "Y_dot" SrcPort 1 DstBlock " SFunction " DstPort 1 } Line { SrcBlock "v_l" SrcPort 1 DstBlock " SFunction " DstPort 2 } Line { SrcBlock "v_r" SrcPort 1 DstBlock " SFunction " DstPort 3 } Line { Name "Torque" Labels [0, 0] SrcBlock " SFunction " SrcPort 2 DstBlock "Torque" DstPort 1 } Line { SrcBlock " Demux " SrcPort 1 DstBlock " Terminator " DstPort 1 } } } Block { BlockType SubSystem Name "Robot" SID 131 Ports [3, 1] Position [260, 76, 375, 214] LibraryVersion "1.31" PermitHierarchicalResolution "ExplicitOnly" TreatAsAtomicUnit on MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off Array { Type "Handle" Dimension 0 PropName "AvailSigsLoadSave" } RequestExecContextInheritance off MaskHideContents off MaskType "Stateflow" MaskDescription "Embedded MATLAB block" MaskDisplay "disp('Robot');" MaskSelfModifiable on MaskIconFrame on MaskIconOpaque off MaskIconRotate "none" MaskPortRotate "default" MaskIconUnits "autoscale" System { Name "Robot" Location [257, 457, 812, 717] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "A4" PaperUnits "centimeters" TiledPaperMargins [1.270000, 1.270000, 1.270000, 1.270000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" SIDHighWatermark 21 Block { BlockType Inport Name "Y_dot" SID 18 Position [20, 101, 40, 119] IconDisplay "Port number" } Block { BlockType Inport Name "Y" SID 1 Position [20, 136, 40, 154] Port "2" IconDisplay "Port number" OutDataType "sfix(16)" OutScaling "2^0" } Block { BlockType Inport Name "T" SID 21 Position [20, 171, 40, 189] Port "3" IconDisplay "Port number" } Block { BlockType Demux Name " Demux " SID 15 Ports [1, 1] Position [270, 335, 320, 375] Outputs "1" } Block { BlockType "S-Function" Name " SFunction " SID 14 Tag "Stateflow S-Function balancingRobot_LQR 2" Ports [3, 2] Position [180, 125, 230, 335] FunctionName "sf_sfun" PortCounts "[3 2]" EnableBusSupport on Port { PortNumber 2 Name "Y_2dot" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Terminator Name " Terminator " SID 17 Position [460, 346, 480, 364] } Block { BlockType Outport Name "Y_2dot" SID 5 Position [460, 101, 480, 119] IconDisplay "Port number" OutDataType "sfix(16)" OutScaling "2^0" } Line { SrcBlock " SFunction " SrcPort 1 DstBlock " Demux " DstPort 1 } Line { SrcBlock "Y_dot" SrcPort 1 DstBlock " SFunction " DstPort 1 } Line { SrcBlock "Y" SrcPort 1 DstBlock " SFunction " DstPort 2 } Line { SrcBlock "T" SrcPort 1 DstBlock " SFunction " DstPort 3 } Line { Name "Y_2dot" Labels [0, 0] SrcBlock " SFunction " SrcPort 2 DstBlock "Y_2dot" DstPort 1 } Line { SrcBlock " Demux " SrcPort 1 DstBlock " Terminator " DstPort 1 } } } Block { BlockType Outport Name "Y" SID 133 Position [585, 138, 615, 152] IconDisplay "Port number" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Outport Name "Y_dot" SID 134 Position [585, 178, 615, 192] Port "2" IconDisplay "Port number" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Line { SrcBlock "Integrator" SrcPort 1 Points [15, 0] Branch { DstBlock "Integrator1" DstPort 1 } Branch { Points [0, -95; -230, 0] Branch { DstBlock "Robot" DstPort 1 } Branch { Points [-185, 0; 0, 95] DstBlock "Motor" DstPort 1 } } Branch { Points [0, 40] DstBlock "Y_dot" DstPort 1 } } Line { SrcBlock "Integrator1" SrcPort 1 Points [15, 0] Branch { DstBlock "Y" DstPort 1 } Branch { Points [0, -120; -330, 0; 0, 120] DstBlock "Robot" DstPort 2 } } Line { SrcBlock "Robot" SrcPort 1 DstBlock "Integrator" DstPort 1 } Line { SrcBlock "V_l" SrcPort 1 DstBlock "Motor" DstPort 2 } Line { SrcBlock "V_r" SrcPort 1 DstBlock "Motor" DstPort 3 } Line { SrcBlock "Motor" SrcPort 1 DstBlock "Robot" DstPort 3 } } } Block { BlockType Constant Name "Constant" SID 144 Position [90, 85, 120, 115] Value "0" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Constant Name "Constant1" SID 138 Position [40, 165, 70, 195] Value "0" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Constant Name "Constant2" SID 139 Position [90, 205, 120, 235] Value "0" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Constant Name "Constant3" SID 140 Position [140, 245, 170, 275] Value "0" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Fcn Name "Fcn" SID 36 Position [420, 105, 480, 135] Expr "(u(1)-u(2))/2" } Block { BlockType Fcn Name "Fcn1" SID 37 Position [420, 185, 480, 215] Expr "(u(1)+u(2))/2" } Block { BlockType Gain Name "LQR Gain K" SID 42 Position [295, 145, 360, 175] Gain "K" Multiplication "Matrix(K*u)" ParameterDataTypeMode "Inherit via internal rule" ParameterDataType "fixdt(1, 16)" ParameterScaling "2^0" ParamDataTypeStr "Inherit: Inherit via internal rule" OutDataTypeMode "Inherit via internal rule" OutDataType "fixdt(1, 16)" OutScaling "2^0" OutDataTypeStr "Inherit: Inherit via internal rule" SaturateOnIntegerOverflow off } Block { BlockType Mux Name "Mux1" SID 141 Ports [2, 1] Position [295, 264, 300, 326] BlockMirror on ShowName off Inputs "2" DisplayOption "bar" } Block { BlockType Mux Name "Mux2" SID 33 Ports [6, 1] Position [200, 46, 205, 274] ShowName off Inputs "6" DisplayOption "bar" } Block { BlockType DiscretePulseGenerator Name "Pulse\nGenerator" SID 109 Ports [0, 1] Position [40, 44, 70, 76] PulseType "Time based" Amplitude "pi" Period "10" PulseWidth "50" PhaseDelay "0" SampleTime "1" } Block { BlockType DiscretePulseGenerator Name "Pulse\nGenerator1" SID 143 Ports [0, 1] Position [140, 124, 170, 156] PulseType "Time based" Amplitude "0" Period "10" PulseWidth "20" PhaseDelay "5" SampleTime "1" } Block { BlockType Saturate Name "Saturation" SID 116 Ports [1, 1] Position [520, 105, 550, 135] UpperLimit "20" LowerLimit "-20" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Saturate Name "Saturation1" SID 117 Ports [1, 1] Position [520, 185, 550, 215] UpperLimit "20" LowerLimit "-20" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Sum Name "Sum1" SID 136 Ports [2, 1] Position [240, 150, 260, 170] ShowName off IconShape "round" Inputs "|+-" InputSameDT off OutDataTypeMode "Inherit via internal rule" OutDataType "fixdt(1, 16)" OutScaling "2^0" OutDataTypeStr "Inherit: Inherit via internal rule" SaturateOnIntegerOverflow off } Block { BlockType Scope Name "theta,psi,phi" SID 119 Ports [1] Position [725, 104, 755, 136] Floating off Location [1761, 72, 2420, 514] Open on NumInputPorts "1" List { ListType AxesTitles axes1 "%" } TimeRange "10" YMin "-0.5" YMax "2.5" SaveToWorkspace on SaveName "SimResult" DataFormat "Array" LimitDataPoints off SampleTime "0" } Block { BlockType Scope Name "u1, u2" SID 38 Ports [1] Position [420, 44, 450, 76] NamePlacement "alternate" Floating off Location [1770, 586, 2406, 1054] Open on NumInputPorts "1" List { ListType AxesTitles axes1 "%" } TimeRange "10" YMin "-8" YMax "8" DataFormat "StructureWithTime" SampleTime "0" } Line { SrcBlock "Pulse\nGenerator" SrcPort 1 DstBlock "Mux2" DstPort 1 } Line { SrcBlock "Fcn" SrcPort 1 DstBlock "Saturation" DstPort 1 } Line { SrcBlock "Saturation" SrcPort 1 DstBlock "Balancing Robot\nSimulator" DstPort 1 } Line { SrcBlock "Fcn1" SrcPort 1 DstBlock "Saturation1" DstPort 1 } Line { SrcBlock "Saturation1" SrcPort 1 DstBlock "Balancing Robot\nSimulator" DstPort 2 } Line { SrcBlock "Constant" SrcPort 1 DstBlock "Mux2" DstPort 2 } Line { SrcBlock "LQR Gain K" SrcPort 1 Points [15, 0] Branch { Points [0, 40] DstBlock "Fcn1" DstPort 1 } Branch { Points [0, -40] Branch { DstBlock "Fcn" DstPort 1 } Branch { Points [0, -60] DstBlock "u1, u2" DstPort 1 } } } Line { SrcBlock "Balancing Robot\nSimulator" SrcPort 1 Points [30, 0] Branch { DstBlock "theta,psi,phi" DstPort 1 } Branch { Points [0, 160] DstBlock "Mux1" DstPort 1 } } Line { SrcBlock "Pulse\nGenerator1" SrcPort 1 DstBlock "Mux2" DstPort 3 } Line { SrcBlock "Mux2" SrcPort 1 DstBlock "Sum1" DstPort 1 } Line { SrcBlock "Constant1" SrcPort 1 DstBlock "Mux2" DstPort 4 } Line { SrcBlock "Constant2" SrcPort 1 DstBlock "Mux2" DstPort 5 } Line { SrcBlock "Constant3" SrcPort 1 DstBlock "Mux2" DstPort 6 } Line { SrcBlock "Sum1" SrcPort 1 DstBlock "LQR Gain K" DstPort 1 } Line { SrcBlock "Mux1" SrcPort 1 Points [-40, 0] DstBlock "Sum1" DstPort 2 } Line { SrcBlock "Balancing Robot\nSimulator" SrcPort 2 Points [15, 0; 0, 110] DstBlock "Mux1" DstPort 2 } Annotation { Name "v_l" Position [497, 112] } Annotation { Name "v_r" Position [497, 190] } } } # Finite State Machines # # Stateflow Version 7.5 (R2010a) dated Jan 19 2010, 18:40:00 # # Stateflow { machine { id 1 name "balancingRobot_LQR" created "14-Jul-2010 10:40:12" isLibrary 0 firstTarget 20 sfVersion 75014000 } chart { id 2 name "Balancing Robot\nSimulator/Motor" windowPosition [371.813 264 200.25 189.75] viewLimits [0 156.75 0 153.75] screen [1 1 2560 1600 1.333333333333333] treeNode [0 3 0 0] firstTransition 5 firstJunction 4 viewObj 2 machine 1 toolbarMode LIBRARY_TOOLBAR subviewS { } ssIdHighWaterMark 16 decomposition CLUSTER_CHART type EML_CHART firstData 6 chartFileNumber 1 disableImplicitCasting 1 eml { name "Motor" } } state { id 3 labelString "eML_blk_kernel()" position [18 64.5 118 66] fontSize 12 chart 2 treeNode [2 0 0 0] superState SUBCHART subviewer 2 ssIdNumber 1 type FUNC_STATE decomposition CLUSTER_STATE eml { isEML 1 script "function Torque = Motor(Y_dot, v_l, v_r)\n\nn=50; %Gear ratio\nR=0.2; %Radius of wheel" "\nW=0.3; %Distance between two wheels\nf_m=0.05; %Friction coefficient of wheel axis\n\n% Motor constan" "ts\nRm = 5; \nKt = 0.5;\nKb = 0.5;\n\ntheta_dot = Y_dot(1,1);\npsy_dot = Y_dot(2,1);\nphi_dot = Y_dot(3,1);" "\n\nalpha = n*Kt/Rm; \nbeta = n*Kt*Kb/Rm + f_m; \n\nT_theta = alpha*(v_l + v_r) - 2*beta*(theta_dot - psy_do" "t) - 2*f_m*theta_dot;\nT_psy = -alpha*(v_l + v_r) + 2*beta*(theta_dot - psy_dot);\nT_phi = W/(2*R)*alpha*(v" "_r - v_l) - W^2/(2*R^2)*beta*phi_dot;\n\nTorque = [T_theta T_psy T_phi];" editorLayout "100 M4x1[1552 207 1011 988]" } } junction { id 4 position [23.5747 49.5747 7] chart 2 linkNode [2 0 0] subviewer 2 ssIdNumber 3 type CONNECTIVE_JUNCTION } transition { id 5 labelString "{eML_blk_kernel();}" labelPosition [32.125 19.875 102.544 14.964] fontSize 12 src { intersection [0 0 1 0 23.5747 14.625 0 0] } dst { id 4 intersection [7 0 -1 -1 23.5747 42.5747 0 0] } midPoint [23.5747 24.9468] chart 2 linkNode [2 0 0] dataLimits [23.575 23.575 14.625 34.575] subviewer 2 drawStyle SMART executionOrder 1 ssIdNumber 2 } data { id 6 ssIdNumber 4 name "Y_dot" linkNode [2 0 7] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE } complexity SF_COMPLEX_INHERITED } dataType "Inherit: Same as Simulink" } data { id 7 ssIdNumber 5 name "Torque" linkNode [2 6 8] scope OUTPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE } complexity SF_COMPLEX_INHERITED frame SF_FRAME_NO } dataType "Inherit: Same as Simulink" } data { id 8 ssIdNumber 11 name "v_l" linkNode [2 7 9] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } complexity SF_COMPLEX_INHERITED frame SF_FRAME_INHERITED } dataType "Inherit: Same as Simulink" } data { id 9 ssIdNumber 12 name "v_r" linkNode [2 8 0] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } complexity SF_COMPLEX_INHERITED frame SF_FRAME_INHERITED } dataType "Inherit: Same as Simulink" } instance { id 10 name "Balancing Robot\nSimulator/Motor" machine 1 chart 2 } chart { id 11 name "Balancing Robot\nSimulator/Robot" windowPosition [341.813 294 200.25 189.75] viewLimits [0 156.75 0 153.75] screen [1 1 2560 1600 1.333333333333333] treeNode [0 12 0 0] firstTransition 14 firstJunction 13 viewObj 11 machine 1 toolbarMode LIBRARY_TOOLBAR subviewS { } ssIdHighWaterMark 31 decomposition CLUSTER_CHART type EML_CHART firstData 15 chartFileNumber 2 disableImplicitCasting 1 eml { name "Robot" } } state { id 12 labelString "eML_blk_kernel()" position [18 64.5 118 66] fontSize 12 chart 11 treeNode [11 0 0 0] superState SUBCHART subviewer 11 ssIdNumber 1 type FUNC_STATE decomposition CLUSTER_STATE eml { isEML 1 script "function Y_2dot = Robot(Y_dot, Y, T)\n\ng=9.81;\nm=1; %Mass of motor and wheel\nM=5; " " %Mass of body\nn=50; %Gear ratio\nR=0.2; %Radius of wheel\nL=1.0; %Height of Center of Mass\nW" "=0.3; %Distance between two wheels\nJ_psy=0.1; %Inertia of body (pitch)\nJ_phi=0.1; %Inertia of body (yaw" ")\nJ_w=0.01; %Inertia of Wheel\nJ_m=0.0; %Inertia of motor axis\n\ncfc = 0.0; % cfc - coulomb friction coef" "ficient\nvfc = 0.0; % vfc - viscous friction coefficient\n\nT = T - vfc*Y_dot - cfc*sign(Y_dot);\n\ntheta = Y(1," "1);\npsy = Y(2,1);\nphi = Y(3,1);\n\ntheta_dot = Y_dot(1,1);\npsy_dot = Y_dot(2,1);\nphi_dot = Y_dot(3,1);\n\na_" "11 = (2*m + M)*R^2 + 2*J_w + 2*n^2*J_m;\na_12 = M*L*R*cos(psy) - 2*n^2*J_m;\na_21 = M*L*R*cos(psy) - 2*n^2*J_m;\n" "a_22 = M*L^2 + J_psy + 2*n^2*J_m;\na_33 = 0.5*m*W^2 + J_phi + W^2/(2*R^2)*(J_w + n^2*J_m) + M*L^2*(sin(psy))^2;\n" "\nb_1 = -M*L*R*psy_dot^2*sin(psy);\nb_2 = -M*g*L*sin(psy) - M*L^2*phi_dot^2*sin(psy)*cos(psy);\nb_3 = 2*M*L^2*ps" "y_dot*phi_dot*sin(psy)*cos(psy);\n\nA=[a_11 a_12 0;a_21 a_22 0;0 0 a_33];\nB=[b_1;b_2;b_3];\n\nY_2dot = inv(A)*(" "T-B);\n" editorLayout "100 M4x1[1613 147 1011 988]" } } junction { id 13 position [23.5747 49.5747 7] chart 11 linkNode [11 0 0] subviewer 11 ssIdNumber 3 type CONNECTIVE_JUNCTION } transition { id 14 labelString "{eML_blk_kernel();}" labelPosition [32.125 19.875 102.544 14.964] fontSize 12 src { intersection [0 0 1 0 23.5747 14.625 0 0] } dst { id 13 intersection [7 0 -1 -1 23.5747 42.5747 0 0] } midPoint [23.5747 24.9468] chart 11 linkNode [11 0 0] dataLimits [23.575 23.575 14.625 34.575] subviewer 11 drawStyle SMART executionOrder 1 ssIdNumber 2 } data { id 15 ssIdNumber 6 name "Y_dot" linkNode [11 0 16] scope INPUT_DATA machine 1 props { array { size "3" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } complexity SF_COMPLEX_INHERITED frame SF_FRAME_INHERITED } dataType "Inherit: Same as Simulink" } data { id 16 ssIdNumber 4 name "Y" linkNode [11 15 17] scope INPUT_DATA machine 1 props { array { size "3" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE } complexity SF_COMPLEX_INHERITED } dataType "Inherit: Same as Simulink" } data { id 17 ssIdNumber 5 name "Y_2dot" linkNode [11 16 18] scope OUTPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE } complexity SF_COMPLEX_INHERITED frame SF_FRAME_NO } dataType "Inherit: Same as Simulink" } data { id 18 ssIdNumber 9 name "T" linkNode [11 17 0] scope INPUT_DATA machine 1 props { array { size "3" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } complexity SF_COMPLEX_INHERITED frame SF_FRAME_INHERITED } dataType "Inherit: Same as Simulink" } instance { id 19 name "Balancing Robot\nSimulator/Robot" machine 1 chart 11 } target { id 20 name "sfun" description "Default Simulink S-Function Target." machine 1 linkNode [1 0 0] } }