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_14 [2020/02/13 08:22]
britaldo
lesson_14 [2020/02/18 00:26]
argemiro
Line 38: Line 38:
 \\ \\
 \\ \\
-Now, grab and place on the sketch one Calculate value functor. Click on the hook tool to create three hook functors inside the Calculate Map: one Number table and two Number value functors. Click on the Number value functor and number table with the Functor Editor tool and enter “1”, “2” ​and “3”, respectively. This is a number identifier for each element and will be represented within the equation box as v1 (value 1), v2 (value 2) and t1 (table 1) respectively. ​+Now, grab and place on the sketch one Calculate value functor. Click on the hook tool to create three hook functors inside the Calculate Map: one Number table and two Number value functors. Click on the Number value functor and number table with the Functor Editor tool and enter “1”, “2”“3”, respectively. This is a number identifier for each element and will be represented within the equation box as v1 (value 1), v2 (value 2) and t1 (table 1) respectively. ​
 \\ \\
 Grab and place on the sketch two Real value functors to insert a double precision real constant: A CO2 conversion factor (3.666) and a Carbon Content (0.47). Connect the Extract map attributes Map to Number Table and the two Real Value functors to Number Value Functor inside the Calculate Value. Grab and place on the sketch two Real value functors to insert a double precision real constant: A CO2 conversion factor (3.666) and a Carbon Content (0.47). Connect the Extract map attributes Map to Number Table and the two Real Value functors to Number Value Functor inside the Calculate Value.
Line 81: Line 81:
 \\ \\
 \\ \\
-Now, an output map is produced for each iteration, Calculate Map outputs a map containing the remaining forest for each category.+Now, an output map and an output table are produced for each iteration, Calculate Map outputs a map containing the remaining forest for each category ​of protected areas (1, 2, 3 or 4).
 \\ \\
-Grab the container Repeat from the Control tab and place it on the sketch. Drag the previous model into it. It will automatically resize to envelop Calculate Map. +Grab the container Repeat from the Control tab and place it on the sketch. Drag the previous model into it:  
 +{{ :13_02a.png?600 |}} 
 \\ \\
-Open Calculate Map by clicking on its top left icon and connect Step to Value port of Number Value. ??**Não há number value em calculate map ainda**?? The Step functor associates to the enveloping ​container and passes to Calculate Map the current ​step. Thus for each iteration Calculate Map produces a map containing ​the current Amazon Protected areas for each time step+Double-click ​the For container and in the window that opens enter the values 1 as the initial ​step and 4 as the final step:
 \\ \\
 \\ \\
-{{ :14j.png?600 |}}+{{ :13_02b.png?600 | 
 +\\}} 
 +The Step functor associates to the enveloping container passes to Calculate Map the current step (1 to 4, that refer to each type of protected area). Thus for each iteration Calculate Map produces a map containing the current Amazon Protected areas for each time step. 
 \\ \\
 \\ \\
-Now you need to fill in a table in order to store the area calculated for each category. The functor Set Table Cell Value updates a table placing a value to a position defined by a key. To fill in the entire table, you need to develop a loop that enables this functor to browse through the table. To close this loop, you will need a functor that is key to the development of dynamic models.  +Mark the eye button ​at the top of “Save ​Table” and "Save Map" ​to viewer ​the results hereafter: \\ \\
-\\ +
-\\ +
-Here we introduce the concept of Mux functor. A Mux functor can be a map, a categorical map, a lookup table, a table or a value. Look at the Control tab to find Mux Table and drag it into Repeat. Also drag Set Table Cell Value from the Table tab. +
-\\ +
-\\ +
-{{ :​14k.png?​400 |}} +
-\\ +
-\\ +
-Now, click on the Mux Table with the Edit Functor Ports. Every Mux functor has two input ports. In the first iteration, it reads the input from the Initial port; thereafter it receives the data from the model step through the port Feedback. This process allows data to be updated by the model, thus becoming dynamic. Hence this functor is key to the incorporation ​of feedback into a dynamic model.  +
-\\ +
-\\ +
-{{ :​14l.png?​400 |}} +
-\\ +
-\\ +
-Also open Set Table Cell Value with the Edit Functor Ports. This functor receives a table that will be updated with a value placed in a position defined by a key. So you need to connect table output from the functor Mux Lookup table to the input port of Set Table Cell Value. +
-\\ +
-\\ +
-{{ :​14m.png?​400 |}} +
-\\ +
-\\ +
-Again, let’s connect the output from Set Table Cell Value to Mux Table. When a connection has two or more options, the Edit Functor Ports window opens automatically. You have to choose the port Feedback.  +
-\\ +
-\\ +
-{{ :​14n.png?​500 |}} +
-\\ +
-\\ +
-Now click on the port Initial with the right mouse button. You will open a table editor. In this case you just need to enter “0“ and “0” as Key and Value for the first table record, and then save these inputs using the ”+” button. \\ +
-Still, you need to connect the output from Calculate Value to the input port of Set Lookup Table Value.  +
-\\ +
-\\ +
-{{ :​14o.png?​500 |}} +
-\\ +
-\\ +
-The Edit Functor Ports window pops up because there are two options. Connect the arrow to the port Value; the key comes from the current model step via the connection of Step to Set Lookup Table Value.  +
-\\ +
-Observe that the feedback connection is between Mux Lookup Table and Set Calculate Value. As a last step, you need to save the lookup table into a file. Drag the functor ​Save Lookup Table from the Input/​Output tab. Connect Set Lookup Table Value to it and edit the name for the CSV file.  +
-\\ +
-\\ +
-{{ :14p.png?500 |}} +
-\\ +
-\\ +
-<note tip>TIP: Although Suffix Digits is “2” by default, the file name won’t have a suffix because it will be saved after Repeat is done.</​note>​ +
-\\ +
-\\ +
-As a last step, you need to save the lookup table into a file. Drag the functor Save Lookup Table from the Input/​Output tab. Connect Set Lookup Table Value to it and edit the name for the CSV file. +
  
-Mark the eye button at the top of “Save Table” to viewer the results hereafter. \\ \\ 
 **Save and run the model!** ​ \\ \\ **Save and run the model!** ​ \\ \\
-Click on the layout tool Left to Right and your final model will look like the one below:  + 
-\\ +The results found will be:  
-\\ + 
-{{ :14q.png?600 |}} +**4 maps:** The biomass map for each type of protected area in the Legal Amazon
-\\ + 
-\\ +**4 Tables:** The biomass table for each type of protected area in the Legal Amazon. 
-Now, click on eye button ​of “Save Lookup Table” to see the resultThis functor output is table that looks like this:+
 \\ \\
 \\ \\
-{{ :​14r.png?​600 |}}+===Congratulations,​ you have successfully completed this lesson!===
 \\ \\
 +☞[[lesson_15|Next Lesson]]
 \\ \\
-Congratulations,​ you have successfully completed this lesson! Now let’s move to the **next lesson:​** ​[[lesson_15|LESSON 15: Using "​while" ​to make successive calculations]]+[[:​guidebook_startBack to Guidebook Start]]