102
OMS Workshop September 2007, Fort Collins 1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

Embed Size (px)

Citation preview

Page 1: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 1

Object Modeling System

Olaf David

Page 2: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 2

Agenda

• Historical Review

• Overview OMS 2.1

– System Features and Architecture (Olaf D.)

– OMS Colab integration.

– Component Repository (Wes L.)

– A new Approach in model Development (Steve M. USGS)

– Model Calibration - Lauren H (USGS)

Page 3: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 3

History

Project Started 2000

Mission: Develop a Next Generation Modeling Platform for ARS

based on MMS experience

2001/02 2003/04 2005/06 2007

Netbeans 3.6 PF

Major Refactoring

CVS

Netbeans 4.0 PF

Modeling Projects

CoLab Use

Project Plan/Process

CEAP

Initial Prototype

Swing based

PRMS/RZWQM

Netbeans 5.5.1 PF

Modeling Projects

Ressource Analysis

(Worldwind)

CoLab integraion

SOA/Calib

PRMS/J2000/RLS/…

Major Milestones:

Page 4: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 4

Required Features

• Modules / Component are the building blocks for models

• Allow for reuse of those!

• Visual assembly of models

• The legacy issue (be modern but not too modern!)

• Scientific Programming Languages

• Object oriented is “state of the art” in Software Engineering

• Fits ARS/USDA needs

Page 5: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 5

Principle Modeling System Structure

Data IO

GUI

Time stepcomponent

Spatial unitcomponent

DataParameterHandling

time step iteration

spatial unit iteration

ETP

Inter-ception

Snow

Soil-water

Ground-water

Inter-flow

Base-flow

SurfaceRO

Irrigation

Erosion

Surfacewater use

Groundwater use

Plantgrowth

Stre

am

RO

Generic SystemComponents

ModelSetup

SensitivityAnalysis

Optimization

Process modulelibrary

ETP

Hydr.

GW

WQWQ

Irrig.

[Krause 2004]

Page 6: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 6

2001 Prototype

• Java 1.3

• Swing application

• XML

• Dictionary

• Monolithic

OMSModel(from model)

OMSModule(from model)

OMSInterface(from model)

<<Interface>>System

(from oms)

OMSCallable(from model)

<<Interface>>#modules[]

$OMS

OMSMTModel(from model)

Page 7: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 7

OMS in 2002

• Netbeans 3.5 PF

• Update center

• Modularization

• RWQM

Prototype

• PRMS prototype

Page 8: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 8

Netbeans Application Platform

• Open Source, Java, Developer community

• User interface management

• Data and presentation management

• Setting management

• Graphical Editing

• The Editor

• The Wizard framework

• Storage management

• Big Selection of additional components

• Internet-based update delivery

• Modular architecture

Page 9: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 9

2004 OMS (1.1)

• Netbeans 3.6 PF

• Few Modules

– ComponentBuil

der

– ModuleBuilder

– Analysis

– OMS Core

• Compiler

Modeling Projects

Component Library

Model Editor Parameter

Editor

ComponentEditor

OutputAnalysis

Statistics

Page 10: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 10

2005 OMS (1.2)

• Modeling Projects

• First Component

Library (Local)

• Internal Code

disaggregation

• GCC bundle

Page 11: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 11

2006 – OMS 2.0

• NB 5.0

• Improved

spatial

Modeling

• Data

Analysis

• Execution

API

Page 12: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 12

2007 OMS 2.1

• Netbeans 5.5.1 PF

• JDK 1.6

• Modeling Projects

• Simulation management

– ESP

• CoLab access

• Model Calibration

– Luca

• Visualization

– Worldwind (Prototype)

Page 13: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 13

Current and Upcoming System Main Development Collaborations• USGS

– Luca - Model Calibration

– Analysis,

– Ensemble Streamflow Prediction

• NRCS– System Testing

– NWCC – Testing (ESP, Luca)

– GEOLEM

• SUN Microsystems / Intland– Codebeamer Integration

• (NASA)– Worldwind, Geolem

• (MSU)– GIS, GEOLEM

• Related activities– FRAMES (EPA)

– Catchment Modeling Toolkit, Apsim (CSIRO)

– OpenMI (EU)

– Daisy (Copenhagen)

– Federal MOU on Multimedia Modeling Systems, …

Page 14: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 14

Developer Group

