Model { Name "hand_open_close" Version 6.3 MdlSubVersion 0 GraphicalInterface { NumRootInports 0 NumRootOutports 4 Outport { BusObject "" BusOutputAsStruct "off" Name "Out1" } Outport { BusObject "" BusOutputAsStruct "off" Name "Out2" } Outport { BusObject "" BusOutputAsStruct "off" Name "Out3" } Outport { BusObject "" BusOutputAsStruct "off" Name "Out4" } ParameterArgumentNames "" ComputedModelVersion "1.148" NumModelReferences 0 NumTestPointedSignals 0 } SavedCharacterEncoding "windows-1252" SaveDefaultBlockParams on SampleTimeColors off LibraryLinkDisplay "none" WideLines on ShowLineDimensions off ShowPortDataTypes off ShowLoopsOnError on IgnoreBidirectionalLines off ShowStorageClass off ShowTestPointIcons on ShowViewerIcons on SortedOrder off ExecutionContextIcon off ShowLinearizationAnnotations on RecordCoverage off CovPath "/" CovSaveName "covdata" CovMetricSettings "dw" CovNameIncrementing off CovHtmlReporting on covSaveCumulativeToWorkspaceVar on CovSaveSingleToWorkspaceVar on CovCumulativeVarName "covCumulativeData" CovCumulativeReport off CovReportOnPause on ScopeRefreshTime 0.035000 OverrideScopeRefreshTime on DisableAllScopes off DataTypeOverride "UseLocalSettings" MinMaxOverflowLogging "UseLocalSettings" MinMaxOverflowArchiveMode "Overwrite" BlockNameDataTip off BlockParametersDataTip off BlockDescriptionStringDataTip off ToolBar on StatusBar on BrowserShowLibraryLinks off BrowserLookUnderMasks off Created "Sat Nov 12 12:09:56 2005" UpdateHistory "UpdateHistoryNever" ModifiedByFormat "%" LastModifiedBy "Lab" ModifiedDateFormat "%" LastModifiedDate "Thu Nov 03 10:26:25 2005" ModelVersionFormat "1.%" ConfigurationManager "None" LinearizationMsg "none" Profile off ParamWorkspaceSource "MATLABWorkspace" AccelSystemTargetFile "accel.tlc" AccelTemplateMakefile "accel_default_tmf" AccelMakeCommand "make_rtw" TryForcingSFcnDF 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 off ExtModeSkipDownloadWhenConnect off ExtModeLogAll on ExtModeAutoUpdateStatusClock on BufferReuse off StrictBusMsg "None" ProdHWDeviceType "32-bit xPC Target (Intel Pentium)" ShowModelReferenceBlockVersion off ShowModelReferenceBlockIO off Array { Type "Handle" Dimension 1 Simulink.ConfigSet { $ObjectID 1 Version "1.1.0" Array { Type "Handle" Dimension 7 Simulink.SolverCC { $ObjectID 2 Version "1.1.0" StartTime "0.0" StopTime "500" AbsTol "auto" FixedStep "dt" InitialStep "auto" MaxNumMinSteps "-1" MaxOrder 5 ExtrapolationOrder 4 NumberNewtonIterations 1 MaxStep "auto" MinStep "auto" RelTol "1e-3" SolverMode "Auto" Solver "FixedStepDiscrete" SolverName "FixedStepDiscrete" ZeroCrossControl "UseLocalSettings" AlgebraicLoopSolver "TrustRegion" SolverResetMethod "Fast" PositivePriorityOrder off AutoInsertRateTranBlk off SampleTimeConstraint "Unconstrained" RateTranMode "Deterministic" } Simulink.DataIOCC { $ObjectID 3 Version "1.1.0" Decimation "1" ExternalInput "[t, u]" FinalStateName "xFinal" InitialState "xInitial" LimitDataPoints on MaxDataPoints "1000000" LoadExternalInput off LoadInitialState off SaveFinalState off SaveFormat "Array" SaveOutput on SaveState off SignalLogging on InspectSignalLogs off SaveTime on StateSaveName "xout" TimeSaveName "tout" OutputSaveName "yout" SignalLoggingName "logsout" OutputOption "RefineOutputTimes" OutputTimes "[]" Refine "1" } Simulink.OptimizationCC { $ObjectID 4 Array { Type "Cell" Dimension 8 Cell "ZeroExternalMemoryAtStartup" Cell "ZeroInternalMemoryAtStartup" Cell "InitFltsAndDblsToZero" Cell "OptimizeModelRefInitCode" Cell "NoFixptDivByZeroProtection" Cell "LocalBlockOutputs" Cell "BufferReuse" Cell "ExpressionFolding" PropName "DisabledProps" } Version "1.1.0" BlockReduction off BooleanDataType on ConditionallyExecuteInputs off InlineParams off InlineInvariantSignals off OptimizeBlockIOStorage off BufferReuse off EnforceIntegerDowncast on ExpressionFolding off FoldNonRolledExpr off LocalBlockOutputs off ParameterPooling off RollThreshold 5 SystemCodeInlineAuto off StateBitsets off DataBitsets off UseTempVars off ZeroExternalMemoryAtStartup on ZeroInternalMemoryAtStartup on InitFltsAndDblsToZero on NoFixptDivByZeroProtection off EfficientFloat2IntCast off OptimizeModelRefInitCode off LifeSpan "inf" BufferReusableBoundary on } Simulink.DebuggingCC { $ObjectID 5 Version "1.1.0" RTPrefix "error" ConsistencyChecking "none" ArrayBoundsChecking "none" SignalInfNanChecking "none" ReadBeforeWriteMsg "UseLocalSettings" WriteAfterWriteMsg "UseLocalSettings" WriteAfterReadMsg "UseLocalSettings" AlgebraicLoopMsg "warning" ArtificialAlgebraicLoopMsg "warning" CheckSSInitialOutputMsg on CheckExecutionContextPreStartOutputMsg off CheckExecutionContextRuntimeOutputMsg off SignalResolutionControl "TryResolveAllWithWarning" BlockPriorityViolationMsg "warning" MinStepSizeMsg "warning" SolverPrmCheckMsg "warning" InheritedTsInSrcMsg "warning" DiscreteInheritContinuousMsg "warning" MultiTaskDSMMsg "warning" MultiTaskRateTransMsg "error" SingleTaskRateTransMsg "none" TasksWithSamePriorityMsg "warning" SigSpecEnsureSampleTimeMsg "warning" CheckMatrixSingularityMsg "none" IntegerOverflowMsg "warning" Int32ToFloatConvMsg "warning" ParameterDowncastMsg "error" ParameterOverflowMsg "error" ParameterUnderflowMsg "none" ParameterPrecisionLossMsg "warning" 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" ModelReferenceSimTargetVerbose off UnknownTsInhSupMsg "warning" ModelReferenceDataLoggingMessage "warning" ModelReferenceSymbolNameMessage "warning" ModelReferenceExtraNoncontSigs "error" } Simulink.HardwareCC { $ObjectID 6 Version "1.1.0" ProdBitPerChar 8 ProdBitPerShort 16 ProdBitPerInt 32 ProdBitPerLong 32 ProdIntDivRoundTo "Zero" ProdEndianess "LittleEndian" ProdWordSize 32 ProdShiftRightIntArith on ProdHWDeviceType "32-bit xPC Target (Intel Pentium)" TargetBitPerChar 8 TargetBitPerShort 16 TargetBitPerInt 32 TargetBitPerLong 32 TargetShiftRightIntArith on TargetIntDivRoundTo "Undefined" TargetEndianess "Unspecified" TargetWordSize 32 TargetTypeEmulationWarnSuppressLevel 0 TargetPreprocMaxBitsSint 32 TargetPreprocMaxBitsUint 32 TargetHWDeviceType "32-bit Generic" TargetUnknown off ProdEqTarget off } Simulink.ModelReferenceCC { $ObjectID 7 Version "1.1.0" UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange" CheckModelReferenceTargetMessage "error" ModelReferenceNumInstancesAllowed "Multi" ModelReferencePassRootInputsByReference on ModelReferenceMinAlgLoopOccurrences off } Simulink.RTWCC { $BackupClass "Simulink.RTWCC" $ObjectID 8 Array { Type "Cell" Dimension 1 Cell "IncludeHyperlinkInReport" PropName "DisabledProps" } Version "1.1.0" SystemTargetFile "xpctarget.tlc" GenCodeOnly off MakeCommand "make_rtw" TemplateMakefile "xpc_default_tmf" Description "xPC Target" GenerateReport off SaveLog off RTWVerbose on RetainRTWFile off ProfileTLC off TLCDebug off TLCCoverage off TLCAssert off ProcessScriptMode "Default" ConfigurationMode "Optimized" ProcessScript "xpctarget_make_rtw_hook" ConfigAtBuild off IncludeHyperlinkInReport off LaunchReport off TargetLang "C" Array { Type "Handle" Dimension 2 Simulink.CodeAppCC { $ObjectID 9 Array { Type "Cell" Dimension 9 Cell "IgnoreCustomStorageClasses" Cell "InsertBlockDesc" Cell "SFDataObjDesc" Cell "SimulinkDataObjDesc" Cell "DefineNamingRule" Cell "SignalNamingRule" Cell "ParamNamingRule" Cell "InlinedPrmAccess" Cell "CustomSymbolStr" PropName "DisabledProps" } Version "1.1.0" ForceParamTrailComments off GenerateComments on IgnoreCustomStorageClasses on IncHierarchyInIds off MaxIdLength 31 PreserveName off PreserveNameWithParent off ShowEliminatedStatement off IncAutoGenComments off SimulinkDataObjDesc off SFDataObjDesc off IncDataTypeInIds off PrefixModelToSubsysFcnNames on CustomSymbolStr "$R$N$M" MangleLength 1 DefineNamingRule "None" ParamNamingRule "None" SignalNamingRule "None" InsertBlockDesc off SimulinkBlockComments on EnableCustomComments off InlinedPrmAccess "Literals" ReqsInCode off } xpctarget.xpcTargetCC { $BackupClass "Simulink.TargetCC" $ObjectID 10 Array { Type "Cell" Dimension 12 Cell "IncludeMdlTerminateFcn" Cell "CombineOutputUpdateFcns" Cell "SuppressErrorStatus" Cell "ERTCustomFileBanners" Cell "GenerateSampleERTMain" Cell "MultiInstanceERTCode" Cell "PurelyIntegerCode" Cell "SupportNonFinite" Cell "SupportComplex" Cell "SupportAbsoluteTime" Cell "SupportContinuousTime" Cell "SupportNonInlinedSFcns" PropName "DisabledProps" } Version "1.1.0" TargetFcnLib "ansi_tfl_tmw.mat" TargetLibSuffix "" TargetPreCompLibLocation "" GenFloatMathFcnCalls "ANSI_C" UtilityFuncGeneration "Auto" GenerateFullHeader on GenerateSampleERTMain off IsPILTarget off ModelReferenceCompliant on IncludeMdlTerminateFcn on CombineOutputUpdateFcns off SuppressErrorStatus off IncludeFileDelimiter "Auto" ERTCustomFileBanners off SupportAbsoluteTime on LogVarNameModifier "rt_" MatFileLogging on MultiInstanceERTCode off SupportNonFinite on SupportComplex on PurelyIntegerCode off SupportContinuousTime on SupportNonInlinedSFcns on RL32ModeModifier "Real-Time" ExtMode on ExtModeMexFile "ext_xpc" ExtModeArmWhenConnect off RL32LogTETModifier on RL32LogBufSizeModifier "1000000" RL32IRQSourceModifier "Timer" xPCIRQSourceBoard "None/Other" xPCIOIRQSlot "-1" xpcDblBuff off xpcObjCom off xPCGenerateASAP2 off RL32ObjectName "tg" xPCisDownloadable on xPCisDefaultEnv on } PropName "Components" } } PropName "Components" } Name "Configuration" SimulationMode "external" CurrentDlgPage "Real-Time Workshop" } PropName "ConfigurationSets" } Simulink.ConfigSet { $PropName "ActiveConfigurationSet" $ObjectID 1 } BlockDefaults { Orientation "right" ForegroundColor "black" BackgroundColor "white" DropShadow off NamePlacement "normal" FontName "arial" FontSize 10 FontWeight "normal" FontAngle "normal" ShowName on } BlockParameterDefaults { Block { BlockType DataStoreMemory ReadBeforeWriteMsg "none" WriteAfterWriteMsg "none" WriteAfterReadMsg "none" StateMustResolveToSignalObject off ShowAdditionalParam off DataType "auto" OutDataType "sfix(16)" OutScaling "2^0" SignalType "auto" } Block { BlockType DataStoreRead } Block { BlockType DataStoreWrite } Block { BlockType Demux Outputs "4" DisplayOption "none" BusSelectionMode off } Block { BlockType DiscretePulseGenerator PulseType "Sample based" TimeSource "Use simulation time" Amplitude "1" Period "2" PulseWidth "1" PhaseDelay "0" SampleTime "1" VectorParams1D on } Block { BlockType Inport Port "1" UseBusObject off BusObject "BusObject" BusOutputAsStruct off PortDimensions "-1" SampleTime "-1" DataType "auto" OutDataType "sfix(16)" OutScaling "2^0" SignalType "auto" SamplingMode "auto" LatchByDelayingOutsideSignal off LatchByCopyingInsideSignal off Interpolate 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 "S-Function" FunctionName "system" SFunctionModules "''" PortCounts "[]" } Block { BlockType SubSystem ShowPortLabels on Permissions "ReadWrite" PermitHierarchicalResolution "All" SystemSampleTime "-1" RTWFcnNameOpts "Auto" RTWFileNameOpts "Auto" SimViewingDevice off DataTypeOverride "UseLocalSettings" MinMaxOverflowLogging "UseLocalSettings" } Block { BlockType Terminator } } 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 "hand_open_close" Location [213, 125, 1201, 798] Open on ModelBrowserVisibility off ModelBrowserWidth 212 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" ReportName "simulink-default.rpt" Block { BlockType SubSystem Name "Control Motor" Ports [2, 1] Position [640, 416, 780, 474] TreatAsAtomicUnit off MinAlgLoopOccurrences off RTWSystemCode "Auto" MaskHideContents off MaskType "Stateflow" MaskDescription "Embedded MATLAB block" MaskDisplay "disp('fcn');" MaskSelfModifiable on MaskIconFrame on MaskIconOpaque off MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "Control Motor" Location [257, 457, 812, 717] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" Block { BlockType Inport Name "hall_in" Position [20, 101, 40, 119] IconDisplay "Port number" } Block { BlockType Inport Name "dir" Position [20, 136, 40, 154] Port "2" IconDisplay "Port number" } Block { BlockType Demux Name " Demux " Ports [1, 1] Position [270, 160, 320, 200] Outputs "1" } Block { BlockType "S-Function" Name " SFunction " Tag "Stateflow S-Function hand_open_close 3" Ports [2, 2] Position [180, 100, 230, 160] FunctionName "sf_sfun" PortCounts "[2 2]" Port { PortNumber 2 Name "motor_out" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Terminator Name " Terminator " Position [460, 171, 480, 189] } Block { BlockType Outport Name "motor_out" Position [460, 101, 480, 119] IconDisplay "Port number" BusOutputAsStruct off } Line { SrcBlock "hall_in" SrcPort 1 DstBlock " SFunction " DstPort 1 } Line { SrcBlock " Demux " SrcPort 1 DstBlock " Terminator " DstPort 1 } Line { SrcBlock " SFunction " SrcPort 1 Points [0, 65] DstBlock " Demux " DstPort 1 } Line { SrcBlock "dir" SrcPort 1 DstBlock " SFunction " DstPort 2 } Line { Name "motor_out" Labels [0, 0] SrcBlock " SFunction " SrcPort 2 DstBlock "motor_out" DstPort 1 } } } Block { BlockType DataStoreMemory Name "Data Store\nMemory" Position [190, 25, 222, 55] DataStoreName "Dir" ReadBeforeWriteMsg "warning" WriteAfterWriteMsg "warning" WriteAfterReadMsg "warning" InitialValue "1" RTWStateStorageClass "Auto" VectorParams1D on ShowAdditionalParam off } Block { BlockType DataStoreRead Name "Data Store\nRead" Position [320, 500, 350, 530] DataStoreName "Dir" SampleTime "0" } Block { BlockType DataStoreRead Name "Data Store\nRead1" Position [570, 445, 600, 475] DataStoreName "Dir" SampleTime "0" } Block { BlockType DataStoreWrite Name "Data Store\nWrite" Position [505, 420, 535, 450] DataStoreName "Dir" SampleTime "-1" } Block { BlockType SubSystem Name "Determine Initial State" Ports [2, 1] Position [200, 408, 285, 457] TreatAsAtomicUnit off MinAlgLoopOccurrences off RTWSystemCode "Auto" MaskHideContents off MaskType "Stateflow" MaskDescription "Embedded MATLAB block" MaskDisplay "disp('fcn');" MaskSelfModifiable on MaskIconFrame on MaskIconOpaque off MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "Determine Initial State" Location [257, 457, 812, 717] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" Block { BlockType Inport Name "hall_in" Position [20, 101, 40, 119] IconDisplay "Port number" } Block { BlockType Inport Name "EMG" Position [20, 136, 40, 154] Port "2" IconDisplay "Port number" } Block { BlockType Demux Name " Demux " Ports [1, 1] Position [270, 160, 320, 200] Outputs "1" } Block { BlockType "S-Function" Name " SFunction " Tag "Stateflow S-Function hand_open_close 2" Ports [2, 2] Position [180, 100, 230, 160] FunctionName "sf_sfun" PortCounts "[2 2]" Port { PortNumber 2 Name "dir" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Terminator Name " Terminator " Position [460, 171, 480, 189] } Block { BlockType Outport Name "dir" Position [460, 101, 480, 119] IconDisplay "Port number" BusOutputAsStruct off } Line { SrcBlock " SFunction " SrcPort 1 Points [0, 65] DstBlock " Demux " DstPort 1 } Line { SrcBlock " Demux " SrcPort 1 DstBlock " Terminator " DstPort 1 } Line { SrcBlock "hall_in" SrcPort 1 DstBlock " SFunction " DstPort 1 } Line { Name "dir" Labels [0, 0] SrcBlock " SFunction " SrcPort 2 DstBlock "dir" DstPort 1 } Line { SrcBlock "EMG" SrcPort 1 DstBlock " SFunction " DstPort 2 } } } Block { BlockType Reference Name "Hall Sensor" Ports [0, 1] Position [15, 395, 120, 445] SourceBlock "xpcsensoraylib/A//D/Sensoray626 AD " SourceType "sensoray626_ad" board "1" channel "2" range "[-10]" sampleTime "dt" } Block { BlockType Reference Name "Motor" Ports [1] Position [810, 420, 915, 470] SourceBlock "xpcsensoraylib/D//A/Sensoray626 DA " SourceType "sensoray626_da" board "1" channel "1" reset "[1]" initValue "[0]" sampleTime "dt" } Block { BlockType DiscretePulseGenerator Name "Pulse\nGenerator" Ports [0, 1] Position [15, 468, 60, 502] PulseType "Time based" PulseWidth "5" } Block { BlockType Reference Name "Scope (xPC) " Ports [1] Position [155, 205, 245, 265] SourceBlock "xpclib/Misc./Scope (xPC) " SourceType "xpcscopeblock" ShowPortLabels on scopeno "1" scopetype "Target" autostart on viewmode "Graphical redraw" formatstr "'%15.6f'" grid on ylimits "[0,0]" nosamples "250" noprepostsamples "0" interleave "1" triggermode "FreeRun" triggersignal "1" triggerlevel "0.0" triggerslope "Either" triggerscope "1" triggersample "0" filename "data.dat" mode "Lazy" writesize "512" autorestart off } Block { BlockType Reference Name "Scope (xPC) 1" Ports [1] Position [180, 495, 270, 555] SourceBlock "xpclib/Misc./Scope (xPC) " SourceType "xpcscopeblock" ShowPortLabels on scopeno "2" scopetype "Target" autostart on viewmode "Graphical redraw" formatstr "'%15.6f'" grid on ylimits "[0,0]" nosamples "250" noprepostsamples "0" interleave "1" triggermode "FreeRun" triggersignal "1" triggerlevel "0.0" triggerslope "Either" triggerscope "1" triggersample "0" filename "data.dat" mode "Lazy" writesize "512" autorestart off } Block { BlockType Reference Name "Scope (xPC) 2" Ports [1] Position [805, 275, 895, 335] SourceBlock "xpclib/Misc./Scope (xPC) " SourceType "xpcscopeblock" ShowPortLabels on scopeno "3" scopetype "Target" autostart on viewmode "Graphical redraw" formatstr "'%15.6f'" grid on ylimits "[0,0]" nosamples "250" noprepostsamples "0" interleave "1" triggermode "FreeRun" triggersignal "1" triggerlevel "0.0" triggerslope "Either" triggerscope "1" triggersample "0" filename "data.dat" mode "Lazy" writesize "512" autorestart off } Block { BlockType Reference Name "Sensoray626 Init " Ports [] Position [15, 15, 120, 65] SourceBlock "xpcsensoraylib/Init /Sensoray626 Init " SourceType "sensoray626_init" board "1" revA off slot "-1" } Block { BlockType SubSystem Name "Update Direction" Ports [2, 1] Position [385, 409, 455, 456] TreatAsAtomicUnit off MinAlgLoopOccurrences off RTWSystemCode "Auto" MaskHideContents off MaskType "Stateflow" MaskDescription "Embedded MATLAB block" MaskDisplay "disp('fcn');" MaskSelfModifiable on MaskIconFrame on MaskIconOpaque off MaskIconRotate "none" MaskIconUnits "autoscale" System { Name "Update Direction" Location [257, 457, 812, 717] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" ZoomFactor "100" Block { BlockType Inport Name "dir_new" Position [20, 101, 40, 119] IconDisplay "Port number" } Block { BlockType Inport Name "dir_old" Position [20, 136, 40, 154] Port "2" IconDisplay "Port number" } Block { BlockType Demux Name " Demux " Ports [1, 1] Position [270, 160, 320, 200] Outputs "1" } Block { BlockType "S-Function" Name " SFunction " Tag "Stateflow S-Function hand_open_close 1" Ports [2, 2] Position [180, 100, 230, 160] FunctionName "sf_sfun" PortCounts "[2 2]" Port { PortNumber 2 Name "dir" RTWStorageClass "Auto" DataLoggingNameMode "SignalName" } } Block { BlockType Terminator Name " Terminator " Position [460, 171, 480, 189] } Block { BlockType Outport Name "dir" Position [460, 101, 480, 119] IconDisplay "Port number" BusOutputAsStruct off } Line { SrcBlock " SFunction " SrcPort 1 Points [0, 65] DstBlock " Demux " DstPort 1 } Line { SrcBlock " Demux " SrcPort 1 DstBlock " Terminator " DstPort 1 } Line { SrcBlock "dir_new" SrcPort 1 DstBlock " SFunction " DstPort 1 } Line { Name "dir" Labels [0, 0] SrcBlock " SFunction " SrcPort 2 DstBlock "dir" DstPort 1 } Line { SrcBlock "dir_old" SrcPort 1 DstBlock " SFunction " DstPort 2 } } } Block { BlockType Outport Name "Out1" Position [165, 298, 195, 312] IconDisplay "Port number" BusOutputAsStruct off } Block { BlockType Outport Name "Out2" Position [185, 578, 215, 592] Port "2" IconDisplay "Port number" BusOutputAsStruct off } Block { BlockType Outport Name "Out3" Position [805, 363, 835, 377] Port "3" IconDisplay "Port number" BusOutputAsStruct off } Block { BlockType Outport Name "Out4" Position [480, 508, 510, 522] Port "4" IconDisplay "Port number" BusOutputAsStruct off } Line { SrcBlock "Hall Sensor" SrcPort 1 Points [15, 0] Branch { Points [0, -115] Branch { DstBlock "Scope (xPC) " DstPort 1 } Branch { DstBlock "Out1" DstPort 1 } } Branch { Points [30, 0] Branch { DstBlock "Determine Initial State" DstPort 1 } Branch { Points [0, -55; 410, 0; 0, 65] DstBlock "Control Motor" DstPort 1 } } } Line { SrcBlock "Pulse\nGenerator" SrcPort 1 Points [95, 0] Branch { Points [0, -40] DstBlock "Determine Initial State" DstPort 2 } Branch { Points [0, 40] Branch { DstBlock "Scope (xPC) 1" DstPort 1 } Branch { Points [0, 60] DstBlock "Out2" DstPort 1 } } } Line { SrcBlock "Determine Initial State" SrcPort 1 Points [40, 0; 0, -15] DstBlock "Update Direction" DstPort 1 } Line { SrcBlock "Data Store\nRead" SrcPort 1 Points [5, 0; 0, -70] DstBlock "Update Direction" DstPort 2 } Line { SrcBlock "Update Direction" SrcPort 1 Points [10, 0] Branch { DstBlock "Data Store\nWrite" DstPort 1 } Branch { Points [-5, 0] DstBlock "Out4" DstPort 1 } } Line { SrcBlock "Control Motor" SrcPort 1 Points [0, -5] Branch { Points [0, -70] Branch { Points [0, -65] DstBlock "Scope (xPC) 2" DstPort 1 } Branch { DstBlock "Out3" DstPort 1 } } Branch { Points [0, 5] DstBlock "Motor" DstPort 1 } } Line { SrcBlock "Data Store\nRead1" SrcPort 1 DstBlock "Control Motor" DstPort 2 } } } # Finite State Machines # # Stateflow Version 6.2 (R14SP2) dated Aug 4 2005, 10:13:39 # # Stateflow { machine { id 1 name "hand_open_close" created "12-Nov-2005 12:33:11" isLibrary 0 firstTarget 26 sfVersion 62014000 } chart { id 2 name "Update Direction" windowPosition [281.813 329.45 200.25 189.75] viewLimits [0 156.75 0 153.75] screen [1 1 1280 1024 1.333333333333333] treeNode [0 3 0 0] firstTransition 5 firstJunction 4 viewObj 2 machine 1 decomposition CLUSTER_CHART type EML_CHART firstData 6 chartFileNumber 1 disableImplicitCasting 1 eml { name "fcn" } } 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 type FUNC_STATE decomposition CLUSTER_STATE eml { isEML 1 script "function dir = fcn(dir_new,dir_old)\n" "% This block supports an embeddable subset of the MATLAB la" "nguage.\n" "% See the help menu for details. \n" "\n" "dir = dir_old+2*dir_new;\n" "if dir < -1\n" " dir = -1;\n" "elseif dir > 1\n" " dir = 1;\n" "end" editorLayout "100 M4x1[355 284 641 627]" fimathString "fimath(...\n" "'RoundMode', 'floor',...\n" "'OverflowMode', 'wrap',...\n" "'ProductMode', 'KeepLSB', 'ProductWordLength', 32,..." "\n" "'SumMode', 'KeepLSB', 'SumWordLength', 32,...\n" "'CastBeforeSum', false)" treatIntsAsFixpt 0 } } junction { id 4 position [23.5747 49.5747 7] chart 2 linkNode [2 0 0] subviewer 2 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 [21.175 25.975 14.625 42.575] subviewer 2 drawStyle SMART executionOrder 1 } data { id 6 name "dir_new" linkNode [2 0 7] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE } complexity SF_COMPLEX_INHERITED } dataType "inherited" fixptType { slope 1 baseType SF_INT16_TYPE } complexity SF_COMPLEX_INHERITED } data { id 7 name "dir" linkNode [2 6 8] scope OUTPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE } complexity SF_COMPLEX_INHERITED } dataType "inherited" fixptType { slope 1 baseType SF_INT16_TYPE } complexity SF_COMPLEX_INHERITED } data { id 8 name "dir_old" linkNode [2 7 0] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } } dataType "inherited" } instance { id 9 name "Update Direction" machine 1 chart 2 } chart { id 10 name "Determine Initial State" windowPosition [281.813 329.45 200.25 189.75] viewLimits [0 156.75 0 153.75] screen [1 1 1280 1024 1.333333333333333] treeNode [0 11 0 0] firstTransition 13 firstJunction 12 viewObj 10 machine 1 decomposition CLUSTER_CHART type EML_CHART firstData 14 chartFileNumber 2 disableImplicitCasting 1 eml { name "fcn" } } state { id 11 labelString "eML_blk_kernel()" position [18 64.5 118 66] fontSize 12 chart 10 treeNode [10 0 0 0] superState SUBCHART subviewer 10 type FUNC_STATE decomposition CLUSTER_STATE eml { isEML 1 script "function dir = fcn(hall_in, EMG)\n" "% This block supports an embeddable subset of the MATLAB la" "nguage.\n" "%% HAND \n" "%TO OPEN, V=+13\n" "\n" "dir=0;\n" "\n" "hmax1 = 3.2;\n" "hmin1 = 2.52; % define hall sensor upper and lower bounds\n" "thresh = 0.25; % threshold value (V) to turn on motor\n" "\n" "if EMG >= thresh\n" "\n" " if hall_in >= hmax1 %hand is currently open\n" " dir = -1; %want to close the hand\n" " end\n" " if hall_in <= hmin1 %hand is currently closed\n" " dir = 1; %want to open the hand\n" " end\n" "end\n" "\n" "\n" " \n" "\n" "\n" "\n" "" editorLayout "100 M4x1[109 215 735 653]" fimathString "fimath(...\n" "'RoundMode', 'floor',...\n" "'OverflowMode', 'wrap',...\n" "'ProductMode', 'KeepLSB', 'ProductWordLength', 32,..." "\n" "'SumMode', 'KeepLSB', 'SumWordLength', 32,...\n" "'CastBeforeSum', false)" treatIntsAsFixpt 0 } } junction { id 12 position [23.5747 49.5747 7] chart 10 linkNode [10 0 0] subviewer 10 type CONNECTIVE_JUNCTION } transition { id 13 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 12 intersection [7 0 -1 -1 23.5747 42.5747 0 0] } midPoint [23.5747 24.9468] chart 10 linkNode [10 0 0] dataLimits [21.175 25.975 14.625 42.575] subviewer 10 drawStyle SMART executionOrder 1 } data { id 14 name "hall_in" linkNode [10 0 15] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE } complexity SF_COMPLEX_INHERITED } dataType "inherited" fixptType { slope 1 baseType SF_INT16_TYPE } complexity SF_COMPLEX_INHERITED } data { id 15 name "dir" linkNode [10 14 16] scope OUTPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE } complexity SF_COMPLEX_INHERITED } dataType "inherited" fixptType { slope 1 baseType SF_INT16_TYPE } complexity SF_COMPLEX_INHERITED } data { id 16 name "EMG" linkNode [10 15 0] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } } dataType "inherited" } instance { id 17 name "Determine Initial State" machine 1 chart 10 } chart { id 18 name "Control Motor" windowPosition [296.813 314.45 200.25 189.75] viewLimits [0 156.75 0 153.75] screen [1 1 1280 1024 1.333333333333333] treeNode [0 19 0 0] firstTransition 21 firstJunction 20 viewObj 18 machine 1 decomposition CLUSTER_CHART type EML_CHART firstData 22 chartFileNumber 3 disableImplicitCasting 1 eml { name "fcn" } } state { id 19 labelString "eML_blk_kernel()" position [18 64.5 118 66] fontSize 12 chart 18 treeNode [18 0 0 0] superState SUBCHART subviewer 18 type FUNC_STATE decomposition CLUSTER_STATE eml { isEML 1 script "function motor_out = fcn(hall_in,dir)\n" "% This block supports an embeddable subset of the MATLAB la" "nguage.\n" "% See the help menu for details. \n" "\n" "motor_out = 0;\n" "hmax1 =3.2;\n" "hmin1 = 2.52;\n" "\n" "if hall_in >= hmax1 %if hand is currently open\n" " switch dir \n" " case 1 %we want to open the hand\n" " motor_out = 0; %don't open hand any furthe" "r\n" " case -1 %we want to close the hand\n" " motor_out = dir*8; %go ahead and close the hand" "\n" " end\n" "elseif hall_in <= hmin1 %if hand is currently close" "d\n" " switch dir\n" " case 1 %we want to open hand\n" " motor_out = dir*8; % go ahead and open the hand" "\n" " case -1\n" " motor_out = 0; %don't close hand any furth" "er\n" " end\n" "else\n" " motor_out = dir*8; %if hand is in between extre" "memes, continue opening or closing\n" "end\n" " \n" " " editorLayout "100 M4x1[16 156 544 646]" fimathString "fimath(...\n" "'RoundMode', 'floor',...\n" "'OverflowMode', 'wrap',...\n" "'ProductMode', 'KeepLSB', 'ProductWordLength', 32,..." "\n" "'SumMode', 'KeepLSB', 'SumWordLength', 32,...\n" "'CastBeforeSum', false)" treatIntsAsFixpt 0 } } junction { id 20 position [23.5747 49.5747 7] chart 18 linkNode [18 0 0] subviewer 18 type CONNECTIVE_JUNCTION } transition { id 21 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 20 intersection [7 0 -1 -1 23.5747 42.5747 0 0] } midPoint [23.5747 24.9468] chart 18 linkNode [18 0 0] dataLimits [21.175 25.975 14.625 42.575] subviewer 18 drawStyle SMART executionOrder 1 } data { id 22 name "hall_in" linkNode [18 0 23] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE } complexity SF_COMPLEX_INHERITED } dataType "inherited" fixptType { slope 1 baseType SF_INT16_TYPE } complexity SF_COMPLEX_INHERITED } data { id 23 name "dir" linkNode [18 22 24] scope INPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE } complexity SF_COMPLEX_INHERITED } dataType "inherited" fixptType { slope 1 baseType SF_INT16_TYPE } complexity SF_COMPLEX_INHERITED } data { id 24 name "motor_out" linkNode [18 23 0] scope OUTPUT_DATA machine 1 props { array { size "-1" } type { method SF_INHERITED_TYPE primitive SF_DOUBLE_TYPE isSigned 1 wordLength "16" } } dataType "inherited" } instance { id 25 name "Control Motor" machine 1 chart 18 } target { id 26 name "sfun" description "Default Simulink S-Function Target." machine 1 linkNode [1 0 27] } target { id 27 name "rtw" codeFlags " comments=1 statebitsets=1 databitsets=1 emitlogicalops=1 el" "seifdetection=1 constantfolding=1 redundantloadelimination=0" " preservenames=0 preservenameswithparent=0 exportcharts=0" machine 1 linkNode [1 26 0] } }