====== General variable ====== A general variable acts as substitute for another object and is used when the model creator wants to present users with different options for a certain calculation. ===== Creating a general variable ===== From the [[Projects_window|Projects window]] * Expand the Project to which you wish to add the general variable by clicking the + symbol next to it. Right-click on ‘Blocks’, or a [[Sub-system|sub-system]] in ‘Blocks’, and select **General Variable** from the pop-up menu. From the Model window * Right click an empty diagonal cell of the matrix and select **Other | General Variable** from the the pop-up menu. From the [[Blocks_window|Blocks window]] * Place the mouse cursor over the table and right-click on it. Select **Create | General Variable** from the pop-up menu, //or// * In the title bar, select **General Variable** from the **Type** drop-down list and click on the {{:New24.png|New}} button. ===== Editing a general variable ===== The block editor is shown by right-clicking the block in a window and selecting **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, sub-system and base unit. See [[Editing_properties|editing properties]] for more information. For General variable **Unit** can not be changed. ==== 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. ==== Values ==== |Note|Most block properties can be edited directly in the [[Blocks_window|Blocks window]].| **Dimension** - You can specify the dimension of the block by using the **Type** drop down list. Depending on the dimension the index drop down lists are activated. See [[Editing_values|editing values]] for more information. **Target** * **//Indices//** - For blocks that are non-scalar, the first columns will specify indices from the [[Index_list|index lists]]. This allows you to specify different targets for different indices. The top row is named “default” and can be used when the same target should be set for all indices. * **Selected** - Select the target object that this general variable should delegate to. * **Information** - By using the [[Table_control_button|Table control button]] you can display more columns that will help you document your model. **Available** * **Available** - Shows list of available objects that may be available options for the general variable. * **Selected** - Specify which objects that should be available options for the general variable. ===== Example ===== The deposition of a contaminant onto soil can be specified in different ways depending on the scenario. In one scenario, the user might have time dependent measurements for deposition. In another the deposition is constant. In a third the deposition is calculated as a function of temperature, the concentration in air etc. Rather than building three different models, the modeller creates one object for each scenario: a lookup table, a parameter and an expression. He then creates a [[General_variable|general variable]] and calls it “deposition strategy”. Finally the modeller adds the three objects to the general variable and selects one of them. The general variable can now be used in equations, and will delegate to the selected object. A user can easily change the strategy simply by editing the general variable and select the apropriate object. ===== See also ===== * [[Block|Blocks]] * The [[Blocks_window|Blocks window]]