• Ian Schneider (2002 – 2006) (a lot!)

• Wes Lloyd (since Aug. 2007) (first CoLab Integration)

• System Code Contributors

– Steve Markstrom (Analysis, ESP, …)

– Makiko Umemoto (Luca)

– Hussein Chinoy (Worldwind)

– Few Students

• Tester

– Frank Geter, Dennis Flanagan, George Leaveslay, Pat Bartling, Candace

Batts

– Alan Andales, Jim Ascough, Mark Strudley, Dave Garen,

– …

Page 15: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 15

Applications, current efforts

• Precipitation Runoff Modeling System

• Common Wind and Water Erosion Model

• J2000 (fully distributed watershed model)

• OMNI

• Range / Livestock

Page 16: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 16

OMS Publications

• …

• David O. et al.(2002): The Object Modeling System In: Agricultural System Models in Field Research and Technology Transfer, L. Ahuja, L. Ma, T.A. Howell, Eds., Lewis Publishers, CRC Press LLC, 2002: Chapter 15, 317- 331.

• Ahuja, L.R., David, O., and Ascough II, J.C. (2004). Developing natural resource models using the Object Modeling System: Feasibility and challenges. Advances in Geosciences, Vol. 4, pp 29-36, 9-8-2005

• Flanagan D.C., Ascough, J.C., Geter, W. F, David O. (2005): Developing of a Hillslope Erosion Module for the Object Modeling System. Proceedings of the 2005 ASAE Annual International Meeting, Tampa, Florida, July 17-20, 2005.

• Rizzoli, et al.(2006): Integrated modeling frameworks for environmental assessment and decision support. Book chapter in: Modelling and Software for Integrated Assessment and Management (Elsevier IDEA Book Series). 2006.

• …

Page 17: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 17

OMS 2.1

User Interface

Page 18: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 18

OMS 2.1 User Interface

Page 19: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 19

OMS Modular Tool Concept

Page 20: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 20

Modeling Projects

• Workspace that contains all resource for developing and running a model– Documentation

– Input Data

– Output data

– Model Components

• Component = behavior

– Model Assemblies

• Model = components + attributes

– Simulations

• Simulation =model + input data + execution scheme + additional info

• Project level Actions

Page 21: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 21

Project Resource Creation

Page 22: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 22

General Properties Window

• Allows for general

Configuration changes of

almost everything

– Components

– Model

– Attributes

– Files

– …

Page 23: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 23

Recent Features

• Model Simulation Management

• Meta Data Annotations for Components

• Execution API & SOA

• USDA CoLab Integration

• Luca Model Calibration

Page 24: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 24

Component Development

“Creating the model building blocks”

Page 25: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 25

What is a Component ?

• Encapsulates Data and Operations to realize one specific

purpose

• Communicates to its environment using a defined

interface

• Black box behavior

• Testability by its own !Model

ComponentComponent

Attribute

Page 26: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 26

(IV) Component Implementation

• Java Class that implements

– Executable,

– Stateful …

• Defines Attributes references

– Attribute.Double

– Attribute.Integer

– ..

• Defined Method structure

– initialization

– component logic

– cleaning up resources

– additional methods

init()

run()

cleanup()

Component Implementation

Attribute ojects

Page 27: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 27

Component API

Page 28: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 28

Component Sources

• Java Language

– (maybe native bindings)

• Project Components

folder

• Packages

• Wizard Generation

Page 29: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 29

Component Editor

Page 30: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 30

Component Attributes

• Attribute Objects

– Type

– Name

• Attribute Annotations

– Description

– Access

– Role

– Unit

– Constraint

• Packages– org.oms.model.data

– org.oms.model.data.annotations

area

snow_trs

snow_trans

Page 31: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 31

Component Behavior

• Initialization

• Execution

• Cleanup

• Native Code handling

• Visual elements

• package– org.oms.model.components

Page 32: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 32

Component Meta Data

• Component Name

• Annotations

– Description

– Keywords

– Version Info

– Source

– Author

– (Status)

Page 33: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 33

Native Components

• Can be implemented in FORTRAN,C, C++

• FORTRAN: automatic encapsulation of

subroutines/functions into a component.

• Embedded JNative library is able to call dynamic link

libraries.

Page 34: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 34

Model Integration

Integrate Components into a model

Connect Component Attributes

Page 35: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 35

