Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
scrollbar

How to port the OpenMI environment from Windows to Linux

Table of contents

Table of Contents

1. Introduction

The document describes how to generate and run Linux dlls and executables from the original Windows C# sources. This is done by using Mono, a .NET Open Source project on different platforms. Only few adjustments are necessary in order to port the complete OpenMI functionality:

  • the standard OpenMI.Standard
  • the source development kit

...

  • Oatc.OpenMI.Sdk.*

...

  • the

...

  • dlls

...

  • and

...

  • executables

...

  • Oatc.OpenMI.Gui.*

...

  • for

...

  • running

...

  • OpenMI

...

  • in

...

  • the

...

  • configuration

...

  • editor

...

  • with

...

  • GUIs

...

  • or

...

  • from

...

  • command

...

  • line. 

...


  •  

    2.

...

  • Technical

...

  • prerequisites

...

  • 2.1.

...

  • Machine

...

  • and

...

  • OS

...

  • of

...

  • the

...

  • test

...

  • system

...

  • workstation

...

  • with

...

  • an

...

  • Intel

...

  • Xeon

...

  • processor

...

  • 64bit

...

  • openSUSE

...

  • 11.0

...

  • 2.2.

...

  • Mono

...

  • Mono

...

  • v.

...

  • 1.9.1.

...

  • for

...

  • openSUSE

...

  • 11.0

...

  • in

...

  • 64

...

  • bit

...

  • mode.

...

  • V.

...

  • 1.9.1.

...

  • is

...

  • also

...

  • referred

...

  • to

...

  • as

...

  • Mono

...

  • 2.0.

...

  • The

...

  • standard

...

  • and

...

  • the

...

  • sdk

...

  • sources

...

  • should

...

  • be

...

  • compilable

...

  • with

...

  • previous

...

  • versions.

...

  • But

...

  • the

...

  • GUIs

...

  • require

...

  • Windows.Forms,

...

  • which

...

  • has

...

  • been

...

  • shipped

...

  • with

...

  • v.

...

  • 1.9.1.

...

  • in

...

  • Oct.

...

  • 2009.

...

2.

...

How

...

to

...

compile

...

and

...

execute

...

a

...

Mono application

Command for generating a dll:

Code Block
java
java
 application

Used command for generating a dll:
{code:java}
gmcs -target:library -out:<target>.dll -r<linkedlibr<linkedLib_1>.pcdll,<linkedLib_k>.dll -pkg:<linkedlib<package_1>.pc;...;<linkedlib<package_m>.pc <source_1>.cs ... <source_n>.cs 
{code} 
gmcs -target:library -out:<target>.dll -pkg:<linkedlib_1>.pc;...;<linkedlib_m>.pc <source_1>.cs ... <source_n>.cs 
<linkedlib
<linkedLib_?>.pc are linked shared libraries (path and name) 

<package_?>.pc are ASCII files (path and name), that refer to the linked libraries <linkedlib_?>.dll. They contain the path and the version of the dll. Example for the Windows standardForms dll:
prefix=/net/themis2/system/akprog/CS/OATC/AthenTraining/xe64/src/OpenMI.Standard

prefix=/usr/lib/mono/2.0
exec_prefix=${prefix}
libdir=${exec_prefix}
Name: OpenMIStandardWindowsForms
Description: OpenMIWindows StandardForms
Version: 12.40
Libs: -r:${libdir}/OpenMISystem.Windows.StandardForms.dll

Used

...

command

...

for

...

generating

...

an

...

exe

...

file:

Code Block
java
java
gmcs -out:<target>.<postfix>exe -r<linkedLib_1>.dll,<linkedLib_k>.dll -pkg:<linkedlib<package_1>.pc;...;<linkedlib<package_m>.pc <source_1>.cs ... <source_n>.cs 

Further

...

compile

...

information

...

for

...

resources

...

is

...

given

...

in

...

section

...

3.3..

...


Applications

...

