integrating a personnalized user-interface in a cormas model

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

Upload: eilis

Post on 05-Jan-2016

31 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Integrating a personnalized user-interface  in a CORMAS model

Integrating a personnalized user-interface in a CORMAS model

2. Construct a graphic interface that displaysa histogramUtilization of ‘Canvas Builder’ of VisualWorks

1. Prepare the data to be visualizedExample: structure in classes of annual age of the population of blue cephalophes in the Djemiong model

3. Connect the graphic interface to the dataBonus: activate it with a click on the spatial grid

Page 2: Integrating a personnalized user-interface  in a CORMAS model

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+ )

Page 3: Integrating a personnalized user-interface  in a CORMAS model

1. (continued) Write the methodDjemiong>>duikersYearlyClasses

At the level of the Cormas model Djemiong, the collection of instances of Duiker are called theDuikers.

duikersYearlyClasses| nbYearClasses yearlyClasses yearClass | 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

Page 4: Integrating a personnalized user-interface  in a CORMAS model

2. Construct a graphic interfacethat displays a histogram

Open the ‘canvas builder’ from VisualWorks

Page 5: Integrating a personnalized user-interface  in a CORMAS model

2.1 Give a title to the window

Page 6: Integrating a personnalized user-interface  in a CORMAS model

2.2 Place an element of type ‘Chart’on the canvas

« Drag & drop »

Page 7: Integrating a personnalized user-interface  in a CORMAS model

2.3 Comple the properties of the element ‘Chart’

Page 8: Integrating a personnalized user-interface  in a CORMAS model

2.4 Create (‘install’) the class from the interface

Click on the icon ‘install’

Page 9: Integrating a personnalized user-interface  in a CORMAS model

Open the assistant for the creation

Complete the fields

2.4 (continued)

Page 10: Integrating a personnalized user-interface  in a CORMAS model

2.4 (end)

Name the resource

Validate

Page 11: Integrating a personnalized user-interface  in a CORMAS model

3. Link with the model Djemiong

Page 12: Integrating a personnalized user-interface  in a CORMAS model

3.1 Add an attribute cormasModelto the class Interfaces

Do not forget the accessor methods !!!

Page 13: Integrating a personnalized user-interface  in a CORMAS model

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

Page 14: Integrating a personnalized user-interface  in a CORMAS model

3.3 Activate the link with a simple click