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
lesson_11 [2020/02/14 18:50]
argemiro
lesson_11 [2020/02/19 16:59] (current)
argemiro
Line 11: Line 11:
 \\ \\
 Initially, we will learn how to create a submodel and next we will learn how to use it in a Model. ​ Initially, we will learn how to create a submodel and next we will learn how to use it in a Model. ​
-We will start with the model ''​5_calculate_lookup_table''​ located in ''​Guidebook_Dinamica_5/Models/​Set_2/​basics/​5_calculate_lookup_table''​. Using this model we will answer the following question: ​+We will start with the model ''​5_calculate_lookup_table''​ located in ''​\Guidebook_Dinamica_5\Models\creating_and_using_local_submodels''​. Using this model we will answer the following question: ​
 \\ \\
 \\ \\
Line 35: Line 35:
 \\ \\
 \\ \\
-You will see:+  * You will see:
 \\ \\
 \\ \\
Line 41: Line 41:
 \\ \\
 \\ \\
-===Now, We can use this submodel in an independent model===+===Using the submodel in an independent model===
 \\ \\
 +   * Previously, the submodel only calculated productivity for crop 3. Now, we must give the user the option to choose the crop to be analyzed. For this, it is necessary to create an entry where it will be possible to specify the crop to be analyzed (1, 2 or 3). 
 \\ \\
-   * Previously, the submodel only calculated productivity for crop 3. Now, we must give the user the option to choose the crop to be analyzed. For this, is necessary create an entry where it will be possible enter with that refers to crop to be analyzed (1, 2 or 3).  +\\ 
- \\ +<note important>​ 
- \\ +To edit the submodel creating this input for the submodel, you need to open the submodel by clicking on its name in the lateral bar
-<note important>​To edit the submodel creating this input for the submodel, you need to open the submodel by clicking on its name in the lateral bar</​note>​+</​note>​
 \\ \\
 \\ \\
Line 55: Line 56:
 {{ :​aaa3.png?​600 |}} {{ :​aaa3.png?​600 |}}
 \\ \\
-  * After including ​the changes, click on Apply changes / Update Submodel Properties as shown in the image below and click OK: +  * On the top bar of the Functor integer value, click on the option Export functor inputs ​and outputs, and, in the new window, double-click the editor icon (pencil) and enter the name "​Crop"​. Click Ok:
- \\+
 \\ \\
-  ​{{ :aaa4.png?600 |}}+{{ :aaa6.png?600 |}}
 \\ \\
 +  * After including the changes, click on Apply changes / Edit Submodel Properties as shown in the image below and click OK:
 +\\
 +{{ :​aaa10.png?​600 |}}
 +\\
 +Next, click OK, and again OK:
 {{ :​aaa5.png?​600 |}} {{ :​aaa5.png?​600 |}}
 \\ \\
-  * Create a new model script, grab a **Load Table Functor** and place it on the sketch. Double click the Load Table Functor and open the IBGE_crop_information_complete.csv file located in ''​Guidebook_Dinamica_5/​Models/​Set_2/​basics/​2_add_table_column_set_table_by_key/​IBGE_crop_information_complete.csv''​. Grab a **Reorder Table Column** and place it on the sketch to switch the order of the year and crop key columns. Connect the Load Table to Reorder Table Column. In the Functor Editor window insert the index of the column to be moved (1) and the new column index (0).+  * Create a new model script, grab a **Load Table Functor** and place it on the sketch. Double click the Load Table Functor and open the IBGE_crop_information_complete.csv file located in ''​\Guidebook_Dinamica_5\Database\Tables''​. Grab a **Reorder Table Column** and place it on the sketch to switch the order of the year and crop key columns. Connect the Load Table to Reorder Table Column. In the Functor Editor window insert the index of the column to be moved (1) and the new column index (0) and click OK.
 \\ \\
 \\ \\
Line 68: Line 73:
 \\ \\
 \\ \\
-  * To insert our previously created Submodel, first, click on the Submodels tab and from the library window grab Calc Most Productive year Submodel ​and place it on the sketch. ​+  * To insert our previously created Submodel, click on the Local Submodels tab and from the library window grab the Calc Most Productive year submodel ​and place it on the sketch. This will import the submodel, click ok on the prompted warning. 
 +\\ 
 +\\ 
 +  * We want to calculate the most productive year for each crop; thus, we will use this Submodel 3 times, i.e. for the crops 1, 2 and 3. For this, Double click in each submodel loaded and insert the number that corresponds to each crop, as the image below
 \\ \\
 +{{ :​aaa7.png?​600 |}}
 \\ \\
-  * We want to calculate the most productive year for each crop; thus, we will use this Submodel 3 times, i.e. for the crops 1, 2 and 3 inserting the number that corresponds to each crop on the Integer value functor, as the imagem bellow. ​To save the results to a file, grab three **Save Table** functors, place them on the sketch and connect to each Submodel (for the three crops). Open **Save Table** Functors, browse to the ''​Guidebook_Dinamica_5/Models/​Set_2/​basics/​6_submodel''​ and write the file names (e.g. most_productive_year_for_crop_1.csv, ​ most_productive_year_for_crop_2.csv and most_productive_year_for_crop_3.csv).+  * To save the results to a file, grab three **Save Table** functors, place them on the sketch and connect to each Submodel (for the three crops). Open **Save Table** Functors, browse to the ''​\Guidebook_Dinamica_5\Models\creating_and_using_local_submodels''​ and write the file names (e.g. most_productive_year_for_crop_1.csv, ​ most_productive_year_for_crop_2.csv and most_productive_year_for_crop_3.csv).
 \\ \\
 \\ \\
Line 78: Line 87:
 <​note>​The red box highlights the window in which the crop should be chosen</​note>​ <​note>​The red box highlights the window in which the crop should be chosen</​note>​
 \\ \\
-{{ :guide_04.png?600 |}}+{{ :aaa8.png?700 |}}
 \\ \\
 \\ \\