# Difference between revisions of "Creating a new disease label"

Line 3: | Line 3: | ||

It is possible to create custom EMF labels and label values to represent other more exotic models. For instance, in tuberculosis the population can be be thought of as being in 2 infected states, either actively infected or latently infected. To implement such a disease model we need to create a new label and label value having two infected compartments instead of one. | It is possible to create custom EMF labels and label values to represent other more exotic models. For instance, in tuberculosis the population can be be thought of as being in 2 infected states, either actively infected or latently infected. To implement such a disease model we need to create a new label and label value having two infected compartments instead of one. | ||

− | All disease model | + | All disease model labels and label values must extend the StandardDiseaseModelLabel and StandardDiseaseModelLabelValue. By doing this, you inherit three mandatory attributes: |

S: The susceptible population. | S: The susceptible population. |

## Revision as of 20:09, 14 February 2011

Labels and label values in STEM are used to hold the state of a population at any given time during a simulation. For instance, a compartmental SIR disease model has an SIRLabelValue that includes (among other things) the 3 EMF attributes s, i and r (of type EDouble).

It is possible to create custom EMF labels and label values to represent other more exotic models. For instance, in tuberculosis the population can be be thought of as being in 2 infected states, either actively infected or latently infected. To implement such a disease model we need to create a new label and label value having two infected compartments instead of one.

All disease model labels and label values must extend the StandardDiseaseModelLabel and StandardDiseaseModelLabelValue. By doing this, you inherit three mandatory attributes:

S: The susceptible population.

incidence: The number of new infectious cases in a given time period. You can sub-divide the incidence into particular incidences if a susceptible person can transition onto more than one I compartment, but they you need to aggregate the total incidence into this attribute.

diseaseDeaths. The cumulative number of disease deaths. As for incidence, you can sub-divide this into one attribute for each infected compartment. However, you need to aggregate the number into this attribute.

To create a new label and label value, in your (disease model) plugin (new or existing):

1. Create a new EMF class XYZLabel extending StandardDiseaseModelLabel

2. Create a new EMF class XYZZLabelValue extending StandardDiseaseModelLabelValue. You will inherit the mandatory S, incidence and disease deaths attributes.

3. Add 4 EReference attributes to XYZLabel of type XYZLabelValue. The names must be deltaValue, tempValue, probeValue and errorScale. These values are needed to do the integration using Runge Kutta.

5. In XYZLabelValueImpl add the arithmetic methods:

5.1 DiseaseModelLabelValue set(IntegrationLabelValue value) Call super.set(…) and then set any local state variables from the input

5.2 DiseaseModelLabelValue add(IntegrationLabelValue value) Call super.add(…) and then add to any local state variables from the input

5.3 DiseaseModelLabelValue sub(IntegrationLabelValue value) Call super.sub(…) and then subtract from any local state variables from the input

5.4 DiseaseModelLabelValue scale(double scaleFactor) Call super.scale(…) and then scale any local state variables from the input

5.5 DiseaseModelLabelValue add(double addition) Call super.add(…) then add the scalar to any local state variables

5.6 DiseaseModelLabelValue abs() Call super.abs(…) and then set local state variables to their absolute values.

5.7 IntegrationLabelValue divide(IntegrationLabelValue d) Call super.divide(…) then divide any local state variables from the input

5.8 double max() Call super.max() and determine the maximum value of any state variables.

5.9 public void reset() Call super.reset() and reset any local state variables to their default values