Component Library

A

B

C

A

B

C

D

A

B

A

B

C

D

A

B

C

Snowmelt Infiltration Evaporation Interception Regionalization

C B A B B

Model

ComponentLibrary

Page 36: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 36

Create a Model using the Wizard

• Model Wizard

• A model is a

hierarchical

assembly of

components

• Sequential

Execution order

Page 37: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 37

Component Palette

• Controls execution of

components

• Control Components

– Sequential execution

– Parallel Execution

– Conditional Exec

– Iteration

– Temporal Execution

– Spatial Execution

Page 38: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 38

Adding a Component

• Drag and

Drop a

component

into a model

• Where to

instantiate

the

Attributes?

• Scoping

Page 39: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 39

Model Attributes

• Attributes that gets shared

between components

• Global data element in a

model

• Primitive and aggregated

data structures

• Introduced by components

when they are added to the

model or explicitly declared

Page 40: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 40

Component Connectivity

• Shows and Controls

how a component is

connected to the

models data

• Connections

changeable

• Component Attribute

references point to

Model Attribute Objects

• Path like syntax

Page 41: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 41

Component Connectivity

Page 42: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 42

Data Assimilation

Tables

Parameter

Page 43: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 43

Data Input

• Tabular data

• Property parameter sets

• Any other “unknown” data

files

• Wizard

Page 44: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 44

Tabular Data support

• Table API / SPI

– CSV

– MMS statvar/data

– NetCDF

– JDBC

• COSU oriented

• Multi view Editor

• Copy & paste

from/to Excel

Page 45: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 45

Property Parameter Sets

• Model parameter

• Structure

– key = value

Page 46: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 46

Model Execution

Various ways to execute a model

Visual

Batch

Page 47: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 47

Visual Execution

• Editing

• Filtering

– Type

– Name

– Role

– Dimension

– Access

• Selection

Page 48: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 48

Spreadsheet view

• Transpose view

• Apply formulas

– Math

– Statistics

Page 49: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 49

Control Model Execution

• Set breakpoints

• Execution will stop after

component execution

• Check attributes in Explorer

• Debugging at the component

level

Page 50: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 50

Batch Execution

• No GUI, just standard output

• Not exciting, but very useful

Page 51: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 51

Output Analysis

“Ad-hoc post run analysis”

Page 52: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 52

Analysis

• Analysis types

• Configure them once

and execute often.

• Plays well with

simulation

management

Page 53: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 53

Analysis

• Canned analysis configuration

• Analysis of output data

– Graphs

• TS Plot

• XY Error

• Flow duration

• Residuals

– Statistics

• Table IO/API

Page 54: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 54

Analysis 2D Plot types

• 2D Plot types

– Combined scale

– Multiple scale

– Vert/Horiz.

Arranged

– Scattered Plots

– Statistical Moments

Page 55: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 55

ESP Trace Analysis

• USGS OUI ESP Tool

• Statistical analysis

• Report generation

Page 56: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 56

NASA Worldwind OMS Prototype (not in 2.1)

Page 57: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 57

Extension to map OMS model output data into Worldwind

Page 58: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 58

Simulations

Configure a model application

Page 59: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 59

Simulation ?

• = Model + Input Data + Execution type + (Analysis) +

Additional Settings

• Type

– Basic Simulation

– Ensemble Streamflow Prediction

– Model calibration using LUCA (Prototype)

• Combine models with different data file, and ways to

execute them together.

Page 60: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 60

Simulations

• Wizard generated

• Icons represent types

Page 61: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 61

Basic Simulation

Sections

• Drag and Drop from project

– Model

– Parameter file

• Check execution type

– GUI

– Batch

• (Analysis)

Page 62: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 62

Ensemble Streamflow Prediction

• Similar to Basic

Simulation

– Model

– Parameter Files

• ESP parameter

– Init period

– Forecasting

period

– Historical years

Page 63: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 63

Model Calibration using Luca

• Luca wizard start

• Calibration

settings overview

Page 64: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 64

Calibration wizard as developed at USGS (prototype)

• Stepwise Calibration Methodology

– Lauren …

• OMS Adaptation

– Execution API

– Table API

– -> COSU

Page 65: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 65

Documentation

CoLab OMS Project

Page 66: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 66

Documentation

• OMS Project WIKI

– Olaf, Frank,

George

