Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
submodels [2015/11/18 02:20]
admin [Turning a Local Submodel into a User Submodel (Publishing)]
submodels [2017/07/05 20:43] (current)
admin [Creating Local Submodels]
Line 7: Line 7:
 Conceptually,​ a submodel is a combination of functors exporting inputs and outputs to be bound externally, but, from the user point of view, a submodel is used just like any other ordinary functor. Conceptually,​ a submodel is a combination of functors exporting inputs and outputs to be bound externally, but, from the user point of view, a submodel is used just like any other ordinary functor.
  
-[{{ :submodels:general_view.png |Model fragment showing submodels}}]+[{{ :submodels:basic_overview_submodels.png?1200 |Submodel Overview}}]
  
 Submodels are also first class citizen that can be transferred from one model to another. They can also be modified and updated at any time without breaking the model where they are being used. They can also depend on other submodels, as long as their definition do not form a cycle. Submodels are also first class citizen that can be transferred from one model to another. They can also be modified and updated at any time without breaking the model where they are being used. They can also depend on other submodels, as long as their definition do not form a cycle.
Line 27: Line 27:
  
 In practice, users can only create local submodels. These local submodels can later be promoted to user submodels making them a definitive part of the user's tool set. In practice, users can only create local submodels. These local submodels can later be promoted to user submodels making them a definitive part of the user's tool set.
 +
 +[{{ :​submodels:​submodel_types.png?​900 |Different Types of Submodels}}]
  
 <note tip>​Changing the definition of **user submodels** may break existent models that use that definition, making those models useless unless the user manually updates each one of them. On the other hand, **local submodels** can be safely updated since their updates are propagated to all local submodels from the same model and to the main model itself.</​note>​ <note tip>​Changing the definition of **user submodels** may break existent models that use that definition, making those models useless unless the user manually updates each one of them. On the other hand, **local submodels** can be safely updated since their updates are propagated to all local submodels from the same model and to the main model itself.</​note>​
 +
  
 ==== Where Local Submodels Are Stored ==== ==== Where Local Submodels Are Stored ====
  
-Local submodels are stored in a folder based on the model name. If the model containing the local submodel is named ''​simulation model.egoml'',​ its local submodels will be stored in a subfolder called ''​simulation model_egoml_Submodels''​. Basically, the name construction algorithm just replaces "​."​ with "​_"​ and appends "​_Submodels"​ to the name.+Local submodels are stored in a folder based on the model name. If the model containing the local submodel is named ''​simulation model.egoml'',​ its local submodels will be stored in a subfolder called ''​simulation model_egoml_Submodels''​. Basically, the name construction algorithm just replaces "​."​ with "​_"​ and appends "​_Submodels"​ to the name. Using a unique submodel folder for each model guarantees that submodels from one model are completely independent from the submodels from any other model. Local submodels can also be defined in a folder called "​Submodels"​ located in the same folder where the model file is located, and shared shared among all the models located in that folder. However, the folder is automatically converted into an unique submodel folder when the model is saved by the graphical interface. 
 + 
 +User submodels are stored typically in the folder ''​c:​\<​User>​\Documents\Dinamica EGO\Submodels''​. 
 + 
 +Store submodels are stored typically in the folder ''​c:​\<​User>​\AppData\Local\Dinamica EGO\StoreSubmodels''​.
  
-The use a unique submodel folder for each model, guarantees that submodels from one model are completely independent from the submodels from any other model. 
  
 ===== Creating Local Submodels ===== ===== Creating Local Submodels =====
Line 40: Line 46:
 Local submodels can be created by simply selecting the parts of a model that will be converted to a submodel and choosing the menu Edit => Create Submodel. The selection will be replaced by the new submodel and the visual representation of the new submodel will be available to be edited as a new tab on the script editor. Local submodels can be created by simply selecting the parts of a model that will be converted to a submodel and choosing the menu Edit => Create Submodel. The selection will be replaced by the new submodel and the visual representation of the new submodel will be available to be edited as a new tab on the script editor.
  
