Model {
  Name			  "sldemo_eml_galaxy"
  Version		  6.2
  MdlSubVersion		  0
  GraphicalInterface {
    NumRootInports	    0
    NumRootOutports	    0
    ParameterArgumentNames  ""
    ComputedModelVersion    "1.594"
    NumModelReferences	    0
    NumTestPointedSignals   0
  }
  Description		  "Spiral Galaxy Formation Simulation with Embedded MA"
"TLAB Function block\n\nThis model was inspired by the classic paper \"Galacti"
"c Bridges and Tails\" \n(Toomre & Toomre 1972).  Two disc shape galaxies are "
"setup to almost collide. Once \nthe galaxies are close enough, mutual gravita"
"tional forces give the two spiral arm effect. \n\nStandard Newtonian dynamics"
" are applied at each time step. We approximate the massive \ncloud of stars w"
"ith a single black hole at the center of the galaxy. We also partition the \n"
"stars into heavy and light bodies and skip the computation between light and "
"light \nbodies to improve performance.\n\nThe green blocks initialize the sim"
"ulation, the orange blocks are the core of the \nsimulation, and the yellow b"
"lock is used to make the galaxy animation view.\n\nExcept for the \"PlotAll\""
" visualization block's use of plotting routines, all of the \nEmbedded MATLAB"
" function blocks in this model support code generation with \nReal-Time Works"
"hop and Real-Time Workshop Embedded Coder.\n\n  Demo Requirements \n\nDuring "
"this demonstration, Simulink generates code for the simulation in a Simulink "
"\nproject directory created in the current working directory (pwd). If you do"
" not want \nto affect the current directory (or if you cannot) generate files"
" in this directory, you \nshould change your working directory.\n"
  SavedCharacterEncoding  "ibm-5348_P100-1997"
  SaveDefaultBlockParams  on
  SampleTimeColors	  off
  LibraryLinkDisplay	  "none"
  WideLines		  on
  ShowLineDimensions	  on
  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
  CloseFcn		  "foundFig = findobj('Tag','galaxyScreen');\nif ishan"
"dle(foundFig), delete(foundFig); end"
  Created		  "Tue Mar 30 17:18:27 2004"
  Creator		  "The MathWorks Inc."
  UpdateHistory		  "UpdateHistoryNever"
  ModifiedByFormat	  "%<Auto>"
  LastModifiedBy	  "batserve"
  ModifiedDateFormat	  "%<Auto>"
  LastModifiedDate	  "Sat Jan 22 19:08:53 2005"
  ModelVersionFormat	  "1.%<AutoIncrement:594>"
  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	  on
  ExtModeSkipDownloadWhenConnect off
  ExtModeLogAll		  on
  ExtModeAutoUpdateStatusClock off
  BufferReuse		  on
  StrictBusMsg		  "None"
  ProdHWDeviceType	  "32-bit Generic"
  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		  "250"
	  AbsTol		  "auto"
	  FixedStep		  "1"
	  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		  "1000"
	  LoadExternalInput	  off
	  LoadInitialState	  off
	  SaveFinalState	  off
	  SaveFormat		  "Array"
	  SaveOutput		  on
	  SaveState		  off
	  SignalLogging		  on
	  SaveTime		  on
	  StateSaveName		  "xout"
	  TimeSaveName		  "tout"
	  OutputSaveName	  "yout"
	  SignalLoggingName	  "logsout"
	  OutputOption		  "RefineOutputTimes"
	  OutputTimes		  "[]"
	  Refine		  "1"
	}
	Simulink.OptimizationCC {
	  $ObjectID		  4
	  Array {
	    Type		    "Cell"
	    Dimension		    5
	    Cell		    "ZeroExternalMemoryAtStartup"
	    Cell		    "ZeroInternalMemoryAtStartup"
	    Cell		    "InitFltsAndDblsToZero"
	    Cell		    "OptimizeModelRefInitCode"
	    Cell		    "NoFixptDivByZeroProtection"
	    PropName		    "DisabledProps"
	  }
	  Version		  "1.1.0"
	  BlockReduction	  on
	  BooleanDataType	  on
	  ConditionallyExecuteInputs on
	  InlineParams		  off
	  InlineInvariantSignals  on
	  OptimizeBlockIOStorage  on
	  BufferReuse		  on
	  EnforceIntegerDowncast  on
	  ExpressionFolding	  on
	  FoldNonRolledExpr	  on
	  LocalBlockOutputs	  on
	  ParameterPooling	  on
	  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  off
	}
	Simulink.DebuggingCC {
	  $ObjectID		  5
	  Version		  "1.1.0"
	  RTPrefix		  "error"
	  ConsistencyChecking	  "none"
	  ArrayBoundsChecking	  "none"
	  SignalInfNanChecking	  "none"
	  AlgebraicLoopMsg	  "warning"
	  ArtificialAlgebraicLoopMsg "warning"
	  CheckSSInitialOutputMsg on
	  CheckExecutionContextPreStartOutputMsg on
	  CheckExecutionContextRuntimeOutputMsg	on
	  SignalResolutionControl "TryResolveAllWithWarning"
	  BlockPriorityViolationMsg "warning"
	  MinStepSizeMsg	  "warning"
	  SolverPrmCheckMsg	  "warning"
	  InheritedTsInSrcMsg	  "warning"
	  DiscreteInheritContinuousMsg "warning"
	  MultiTaskDSMMsg	  "warning"
	  MultiTaskRateTransMsg	  "error"
	  SingleTaskRateTransMsg  "none"
	  TasksWithSamePriorityMsg "warning"
	  CheckMatrixSingularityMsg "none"
	  IntegerOverflowMsg	  "warning"
	  Int32ToFloatConvMsg	  "warning"
	  ParameterDowncastMsg	  "error"
	  ParameterOverflowMsg	  "error"
	  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  "none"
	  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	  "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.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	  "grt.tlc"
	  GenCodeOnly		  off
	  MakeCommand		  "make_rtw"
	  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
	  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
	    }
	    Simulink.GRTTargetCC {
	      $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
	      ExtMode		      off
	      ExtModeStaticAlloc      off
	      ExtModeTesting	      off
	      ExtModeStaticAllocSize  1000000
	      ExtModeTransport	      0
	      ExtModeMexFile	      "ext_comm"
	      RTWCAPISignals	      off
	      RTWCAPIParams	      off
	      RTWCAPIStates	      off
	      GenerateASAP2	      off
	    }
	    PropName		    "Components"
	  }
	}
	PropName		"Components"
      }
      Name		      "Configuration"
      SimulationMode	      "normal"
      CurrentDlgPage	      "Solver"
    }
    PropName		    "ConfigurationSets"
  }
  Simulink.ConfigSet {
    $PropName		    "ActiveConfigurationSet"
    $ObjectID		    1
  }
  BlockDefaults {
    Orientation		    "right"
    ForegroundColor	    "black"
    BackgroundColor	    "white"
    DropShadow		    off
    NamePlacement	    "normal"
    FontName		    "Helvetica"
    FontSize		    10
    FontWeight		    "normal"
    FontAngle		    "normal"
    ShowName		    on
  }
  BlockParameterDefaults {
    Block {
      BlockType		      Clock
      DisplayTime	      off
    }
    Block {
      BlockType		      Constant
      Value		      "1"
      VectorParams1D	      on
      OutDataTypeMode	      "Inherit from 'Constant value'"
      OutDataType	      "sfix(16)"
      ConRadixGroup	      "Use specified scaling"
      OutScaling	      "2^0"
      SampleTime	      "inf"
    }
    Block {
      BlockType		      Demux
      Outputs		      "4"
      DisplayOption	      "none"
      BusSelectionMode	      off
    }
    Block {
      BlockType		      Inport
      UseBusObject	      off
      BusObject		      "BusObject"
      BusOutputAsStruct	      off
      PortDimensions	      "-1"
      SampleTime	      "-1"
      DataType		      "auto"
      OutDataType	      "sfix(16)"
      OutScaling	      "2^0"
      SignalType	      "auto"
      SamplingMode	      "auto"
      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		      Reference
    }
    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		      Switch
      Criteria		      "u2 >= Threshold"
      Threshold		      "0"
      InputSameDT	      on
      OutDataTypeMode	      "Inherit via internal rule"
      RndMeth		      "Floor"
      SaturateOnIntegerOverflow	on
      ZeroCross		      on
      SampleTime	      "-1"
    }
    Block {
      BlockType		      Terminator
    }
    Block {
      BlockType		      UnitDelay
      X0		      "0"
      SampleTime	      "1"
      StateMustResolveToSignalObject off
      RTWStateStorageClass    "Auto"
    }
  }
  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		    "sldemo_eml_galaxy"
    Location		    [65, 171, 980, 702]
    Open		    on
    ModelBrowserVisibility  off
    ModelBrowserWidth	    200
    ScreenColor		    "white"
    PaperOrientation	    "landscape"
    PaperPositionMode	    "auto"
    PaperType		    "usletter"
    PaperUnits		    "inches"
    ZoomFactor		    "100"
    ReportName		    "simulink-default.rpt"
    Block {
      BlockType		      SubSystem
      Name		      "Apply Newtonian gravitation"
      Ports		      [2, 2]
      Position		      [665, 131, 820, 184]
      Orientation	      "left"
      BackgroundColor	      "orange"
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Embedded MATLAB block"
      MaskDisplay	      "disp('ApplyGravity');"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Apply Newtonian gravitation"
	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			  "light"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "heavy"
	  Position		  [20, 136, 40, 154]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1]
	  Position		  [270, 180, 320, 220]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function sldemo_eml_galaxy 3"
	  Ports			  [2, 3]
	  Position		  [180, 100, 230, 180]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[2 3]"
	  Port {
	    PortNumber		    2
	    Name		    "heavy1"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	  Port {
	    PortNumber		    3
	    Name		    "light1"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 191, 480, 209]
	}
	Block {
	  BlockType		  Outport
	  Name			  "heavy1"
	  Position		  [460, 101, 480, 119]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "light1"
	  Position		  [460, 136, 480, 154]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  Points		  [0, 85]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "light"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "heavy"
	  SrcPort		  1
	  Points		  [120, 0]
	  DstBlock		  " SFunction "
	  DstPort		  2
	}
	Line {
	  Name			  "heavy1"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "heavy1"
	  DstPort		  1
	}
	Line {
	  Name			  "light1"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  3
	  DstBlock		  "light1"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Constant
      Name		      "CenterMass1 (Solar)"
      Position		      [25, 95, 135, 115]
      Value		      "1.73e+11"
    }
    Block {
      BlockType		      Constant
      Name		      "CenterMass2 (Solar)"
      Position		      [30, 270, 135, 290]
      Value		      "1.5e+11"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Construct Galaxy 1"
      Ports		      [4, 1]
      Position		      [170, 55, 330, 190]
      BackgroundColor	      "darkGreen"
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Embedded MATLAB block"
      MaskDisplay	      "disp('ConstructGalaxy');"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Construct Galaxy 1"
	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			  "rp"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "cm"
	  Position		  [20, 136, 40, 154]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "pos"
	  Position		  [20, 171, 40, 189]
	  Port			  "3"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "vel"
	  Position		  [20, 206, 40, 224]
	  Port			  "4"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1]
	  Position		  [270, 205, 320, 245]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function sldemo_eml_galaxy 2"
	  Ports			  [4, 2]
	  Position		  [180, 102, 230, 203]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[4 2]"
	  Port {
	    PortNumber		    2
	    Name		    "bodies"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 216, 480, 234]
	}
	Block {
	  BlockType		  Outport
	  Name			  "bodies"
	  Position		  [460, 101, 480, 119]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  Points		  [0, 95]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "rp"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "cm"
	  SrcPort		  1
	  Points		  [120, 0]
	  DstBlock		  " SFunction "
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "pos"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "vel"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  4
	}
	Line {
	  Name			  "bodies"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "bodies"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Construct Galaxy 2"
      Ports		      [4, 1]
      Position		      [170, 230, 330, 365]
      BackgroundColor	      "darkGreen"
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Embedded MATLAB block"
      MaskDisplay	      "disp('ConstructGalaxy');"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Construct Galaxy 2"
	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			  "rp"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "cm"
	  Position		  [20, 136, 40, 154]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "pos"
	  Position		  [20, 171, 40, 189]
	  Port			  "3"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "vel"
	  Position		  [20, 206, 40, 224]
	  Port			  "4"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1]
	  Position		  [270, 205, 320, 245]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function sldemo_eml_galaxy 6"
	  Ports			  [4, 2]
	  Position		  [180, 102, 230, 203]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[4 2]"
	  Port {
	    PortNumber		    2
	    Name		    "bodies"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 216, 480, 234]
	}
	Block {
	  BlockType		  Outport
	  Name			  "bodies"
	  Position		  [460, 101, 480, 119]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  Points		  [0, 95]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "rp"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "cm"
	  SrcPort		  1
	  Points		  [120, 0]
	  DstBlock		  " SFunction "
	  DstPort		  2
	}
	Line {
	  SrcBlock		  "pos"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  3
	}
	Line {
	  SrcBlock		  "vel"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  4
	}
	Line {
	  Name			  "bodies"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "bodies"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Reference
      Name		      "Matrix\nConcatenation"
      Ports		      [2, 1]
      Position		      [375, 253, 430, 317]
      BackgroundColor	      "darkGreen"
      SourceBlock	      "simulink/Math\nOperations/Matrix\nConcatenation"
      SourceType	      "Matrix Concatenation"
      numInports	      "2"
      catMethod		      "Vertical"
    }
    Block {
      BlockType		      SubSystem
      Name		      "Merge heavy and\nlight bodies"
      Ports		      [2, 1]
      Position		      [555, 131, 625, 184]
      Orientation	      "left"
      BackgroundColor	      "orange"
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Embedded MATLAB block"
      MaskDisplay	      "disp('combine');"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Merge heavy and\nlight bodies"
	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			  "A"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Inport
	  Name			  "B"
	  Position		  [20, 136, 40, 154]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	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 sldemo_eml_galaxy 5"
	  Ports			  [2, 2]
	  Position		  [180, 100, 230, 160]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[2 2]"
	  Port {
	    PortNumber		    2
	    Name		    "M"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 171, 480, 189]
	}
	Block {
	  BlockType		  Outport
	  Name			  "M"
	  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		  "A"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "B"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  2
	}
	Line {
	  Name			  "M"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "M"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "More Info"
      Ports		      []
      Position		      [15, 15, 39, 38]
      DropShadow	      on
      ShowName		      off
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskDisplay	      "disp('?')"
      MaskIconFrame	      on
      MaskIconOpaque	      on
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"More Info"
	Location		[74, 70, 720, 494]
	Open			off
	ModelBrowserVisibility	off
	ModelBrowserWidth	200
	ScreenColor		"white"
	PaperOrientation	"landscape"
	PaperPositionMode	"auto"
	PaperType		"usletter"
	PaperUnits		"inches"
	ZoomFactor		"100"
	Block {
	  BlockType		  Reference
	  Name			  "Model Info"
	  Ports			  []
	  Position		  [15, 19, 610, 408]
	  ShowName		  off
	  FontName		  "Arial"
	  SourceBlock		  "simulink/Model-Wide\nUtilities/Model Info"
	  SourceType		  "CMBlock"
	  ShowPortLabels	  "on"
	  InitialBlockCM	  "None"
	  BlockCM		  "None"
	  Frame			  "on"
	  DisplayStringWithTags	  "Model Description:\n-------------------\n\n"
"%<Description>"
	  MaskDisplayString	  "Model Description:\\n-------------------\\n"
"\\nState Events Demonstration \\n\\nThis demonstrations shows state event han"
"dling.  Run the simulation and see the \\nphase plane plot, where the state x"
"1 is along the X-axis and the state x2 is along \\nthe Y-axis.\\n\\n"
	  HorizontalTextAlignment "Left"
	  LeftAlignmentValue	  "0.02"
	  SourceBlockDiagram	  "sldemo_bangbang"
	  TagMaxNumber		  "20"
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Partition bodies/stars into\nheavy and light"
      Ports		      [1, 2]
      Position		      [665, 231, 820, 284]
      BackgroundColor	      "orange"
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Embedded MATLAB block"
      MaskDisplay	      "disp('Partition');"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Partition bodies/stars into\nheavy and light"
	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			  "bodies"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1]
	  Position		  [270, 180, 320, 220]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function sldemo_eml_galaxy 4"
	  Ports			  [1, 3]
	  Position		  [180, 100, 230, 180]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[1 3]"
	  Port {
	    PortNumber		    2
	    Name		    "heavy"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	  Port {
	    PortNumber		    3
	    Name		    "light"
	    RTWStorageClass	    "Auto"
	    DataLoggingNameMode	    "SignalName"
	    ShowSigGenPortName	    on
	  }
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 191, 480, 209]
	}
	Block {
	  BlockType		  Outport
	  Name			  "heavy"
	  Position		  [460, 101, 480, 119]
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Block {
	  BlockType		  Outport
	  Name			  "light"
	  Position		  [460, 136, 480, 154]
	  Port			  "2"
	  IconDisplay		  "Port number"
	  BusOutputAsStruct	  off
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  Points		  [0, 85]
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "bodies"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
	Line {
	  Name			  "heavy"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  2
	  DstBlock		  "heavy"
	  DstPort		  1
	}
	Line {
	  Name			  "light"
	  Labels		  [0, 0]
	  SrcBlock		  " SFunction "
	  SrcPort		  3
	  DstBlock		  "light"
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      SubSystem
      Name		      "Plot all bodies/stars"
      Ports		      [1]
      Position		      [665, 52, 820, 108]
      BackgroundColor	      "yellow"
      TreatAsAtomicUnit	      off
      MinAlgLoopOccurrences   off
      RTWSystemCode	      "Auto"
      MaskType		      "Stateflow"
      MaskDescription	      "Embedded MATLAB block"
      MaskDisplay	      "disp('PlotAll');"
      MaskSelfModifiable      on
      MaskIconFrame	      on
      MaskIconOpaque	      off
      MaskIconRotate	      "none"
      MaskIconUnits	      "autoscale"
      System {
	Name			"Plot all bodies/stars"
	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			  "bodies"
	  Position		  [20, 101, 40, 119]
	  Port			  "1"
	  IconDisplay		  "Port number"
	  LatchInput		  off
	}
	Block {
	  BlockType		  Demux
	  Name			  " Demux "
	  Ports			  [1, 1]
	  Position		  [270, 100, 320, 140]
	  Outputs		  "1"
	}
	Block {
	  BlockType		  "S-Function"
	  Name			  " SFunction "
	  Tag			  "Stateflow S-Function sldemo_eml_galaxy 1"
	  Ports			  [1, 1]
	  Position		  [180, 100, 230, 140]
	  FunctionName		  "sf_sfun"
	  PortCounts		  "[1 1]"
	}
	Block {
	  BlockType		  Terminator
	  Name			  " Terminator "
	  Position		  [460, 111, 480, 129]
	}
	Line {
	  SrcBlock		  " SFunction "
	  SrcPort		  1
	  DstBlock		  " Demux "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  " Demux "
	  SrcPort		  1
	  DstBlock		  " Terminator "
	  DstPort		  1
	}
	Line {
	  SrcBlock		  "bodies"
	  SrcPort		  1
	  DstBlock		  " SFunction "
	  DstPort		  1
	}
      }
    }
    Block {
      BlockType		      Constant
      Name		      "Position1"
      Position		      [25, 130, 135, 150]
      Value		      "-1e4*[ 10, 14,  6 ]"
    }
    Block {
      BlockType		      Constant
      Name		      "Position2"
      Position		      [30, 305, 135, 325]
      Value		      "1e4*[ 10, -10, -6 ]"
    }
    Block {
      BlockType		      Constant
      Name		      "Radius1 (Parsec)"
      Position		      [30, 60, 135, 80]
      Value		      "15000"
    }
    Block {
      BlockType		      Constant
      Name		      "Radius2 (Parsec)"
      Position		      [30, 235, 135, 255]
      Value		      "15000"
    }
    Block {
      BlockType		      Switch
      Name		      "Select IC / previous values"
      Position		      [555, 220, 605, 300]
      BackgroundColor	      "orange"
      Criteria		      "u2 > Threshold"
      InputSameDT	      off
      SaturateOnIntegerOverflow	off
      ZeroCross		      off
    }
    Block {
      BlockType		      Clock
      Name		      "Time"
      Position		      [515, 250, 535, 270]
      Decimation	      "10"
    }
    Block {
      BlockType		      Constant
      Name		      "Velocity1 (m/s)"
      Position		      [25, 165, 135, 185]
      Value		      "1e3*[ 300, 90, 0 ]"
    }
    Block {
      BlockType		      Constant
      Name		      "Velocity2 (m/s)"
      Position		      [30, 340, 135, 360]
      Value		      "1e3*[ -300, 90, 0 ]"
    }
    Block {
      BlockType		      UnitDelay
      Name		      "unit delay"
      Position		      [465, 218, 500, 252]
      BackgroundColor	      "orange"
      SampleTime	      "-1"
    }
    Line {
      SrcBlock		      "Radius1 (Parsec)"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 1"
      DstPort		      1
    }
    Line {
      SrcBlock		      "CenterMass1 (Solar)"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 1"
      DstPort		      2
    }
    Line {
      Labels		      [1, 0]
      SrcBlock		      "Partition bodies/stars into\nheavy and light"
      SrcPort		      1
      Points		      [30, 0; 0, -75]
      DstBlock		      "Apply Newtonian gravitation"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Partition bodies/stars into\nheavy and light"
      SrcPort		      2
      Points		      [50, 0; 0, -125]
      DstBlock		      "Apply Newtonian gravitation"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Apply Newtonian gravitation"
      SrcPort		      1
      DstBlock		      "Merge heavy and\nlight bodies"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Apply Newtonian gravitation"
      SrcPort		      2
      DstBlock		      "Merge heavy and\nlight bodies"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Merge heavy and\nlight bodies"
      SrcPort		      1
      Points		      [0, 0; -135, 0]
      Branch {
	Points			[0, 75]
	DstBlock		"unit delay"
	DstPort			1
      }
      Branch {
	Points			[0, -80]
	DstBlock		"Plot all bodies/stars"
	DstPort			1
      }
    }
    Line {
      SrcBlock		      "Time"
      SrcPort		      1
      DstBlock		      "Select IC / previous values"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Select IC / previous values"
      SrcPort		      1
      DstBlock		      "Partition bodies/stars into\nheavy and light"
      DstPort		      1
    }
    Line {
      SrcBlock		      "unit delay"
      SrcPort		      1
      DstBlock		      "Select IC / previous values"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Position1"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 1"
      DstPort		      3
    }
    Line {
      SrcBlock		      "Velocity1 (m/s)"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 1"
      DstPort		      4
    }
    Line {
      SrcBlock		      "Radius2 (Parsec)"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 2"
      DstPort		      1
    }
    Line {
      SrcBlock		      "CenterMass2 (Solar)"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 2"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Position2"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 2"
      DstPort		      3
    }
    Line {
      SrcBlock		      "Velocity2 (m/s)"
      SrcPort		      1
      DstBlock		      "Construct Galaxy 2"
      DstPort		      4
    }
    Line {
      SrcBlock		      "Construct Galaxy 2"
      SrcPort		      1
      DstBlock		      "Matrix\nConcatenation"
      DstPort		      2
    }
    Line {
      SrcBlock		      "Construct Galaxy 1"
      SrcPort		      1
      Points		      [15, 0; 0, 145]
      DstBlock		      "Matrix\nConcatenation"
      DstPort		      1
    }
    Line {
      SrcBlock		      "Matrix\nConcatenation"
      SrcPort		      1
      DstBlock		      "Select IC / previous values"
      DstPort		      3
    }
    Annotation {
      Name		      "\"Spiral Galaxy Formation\" (based on Toomre & "
"Toomre, 1972)"
      Position		      [435, 23]
      FontName		      "Arial"
      FontSize		      20
    }
    Annotation {
      Name		      "This model was inspired by the classic paper \""
"Galactic Bridges and Tails\" (Toomre & Toomre 1972)\n It simulates the gravit"
"ional effect on two closely passing disc shaped galaxies. "
      Position		      [162, 418]
      HorizontalAlignment     "left"
      FontName		      "Arial"
      FontSize		      16
    }
    Annotation {
      Name		      "Standard Newtonian dynamics is applied at each "
"time step. We approximate the massive cloud of stars\nwith a single black hol"
"e at the center of the galaxy. We also partition the stars into heavy and lig"
"ht bodies\nand skip the computation between light and light bodies to improve"
" performance."
      Position		      [162, 478]
      HorizontalAlignment     "left"
      FontName		      "Arial"
      FontSize		      16
    }
  }
}

