Introduction to the OpenMI. OpenMI is an open standard which allows dynamic linking of numerical models, such as river models rainfall-runoff models and so on. See also:
http://www.lictek.com
2. Connecting things - When two and two is five
My model
USB
• Provides freedom of choice for the users
• Provides opportunities for suppliers
Standard
Introduction Jan Gregersen
3. About this presentation
• Examples of use
• How to create OpenMI linked systems
My model
• How does OpenMI work
• How to migrate models
• Hardcoded configurations
• Optimization, calibration, ..
• Support
Introduction Jan Gregersen
4. Examples of use: Integrated modelling
Met. Database
Hymos
precip
RR
RR
RR My model RR
Sobek RR
Mike She GW RR
Runoff RR
Leakage
RR
Mike Basin GW
Level
flow ISIS
RR
RR
Examples of use Jan Gregersen
5. Examples of use: Hydropower DSS
Web service Web service
Estimated Forecasted:
power price Precipitation
Temperature
Evaporation
Use Use
Use
Numeric model Operates
Hydropower DSS Define or optimization tool
HP scenarios
User
Use
Use Use Creates
Numeric model Simulated
Revenue
On-line
Water level
Water level in
Downstream flow
reservoir
Examples of use Jan Gregersen
6. Examples of use: Sewer to sewer
Mike Urban to Mike Urban
Water Level
My model
Wave
Model 1 Model 2
Flow
Examples of use Jan Gregersen
7. How to create OpenMI linked systems : 1,2 Run
Model Engine
1: Populate models Input files
OMI file
My model
2: Configure
3: Run
How to create OpenMI linked system Jan Gregersen
8. How to create OpenMI linked systems : Demo
River and groundwater models
RR model
River model
How to create OpenMI linked system Jan Gregersen
9. How does OpenMI work : OpenMI is OO
Very short introduction to Object Oriented programming
Interface Geometry
string ID
double DistanceToPoint (double x, double y)
My model
implements implements
Class Polygon Class Polyline
String ID String ID
double Area double GetDistanceToPoint(double x, double y)
bool IsPointInside(double x, double y)
double GetOverlapping Area(Polygon polygon
double GetDistanceToPoint(double x, double y)
inherits
Class Rectangle
double diagonal
How does OpenMI work Jan Gregersen
10. How does OpenMI work : ILinkableComponent
From outside all OpenMI compliant
components look the same
OpenMI.Standard.ILinkableComponent
void Initialize(IArgument[] properties)
string ComponentID
string ComponentDescription
RR model string ModelID
string ModelDescription
ITimeSpan TimeHorizon
IInputExchangeItem GetInputExchangeItem(int index)
IOutputExchangeItem GetOutputExchangeItem(int idex)
int InputExchangeItemCount
int OutputExchangeItemCount
River model
void AddLink (ILink link)
void RemoveLink(string linkID)
string Validate()
void Prepare()
IValueSet GetValues(ITime time, string linkID)
ITimeStamp EarliestInputTime
void Finish()
void Dispose()
How does OpenMI work Jan Gregersen
11. How does OpenMI work : GUI Add model
void Initialize(IArgument[] properties)
string ComponentID
string ComponentDescription
string ModelID
string ModelDescription
My model ITimeSpan TimeHorizon
IInputExchangeItem GetInputExchangeItem(int index)
IOutputExchangeItem GetOutputExchangeItem(int idex)
int InputExchangeItemCount
int OutputExchangeItemCount
void AddLink (ILink link)
void RemoveLink(string linkID)
string Validate()
void Prepare()
IValueSet GetValues(ITime time, string linkID)
ITimeStamp EarliestInputTime
1. Read OMI file void Finish()
2. Create component void Dispose()
3. Invoke (call) Initialize
1. Component will read input files and initialize
How does OpenMI work Jan Gregersen
12. How does OpenMI work : The OMI file
<?xml version=quot;1.0quot;?>
<LinkableComponent Type=“RainfallRunoffModelLCquot; Assembly=quot;..binRainfallRunoffModel.dllquot;>
<Arguments>
<Argument Key=“Pathquot; ReadOnly=quot;truequot; Value=“..dataquot; />
</Arguments>
My model
</LinkableComponent>
How does OpenMI work Jan Gregersen
13. How does OpenMI work : Model properties
void Initialize(IArgument[] properties)
string ComponentID
string ComponentDescription
My model string ModelID
string ModelDescription
ITimeSpan TimeHorizon
IInputExchangeItem GetInputExchangeItem(int index)
IOutputExchangeItem GetOutputExchangeItem(int idex)
int InputExchangeItemCount
int OutputExchangeItemCount
void AddLink (ILink link)
void RemoveLink(string linkID)
string Validate()
void Prepare()
IValueSet GetValues(ITime time, string linkID)
ITimeStamp EarliestInputTime
void Finish()
void Dispose()
How does OpenMI work Jan Gregersen
14. How does OpenMI work : Create and add link
void Initialize(IArgument[] properties)
string ComponentID
string ComponentDescription
string ModelID
string ModelDescription
ITimeSpan TimeHorizon
IInputExchangeItem GetInputExchangeItem(int index)
My model IOutputExchangeItem GetOutputExchangeItem(int idex)
int InputExchangeItemCount
int OutputExchangeItemCount
void AddLink (ILink link)
void RemoveLink(string linkID)
string Validate()
void Prepare()
IValueSet GetValues(ITime time, string linkID)
ITimeStamp EarliestInputTime
void Finish()
void Dispose()
1. Query and display exchange items
2. User selects output and input
3. Create a link object
4. Add the link to both components
How does OpenMI work Jan Gregersen
15. How does OpenMI work : ExchangeItems
My model
Where What
How
How does OpenMI work Jan Gregersen
16. How does OpenMI Work : GetValues()
void Initialize(IArgument[] properties)
string ComponentID
string ComponentDescription
string ModelID
string ModelDescription
ITimeSpan TimeHorizon
IInputExchangeItem GetInputExchangeItem(int index)
My model IOutputExchangeItem GetOutputExchangeItem(int idex)
int InputExchangeItemCount
int OutputExchangeItemCount
void AddLink (ILink link)
void RemoveLink(string linkID)
string Validate()
void Prepare()
IValueSet GetValues(ITime time, string linkID)
ITimeStamp EarliestInputTime
GetValues(time)
void Finish()
void Dispose()
GetValues(time)
How does OpenMI work Jan Gregersen
17. How does OpenMI Work : GetValues()
ID-Based link Geo-referenced bi-directional link
My model
GetValues(time)
My model
GetValues(time)
How does OpenMI work Jan Gregersen
19. How to migrate models
How to migrate models Jan Gregersen
20. How to migrate models:
SDK: Balancing stability and flexibility
The OpenMI Standard • Provided by OA
• Rigid release proceedure
• The OpenMI.Standard interfaces
• Non frequent releases
• The OpenMI standard definition
• The one and only Standard
• XSD’s
• Makes components linkable
The OpenMI SDK • Provided by OATC
• Source code C# (and Java) • Flexible release proceedures
• Default implementaion • Frequent releases
• Wrapper • One of many
•Targeting developers • Makes OpenMI easier
• OATC.SDK targeting models
• Not required
The OpenMI Configuration Editor • Components compliant to
• Create linked systems same version of the standard
• Run linked systems can be linked regardless of
•Targeting users (e.g. modellers) which SDK is used.
How to migrate models Jan Gregersen
21. How most models are organized
User Interface
Run Write
My model
Input file
Read
Engine
Write
Output file
How to migrate models Jan Gregersen
22. OpenMI is linking models
User Interface
Run Write
My model
Input file
Read
Engine
Write
Output file
How to migrate models Jan Gregersen
23. User Interface
OpenMI.Standard
Run Write <<ILinkableComponent>>
My model
Input file
Read
Engine
Write
Output file
How to migrate models Jan Gregersen
24. User Interface
OpenMI.Standard
Run Write <<ILinkableComponent>>
My model
Input file
Read
GetValues()
Engine Some
model
Write
GetValues()
Output file
How to migrate models Jan Gregersen
25. How do I set values ?
User Interface
OpenMI.Standard
Run Write <<ILinkableComponent>>
My model
Input file
void Initialize(IArgument[] properties)
string ComponentID
string
Read
string
ComponentDescription
ModelID
GetValues()
string ModelDescription
ITimeSpan TimeHorizon
int InputExchangeItemCount
Engine
IInputExchangeItem GetInputExchangeItem(int inputExchangeItemIndex)
int OutputExchangeItemCount
Some
IOutputExchangeItem GetOutputExchangeItem(int outputExchangeItemIndex) model
void Write AddLink (ILink link)
void RemoveLink(string linkID)
string Validate()
GetValues()
void Prepare()
Output file
IValueSet GetValues(ITime time, string linkID)
ITimeStamp EarliestInputTime
void Finish()
void Dispose()
How to migrate models Jan Gregersen
26. User Interface
Run Write
My model OpenMI.Standard
Input file <<ILinkableComponent>>
Oatc.OpenMI.Sdk
<<IEngine>>
Read GetValues()
Engine SDK Some
(Wrapper) model
Write
GetValues()
Output file
How to migrate models Jan Gregersen
27. // -- Execution control methods (Inherited from IRunEngine) --
void Initialize(Hashtable properties);
bool PerformTimeStep();
void Finish();
//-- Time methods (Inherited from IRunEngine) --
ITime GetCurrentTime();
User Interface ITime GetInputTime(string QuantityID, string ElementSetID);
ITimeStamp GetEarliestNeededTime();
Run Write //-- Data access methods (Inherited from IRunEngine) --
void SetValues(string QuantityID, string ElementSetID, IValueSet values);
IValueSet GetValues(string QuantityID, string ElementSetID);
My model OpenMI.Standard
Input file <<ILinkableComponent>>
//-- Component description methods (Inherited from IRunEngine) --
double GetMissingValueDefinition();
String GetComponentID();
Oatc.OpenMI.Sdk string GetComponentDescription();
<<IEngine>>
Read GetValues()
// -- Model description methods --
string GetModelID();
string GetModelDescription();
Engine SDK
double GetTimeHorizon(); Some
(Wrapper) model
// -- Exchange items --
Write int GetInputExchangeItemCount();
int GetOutputExchangeItemCount();
GetValues()
org.OpenMI.Backbone GetInputExchangeItem(int exchangeItemIndex);
org.OpenMI.Backbone GetOutputExchangeItem(int exchangeItemIndex);
Output file
How to migrate models Jan Gregersen
28. Buffers results from the engine core Mapping of values associated to one
ElementSet to be represented on
another ElementSet
User Interface
Mapping of values associated to one array of
times /timespans to values represented on
another array of times/timespans •Link administration
Run Write
•Exception handling
My model •Events handling
OpenMI.Standard
Input file <<ILinkableComponent>>
t t •And more..
Oatc.OpenMI.Sdk
<<IEngine>>
Read GetValues()
Engine SDK Some
(Wrapper) model
Write
GetValues()
Output file
How to migrate models Jan Gregersen
29. Oatc.OpenMI.Sdk.Wrapper.IEngine
// -- Execution control methods (Inherited from IRunEngine) --
void Initialize(Hashtable properties);
bool PerformTimeStep();
void Finish();
//-- Time methods (Inherited from IRunEngine) --
OpenMI.Standard.IlinkableComponent ITime GetCurrentTime();
ITime GetInputTime(string QuantityID, string ElementSetID);
void Initialize(IArgument[] properties) ITimeStamp GetEarliestNeededTime();
string ComponentID
//-- Data access methods (Inherited from IRunEngine) --
string ComponentDescription
string ModelID void SetValues(string QuantityID, string ElementSetID, IValueSet values);
string ModelDescription IValueSet GetValues(string QuantityID, string ElementSetID);
ITimeSpan TimeHorizon
//-- Component description methods (Inherited from IRunEngine) --
IInputExchangeItem GetInputExchangeItem(int index)
double GetMissingValueDefinition();
IOutputExchangeItem GetOutputExchangeItem(int idex)
int InputExchangeItemCount String GetComponentID();
int OutputExchangeItemCount string GetComponentDescription();
// -- Model description methods --
void AddLink (ILink link)
void RemoveLink(string linkID) string GetModelID();
string Validate() string GetModelDescription();
double GetTimeHorizon();
void Prepare()
IValueSet GetValues(ITime time, string linkID) // -- Exchange items --
ITimeStamp EarliestInputTime
int GetInputExchangeItemCount();
void Finish() int GetOutputExchangeItemCount();
void Dispose() org.OpenMI.Backbone GetInputExchangeItem(int exchangeItemIndex);
org.OpenMI.Backbone GetOutputExchangeItem(int exchangeItemIndex);
How to migrate models Jan Gregersen
30. Migration design pattern
<< interface >>
OpenMI.Standard.ILinkableComponent
<< interface >>
Oatc.OpenMI.Sdk.Wrapper.IEngine
Implements
Implements
<< abstract class >>
Oatc.OpenMI.Sdk.Backbone.LinkableComponent IEngine
<< Class >>
Rivermodel.EngineWrapper
Inherits
access
access
<< abstract class >>
Oatc.OpenMI.Sdk.Wrapper.LinkableEngine create
<< Class >>
RiverModel.Engine
Inherits
access
<< Class >>
Rivermodel.LinkableComponent << dll >>
Fortran Engine
How to migrate models Jan Gregersen
31. Five steps to a compliant model
1. Make sure that your engine is a Dll not a Exe
2. Separate initialization, Perform time step, and finalization
3. Implement IEngine
4. Attach the SDK wrapper
5. Done
6. See also the simple river example
How to migrate models Jan Gregersen
32. Remarks about the configuration editor
• Enables user to create linked
systems and run these
• Is using the OpenMI standard
– not part of the standard
• We encurage other people to
create more sofisticated GUI’s
How to migrate models Jan Gregersen
33. Final remarks on model migration
• The SDK makes model migration easier
• The SDK is aimed at time stepping numerical models
• The SDK is not mandatory to use (only the standard matters)
• SDK and the standard together provides stability and flexibility
How to migrate models Jan Gregersen
34. Hard coded OpenMI configurations
Hardcoded configurations Jan Gregersen
35. Calibration
GetValues()
SaveState()
RestoreState()
GetValues()
Measured values
GetValues()
GetValues()
New parameters
All time steps Simulated discharge
Calc.. New
While (M – S)2 > a parameters
Calibration Jan Gregersen
36. Support through the Internet
• General info
• News & Calendar
• Compliant models
• Documentation
http://sourceforge.net/projects/Openmi
• Help forum
• Discussion forum
• Feature request
http://Wiki.OpenMI.org
• Getting started
• HowTo
• Documentation
Getting help Jan Gregersen
40. People to people
OpenMI Workshops
• OpenMI Life workshops
• Conference workshops
• Specific workshops
OpenMI training
• End users training
• Developers training
• Tailored training
Consulting
• Model provider
• Consultants
Getting help Jan Gregersen