compiled

...

with

...

Mono

...

do

...

not

...

run

...

directly

...

on

...

the

...

linux

...

system,

...

they

...

are

...

interpreted

...

on

...

a

...

runtime

...

engine,

...

comparable

...

to

...

the

...

virtual

...

machine

...

in

...

java.

...

Thus,

...

the

...

command

...

in

...

the

...

terminal

...

window

...

command

...

line

...

has

...

to

...

start

...

with

...

mono,

...

e.g.:

...


mono

...

Oatc.OpenMI.GUI.ConfigurationEditor.<postfix>

...

Include Page
OPENMI:1 Introduction
OPENMI:1

...

Introduction

...

Include Page
OPENMI:2 Planning the migration
OPENMI:2

...

Planning

...

the

...

migration

...

Include Page
OPENMI:3 Wrapping
OPENMI:3 Wrapping

4. Migration - step by step

The best strategy when migrating a model is to split the process into a number of steps; at the end of each step you can compile your code and run a small test.

The steps needed for migration are described in this chapter.

Include Page
OPENMI:4.1 Step 1 - Changing your engine core
OPENMI:4.1 Step 1 - Changing your engine core
Include Page
OPENMI:4.2 Step 2 - Creating the .Net assemblies
OPENMI:4.2 Step 2 - Creating the .Net assemblies
Include Page
OPENMI:4.3 Step 3 - Accessing the functions in the engine core
OPENMI:4.3 Step 3 - Accessing the functions in the engine core
Include Page
OPENMI:4.4 Step 4 - Implementing the MyEngineDotNetAccess
OPENMI:4.4 Step 4 - Implementing the MyEngineDotNetAccess
Include Page
OPENMI:4.5 Step 5 - Implementing the MyEngineWrapper class
OPENMI:4.5 Step 5 - Implementing the MyEngineWrapper class
Include Page
OPENMI:4.6 Step 6 - Implementing the MyModelLinkablComponent
OPENMI:4.6 Step 6 - Implementing the MyModelLinkablComponent
Include Page
OPENMI:4.7 Step 7 - Implementation of the remaining IEngine methods
OPENMI:4.7 Step 7 - Implementation of the remaining IEngine methods

5. Migration of the Simple River

The previous chapter described the steps involved in migrating a model to the OpenMI.

This chapter shows how the migrated code is developed for the Simple River example.

5.1 The Simple River Wrapper

The Simple River model uses the migration pattern shown in Figure 12. Figure 13 gives a detailed explanation of how the Simple River wrapper works in terms of the wrapper classes.

Fig. 13 Simple River wrapper classes

Include Page
OPENMI: 5.2 Implementation of the Initialize method
OPENMI: 5.2 Implementation of the Initialize method
Include Page
OPENMI: 5.3 Implementing the SetValues method
OPENMI: 5.3 Implementing the SetValues method
Include Page
OPENMI: 5.4 Implementing the GetValues method
OPENMI: 5.4 Implementing the GetValues method
Include Page
OPENMI: 5.5 Implementation of the remaining methods
OPENMI: 5.5 Implementation of the remaining methods

6. Testing the component

It is important to test the component to check that it is working correctly. Traditionally, the procedure has been to complete implementation and then run the engine to see if it produces the correct results. However, in recent years new methodologies have been developed for testing. The dominant testing method for object oriented programs is unit testing. Unit testing is done in parallel with the implementation. This means that you will be able to find errors earlier and thus save time on debugging your code later.

This chapter discusses the testing of migrated components.

Include Page
OPENMI: 6.1 Unit testing
OPENMI: 6.1 Unit testing
Include Page
OPENMI: 7. Implementing IManageState
OPENMI: 7. Implementing IManageState
Include Page
OPENMI: 8. The OMI file
OPENMI: 8. The OMI file
Include Page
OPENMI: 9. The OpenMICompliancyInfo file
OPENMI: 9. The OpenMICompliancyInfo file