====== Tutorial 4 - Creating expressions and parameters ====== ===== 3/5 ===== In this lesson an expression is created which calculates the contaminant concentration in different plants, and also the two parameters //CF// and //RootFactor//. \\ **Creating CF**
  1. Open the [[Blocks_window|Blocks window]].

  2. Select **Parameter** from the **Type** drop down list and click the {{:New24.png|New}} button on the [[windows#Title_bar|title bar]], or right-click the window and select **Create | Parameter** from the pop-up menu.

  3. Edit the new parameter. In the **Properties** tab, give it the following properties:

    ^Name^Full Name ^ |CF |Concentration Factor|
  4. Select the **Values** tab. Change dimension from “Scalar” to “Matrix”.

  5. Set **Index-1** to “Materials”. Set **Index-2** to “Plants”.

  6. Assign the following values to the parameter:

    \\

    ^Materials^Plants^Value^ |NO |Pine |0.003| |SO2 |Pine |0.12 | |NO |Fir |0.21 | |SO2 |Fir |0.013| |NO |Wheat |0.06 | |SO2 |Wheat |0.013| |NO |Oats |0.093| |SO2 |Oats |0.013|

    \\

  7. Click **Ok** to close the window.

\\ **Creating RootFactor**
  1. Select **Parameter** from the **Type** drop down list and click the {{:New24.png|New}} button on the [[windows#Title_bar|title bar]], or right-click the window and select **Create | Parameter** from the pop-up menu.

  2. Edit the new parameter. In the **Properties** tab, give it the following properties:

    \\

    ^Name ^Full Name ^ |RootFactor|Root penetration factor|

    \\

  3. Select the **Values** tab. Change dimension from “Scalar” to “Vector”.

  4. Set **Index-1** to “Plant types”.

  5. Assign the following values to the parameter:

    ^Plant types^Value^ |Tree |0.6 | |Grain |0.001|
  6. Click **Ok** to close the window.

\\ **Creating the expression**
  1. Open the [[Blocks_window|Blocks window]]

  2. Click the {{:New24.png|New}} button on the [[windows#Title_bar|title bar]], or right-click the window and select **Create | Expression** from the pop-up menu.

  3. Right-click the new expression and select **Edit** from the pop-up menu.

  4. In the **Properties** tab, give the expression the following properties:

    \\

    ^Name ^Full Name ^Symbol ^ |Plant|Concentration in plant|APlant|

    \\

  5. Select the **Values** tab. Change dimension from “Scalar” to “Matrix”. Set **Index-1** to “Materials” and **Index-2** to “Plants”.

  6. In the **Default** row, enter the expression “CF * ( Upper_Soil + Lower_Soil * RootFactor )”

  7. Click **Ok** to close the window.

|Note|You might wonder why //Plant// has to be a matrix when the expression is the same for all indices. This is because the dimension of an object determines the dimension of the output. Also, the parameters and blocks that are used have the combined dimension of 2).| \\ **Next** * [[Tutorial_4-Index_operators|Index operators (4/5)]] **Previous** * [[Tutorial_4-Creating_a_custom_index_list|Creating a custom index list (2/5)]] **References** * [[Tutorials|Back to Tutorials]] * [[start|Home]]