Page 67: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 67

OMSArchitecture

Points of Extension

Page 68: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 68

Operating Systems

WindowsLinux

SolarisOthers

Virtual Machine

Object Modeling System Version 2.+ Platform

Application Platform

ModelingTools

JAVA 2 Platform

NetBeans Platform

Version Control System (Subversion)

USDA CoLab

Modeling Projects

ComponentLibrary Component

Library ... ComponentLibrary ...

Modeling Core Data

Management GNU Compilers (C, C++, Fortran) Build

System

Modeling API

ModelingProject Management

Model Builder Component

Builder StatisticalAnalysis Spatial

Visualization UncertaintyAnalysis

JAVA 2 Platform

Modeling Runtime

ProcessComponent

Operating System

ProcessComponentProcess

ComponentProcess

Component

Regionalized CEAP Model

ProcessComponent

CEAP Model

Graphical User Interface

USDA ModelingCollaboration Infrastructure

ModelApplications

Page 69: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 69

Build OMS from Source

• Get Netbeans 5.5.1 + JDK 1.6

• Checkout OMS SVN 2.1 branch

– https://colab.sc.egov.usda.gov/svn/oms/branches/2.1

• Open the project

– “omsbuild/omsplatform”

– 25 sub-projects

• Build / run

Page 70: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 70

OMS – System Development in CoLab

• OMS Subversion Repository

– ~240 MB source for 3980 Revisions

• OMS CoLab Project

– 33 members

– Documentation in WIKI

– Tracker for Milestones, Enhancements Requests, and Bugs

– Stores Releases

Page 71: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 71

OMS Extensibility

• Netbeans API’s

– ~40 separate API to write an OMS compatible tool

• OMS API’s

– Component API (model dev)

– Model Execution API (system integration)

– Table API/SPI (data formats)

– Analysis API

– Spreadsheets

– SOA

Page 72: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 72

OMS and SOA : Model Execution Service

• 1) Model Execution Service

– Headless execution of a model based

on the OMS execution API.

– No UI / Netbeans Dependencies

– Callable from Java/.NET

– Prototype for AnnAGNPS

– NRCS Plugin Architecture

OS

JAVA 2 Platform

Modeling Core Data

Management

Modeling API

Web service

Page 73: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 73

OMS and SOA : Model Development Service

• 2) Model Resource Management Service

– Components are stored in CoLab and can be accessed from

OMS

– CoLab (OMS Component Library) web service

• Pushing and pulling of components as a prototype

Page 74: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 74

CoLab Access from within OMS

• Connects direct to USDA

Collaboration platform

• Work with projects

– Tracker item submission

– Discussion forums

– Shared documents

– Builds

Page 75: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 75

Access CoLab Components directly (Prototype)

Connect

ExplorePalette

Integrate

Page 76: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 76

Additional Features

CoLab Integration Component Library

“Advanced Simulation Management”

Luca & beyond

Page 77: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 77

Summary

• OMS is a integrated model development environment IDE.

• It embraces component oriented software development

CBSD for modeling

• Open Modeling Platform has an extensible architecture in

many ways, it is adoptable for future integrations.

• It is certified within the common computing environment

CCE.

• OMS integrates directly into USDA CoLab for sharing of its

component resources.

• It is Open Source, development help is always welcome.

Page 78: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 78

Modularization

Page 79: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 79

Modularization

• Essential for design of complex system

• Since (Parnas 1976):

– „On the Criteria to be used in Decomposing complex systems

into Modules“ [CACM]

• Common guide lines for „concern separation“ in systems

Page 80: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 80

What is a Module ?

• Encapsulates Data and Operations to realize one specific

purpose

• Communicates to its environment through definite

interface

• Black box behavior

• Testability by its own !

Page 81: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 81

Module Design Criteria

• Cohesion ()

• Coupling ()

• Interface (slim)

• Size (?)

• testability !

• Interference / Side effects (!)

• Number of Imports / Uses

Page 82: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 82

Think about Bindings

A B

CD

!!

Page 83: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 83

Again ...

A B

!!

C

Page 84: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 84

