Core Facilities

Physiology and Biophysics AcademicsJingle Bell JogZippity Doo Dah gives to BCHJackson Free Clinic
  • XML Document

    Models typically have one more elements named structure describing model structure, one element named control setting up interactive solution control, and one or more elements named display defining the panels that display the solution.

    The root or document element is named model.

    After some preliminaries, we start the structure element. This element holds child elements named variables, equations and definitions.

    We declare two variables to be used in the calculation of the derivatives and define a parameter that scales contagion.

    <?xml version = '1.0' ?>


    <schema> 2005.0 </schema>
    <modeltitle> An Example - Epidemic </modeltitle>

    <structure><name> Model </name>

        <var><name> HtoC </name></var>
        <var><name> CtoR </name></var>
        <parm><name> Contagion </name><val> 0.001 </val></parm>

    Next we define the model's three integrals. This implicitly declares a derivative for each integral. The derivatives are defined later in the definitions element.


        <name> H </name>
        <integralname> H </integralname>
        <initialval> 1000.0 </initialval>
        <dervname> dH/dt </dervname>
        <errorlim> 1.0 </errorlim>

        <name> C </name>
        <integralname> C </integralname>
        <initialval> 5.0 </initialval>
        <dervname> dC/dt </dervname>
        <errorlim> 1.0 </errorlim>

        <name> C </name>
        <integralname> R </integralname>
        <initialval> 0.0 </initialval>
        <dervname> dR/dt </dervname>
        <errorlim> 1.0 </errorlim>


    Next we complete the defintions element by creating a math block to calcuate the derivatives. This completes definitions and structure so these elements are closed.


    <block><name> CalcDervs </name>

    <def><name> HtoC </name><val> Contagion * H * C </val></def>
    <def><name> CtoR </name><val> 0.1 * C </val></def>

    <def><name> dH/dt </name><val> - HtoC </val></def>
    <def><name> dC/dt </name><val> HtoC - CtoR </val></def>
    <def><name> dR/dt </name><val> CtoR </val></def>



    We next complete a bit of housekeeping by telling DESolver that the math block defined above is to be used to calculate the derivatives.

    <math><dervs> Model.CalcDervs </dervs></math>

    Next we define solution intervals of 10 and 20 days. These intervals will appear in the Go menu, as shown below.


        <solutionint> 10 </solutionint>
        <displayint> 0.5 </displayint>
        <menuitem> 10 Days </menuitem>

        <solutionint> 20 </solutionint>
        <displayint> 0.5 </displayint>
        <menuitem> 20 Days </menuitem>


    The final step is to define the display element, which has one panel child element. The position of a display object in the panel is defined in terms of rows and columns, from the upper-left corner. We displayed the panel name up in the corner.


    <name> An Example - Epidemic </name>

    <at><row> 0.5 </row><col> 1 </col></at>

    Next we defined a bargraph to dislay the group counts for the healthy (H), contagious (C) and recovered (R) groups.

    <at><row> 2.4 </row><col> 1 </col></at>
        <high> 4.8 </high><wide> 24 </wide><leftmargin> 1 </leftmargin>
        <title> People </title>
            <name> Model.H </name> <label> H </label> <color> BLUE </color>
            <name> Model.C </name> <label> C </label> <color> RED </color>
            <name> Model.R </name> <label> R </label> <color> BLACK </color>
        <scale><min> 0 </min><max> 1000 </max></scale>

    Next on the panel are numerical values for the H, C and R groups.

    <at><row> 8.0 </row><col> 1 </col></at>
        <name> Model.H </name> <label> Healthy </label> <format> <integer/> </format>

    <at><row> 9.0 </row><col> 1 </col></at>
        <name> Model.C </name> <label> Contagious </label> <format> <integer/> </format>

    <at><row> 10.0 </row><col> 1 </col></at>
        <name> Model.R </name> <label> Recovered </label> <format> <integer/> </format>

    Then a slidebar to adjust the contagion parameter.

        <name> Model.Contagion </name>
        <map><val> 0.0005 </val><img> Low </img></map>
        <map><val> 0.001 </val><img> Normal </img></map>
        <map><val> 0.01 </val><img> High </img></map>

    <at><row> 11.5 </row><col> 1 </col></at>
        <name> Model.Contagion </name><listname> Model.Contagion </listname>
        <label> Contagion </label>

    On to the right-hand side of the panel. First we creat a clock to show the value of the independent variable.

    <at><row> 0.5 </row><col> 30 </col></at>
        <name> System.X </name><timebase> DAY </timebase><showdays/>

    Then we create a graph to show the changes in the H, C and R groups as a function of time.

    <at><row> 2.0 </row><col> 30 </col></at>
        <high> 12 </high><wide> 30 </wide><leftmargin> 5 </leftmargin>
            <name> System.X </name> <label> Days </label>
            <scale><min> 0 </min><max> 20 </max></scale>
            <name> Model.H </name> <label> H </label> <linecolor> BLUE </linecolor>
            <name> Model.C </name> <label> C </label> <linecolor> RED </linecolor>
            <name> Model.R </name> <label> R </label> <linecolor> BLACK </linecolor>
        <scale><min> 0 </min><max> 1000 </max></scale>

    The last element on the panel is an information button that explains what the H, C and R labels mean.

    <at><row> 14.5 </row><col> 28 </col></at>

    <at><row> 14.5 </row><col> 28 </col></at>
        <label> Populations </label>
        <line> H - Healthy </line>
        <line> C - Contagious </line>
        <line> R - Recovered and Immune </line>

    This completes the panel, display and model elements so we'll add the close tags for these elements.



    The XML document is complete.