-At any time, the user can make changes to the local submodel and choose update ​"Apply changes / Update Submodel Properties"​ on the [[model toolbar]]. See more information about updating a local submodel on the next sections.+At any time, the user can make changes to the local submodel and apply those changes clicking on "Apply changes / Update Submodel Properties"​ on the [[model toolbar]]. See more information about updating a local submodel on the next sections.
  
 It is also possible to select parts of a local submodel and create another local submodel using that selection. The new local submodel will be a dependency of the previous one, but the submodel creation process is basically the same. It is also possible to select parts of a local submodel and create another local submodel using that selection. The new local submodel will be a dependency of the previous one, but the submodel creation process is basically the same.
Line 88: Line 94:
 It is also worth noting that it is possible to safely rename inputs and outputs. The connections to the port will be maintained when the changes are propagated. It is also worth noting that it is possible to safely rename inputs and outputs. The connections to the port will be maintained when the changes are propagated.
  
-<note tip>Tip: Dinamica EGO comes with a set of icons from the [[http://​www.fatcow.com/​free-icons|Fat Cow Icon Set]] that can be used to customize the local submodels created by users. The icons come in size 16x16 and 32x32 pixels.</​note>​+<note tip>Tip: Dinamica EGO comes with a set of icons from the [[http://​www.fatcow.com/​free-icons|Fat Cow Icon Set]] that can be used to customize the local submodels created by users. The icons come in size 16x16 and 32x32 pixels. ​The overall color of the icon choosen is automatically used to define the color of the functor representing the submodel on the graphical interface. 
 +The set of icons are usually installed in the folder ''​IconSamples''​ in your Dinamica EGO installation folder</​note>​
  
 When updating a local submodel, the changes from all dependent local submodels will also be propagated. It means that updating a submodel always updates the whole chain of local submodels that uses that submodel as part of their definition. When updating a local submodel, the changes from all dependent local submodels will also be propagated. It means that updating a submodel always updates the whole chain of local submodels that uses that submodel as part of their definition.
Line 108: Line 115:
 On the dependency graph viewer, all local submodels are represented by their names and corresponding icons. An arrow pointing from a submodel A to a submodel B means that the submodel A is used by the submodel B. Multiple arrows mean that a local submodel is used more than once. On the dependency graph viewer, all local submodels are represented by their names and corresponding icons. An arrow pointing from a submodel A to a submodel B means that the submodel A is used by the submodel B. Multiple arrows mean that a local submodel is used more than once.
  
-===== Copying (Importing) a Local Submodel Between ​Submodel ​=====+===== Copying (Importing) a Local Submodel Between ​Models ​=====
  
 It is possible to copy local submodels definitions between models. Once the submodel is copied from one model to another model, the submodels can be modified and updated independently. It is possible to copy local submodels definitions between models. Once the submodel is copied from one model to another model, the submodels can be modified and updated independently.
Line 121: Line 128:
  
 Once your local submodel was developed and fully tested, you can turn your local submodel into a user submodel. Once your local submodel was developed and fully tested, you can turn your local submodel into a user submodel.
 +
 +To publish a local submodel into a user submodel, click on the "​Publish Submodel"​ button on the submodel "​Submodel Options"​ drop down menu located on the model toolbar. ​
  
 Turning a local submodel into a user submodel make reusing a submodel easier, the submodel will always be available to be used on your next models, but it have some drawbacks as well. You are fully responsible for the consequences of updating a user submodel. Beware, that unlike local submodels, your models will not carry a copy of a user submodel as part of their definition. So, if you change a user submodel in a way that breaks compatibility with the model using its definition, your models will not work anymore. Turning a local submodel into a user submodel make reusing a submodel easier, the submodel will always be available to be used on your next models, but it have some drawbacks as well. You are fully responsible for the consequences of updating a user submodel. Beware, that unlike local submodels, your models will not carry a copy of a user submodel as part of their definition. So, if you change a user submodel in a way that breaks compatibility with the model using its definition, your models will not work anymore.