User Tools

Site Tools


How to build your own model

HYSS template model

The HYdrological Simulation System (HYSS) that is used for HYPE is a framework that can be used to simulate other models. HYSS handles calibration, simulation, input data and writing results to files. The model handles the hydrological processes and calculates what happens during one time step. If you want to build your own model in the HYSS framework you only need to program the core of the model and couple it to the framework.

Starting a new model or digging into the HYPE-code can be daunting. We provide a simple hydrological model set in the HYSS framework as a template to facilitate this task. The simple model code is explained in detail in the code files and has only basic features. The template model is found on sourceforge (HYSS template model).

The template model has four states; water in snow, soil, river and lake. These states have one value for each subbasin, and water in snow and soil also for each class. The effect of evaporation, snow melt and runoff is calculated for each class. For lakes and rivers evaporation and flow is calculated.

Files and fortran modules of HYSS template model

Three fortran modules provide the primary interface between HYSS and the model. They are the modules modvar, statetype_module and modelmodule. The module modvar holds global variables and arrays that HYSS makes available to the model-programmer, e.g. input data. The statetype_module and modelmodule are special for the model. More information on the coupling between a model and HYSS can be found in the pdf-file describing the structure of the HYPE code.

File Modules Description
modelroutines.f90modelmodulethe module contains procedures for model calculations during one time step, for initiation of model, for definition of model parameters and output variables, for handling state variables defined in model and procedures for updating
modeltypes.f90statetype_modulethe module contains types for state-variables and procedure for handling them

Overview of HYSS

The HYSS framework can simulate a semi-distributed hydrological model for water over time. Its spatial division is related to sub-catchments (in the model called subbasins) and classes (non-located fractions of the subbasin area separated by land use/vegetation, soil type). HYSS takes care of input and output to the model. In addition, HYSS provides features for computing evaluation criteria and automatic calibration (optimization) of parameters for the model it runs.

The HYSS framework is written in Fortran 95 and can be compiled for Windows or Linux. The source code is published under the GNU Lesser General Public License and publicly available at For more information about the HYSS (and HYPE) code look at the documentation on the web: code documentation.

More information on HYSS can be found in a pdf-file (The structure of the HYPE code). The following are the calculation steps performed by HYSS:

  • Read and prepare all input data for the model set-up and simulation
  • Parameter optimization, if that option is chosen.
    • The optimization contains several simulations with different parameters to find the one that gives the minimum value of the objective function. The result will be one or several sets of (optimal) model parameters.
  • Model simulation with output. If optimization has been done the optimal parameters will be used, otherwise the parameter values of input data is used.
    • Initialize the state variables.
    • The model simulation iterates through a series of tasks for each time step:
      • Get current forcing data, may be read from file
      • Simulate the progress of the model
      • Accumulate data for performance criteria calculation
      • Accumulate data for output and write time-series output
  • Write other outputs, e.g. map-files
  • Calculate and write performance criteria
start/hype_tutorials/hyss_template_model.txt ยท Last modified: 2016/12/29 16:10 by cpers