You are not logged in. Click here to log in.

Application Lifecycle Management

Search In Project

Search inClear

Tags:  not added yet

Create a New OMS Model

In this section we will create a model that has two different potential evapotranspiration (PET) components; a Hamon PET component and a modified Jensen-Haise PET component. The Hamon component computes PET as a function of daily mean air temperature and daily possible hours of sunshine. The modified Jensen-Haise component computes PET as a function of daily mean air temperature and daily solar radiation. The components used are from the distributed-parameter watershed model PRMS. For watershed scale applications of PRMS, a watershed is partitioned into spatial units, using characteristics such as slope, aspect, elevation,vegetation type, soil type, and precipitation distribution. Each unit is assumed to be homogeneous with respect to its hydrologic response and to the characteristics listed above; each unit is called a hydrologic response unit (HRU). A water balance and an energy balance are computed daily for each HRU. The sum of the responses of all HRUs, weighted on a unit‑area basis, produces the daily watershed response. In the model we are building, PET is computed daily for each HRU as a function of its slope, aspect, and elevation and the daily meteorological variables of temperature, precipitation, and solar radiation. The full model will be built using the Hamon and Jensen-Haise components as well as a number of additional components that are needed to provide the inputs to the PET component computations. These additional components will be defined below.

The source codes for the model components to be used in this exercise are in a zip file named OmsEtTutorial_src.zip. This file needs to be copied to the src/gov/usgs/prms directory of the OmsEtTutorial project you created above. Copy the file OmsEtTutorial_src.zip to C:\omswork\OmsEtTutorial\src\gov\usgs\prms. Unzip the contents of the zip file to the C:\omswork\OmsEtTutorial\src\gov\usgs\prms directory. Open the Component Sources directory in the OMS Projects window and you will see the subdirectory gov.usgs.prms. Opening this subdirectory shows the source code names for the components. If the source component names do not appear, the zip file has not been unzipped in the correct directory. These components are all written in Java. These components are a subset of the components of the USGS watershed model PRMS. In this exercise we will use these components to create the PET model.

Double click on any of the component names and the source code for the selected component will be displayed for viewing and editing. In the example below the Basin.java component was selected and is displayed. Java source files can include a package statement at the top of the file to designate the package for the classes the source file defines. Note that the package name in the source file Basin.java is the same as the package name listed under Component Sources.

If you copy a component into this component source directory from another project, the system will change the package statement name of the component to be the same as the receiving package. However, if you bring in components in a zip file as we did above, the system does not change the package names on the new component source code when the file is unzipped. Therefore, in this situation, it is the modelers responsibility to insure that the package statement names in the source code agree with the package name for the project. Failure to have the package names agree will cause the system to be unable to locate the new component source code.

Java packages can be stored in compressed archive files called JAR files. The next step is to compile the component source files and to build a jar file that contains the compiled components. Whenever compiling sources, make sure the name of the project in the projects tab is bold for the project that has the sources you want to compile. If it is not in bold, you can right click on the project name and select "Set as Main Project". Once the project name is in bold font in the projects tab, click on the Clean and Build icon. The Clean and Build will delete old compiled object files in the project and recompile the project from scratch. The Build will only compile code that has changed since the last compile.

With the project code compiled, we can now begin the model building process. Right click on the Model folder and select New then Model.

In step 2 you will provide a model name and identify the folder where the model will be placed. The default name if left unchanged will be Model.jma. You can change this to a name of your choice. For this exercise type the name OmsEtCompare in the File Name input field. Note that when you enter the new name in the File Name input field it is automatically written to the Created File input field and appended with .jma.

The model name now appears under the Models directory in the Projects window. A work window, to the right of the Projects window, has also been created named OmsEtCompare.jma. The model name OmsEtCompare appears under the Structure tab of this window. At this point we are now ready to start adding model components from the project to OmsEtCompare in the OmsEtCompare.jma window.

Go to the project and open the Component Sources folder then open the gov.usgs.prms folder and view the components contained in the project. These components are the building blocks that will be used to create an OmsEtCompare model.

Click on the Basin component in the gov.usgs.prms folder with the left mouse button. Hold the left mouse button down and drag your cursor to a position just below the OmsEtCompare line in the OmsEtCompare.jma window. This will link a Basin icon to OmsEtCompare as shown below. The Instantiate Attributes window will then open. This window is used to instantiate the Basin component attributes to the model. The Basin component is used to define characteristics about the basin to be modeled. Click the the OmsEtCompare name in the Instantiate Attributes window and click OK.

This completes the linking of the Basin component to the model. Notice that the red x is no longer shown on the Basin icon. This indicates that the linking was successful.

The next component to be added to the model is the Soltab component. This component creates a table of daily potential shortwave solar radiation values for select combinations of slope, aspect, and latitude. The component is added to the model using the same drag and drop procedure that was used for the Basin component above. Here a black line is provided to assist in positioning the component.

A Instantiate Attributes window appears for use instantiating Soltab componant attributes to the model. Click on the OmsEtCompare name in the Instantiate Attributes window and then click OK to complete the declaration.

The Soltab component has now been successfully added to the model

A unique feature of the Basin and Soltab components is that they are only executed once during a model run. However, the other components needed for the PET model are executed once each daily timestep. Therefore a timestep iteration component needs to be added to the model. This component is a system component and is added by clicking on the OmsEtCompare model name using the right mouse button and then selecting the Add and SimpleIteration options. In a future version of this tutorial we will use the TimeIteration choice. However, this choice will allow some additional concepts to be presented

The Enter a name window appears with the name SimpleIteration displayed.

Change this name to DailyLoop to specify to any users the length of the iteration time step. Note that the name is written without spaces. The name should not contain spaces or special characters.

The name DailyLoop wll now appear in the model structure. It contains a box with a red x to note that there are unsatisfied attributes.

Before addressing the unsatisfied attributes in DailyLoop, add the Obs component to the model. Be sure that the Obs component links to the DailyLoop. A Declare Attributes window will appear. Click on OmsEtCompare in this window and then click OK.

The attributes in the Obs component are now linked to the model but the DailyLoop attributes are still not linked.

Click on the DailyLoop icon in the model structure and the Component Connectivity will appear in the Hookups for DailyLoop window.

Click on the attribute Condition which is the single attribute in the DailyLoop component. This will bring up the condition -> Properties window below. One of the elements of this window is Hookup. Click on Hookup and you will see that there is one attribute named @moreData available to hookup. Click on this choice with the left mouse button

This will link the attribute condition to the attribute @moreData. When this link is made, the red box with the x will be removed indicating that the links in the DailyLoop are complete.

The next component to add is Temp1sta. This component handles the spatial distribution and elevation adjustment of point temperature measurements. Click on the Temp1sta icon in the Component Library and drag it to a position below the Obs component. Click on OmsEtCompare in the Declare Attributes window and then click OK to complete the declaration step. Be sure the link is made to the DailyLoop and not to the outer loop. If the icon links to the outer loop, delete the icon by clicking on it with the right mouse button, select Delete from the menu, and redo this step.

Follow same procedure as above to link in the remaining components for the PET model. These components, in order of insertion, are Precip, Ddsolrad, PotetHamon, PotetJH, and Output. The final model structure should appear as shown below.