====== Sub-system ====== {{:subsystem.png|Screenshot}}\\ Like [[Group|groups]], sub-systems are containers for [[Block|blocks]] and are used to make large [[Model|models]] more manageable and understandable. The sub-system also acts as a name space for the blocks that it contains, which means that it will determine the ID of the blocks and guarantee that there are never two blocks inside the same sub-system with the same name. Finally, sub-systems can communicate with other sub-systems through the use of [[Connector|connectors]]. As sub-system can contain other sub-systems, hierarchies of sub-systems can be created. The top level sub-system is called the [[Root_sub-system|root sub-system]]. When a sub-system contains another sub-system, it is said to be the [[Parent_sub-system|parent]] of that sub-system. Blocks always belong to a sub-system - if no sub-system is created they belong to the [[Root_sub-system|root sub-system]]. The [[ID|id]] of a [[Block|block]] or sub-system is composed by the name of the [[Block|block]] and the [[ID|id]] of the parent sub-system. The [[ID|id]] of the [[Root_sub-system|root sub-system]] is empty, which means that the [[ID|id]] of blocks belonging to is the same as their [[Name|name]]. Because the sub-system controls the [[ID|id]] of the blocks it contains, several blocks can have the same [[Name|name]] as long as they belong to different sub-systems. === Modules === By defining [[Model_input|inputs]] and [[Model_output|outputs]] a sub-system becomes a stand-alone module. Modules are reusable components that can be easily connected to quickly assemble new models. Modules can be added to and from the module [[Library|library]]. === Matrix and graph === The matrix of the [[Matrix_window|matrix window]] and the graph of the [[Graph_window|graph window]] benefit greatly from the use of sub-systems. A large model, with many [[Block|blocks]] becomes difficult to handle if it is not divided into sub-systems. Both the [[Interaction_matrix|matrix]] and the [[Box_diagram|graphs]] let you expand and collapse sub-systems, so that you can choose which sub-systems should be open. Once you have created a sub-system, you can expand it by clicking the {{:expand_subsystem.png}} button. To collapse the sub-system, click the {{:collapse_subsystem.png}} button. In the [[windows#Title_bar|title bar]] of the windows you can select which sub-system to view from a drop down menu. ===== Creating sub-systems ===== A sub-system can be created in several ways: **From the [[Projects_window|Projects window]]** * Expand the project folder. Right-click the Blocks node and select **New | Sub-system**. A new sub-system folder is added, and a corresponding sub-system will appear in the matrix of the matrix window. You can nest sub-systems by adding a sub-system into another. **From the [[Matrix_window|Matrix window]]** * Right-click an empty diagonal cell and select **Sub-system** from the pop-up menu, //or// * First add the object(s) that will make out the sub-system (blocks(s) and/or sub-system(s)). Select all the objects by selecting the first object, keeping SHIFT pressed and selecting the last object. The selected objects are highlighted in blue. Right-click and select **Sub-system** option from the pop-up menu. Now all added objects are put into the created sub-system. **From the [[Graph_window|Graph window]]** * Right-click an empty spot in the window and select **Sub-system** from the menu. ===== Editing a sub-system ===== To edit a sub-system, right-click the sub-system in any window and select **Edit**. In the [[Blocks_window|Blocks window]], you can also show the block editor by selecting the block and clicking the {{:Edit24.png|Edit}} button, or by double-clicking the right-most “validation” column of the block. The block editor has three tabs: ==== Properties ==== This page lets you edit basic properties such as name, and sub-system. See [[Editing_properties|editing properties]] for more information. ==== Appearance ==== This page lets you edit the visual properties of the block in the [[Matrix_window|matrix window]] and [[Graph_window|graph window]]. See [[Editing_appearance|editing appearance]] for more information. ==== Inputs ==== This page lets you specify sub-system [[model_input]|inputs]]. ==== Outputs ==== This page lets you specify sub-system [[model_output]|outputs]]. ==== Comments ==== This page is used during the quality assurance. See [[Editing_values|editing values]] for more information. ===== Deleting sub-systems ===== When you delete a sub-system, all its contents – blocks and nested sub-systems - are deleted. To delete a sub-system, right click the sub-system either in the [[Projects_window|Projects window]] or the [[Matrix_window|Matrix window]] and select **Delete** from the pop-up menu. A dialog box will ask you if you want to remove the sub-system. Click Ok to confirm or Cancel to cancel this action. If you simply want to remove the sub-system, but retain all its contents, you can instead choose **Destroy sub-system** from the menu. ===== Converting between group and sub-system ===== A [[Group|group]] can be converted to a [[Sub-system|sub-system]] and vice versa by right-clicking the group/sub-system and selecting **Convert to sub-system/group**. Note that if you convert a sub-system to a group, the block’s names might change so that they have a unique name in their new sub-system. ===== See also ===== * [[Block|Blocks]] * [[Blocks_window|Blocks window]] * [[Matrix_window|Matrix window]] * [[Graph_window|Graph window]]