HTML Injection Attacks: Impact and Mitigation Strategies
How To Make Your Component Compliant
1. How to make your model OpenMI compliant
Jan Gregersen LicTek / DHI
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. 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
4. 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
5. 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
6. 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
7. 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
8. 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
9. How does OpenMI work : ExchangeItems
My model
Where What
How
How does OpenMI work Jan Gregersen
10. 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
11. 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
13. How to migrate models
How to migrate models Jan Gregersen
14. How most models are organized
User Interface
Run Write
My model
Input file
Read
Engine
Write
Output file
How to migrate models Jan Gregersen
15. OpenMI is linking models
User Interface
Run Write
My model
Input file
Read
Engine
Write
Output file
How to migrate models Jan Gregersen
16. User Interface
OpenMI.Standard
Run Write <<ILinkableComponent>>
My model
Input file
Read
Engine
Write
Output file
How to migrate models Jan Gregersen
17. 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
18. 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
• Provided by OATC
• Flexible release proceedures
• Frequent releases
The OpenMI SDK • One of many
• Source code C# (and Java) • Makes OpenMI easier
• Default implementaion • OATC.SDK targeting models
• Wrapper • Not required
•Targeting developers • Components compliant to
same version of the standard
can be linked regardless of
which SDK is used.
How to migrate models Jan Gregersen
19. 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
20. // -- 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
21. 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
22. 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
23. 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
24. 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
How to migrate models Jan Gregersen