Date post: | 28-Dec-2015 |
Category: |
Documents |
Upload: | dominick-lambert |
View: | 215 times |
Download: | 1 times |
OMS Workshop September 2007, Fort Collins 1
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)
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:
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
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]
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)
OMS Workshop September 2007, Fort Collins 7
OMS in 2002
• Netbeans 3.5 PF
• Update center
• Modularization
• RWQM
Prototype
• PRMS prototype
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
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
OMS Workshop September 2007, Fort Collins 10
2005 OMS (1.2)
• Modeling Projects
• First Component
Library (Local)
• Internal Code
disaggregation
• GCC bundle
OMS Workshop September 2007, Fort Collins 11
2006 – OMS 2.0
• NB 5.0
• Improved
spatial
Modeling
• Data
Analysis
• Execution
API
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)
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, …
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,
– …
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
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.
• …
OMS Workshop September 2007, Fort Collins 17
OMS 2.1
User Interface
OMS Workshop September 2007, Fort Collins 18
OMS 2.1 User Interface
OMS Workshop September 2007, Fort Collins 19
OMS Modular Tool Concept
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
OMS Workshop September 2007, Fort Collins 21
Project Resource Creation
OMS Workshop September 2007, Fort Collins 22
General Properties Window
• Allows for general
Configuration changes of
almost everything
– Components
– Model
– Attributes
– Files
– …
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
OMS Workshop September 2007, Fort Collins 24
Component Development
“Creating the model building blocks”
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
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
OMS Workshop September 2007, Fort Collins 27
Component API
OMS Workshop September 2007, Fort Collins 28
Component Sources
• Java Language
– (maybe native bindings)
• Project Components
folder
• Packages
• Wizard Generation
OMS Workshop September 2007, Fort Collins 29
Component Editor
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
OMS Workshop September 2007, Fort Collins 31
Component Behavior
• Initialization
• Execution
• Cleanup
• Native Code handling
• Visual elements
• package– org.oms.model.components
OMS Workshop September 2007, Fort Collins 32
Component Meta Data
• Component Name
• Annotations
– Description
– Keywords
– Version Info
– Source
– Author
– (Status)
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.
OMS Workshop September 2007, Fort Collins 34
Model Integration
Integrate Components into a model
Connect Component Attributes
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
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
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
OMS Workshop September 2007, Fort Collins 38
Adding a Component
• Drag and
Drop a
component
into a model
• Where to
instantiate
the
Attributes?
• Scoping
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
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
OMS Workshop September 2007, Fort Collins 41
Component Connectivity
OMS Workshop September 2007, Fort Collins 42
Data Assimilation
Tables
Parameter
OMS Workshop September 2007, Fort Collins 43
Data Input
• Tabular data
• Property parameter sets
• Any other “unknown” data
files
• Wizard
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
OMS Workshop September 2007, Fort Collins 45
Property Parameter Sets
• Model parameter
• Structure
– key = value
OMS Workshop September 2007, Fort Collins 46
Model Execution
Various ways to execute a model
Visual
Batch
…
OMS Workshop September 2007, Fort Collins 47
Visual Execution
• Editing
• Filtering
– Type
– Name
– Role
– Dimension
– Access
• Selection
OMS Workshop September 2007, Fort Collins 48
Spreadsheet view
• Transpose view
• Apply formulas
– Math
– Statistics
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
OMS Workshop September 2007, Fort Collins 50
Batch Execution
• No GUI, just standard output
• Not exciting, but very useful
OMS Workshop September 2007, Fort Collins 51
Output Analysis
“Ad-hoc post run analysis”
OMS Workshop September 2007, Fort Collins 52
Analysis
• Analysis types
• Configure them once
and execute often.
• Plays well with
simulation
management
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
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
OMS Workshop September 2007, Fort Collins 55
ESP Trace Analysis
• USGS OUI ESP Tool
• Statistical analysis
• Report generation
OMS Workshop September 2007, Fort Collins 56
NASA Worldwind OMS Prototype (not in 2.1)
OMS Workshop September 2007, Fort Collins 57
Extension to map OMS model output data into Worldwind
OMS Workshop September 2007, Fort Collins 58
Simulations
Configure a model application
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.
OMS Workshop September 2007, Fort Collins 60
Simulations
• Wizard generated
• Icons represent types
OMS Workshop September 2007, Fort Collins 61
Basic Simulation
Sections
• Drag and Drop from project
– Model
– Parameter file
• Check execution type
– GUI
– Batch
• (Analysis)
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
OMS Workshop September 2007, Fort Collins 63
Model Calibration using Luca
• Luca wizard start
• Calibration
settings overview
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
OMS Workshop September 2007, Fort Collins 65
Documentation
CoLab OMS Project
OMS Workshop September 2007, Fort Collins 66
Documentation
• OMS Project WIKI
– Olaf, Frank,
George
OMS Workshop September 2007, Fort Collins 67
OMSArchitecture
Points of Extension
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
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
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
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
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
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
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
OMS Workshop September 2007, Fort Collins 75
Access CoLab Components directly (Prototype)
Connect
ExplorePalette
Integrate
OMS Workshop September 2007, Fort Collins 76
Additional Features
CoLab Integration Component Library
“Advanced Simulation Management”
Luca & beyond
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.
OMS Workshop September 2007, Fort Collins 78
Modularization
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
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 !
OMS Workshop September 2007, Fort Collins 81
Module Design Criteria
• Cohesion ()
• Coupling ()
• Interface (slim)
• Size (?)
• testability !
• Interference / Side effects (!)
• Number of Imports / Uses
OMS Workshop September 2007, Fort Collins 82
Think about Bindings
A B
CD
!!
OMS Workshop September 2007, Fort Collins 83
Again ...
A B
!!
C
OMS Workshop September 2007, Fort Collins 84
Complexity = ... + f( # Modules)
#Modules
Inner Module Complexity
Overall System Complexity
Opt
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
OMS Workshop September 2007, Fort Collins 86
CoLab&
Subversion
Support for Modeling
OMS Workshop September 2007, Fort Collins 87
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
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
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
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
OMS Workshop September 2007, Fort Collins 92
CodeBeamer Architecture
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.
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)
OMS Workshop September 2007, Fort Collins 95
1) OMS development supported by Colab
OMS Workshop September 2007, Fort Collins 96
OMS Development Process
OMS Workshop September 2007, Fort Collins 97
Development Process
OMS Workshop September 2007, Fort Collins 98
2) General Modeling Projects in CoLab
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.
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
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
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