1 / 14

Integrating a personnalized user-interface in a CORMAS model

Integrating a personnalized user-interface in a CORMAS model. 1. Prepare the data to be visualized Example: structure in classes of annual age of the population of blue cephalophes in the Djemiong model.

eilis
Download Presentation

Integrating a personnalized user-interface in a CORMAS model

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integrating a personnalized user-interface in a CORMAS model 1. Prepare the data to be visualizedExample: structure in classes of annual age of the population of blue cephalophes in the Djemiong model 2. Construct a graphic interface that displaysa histogramUtilization of ‘Canvas Builder’ of VisualWorks 3. Connect the graphic interface to the dataBonus: activate it with a click on the spatial grid

  2. 1. Prepare the data to be visualized In the Djemiong model, the class Duiker is characterizedby an attribute age, expressed in weeks. Initially, the age is attributed by chance between 0 and 80. At each time step, by the activation of the methodgrowth, each instance of Duiker sees the value of itsattribute age augmented by 1. At each time step, by the activation of the methodmortality, each instance of Duiker is subjected to a probability to die. This probability is high for the youngsters, mild for the adults, and becomes very high when the age corresponding to the life expectancy (7 years) is reached. The objective is to calculate the proportions of each 7 annual age group (the last being the class 7+ )

  3. 1. (continued) Write the method Djemiong>>duikersYearlyClasses At the level of the Cormas model Djemiong, the collection of instances of Duiker are called theDuikers. duikersYearlyClasses | nbYearClassesyearlyClassesyearClass | nbYearClasses := 7. yearlyClasses := Array new: nbYearClasses withAll: 0. self theDuikers do: [:aDuiker | yearClass := nbYearClasses min: (aDuiker age quo: 52) + 1. yearlyClasses at: yearClass put: (yearlyClasses at: yearClass) + 1]. yearlyClasses := yearlyClasses collect: [:anInteger | (anInteger / self theDuikers size) asFloat]. ^yearlyClasses

  4. 2. Construct a graphic interfacethat displays a histogram Open the ‘canvas builder’ from VisualWorks

  5. 2.1 Give a title to the window

  6. 2.2 Place an element of type ‘Chart’on the canvas « Drag & drop »

  7. 2.3 Comple the properties of the element ‘Chart’

  8. 2.4 Create (‘install’) the class from the interface Click on the icon ‘install’

  9. 2.4 (continued) Open the assistant for the creation Complete the fields

  10. 2.4 (end) Name the resource Validate

  11. 3. Link with the model Djemiong

  12. 3.1 Add an attribute cormasModelto the class Interfaces Do not forget the accessor methods !!!

  13. 3.2 Write the method linking to the data 1. Create a new protocol ‘data’ 2. Write the method that establishes the link with the data

  14. 3.3 Activate the link with a simple click

More Related