# Finite State Machines
#
#    Stateflow Version 6.2 (R14SP2) dated Jan 21 2005, 03:46:19
#
#

Stateflow {

	machine {
		id                   		1
		name                 		"sldemo_eml_galaxy"
		created              		"30-Mar-2004 17:18:29"
		isLibrary            		0
		firstTarget          		53
		sfVersion            		62014000
		sfDemoChecksum       		[3007975403 1589619386 678448510 4191496760]
	}

	chart {
		id                                        		2
		name                                      		"Plot all bodies/stars"
		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 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		"PlotAll"
		}
	}

	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 PlotAll(bodies)\n"
						"\n"
						"persistent fig;\n"
						"persistent oldPlot;\n"
						"\n"
						"n = size(bodies,1);\n"
						"\n"
						"SpeedOfLight = 299792458; % in m/s\n"
						"YearInSeconds = 365*24*60*60;\n"
						"LightYear = SpeedOfLight*YearInSeconds;\n"
						"Parsec = 3.26*LightYear;\n"
						"foundFig = findobj('Tag','galaxyScreen');\n"
						"\n"
						"if isempty(fig)||isempty(foundFig)\n"
						"    if isempty(foundFig)\n"
						"        fig = figure;\n"
						"    else\n"
						"        fig = figure(foundFig);\n"
						"    end;\n"
						"    clf(fig);\n"
						"    set(fig, 'Name', 'Galaxy');\n"
						"    set(fig, 'DoubleBuffer', 'on', 'Tag', 'galaxyScreen');\n"
						"    set(fig, 'Renderer', 'painters');\n"
						"    set(fig, 'Color', 'black');\n"
						"    hold('on');\n"
						"    fig_axes = 0; % Required for type inference\n"
						"    fig_axes = get(fig, 'CurrentAxes');\n"
						"    init_axes(fig_axes);\n"
						"    text(0,3.5*30000*Parsec,0,...\n"
						"        ['Spiral galaxy formation (based on Toomre, 1972)'."
						"..\n"
						"          char(10),'on close encounters.'],...\n"
						"        'Color','green','FontSize',14, 'HorizontalAlignment"
						"','center');\n"
						"end\n"
						"\n"
						"points_x = zeros(1,n);\n"
						"points_y = zeros(1,n);\n"
						"points_z = zeros(1,n);\n"
						"points_col = zeros(1,n);\n"
						"for i = 1:n,\n"
						"    points_x(i) = bodies(i,2);\n"
						"    points_y(i) = bodies(i,3);\n"
						"    points_z(i) = bodies(i,4);\n"
						"    points_col(i) = bodies(i,8);\n"
						"end\n"
						"\n"
						"%\n"
						"% Remove the old plot.\n"
						"%\n"
						"if isempty(oldPlot)\n"
						"    oldPlot = 0;\n"
						"elseif ~isempty(foundFig)\n"
						"    delete(oldPlot);\n"
						"end\n"
						"\n"
						"oldPlot = plot3(points_x,points_y,points_z,'w.');\n"
						"drawnow;\n"
						"\n"
						"function init_axes(a)\n"
						"    SpeedOfLight = 299792458; % in m/s\n"
						"    YearInSeconds = 365*24*60*60;\n"
						"    LightYear = SpeedOfLight*YearInSeconds;\n"
						"    Parsec = 3.26*LightYear;\n"
						"    set(a, 'CameraTarget', [0,0,0] );\n"
						"    set(a, 'CameraPosition', [0,22000*Parsec*3,18000*Parsec"
						"*3]);\n"
						"    set(a, 'CameraViewAngle', 80 );\n"
						"    set(a, 'CameraUpVector', [0,1,0]);\n"
						"    set(a, 'Visible', 'off' ); \n"
						"    set(a, 'XLim', [-25000*Parsec*8,30000*Parsec*8]);\n"
						"    set(a, 'YLim', [-25000*Parsec*8,30000*Parsec*8]);\n"
						"    set(a, 'ZLim', [-30000*Parsec*8,30000*Parsec*8]);\n"
						"    set(a, 'DrawMode', 'fast');\n"
						""
			editorLayout		"100 M4x1[225 10 716 663]"
		}
	}

	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                          		"bodies"
		linkNode                      		[2 0 0]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	instance {
		id     		7
		name   		"Plot all bodies//stars"
		machine		1
		chart  		2
	}

	chart {
		id                                        		8
		name                                      		"Construct Galaxy 1"
		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 9 0 0]
		firstTransition                           		11
		firstJunction                             		10
		viewObj                                   		8
		machine                                   		1
		decomposition                             		CLUSTER_CHART
		type                                      		EML_CHART
		firstData                                 		12
		chartFileNumber                           		2
		disableImplicitCasting                    		1
		eml {
			name		"ConstructGalaxy"
		}
	}

	state {
		id                  		9
		labelString         		"eML_blk_kernel()"
		position            		[18 64.5 118 66]
		fontSize            		12
		chart               		8
		treeNode            		[8 0 0 0]
		superState          		SUBCHART
		subviewer           		8
		type                		FUNC_STATE
		decomposition       		CLUSTER_STATE
		eml {
			isEML       		1
			script      		"function bodies = ConstructGalaxy(rp,cm,pos,vel)\n"
						"\n"
						"numberOfBodies = 350;\n"
						"\n"
						"bodies = ConstructGalaxy0(rp,cm,pos,vel,numberOfBodies);\n"
						"\n"
						"function bodies = ConstructGalaxy0(rp,cm,pos,vel,n)\n"
						"\n"
						"SolarMass = 1.9891e+30; % In kg \n"
						"G = 6.672E-11; % Nm^2/kg^2 (Gravitational constant)\n"
						"SpeedOfLight = 299792458; % in m/s\n"
						"YearInSeconds = 365*24*60*60;\n"
						"LightYear = SpeedOfLight*YearInSeconds;\n"
						"Parsec = 3.26*LightYear;\n"
						"\n"
						"radiusOuter = rp*Parsec;\n"
						"radiusInner = (rp/3)*Parsec;\n"
						"\n"
						"% Each star has X,Y,Z,VX,VY,VZ\n"
						"% X,Y,Z position in certesian coordinates\n"
						"% VX,VY,VZ velocity in certesian coordinates\n"
						"\n"
						"cm = cm*SolarMass;\n"
						"\n"
						"bodies = zeros(n,8);\n"
						"bodies(1,1) = cm;\n"
						"bodies(1,2) = pos(1)*Parsec;\n"
						"bodies(1,3) = pos(2)*Parsec;\n"
						"bodies(1,4) = pos(3)*Parsec;\n"
						"bodies(1,5) = vel(1);\n"
						"bodies(1,6) = vel(2);\n"
						"bodies(1,7) = vel(3);\n"
						"bodies(1,8) = 'r';\n"
						"if n > 1\n"
						"for i = 2:n,\n"
						"    m0 = 0;\n"
						"    m0 = rand();\n"
						"    m0 = m0*20+4;\n"
						"    m = m0*SolarMass;\n"
						"    r0 = 0;\n"
						"    r0 = rand();\n"
						"    r = r0*(radiusOuter - radiusInner) + radiusInner;\n"
						"    arg0 = 0;\n"
						"    arg0 = rand();\n"
						"    arg = arg0*2*pi;\n"
						"    x = r*cos(arg);\n"
						"    y = r*sin(arg);\n"
						"    z = 0;\n"
						"    dx = cos(arg+pi/2);\n"
						"    dy = sin(arg+pi/2);\n"
						"    dz = 0;\n"
						"    % Compute free fall velocity\n"
						"    v = sqrt(G*cm/r);\n"
						"    bodies(i,1) = m;\n"
						"    bodies(i,2) = x+pos(1)*Parsec;\n"
						"    bodies(i,3) = y+pos(2)*Parsec;\n"
						"    bodies(i,4) = z+pos(3)*Parsec;\n"
						"    bodies(i,5) = dx*v+vel(1);\n"
						"    bodies(i,6) = dy*v+vel(2);\n"
						"    bodies(i,7) = dz*v+vel(3);\n"
						"    bodies(i,8) = 'r';\n"
						"end\n"
						"end\n"
						""
			editorLayout		"100 M4x1[101 1 716 669]"
		}
	}

	junction {
		id         		10
		position   		[23.5747 49.5747 7]
		chart      		8
		linkNode   		[8 0 0]
		subviewer  		8
		type       		CONNECTIVE_JUNCTION
	}

	transition {
		id             		11
		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          		10
			intersection		[7 0 -1 -1 23.5747 42.5747 0 0]
		}
		midPoint       		[23.5747 24.9468]
		chart          		8
		linkNode       		[8 0 0]
		dataLimits     		[21.175 25.975 14.625 42.575]
		subviewer      		8
		drawStyle      		SMART
		executionOrder 		1
	}

	data {
		id                            		12
		name                          		"rp"
		linkNode                      		[8 0 13]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
			}
		}
	}

	data {
		id                            		13
		name                          		"cm"
		linkNode                      		[8 12 14]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
			}
		}
	}

	data {
		id                            		14
		name                          		"bodies"
		linkNode                      		[8 13 15]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		15
		name                          		"pos"
		linkNode                      		[8 14 16]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		16
		name                          		"vel"
		linkNode                      		[8 15 0]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	instance {
		id     		17
		name   		"Construct Galaxy 1"
		machine		1
		chart  		8
	}

	chart {
		id                                        		18
		name                                      		"Apply Newtonian gravitation"
		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		"ApplyGravity"
		}
	}

	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 [heavy1,light1] = ApplyGravity(light,heavy)\n"
						"\n"
						"G = 6.672E-11; % Nm^2/kg^2 (Gravitational constant)\n"
						"\n"
						"SpeedOfLight = 299792458; % in m/s\n"
						"YearInSeconds = 365*24*60*60;\n"
						"LightYear = SpeedOfLight*YearInSeconds;\n"
						"Parsec = 3.26*LightYear;\n"
						"\n"
						"timeStep = 2000000*YearInSeconds;\n"
						"\n"
						"n = size(heavy,1);\n"
						"nProps = size(heavy,2);\n"
						"\n"
						"heavy1 = heavy;\n"
						"light1 = light;\n"
						"\n"
						"for i = 1:n,\n"
						"    mi = heavy(i,1);\n"
						"    if mi == 0\n"
						"        break;\n"
						"    end\n"
						"    xi = heavy(i,2);\n"
						"    yi = heavy(i,3);\n"
						"    zi = heavy(i,4);\n"
						"    ar = [0 0 0];\n"
						"    for j = 1:n,\n"
						"        if i ~= j,\n"
						"            mj = heavy(j,1);\n"
						"            if mj == 0\n"
						"                break;\n"
						"            end\n"
						"            xj = heavy(j,2);\n"
						"            yj = heavy(j,3);\n"
						"            zj = heavy(j,4);\n"
						"            d = [xj yj zj] - [xi yi zi];\n"
						"            dr2 = d(1)*d(1)+d(2)*d(2)+d(3)*d(3);\n"
						"            ar = ar + (d/sqrt(dr2))*((G*mj)/dr2);\n"
						"        end\n"
						"    end\n"
						"    for k = 1:3\n"
						"        heavy1(i,4+k) = heavy(i,4+k) + ar(k)*timeStep;\n"
						"    end        \n"
						"end\n"
						"\n"
						"for i = 1:n,\n"
						"    mi = light(i,1);\n"
						"    if mi == 0\n"
						"        break;\n"
						"    end\n"
						"    xi = light(i,2);\n"
						"    yi = light(i,3);\n"
						"    zi = light(i,4);\n"
						"    ar = [0 0 0];\n"
						"    for j = 1:n,\n"
						"        mj = heavy(j,1);\n"
						"        if mj == 0\n"
						"            break;\n"
						"        end\n"
						"        xj = heavy(j,2);\n"
						"        yj = heavy(j,3);\n"
						"        zj = heavy(j,4);\n"
						"        d = [xj yj zj] - [xi yi zi];\n"
						"        dr2 = d(1)*d(1)+ d(2)*d(2) + d(3)*d(3);\n"
						"        ar = ar + (d/sqrt(dr2))*((G*mj)/dr2);\n"
						"    end\n"
						"    for k = 1:3\n"
						"        light1(i,4+k) = light(i,4+k) + ar(k)*timeStep;\n"
						"    end\n"
						"end\n"
						"\n"
						"for i = 1:n\n"
						"    for k = 1:3\n"
						"        heavy1(i,k+1) = heavy1(i,k+1) + timeStep*heavy1(i,k"
						"+4);\n"
						"    end\n"
						"    for k = 1:3\n"
						"        light1(i,k+1) = light1(i,k+1) + timeStep*light1(i,k"
						"+4);\n"
						"    end\n"
						"end\n"
						""
			editorLayout		"100 M4x1[114 65 716 669]"
		}
	}

	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                          		"heavy1"
		linkNode                      		[18 0 23]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		23
		name                          		"light1"
		linkNode                      		[18 22 24]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		24
		name                          		"light"
		linkNode                      		[18 23 25]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		25
		name                          		"heavy"
		linkNode                      		[18 24 0]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	instance {
		id     		26
		name   		"Apply Newtonian gravitation"
		machine		1
		chart  		18
	}

	chart {
		id                                        		27
		name                                      		"Partition bodies/stars into\n"
					"heavy and light"
		windowPosition                            		[311.813 299.45 200.25 189.75]
		viewLimits                                		[0 156.75 0 153.75]
		screen                                    		[1 1 1280 1024 1.333333333333333]
		treeNode                                  		[0 28 0 0]
		firstTransition                           		30
		firstJunction                             		29
		viewObj                                   		27
		machine                                   		1
		decomposition                             		CLUSTER_CHART
		type                                      		EML_CHART
		firstData                                 		31
		chartFileNumber                           		4
		disableImplicitCasting                    		1
		eml {
			name		"Partition"
		}
	}

	state {
		id                  		28
		labelString         		"eML_blk_kernel()"
		position            		[18 64.5 118 66]
		fontSize            		12
		chart               		27
		treeNode            		[27 0 0 0]
		superState          		SUBCHART
		subviewer           		27
		type                		FUNC_STATE
		decomposition       		CLUSTER_STATE
		eml {
			isEML       		1
			script      		"function [heavy,light] = Partition(bodies)\n"
						"\n"
						"SolarMass = 1.9891e+30; % kg \n"
						"Limit = 100*SolarMass;\n"
						"\n"
						"n = size(bodies,1);\n"
						"props = size(bodies,2);\n"
						"heavy = zeros(n,props);\n"
						"light = zeros(n,props);\n"
						"\n"
						"lightIndex = 1;\n"
						"heavyIndex = 1;\n"
						"\n"
						"for i = 1:n\n"
						"    m = bodies(i,1);\n"
						"    if m < Limit\n"
						"        light(lightIndex,:) = bodies(i,:);\n"
						"        lightIndex = lightIndex + 1;\n"
						"    else\n"
						"        heavy(heavyIndex,:) = bodies(i,:);\n"
						"        heavyIndex = heavyIndex + 1;\n"
						"    end\n"
						"end\n"
						""
			editorLayout		"100 M4x1[132 16 716 669]"
		}
	}

	junction {
		id         		29
		position   		[23.5747 49.5747 7]
		chart      		27
		linkNode   		[27 0 0]
		subviewer  		27
		type       		CONNECTIVE_JUNCTION
	}

	transition {
		id             		30
		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          		29
			intersection		[7 0 -1 -1 23.5747 42.5747 0 0]
		}
		midPoint       		[23.5747 24.9468]
		chart          		27
		linkNode       		[27 0 0]
		dataLimits     		[21.175 25.975 14.625 42.575]
		subviewer      		27
		drawStyle      		SMART
		executionOrder 		1
	}

	data {
		id                            		31
		name                          		"bodies"
		linkNode                      		[27 0 32]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		32
		name                          		"heavy"
		linkNode                      		[27 31 33]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		33
		name                          		"light"
		linkNode                      		[27 32 0]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	instance {
		id     		34
		name   		"Partition bodies//stars into\n"
					"heavy and light"
		machine		1
		chart  		27
	}

	chart {
		id                                        		35
		name                                      		"Merge heavy and\n"
					"light bodies"
		windowPosition                            		[311.813 299.45 200.25 189.75]
		viewLimits                                		[0 156.75 0 153.75]
		screen                                    		[1 1 1280 1024 1.333333333333333]
		treeNode                                  		[0 36 0 0]
		firstTransition                           		38
		firstJunction                             		37
		viewObj                                   		35
		machine                                   		1
		decomposition                             		CLUSTER_CHART
		type                                      		EML_CHART
		firstData                                 		39
		chartFileNumber                           		5
		disableImplicitCasting                    		1
		eml {
			name		"combine"
		}
	}

	state {
		id                  		36
		labelString         		"eML_blk_kernel()"
		position            		[18 64.5 118 66]
		fontSize            		12
		chart               		35
		treeNode            		[35 0 0 0]
		superState          		SUBCHART
		subviewer           		35
		type                		FUNC_STATE
		decomposition       		CLUSTER_STATE
		eml {
			isEML       		1
			script      		"function M = combine(A,B)\n"
						"\n"
						"\n"
						"n = size(A,1);\n"
						"nProps = size(A,2);\n"
						"M = zeros(n,nProps);\n"
						"for i = 1:n\n"
						"    if A(i,1) == 0\n"
						"        break;\n"
						"    end\n"
						"    M(i,:) = A(i,:);\n"
						"end\n"
						"n1 = n - i + 1;\n"
						"for j = 1:n1\n"
						"    M(j+i-1,:) = B(j,:);\n"
						"    if B(i,1) == 0\n"
						"        break\n"
						"    end\n"
						"end\n"
						""
			editorLayout		"100 M4x1[147 19 716 669]"
		}
	}

	junction {
		id         		37
		position   		[23.5747 49.5747 7]
		chart      		35
		linkNode   		[35 0 0]
		subviewer  		35
		type       		CONNECTIVE_JUNCTION
	}

	transition {
		id             		38
		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          		37
			intersection		[7 0 -1 -1 23.5747 42.5747 0 0]
		}
		midPoint       		[23.5747 24.9468]
		chart          		35
		linkNode       		[35 0 0]
		dataLimits     		[21.175 25.975 14.625 42.575]
		subviewer      		35
		drawStyle      		SMART
		executionOrder 		1
	}

	data {
		id                            		39
		name                          		"A"
		linkNode                      		[35 0 40]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		40
		name                          		"B"
		linkNode                      		[35 39 41]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		41
		name                          		"M"
		linkNode                      		[35 40 0]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	instance {
		id     		42
		name   		"Merge heavy and\n"
					"light bodies"
		machine		1
		chart  		35
	}

	chart {
		id                                        		43
		name                                      		"Construct Galaxy 2"
		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 44 0 0]
		firstTransition                           		46
		firstJunction                             		45
		viewObj                                   		43
		machine                                   		1
		decomposition                             		CLUSTER_CHART
		type                                      		EML_CHART
		firstData                                 		47
		chartFileNumber                           		6
		disableImplicitCasting                    		1
		eml {
			name		"ConstructGalaxy"
		}
	}

	state {
		id                  		44
		labelString         		"eML_blk_kernel()"
		position            		[18 64.5 118 66]
		fontSize            		12
		chart               		43
		treeNode            		[43 0 0 0]
		superState          		SUBCHART
		subviewer           		43
		type                		FUNC_STATE
		decomposition       		CLUSTER_STATE
		eml {
			isEML       		1
			script      		"function bodies = ConstructGalaxy(rp,cm,pos,vel)\n"
						"\n"
						"numberOfBodies = 350;\n"
						"\n"
						"bodies = ConstructGalaxy0(rp,cm,pos,vel,numberOfBodies);\n"
						"\n"
						"function bodies = ConstructGalaxy0(rp,cm,pos,vel,n)\n"
						"\n"
						"SolarMass = 1.9891e+30; % In kg \n"
						"G = 6.672E-11; % Nm^2/kg^2 (Gravitational constant)\n"
						"SpeedOfLight = 299792458; % in m/s\n"
						"YearInSeconds = 365*24*60*60;\n"
						"LightYear = SpeedOfLight*YearInSeconds;\n"
						"Parsec = 3.26*LightYear;\n"
						"\n"
						"radiusOuter = rp*Parsec;\n"
						"radiusInner = (rp/3)*Parsec;\n"
						"\n"
						"% Each star has X,Y,Z,VX,VY,VZ\n"
						"% X,Y,Z position in certesian coordinates\n"
						"% VX,VY,VZ velocity in certesian coordinates\n"
						"\n"
						"cm = cm*SolarMass;\n"
						"\n"
						"bodies = zeros(n,8);\n"
						"bodies(1,1) = cm;\n"
						"bodies(1,2) = pos(1)*Parsec;\n"
						"bodies(1,3) = pos(2)*Parsec;\n"
						"bodies(1,4) = pos(3)*Parsec;\n"
						"bodies(1,5) = vel(1);\n"
						"bodies(1,6) = vel(2);\n"
						"bodies(1,7) = vel(3);\n"
						"bodies(1,8) = 'y';\n"
						"if n > 1\n"
						"for i = 2:n,\n"
						"    m0 = 0;\n"
						"    m0 = rand();\n"
						"    m0 = m0*20+4;\n"
						"    m = m0*SolarMass;\n"
						"    r0 = 0;\n"
						"    r0 = rand();\n"
						"    r = r0*(radiusOuter - radiusInner) + radiusInner;\n"
						"    arg0 = 0;\n"
						"    arg0 = rand();\n"
						"    arg = arg0*2*pi;\n"
						"    x = r*cos(arg);\n"
						"    y = r*sin(arg);\n"
						"    z = 0;\n"
						"    dx = cos(arg+pi/2);\n"
						"    dy = sin(arg+pi/2);\n"
						"    dz = 0;\n"
						"    % Compute free fall velocity\n"
						"    v = sqrt(G*cm/r);\n"
						"    bodies(i,1) = m;\n"
						"    bodies(i,2) = x+pos(1)*Parsec;\n"
						"    bodies(i,3) = y+pos(2)*Parsec;\n"
						"    bodies(i,4) = z+pos(3)*Parsec;\n"
						"    bodies(i,5) = dx*v+vel(1);\n"
						"    bodies(i,6) = dy*v+vel(2);\n"
						"    bodies(i,7) = dz*v+vel(3);\n"
						"    bodies(i,8) = 'y';\n"
						"end\n"
						"end\n"
						""
			editorLayout		"100 M4x1[101 1 716 669]"
		}
	}

	junction {
		id         		45
		position   		[23.5747 49.5747 7]
		chart      		43
		linkNode   		[43 0 0]
		subviewer  		43
		type       		CONNECTIVE_JUNCTION
	}

	transition {
		id             		46
		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          		45
			intersection		[7 0 -1 -1 23.5747 42.5747 0 0]
		}
		midPoint       		[23.5747 24.9468]
		chart          		43
		linkNode       		[43 0 0]
		dataLimits     		[21.175 25.975 14.625 42.575]
		subviewer      		43
		drawStyle      		SMART
		executionOrder 		1
	}

	data {
		id                            		47
		name                          		"rp"
		linkNode                      		[43 0 48]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
			}
		}
	}

	data {
		id                            		48
		name                          		"cm"
		linkNode                      		[43 47 49]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
			}
		}
	}

	data {
		id                            		49
		name                          		"bodies"
		linkNode                      		[43 48 50]
		scope                         		OUTPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		50
		name                          		"pos"
		linkNode                      		[43 49 51]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	data {
		id                            		51
		name                          		"vel"
		linkNode                      		[43 50 0]
		scope                         		INPUT_DATA
		machine                       		1
		dataType                      		"inherited"
		fixptType {
			bias    		0
			slope   		1
			exponent		0
			baseType		SF_INT16_TYPE
			lock    		0
		}
		dlgFixptMode                  		0
		props {
			range {
				minimum		""
				maximum		""
			}
			array {
				size      		"-1"
				firstIndex		"1"
			}
		}
	}

	instance {
		id     		52
		name   		"Construct Galaxy 2"
		machine		1
		chart  		43
	}

	target {
		id                        		53
		name                      		"sfun"
		description               		"Default Simulink S-Function Target."
		codeFlags                 		" debug=1 overflow=0 echo=1"
		machine                   		1
		linkNode                  		[1 0 0]
	}
}
