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
Next revision Both sides next revision
lesson_11 [2020/02/14 16:14]
argemiro
lesson_11 [2020/02/14 19:24]
argemiro
Line 35: Line 35:
 \\ \\
 \\ \\
-   * Previously, the submodel only calculated productivity for crop 3. Now, we must give the user the option to choose the crop to be analyzed.  +You will see:
- +
-  * 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).  +
-  * **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.** So, with the model open to be edited, place a functor Integer value (where the user can choose the crop - 1, 2 or 3) and connect to get table from key functor: +
 \\ \\
-{{ :​guide_01.png?​600 |}} 
 \\ \\
-  * After including the changes, click on Apply changes / Update Submodel Properties as shown in the image below: +{{ :aaa2.png?​600 |}}
- \\+
 \\ \\
-  * IMAGEM 
 \\ \\
 +===Now, We can use this 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, is necessary create an entry where it will be possible enter with that refers to crop to be analyzed (1, 2 or 3). 
  \\  \\
-  * **Now, We can use this submodel in an independent model**+ \\ 
 +<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>​ 
 +\\ 
 +\\ 
 +  ​So, with the model open to be edited, place a functor Integer value (where the user can choose the crop - 1, 2 or 3) and connect to get table from key functor:
  
 \\ \\
 +{{ :​aaa3.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''​.+  * 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:
 \\ \\
-  ​* 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).+{{ :​aaa6.png?​600 |}} 
 +\\ 
 +  ​After including the changes, click on Apply changes / Update Submodel Properties as shown in the image below and click OK: 
 +\\ 
 +{{ :​aaa10.png?​600 |}} 
 +\\ 
 +Next, click OK, and again OK: 
 +{{ :​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) and click OK.
 \\ \\
 \\ \\
Line 61: Line 72:
 \\ \\
 \\ \\
-**Now, let'​s ​insert our previously created Submodel.** +  ​To insert our previously created Submodel, first, click on the Local Submodels tab and from the library window grab a Calc Most Productive year Submodel and place it on the sketch. ​
- +
-First, click on the Submodels tab and from the library window grab a Calc Most Productive year Submodel and place it on the sketch. ​+
 \\ \\
 \\ \\
-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).+  * 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 inserts ​the number that corresponds to each crop choose, as the image bellow. ​ 
 +\\ 
 +{{ :​aaa7.png?​600 |}} 
 +\\ 
 +  * 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).
 \\ \\
 \\ \\
   * The final model will look like the one in the imagem below. Save and run the model.   * The final model will look like the one in the imagem below. Save and run the model.
 \\ \\
-{{ :guide_04.png?600 |}}+<​note>​The red box highlights the window in which the crop should be chosen</​note>​ 
 +\\ 
 +{{ :aaa8.png?700 |}}
 \\ \\
 \\ \\