Complexity = ... + f( # Modules)

#Modules

Inner Module Complexity

Overall System Complexity

Opt

Page 85: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 85

Complexity and Reusability

• MMS module

structure

• Fortran 77

• Where is

„Jensen-

Haise“ ?

c***********************************************************************c potet_jh.f: Determine whether transpiration is occurring andc compute the potential evapotranspiration for each HRUc version: 1.3 (markstro)c***********************************************************************

c***********************************************************************c c petdecl - set up parameters for potential et computationsc

integer function petdecl_jh(transp_on, potet, + basin_potet, lday, daily_potet)

include 'fmodules.inc'

integer transp_on(MAXHRU) integer lday real potet(MAXHRU), basin_potet real daily_potet(MAXHRU) petdecl_jh = 1

if(declpri('potet_lday', 1, 'integer', lday).ne.0) return if(declpri('potet_daily_potet', MAXHRU, 'real', + daily_potet).ne.0) return if(declvar('potet', 'transp_on', 'nhru', MAXHRU, 'integer', + 'Switch indicating whether transpiration is occurring,'// + ' 0=no 1=yes', + 'none', + transp_on).ne.0) return if(declvar('potet', 'potet', 'nhru', MAXHRU, 'real', + 'Potential evapotranspiration on an HRU', + 'inches', + potet).ne.0) return if(declvar('potet', 'basin_potet', 'one', 1, 'real', + 'Basin area-weighted average of potential et', + 'inches', + basin_potet).ne.0) return

if(declparam('potet', 'transp_beg', 'nhru', 'integer', + '4', '1', '12', + 'Month to begin testing for transpiration', + 'Month to begin summing tmaxf for each HRU; when sum is '// + '>= to transp_tmax, transpiration begins', + 'month').ne.0) return

if(declparam('potet', 'transp_end', 'nhru', 'integer', + '10', '1', '12', + 'End month of transpiration period', + 'Last month for transpiration computations; '// + 'Transpiration is computed thru end of month', + 'month').ne.0) return

if(declparam('potet', 'transp_tmax', 'nhru', 'real', + '500.', '0.', '1000.', + 'Tmax index to determine start of transpiration', + 'Temperature index to determine the specific date of the '// + 'start of the transpiration period. Subroutine sums tmax '// + 'for each HRU starting with the first day of month '// + 'transp_beg. When the sum exceeds this index, '// + 'transpiration begins', + 'degrees').ne.0) return

if(declparam('potet', 'jh_coef', 'nmonths', 'real', + '.014', '.005', '.060', + 'Monthly air temp coefficient - Jensen-Haise', + 'Monthly air temperature coefficient used in Jensen'// + '-Haise potential evapotranspiration computations, see '// + 'PRMS manual for calculation method', + '????').ne.0) return

if(declparam('potet', 'jh_coef_hru', 'nhru', 'real', + '13.0', '5.0', '20.0', + 'HRU air temp coefficient - Jensen-Haise', + 'Air temperature coefficient used in Jensen-Haise potential '// + 'evapotranspiration computations for aech HRU. See PRMS '// + 'manual for calculation method', + '????').ne.0) return

if(declparam('potet', 'epan_coef', 'nmonths', 'real', + '1.0', '0.2', '3.0', + 'Evaporation pan coefficient', + 'Evaporation pan coefficient', + 'none').ne.0) return

if(declparam('potet_jh', 'hru_area', 'nhru', 'real', + '1.0', '0.01', '1e+09', + 'HRU area', + 'HRU area', + 'acres').ne.0) return

if(declparam('potet_jh', 'basin_area', 'one', 'real', + '1.0', '0.01', '1e+09', + 'Total basin area', + 'Total basin area', + 'acres').ne.0) return if(declparam('potet_jh', 'hru_radpl', 'nhru', 'integer', + '1', 'bounded', 'nradpl', + 'Index of radiation plane for HRU', + 'Index of radiation plane used to compute solar '// + 'radiation for an HRU', + 'none').ne.0) return

if(declparam('temp_1sta', 'temp_units', 'one', 'integer', + '0', '0', '1', + 'Units for observed temperature', + 'Units for observed temperature, 0=F, 1=C', + 'none').ne.0) return

petdecl_jh = 0

return end

c***********************************************************************cc petinit - Initialize potet module - get parameter values,c set initial transp_on switchc

integer function petinit_jh(nhru, transp_beg, transp_end, + transp_tmax, jh_coef, jh_coef_hru, + transp_on, tmax_sum, transp_check, + basin_area, hru_area, hru_radpl, + temp_units, lday)

include 'fmodules.inc'

integer nhru, transp_beg(MAXHRU), transp_end(MAXHRU) integer transp_on(MAXHRU), starttime(6), mo, day, i integer hru_radpl(MAXHRU), temp_units integer lday real transp_tmax(MAXHRU), jh_coef(MAXMO), jh_coef_hru(MAXHRU) integer transp_check(MAXHRU) real basin_area, hru_area(MAXHRU) real tmax_sum(MAXHRU)

petinit_jh = 1

nhru = getdim('nhru') if(nhru.eq.-1) return

if(getparam('potet', 'transp_beg', MAXHRU, 'integer', transp_beg) + .ne.0) return

if(getparam('potet', 'transp_end', MAXHRU, 'integer', transp_end) + .ne.0) return

if(getparam('potet', 'transp_tmax', MAXHRU, 'real', transp_tmax) + .ne.0) return

if(getparam('potet', 'jh_coef', MAXMO, 'real', jh_coef) + .ne.0) return

if(getparam('potet', 'jh_coef_hru', MAXHRU, 'real', jh_coef_hru) + .ne.0) return

if(getparam('basin', 'basin_area', 1, 'real', basin_area) + .ne.0) return

if(getparam('basin', 'hru_area', MAXHRU, 'real', hru_area) + .ne.0) return if(getparam('soltab', 'hru_radpl', MAXHRU,'integer', hru_radpl) + .ne.0) return

if(getparam('temp_1sta', 'temp_units', 1, 'integer', temp_units) + .ne.0) return call dattim('start',starttime) mo = starttime(2) day = starttime(3) do 10 i = 1,nhru transp_on(i) = 0 tmax_sum(i) = 0. transp_check(i) = 0

if(mo.eq.transp_beg(i)) then if(day.gt.10) then

transp_on(i) = 1 else transp_check(i) = 1 end if

else if((transp_end(i)-transp_beg(i)).gt.0) then if(mo.gt.transp_beg(i).and.mo.lt.transp_end(i)) + transp_on(i) = 1

else if((mo.gt.transp_beg(i).and.mo.le.12).or. + (mo.ge.1.and.mo.lt.transp_end(i))) transp_on(i) = 1

end if 10 continue

lday = 0

petinit_jh = 0

return end

c***********************************************************************cc petrun - Keeps track of transpiration on or off and computesc potential et for each HRU each dayc

integer function petrun_jh(transp_beg, transp_end, transp_on, + transp_check, transp_tmax,tmax_sum, + jh_coef, jh_coef_hru, potet, nhru, + basin_potet, basin_area, hru_area, + hru_radpl, temp_units, lday, + daily_potet)

include 'fmodules.inc'

integer transp_beg(MAXHRU), transp_end(MAXHRU), nhru integer transp_on(MAXHRU), transp_check(MAXHRU) integer nowtime(6), mo, i, day, lday integer hru_radpl(MAXHRU), temp_units real transp_tmax(MAXHRU), tmax_sum(MAXHRU), jh_coef(MAXMO) real jh_coef_hru(MAXHRU), tavgc(MAXHRU), tavgf(MAXHRU) real swrad(MAXHRU), potet(MAXHRU),tmaxf(MAXHRU), elh, rin real basin_potet, basin_area, hru_area(MAXHRU) real daily_potet(MAXHRU), tmaxc(MAXHRU) real factor double precision dt petrun_jh = 1

dt = deltim()

call dattim('now', nowtime) mo = nowtime(2) day = nowtime(3) basin_potet = 0.

C******Set switch for active transpiration period

if(lday.ne.day) then

lday = day

if(getvar('temp', 'tmaxf', MAXHRU, 'real', tmaxf) + .ne.0) return

if(getvar('temp', 'tmaxc', MAXHRU, 'real', tmaxc) + .ne.0) return

do 10 i= 1,nhru

C******If in checking period, then for each dayC******sum max temp until greater than temperature index parameter,C******at which time, turn transpiration switch on, check switch off

if(transp_check(i).eq.1) then if(temp_units.eq.0) then if(tmaxf(i).gt.32.) tmax_sum(i) = tmax_sum(i) + tmaxf(i) else if(tmaxc(i).gt.0.) tmax_sum(i) = tmax_sum(i) + tmaxc(i) endif

if(tmax_sum(i).gt.transp_tmax(i)) then transp_on(i) = 1 transp_check(i) = 0 tmax_sum(i) = 0. end if

C******Otherwise, check for month to turn check switch on orC***** transpiration switch off

else if(day.eq.1) then

if(mo.eq.transp_beg(i)) then transp_check(i) = 1 if(temp_units.eq.0) then if(tmaxf(i).gt.32.) tmax_sum(i) = tmax_sum(i) + + tmaxf(i) else if(tmaxc(i).gt.0.) tmax_sum(i) = tmax_sum(i) + + tmaxc(i) endif

C******If transpiration switch on, check for end of period

else if(transp_on(i).eq.1) then

if(mo.eq.transp_end(i)) transp_on(i) = 0 end if end if end if end if 10 continue C******Compute potential et for each hru using Jensen-Haise formulation

if(getvar('temp', 'tavgf', MAXHRU, 'real', tavgf) + .ne.0) return

if(getvar('temp', 'tavgc', MAXHRU, 'real', tavgc) + .ne.0) return

if(getvar('solrad', 'swrad', MAXHRU, 'real', swrad) + .ne.0) return

if(dt.lt.24.) then if(getvar('solrad', 'daily_swrad', MAXHRU, 'real', + swrad).ne.0) return end if

do 20 i=1,nhru elh = (597.3-(.57*tavgc(i)))*2.54 rin = swrad(i)/elh daily_potet(i) = jh_coef(mo)*(tavgf(i)-jh_coef_hru(i))*rin if(daily_potet(i).lt.0.) daily_potet(i) = 0. 20 continue

end if

do 30 i=1,nhru if(dt.lt.24.) then factor = (dt * 60.) / 1440. else factor = 1. end if potet(i) = factor * daily_potet(i) basin_potet = basin_potet + potet(i) * hru_area(i) 30 continue

basin_potet = basin_potet / basin_area

C write (*,*) 'basin_potet ', basin_potetC write (*,101) potetC 101 format(' potet ',177f10.4)

petrun_jh = 0

return end

c***********************************************************************cc Main potet_jh routinec

integer function potet_jh_prms(arg)

include 'fmodules.inc'

character*(*) arg

integer petdecl_jh, petinit_jh, petrun_jh, retval integer transp_on(MAXHRU), transp_check(MAXHRU), nhru integer transp_beg(MAXHRU), transp_end(MAXHRU) integer hru_radpl(MAXHRU), temp_units real potet(MAXHRU), transp_tmax(MAXHRU), tmax_sum(MAXHRU) real jh_coef(MAXMO), jh_coef_hru(MAXHRU) real basin_potet, basin_area, hru_area(MAXHRU) real daily_potet(MAXHRU) integer lday

save transp_on, transp_check, nhru, transp_beg, transp_end save potet, transp_tmax, tmax_sum, jh_coef, jh_coef_hru save basin_potet, basin_area, hru_area, hru_radpl, temp_units save lday, daily_potet retval = 0

if(arg.eq.'declare') then retval = petdecl_jh(transp_on, potet, + basin_potet, lday, daily_potet)

else if(arg.eq.'initialize') then retval = petinit_jh(nhru, transp_beg, transp_end, transp_tmax, + jh_coef, jh_coef_hru, transp_on, tmax_sum, + transp_check, basin_area, hru_area, + hru_radpl, temp_units, lday)

else if(arg.eq.'run') then retval = petrun_jh(transp_beg, transp_end, transp_on, + transp_check, + transp_tmax, tmax_sum, jh_coef, jh_coef_hru, + potet, nhru, basin_potet, basin_area, hru_area, + hru_radpl, temp_units, lday, daily_potet)

end if

C******Debug level print call dpint4('End of potet_jh, retval = ', retval, 1, 2)

potet_jh_prms = retval return end

Page 86: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 86

CoLab&

Subversion

Support for Modeling

Page 87: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 87

Page 88: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 88

USDA Colab Overview

• Colab is an acronym for:

– Collaborative Software Development Laboratory

– Similar to concepts as SourceForge, CollabNet, Codehaus, ...

• Colab’s purpose is to facilitate collaborative model

development in a location independent environment.

• History

– Identified the need in 2004

– Prototype phase in 2004/2005

– Production in April 2005

– Founding members USDA (NRCS/ASRU), EPA, CSU, USGS

• http://colab.usda.govhttp://colab.usda.gov

Page 89: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 89

There is room for process enhancements in IT

Problem

• 2/3 of projects fails on time, budget or miss the scope

Trends

• Globalization, IT manager are managing global teams

• Co-location research groups

• Shortened release circles

• Growing code size and complexity

Page 90: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 90

Tools needed by Open Source CommunitiesRequirements

• Must be efficient over WAN, (home)

• Transparency, achievability

• On the fly setup infrastructure

• Easy to maintain

Communication• Mailing lists, Forums

• Wikis, Blogs, RSS the mailing lists, forums replacements

Commonly used Version Control Systems• CVS, Subversion, the CVS replacement

Build• ANT, CruiseControl, part of Maven

Issue tracking• Bugzilla, simple part of Jira

IDE• IDE with integrated CVS, Subversion support

Page 91: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 91

Colab Overview

Colab is made up of two major components

1.1. CodeBeamerCodeBeamer

• Commercial web application to help manage software

project development, communication, and documents.

2.2. SubversionSubversion

• Open source Version Control System

Page 92: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 92

CodeBeamer Architecture

Page 93: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 93

CoLab objectives with respect to modeling

• 1) Facilitate the development of OMS itself. Make the

development process available to the community.

• 2) Migrate existing modeling efforts in USDA into a

structured development environment. Tracking / version

control.

Page 94: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 94

Collaborative Software Development from the User Perspective

CoLab as an enterprise platform of integrated applications includes

• Issue tracking for Bugs, Task, CRQ

• Document Management

• Wiki Spaces

• SCM integration (Subversion)

• QA metrics

• Build support

• Discussion Forum, Email integration

• Dashboard

• Search and Indexing

• USDA eAuth integration (Siteminder)

Page 95: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 95

1) OMS development supported by Colab

Page 96: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 96

OMS Development Process

Page 97: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 97

Development Process

Page 98: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 98

2) General Modeling Projects in CoLab

Page 99: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 99

2) Structured Model Development Process

• Progress Levels for different models– SWAT: 1..2– WWEM: 4– AGNPS: 2– REMM CONCEPTS: 2– PRMS : 4– J2000: 5

1. Integrate Source into Colab2. Adopt the use of a (i) version control system and (ii)

software project management as provided in Colab3. Modeling Source; Refactoring using peer review4. Modularize and use a modeling framework (OMS), eliminate

redundancies5. Implement automated model tests against selected

data sets within Colab6. Use Colab progress tracking methods on model

development (software project management)7. Involve external collaborator and scientific community for

contribution and enhancements.

Page 100: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 100

CoLab Metrics

• User Accounts (969) Projects (315) Repositories (269) repositories)  Documents (21,652) ~100 active User/Day

• Code repository ~20 GB, Documents ~4GB• Users from ~15 different institutions.

• Example Modeling Projects– AGNPS (NRCS), FRAMES/3MRA (EPA), OMS Unified Wind

and Water Erosion (ARS), PRMS (USGS), SWAT (ARS; 2005), RZWQM (ARS), DSSAT Components (OMS), Range/Lifestock (ASRU), J2000 (FSU Jena), COSU (MOU on MIMS), and many others …

• Training classes on (i) Version Control Workflow using Subversion (ii) Codebeamer Project Management and (iii) OMS

Page 101: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 101

Results of the use of a CoLab

• Reduction of administration efforts

• Cost reduction at

• Professional Service costs, Implementation, Training efforts

and cost of travel

• Set up of a centralized Project repository

• Reduction of „Ramp Up Time“

• Enhanced Communication

• Build of Knowledge, -distribution and –usage

• Productivity enhancement for technical and economic user

• Simplifies communication

Page 102: OMS Workshop September 2007, Fort Collins1 Object Modeling System Olaf David

OMS Workshop September 2007, Fort Collins 102

USDA Modeling and Collaboration Infrastructure

Model DevelopmentModel Development- Construct- Run- Analyze- Test- Verify

Model ProjectModel Project ManagementManagement - Tracker- Forums- Documents- CMM Reports- Access Control

ModelModel ResourcesResources Change ManagementChange Management- Version Control- Change Management- Repository- Concurrent Access

OMSOMSOMSOMS

SubversionSubversionSubversionSubversion

CodebeamerCodebeamerCodebeamerCodebeamer