Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
CERTI - Bindings to Matlab and Fortran
Christian Stenzel, Sven Pawletta
RG Computational Engineering and AutomationUniversity of Wismar, Germany
10. Magdeburger HLA-Forum27.02.2008
1 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
2 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
3 / 29
RG Computational Engineering and Automation
research group at the University of Wismarprimary research fields:
I fundamentals of modeling and simulationI modeling, simulation and control applicationsI robotics, engine controlI distributed and parallel scientific computing in the engineering
domain
highly interested in advanced simulation technologies like HLAmain focus on the engineering domain
4 / 29
RG Computational Engineering and Automation
research group at the University of Wismarprimary research fields:
I fundamentals of modeling and simulationI modeling, simulation and control applicationsI robotics, engine controlI distributed and parallel scientific computing in the engineering
domain
highly interested in advanced simulation technologies like HLAmain focus on the engineering domain
4 / 29
RG Computational Engineering and Automation
research group at the University of Wismarprimary research fields:
I fundamentals of modeling and simulationI modeling, simulation and control applicationsI robotics, engine controlI distributed and parallel scientific computing in the engineering
domain
highly interested in advanced simulation technologies like HLAmain focus on the engineering domain
4 / 29
Motivation
today’s RTIs provide C++ and/or Java APIsI but:
F simulation model design and execution in the engineering domaintoday characterized by the usage of Scientific and technicalComputation Environments (SCEs)→ Matlab
F existing Fortran codes are daily used, Fortran primary programminglanguage in HPC community
aims:I provide engineers HLA access within their usual working
environmentI provide a way to easily extend existing code to HLA federatesI increase acceptance of HLA in the engineering domain
5 / 29
Motivation
today’s RTIs provide C++ and/or Java APIsI but:
F simulation model design and execution in the engineering domaintoday characterized by the usage of Scientific and technicalComputation Environments (SCEs)→ Matlab
F existing Fortran codes are daily used, Fortran primary programminglanguage in HPC community
aims:I provide engineers HLA access within their usual working
environmentI provide a way to easily extend existing code to HLA federatesI increase acceptance of HLA in the engineering domain
5 / 29
Motivation
today’s RTIs provide C++ and/or Java APIsI but:
F simulation model design and execution in the engineering domaintoday characterized by the usage of Scientific and technicalComputation Environments (SCEs)→ Matlab
F existing Fortran codes are daily used, Fortran primary programminglanguage in HPC community
aims:I provide engineers HLA access within their usual working
environmentI provide a way to easily extend existing code to HLA federatesI increase acceptance of HLA in the engineering domain
5 / 29
Motivation
today’s RTIs provide C++ and/or Java APIsI but:
F simulation model design and execution in the engineering domaintoday characterized by the usage of Scientific and technicalComputation Environments (SCEs)→ Matlab
F existing Fortran codes are daily used, Fortran primary programminglanguage in HPC community
aims:I provide engineers HLA access within their usual working
environmentI provide a way to easily extend existing code to HLA federatesI increase acceptance of HLA in the engineering domain
5 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
6 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
preferred RTII free, open source→ possibility to study RTI implementation and to
participate in developmentI C++ bindings→ simplifies Fortran bindingI cross platform RTI (including Windows)I advanced implementation status of HLA servicesI active developer community
a number of non-commercial RTIs existoverview about existing non-commercial RTI implementationsrequired
7 / 29
Non-Commercial RTIs
Name Vendor Standard Bindings License
BH-RTI Beijing University 1.3, IEEE 1516 ? ?
CERTI ONERA 1.3 partial, IEEE1516 planned
C++, Java planned GPL, LGPL
EODiSP HLA P&P Software IEEE 1516 partial Java GPL
GERTICO Fraunhofer IITB 1.3 ? ?
Open HLA 1.3 partial, IEEE1516 partial
Java Apache License
RTI-S US JFCOM J9Directorate
1.3 partial C++, Java US Government
poRTIco littlebluefrog labs 1.3 partial, IEEE1516 partial
Java, C++ CDDL
Rendezvous RTI NUST, Pakistan 1.3 C++, Java NUST
Table: www.wikipedia.org, Feb. 2008
8 / 29
Non-Commercial RTIs
Name Vendor Standard Bindings License
BH-RTI Beijing University 1.3, IEEE 1516 ? ?
CERTI ONERA 1.3 partial, IEEE1516 planned
C++, Java planned GPL, LGPL
EODiSP HLA P&P Software IEEE 1516 partial Java GPL
GERTICO Fraunhofer IITB 1.3 ? ?
Open HLA 1.3 partial, IEEE1516 partial
Java Apache License
RTI-S US JFCOM J9Directorate
1.3 partial C++, Java US Government
poRTIco littlebluefrog labs 1.3 partial, IEEE1516 partial
Java, C++ CDDL
Rendezvous RTI NUST, Pakistan 1.3 C++, Java NUST
Table: www.wikipedia.org, Feb. 2008
not downloadable or no activities since 12 months; only binaries available
8 / 29
Non-Commercial RTIs
Name Vendor Standard Bindings License
BH-RTI Beijing University 1.3, IEEE 1516 ? ?
CERTI ONERA 1.3 partial, IEEE1516 planned
C++, Java planned GPL, LGPL
EODiSP HLA P&P Software IEEE 1516 partial Java GPL
GERTICO Fraunhofer IITB 1.3 ? ?
Open HLA 1.3 partial, IEEE1516 partial
Java Apache License
RTI-S US JFCOM J9Directorate
1.3 partial C++, Java US Government
poRTIco littlebluefrog labs 1.3 partial, IEEE1516 partial
Java, C++ CDDL
Rendezvous RTI NUST, Pakistan 1.3 C++, Java NUST
Table: www.wikipedia.org, Feb. 2008
not downloadable or no activities since 12 months; only binaries available
8 / 29
Non-Commercial RTIs
Name Vendor Standard Bindings License
BH-RTI Beijing University 1.3, IEEE 1516 ? ?
CERTI ONERA 1.3 partial, IEEE1516 planned
C++, Java planned GPL, LGPL
EODiSP HLA P&P Software IEEE 1516 partial Java GPL
GERTICO Fraunhofer IITB 1.3 ? ?
Open HLA 1.3 partial, IEEE1516 partial
Java Apache License
RTI-S US JFCOM J9Directorate
1.3 partial C++, Java US Government
poRTIco littlebluefrog labs 1.3 partial, IEEE1516 partial
Java, C++ CDDL
Rendezvous RTI NUST, Pakistan 1.3 C++, Java NUST
Table: www.wikipedia.org, Feb. 2008
not downloadable or no activities since 12 months; only binaries available
8 / 29
general informationI former known as jaRTI, developed since 2005, first public release
June 2006I since May 2007 poRTIcoI license: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
(CDDL, more "commercial friendly" than GNU LGPL)I homepage and development site: http://porticoproject.org
prosI open source, based on JavaI C++ and Java bindingsI HLA1.3 partial, IEEE1516 partial
consI three main developers, all phd students→What follows after their
thesis?I v0.8rc1, Feb. 2008; version < 1.0
9 / 29
general informationI former known as jaRTI, developed since 2005, first public release
June 2006I since May 2007 poRTIcoI license: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
(CDDL, more "commercial friendly" than GNU LGPL)I homepage and development site: http://porticoproject.org
prosI open source, based on JavaI C++ and Java bindingsI HLA1.3 partial, IEEE1516 partial
consI three main developers, all phd students→What follows after their
thesis?I v0.8rc1, Feb. 2008; version < 1.0
9 / 29
general informationI former known as jaRTI, developed since 2005, first public release
June 2006I since May 2007 poRTIcoI license: COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
(CDDL, more "commercial friendly" than GNU LGPL)I homepage and development site: http://porticoproject.org
prosI open source, based on JavaI C++ and Java bindingsI HLA1.3 partial, IEEE1516 partial
consI three main developers, all phd students→What follows after their
thesis?I v0.8rc1, Feb. 2008; version < 1.0
9 / 29
general informationI developed at CERT (ONERA Research Centre, ONERA - French
aerospace lab)I started 1996, first version available in Sept. 1997I license: GNU GPL, libraries under GNU LGPLI homepage: http://www.cert.fr/CERTII devel@Savannah: http://savannah.nongnu.org/projects/certi
prosI active developer community (11 members)I current release 3.2.5, well tested RTII HLA1.3 nearly complete, HLA1516 plannedI cmake build system, different tool chains possible (gcc, msc, icc)I HP CERTI, optimized for SMP multiprocessor machines
consI at present only C++ bindings; Java bindings planned
CERTI fulfills all requirements
10 / 29
general informationI developed at CERT (ONERA Research Centre, ONERA - French
aerospace lab)I started 1996, first version available in Sept. 1997I license: GNU GPL, libraries under GNU LGPLI homepage: http://www.cert.fr/CERTII devel@Savannah: http://savannah.nongnu.org/projects/certi
prosI active developer community (11 members)I current release 3.2.5, well tested RTII HLA1.3 nearly complete, HLA1516 plannedI cmake build system, different tool chains possible (gcc, msc, icc)I HP CERTI, optimized for SMP multiprocessor machines
consI at present only C++ bindings; Java bindings planned
CERTI fulfills all requirements
10 / 29
general informationI developed at CERT (ONERA Research Centre, ONERA - French
aerospace lab)I started 1996, first version available in Sept. 1997I license: GNU GPL, libraries under GNU LGPLI homepage: http://www.cert.fr/CERTII devel@Savannah: http://savannah.nongnu.org/projects/certi
prosI active developer community (11 members)I current release 3.2.5, well tested RTII HLA1.3 nearly complete, HLA1516 plannedI cmake build system, different tool chains possible (gcc, msc, icc)I HP CERTI, optimized for SMP multiprocessor machines
consI at present only C++ bindings; Java bindings planned
CERTI fulfills all requirements
10 / 29
general informationI developed at CERT (ONERA Research Centre, ONERA - French
aerospace lab)I started 1996, first version available in Sept. 1997I license: GNU GPL, libraries under GNU LGPLI homepage: http://www.cert.fr/CERTII devel@Savannah: http://savannah.nongnu.org/projects/certi
prosI active developer community (11 members)I current release 3.2.5, well tested RTII HLA1.3 nearly complete, HLA1516 plannedI cmake build system, different tool chains possible (gcc, msc, icc)I HP CERTI, optimized for SMP multiprocessor machines
consI at present only C++ bindings; Java bindings planned
CERTI fulfills all requirements
10 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
11 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
12 / 29
CERTI Architecture
federates interfacing libRTI throughHLA interface specificationRTIA process interacts with federateprocess through UNIX-domainsockets (Windows TCP sockets)RTIG interacts with RTIA throughTCP/UDP socketsHP CERTI replaces socketcommunication through sharedmemory communication
B. Bréholée, P. Siron: CERTI: Evolutions of theONERA RTI Prototype. In Proceedings of the Fall2002 Simulation Interoperability Workshop 8-13
September 2002, Orlando, FL, USA.
13 / 29
CERTI Architecture
federates interfacing libRTI throughHLA interface specificationRTIA process interacts with federateprocess through UNIX-domainsockets (Windows TCP sockets)RTIG interacts with RTIA throughTCP/UDP socketsHP CERTI replaces socketcommunication through sharedmemory communication
B. Bréholée, P. Siron: CERTI: Evolutions of theONERA RTI Prototype. In Proceedings of the Fall2002 Simulation Interoperability Workshop 8-13
September 2002, Orlando, FL, USA.
13 / 29
CERTI Architecture
federates interfacing libRTI throughHLA interface specificationRTIA process interacts with federateprocess through UNIX-domainsockets (Windows TCP sockets)RTIG interacts with RTIA throughTCP/UDP socketsHP CERTI replaces socketcommunication through sharedmemory communication
B. Bréholée, P. Siron: CERTI: Evolutions of theONERA RTI Prototype. In Proceedings of the Fall2002 Simulation Interoperability Workshop 8-13
September 2002, Orlando, FL, USA.
13 / 29
CERTI Architecture
federates interfacing libRTI throughHLA interface specificationRTIA process interacts with federateprocess through UNIX-domainsockets (Windows TCP sockets)RTIG interacts with RTIA throughTCP/UDP socketsHP CERTI replaces socketcommunication through sharedmemory communication
B. Bréholée, P. Siron: CERTI: Evolutions of theONERA RTI Prototype. In Proceedings of the Fall2002 Simulation Interoperability Workshop 8-13
September 2002, Orlando, FL, USA.
13 / 29
Bindings to Procedural Language Environments
object oriented HLA interface⇐⇒ procedural Matlab, Fortranmapping not straightforward, general problems:
I bidirectional communicationI object instantiationI function overloadingI exception handling
data type conversionlinkage against libRTI
14 / 29
Bindings to Procedural Language Environments
object oriented HLA interface⇐⇒ procedural Matlab, Fortranmapping not straightforward, general problems:
I bidirectional communicationI object instantiationI function overloadingI exception handling
data type conversionlinkage against libRTI
14 / 29
Bindings to Procedural Language Environments
object oriented HLA interface⇐⇒ procedural Matlab, Fortranmapping not straightforward, general problems:
I bidirectional communicationI object instantiationI function overloadingI exception handling
data type conversionlinkage against libRTI
14 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
15 / 29
MatlabHLA-Toolbox
general information:I project developed by RG CEA at the University of WismarI started in 1998I homepage: http://www.mb.hs-wismar.de/cea/sw_projects.htmlI development: http://savannah.nongnu.org/projects/certi
features:I abbreviated RTI service designatorsI selectable exception handlingI default interactive federate servicesI use of vectorization, implicit data types→ simpler RTI interface
implementation status:I standard: HLA 1.3I Federation Management, Declaration Management, Object
Management, Time Management completeI Data Distribution Management, Ownership Management not yet
implemented
16 / 29
MatlabHLA-Toolbox
general information:I project developed by RG CEA at the University of WismarI started in 1998I homepage: http://www.mb.hs-wismar.de/cea/sw_projects.htmlI development: http://savannah.nongnu.org/projects/certi
features:I abbreviated RTI service designatorsI selectable exception handlingI default interactive federate servicesI use of vectorization, implicit data types→ simpler RTI interface
implementation status:I standard: HLA 1.3I Federation Management, Declaration Management, Object
Management, Time Management completeI Data Distribution Management, Ownership Management not yet
implemented
16 / 29
MatlabHLA-Toolbox
general information:I project developed by RG CEA at the University of WismarI started in 1998I homepage: http://www.mb.hs-wismar.de/cea/sw_projects.htmlI development: http://savannah.nongnu.org/projects/certi
features:I abbreviated RTI service designatorsI selectable exception handlingI default interactive federate servicesI use of vectorization, implicit data types→ simpler RTI interface
implementation status:I standard: HLA 1.3I Federation Management, Declaration Management, Object
Management, Time Management completeI Data Distribution Management, Ownership Management not yet
implemented
16 / 29
MatlabHLA-ToolboxBidirectional Communication
Matlab External (MEX) interfaceallows access to external librariesRTI Services
I Matlab federate calls RTI servicem-function
I m-function directly calls functionwithin C++-wrapper (m2RtiSrv)
I type conversion (m2c)I m2RtiSrv calls appropriate RTIamb
methodFederate Services
I libRTI calls implemented federateservices in C++-wrapper
I type conversion (c2m)I fedService m-file invoked by
mexCallMatlab()
17 / 29
MatlabHLA-ToolboxBidirectional Communication
Matlab External (MEX) interfaceallows access to external librariesRTI Services
I Matlab federate calls RTI servicem-function
I m-function directly calls functionwithin C++-wrapper (m2RtiSrv)
I type conversion (m2c)I m2RtiSrv calls appropriate RTIamb
methodFederate Services
I libRTI calls implemented federateservices in C++-wrapper
I type conversion (c2m)I fedService m-file invoked by
mexCallMatlab()
17 / 29
MatlabHLA-ToolboxBidirectional Communication
Matlab External (MEX) interfaceallows access to external librariesRTI Services
I Matlab federate calls RTI servicem-function
I m-function directly calls functionwithin C++-wrapper (m2RtiSrv)
I type conversion (m2c)I m2RtiSrv calls appropriate RTIamb
methodFederate Services
I libRTI calls implemented federateservices in C++-wrapper
I type conversion (c2m)I fedService m-file invoked by
mexCallMatlab()
17 / 29
MatlabHLA-ToolboxObject Instantiation
objects (RTIamb, fedAmb) staticallyinstantiated once in C++-wrapper(one module)plain procedural interface towardslibRTIaccidental/automatic moduleunloading has to be avoided→module locking
18 / 29
MatlabHLA-ToolboxObject Instantiation
objects (RTIamb, fedAmb) staticallyinstantiated once in C++-wrapper(one module)plain procedural interface towardslibRTIaccidental/automatic moduleunloading has to be avoided→module locking
18 / 29
MatlabHLA-ToolboxObject Instantiation
objects (RTIamb, fedAmb) staticallyinstantiated once in C++-wrapper(one module)plain procedural interface towardslibRTIaccidental/automatic moduleunloading has to be avoided→module locking
18 / 29
MatlabHLA-ToolboxFunction Overloading
RTI-interface makes extensive use ofoverloaded methodsMatlab does not support overloadingnativelyMATLAB/MEX allows analysis offunction signatures (number, types)
Matlab Examplefunction fedService(in1, in2, in3, in4)
if nargin==4...else...end
19 / 29
MatlabHLA-ToolboxFunction Overloading
RTI-interface makes extensive use ofoverloaded methodsMatlab does not support overloadingnativelyMATLAB/MEX allows analysis offunction signatures (number, types)
Matlab Examplefunction fedService(in1, in2, in3, in4)
if nargin==4...else...end
19 / 29
MatlabHLA-ToolboxFunction Overloading
RTI-interface makes extensive use ofoverloaded methodsMatlab does not support overloadingnativelyMATLAB/MEX allows analysis offunction signatures (number, types)
Matlab Examplefunction fedService(in1, in2, in3, in4)
if nargin==4...else...end
19 / 29
MatlabHLA-ToolboxFunction Overloading
RTI-interface makes extensive use ofoverloaded methodsMatlab does not support overloadingnativelyMATLAB/MEX allows analysis offunction signatures (number, types)
Matlab Examplefunction fedService(in1, in2, in3, in4)
if nargin==4...else...end
19 / 29
MatlabHLA-ToolboxException Handling
possible exception catched(C++-Wrapper) and returned toMatlabMatlabHLA m-files provide optionalerror return valuecomplex error handling in Matlabfederate possible
Matlab Example...rtiSrv(in1, in2)...err = rtiSrv(in1, in2)switch errcase ’RTIinternalError’...
20 / 29
MatlabHLA-ToolboxException Handling
possible exception catched(C++-Wrapper) and returned toMatlabMatlabHLA m-files provide optionalerror return valuecomplex error handling in Matlabfederate possible
Matlab Example...rtiSrv(in1, in2)...err = rtiSrv(in1, in2)switch errcase ’RTIinternalError’...
20 / 29
MatlabHLA-ToolboxException Handling
possible exception catched(C++-Wrapper) and returned toMatlabMatlabHLA m-files provide optionalerror return valuecomplex error handling in Matlabfederate possible
Matlab Example...rtiSrv(in1, in2)...err = rtiSrv(in1, in2)switch errcase ’RTIinternalError’...
20 / 29
MatlabHLA-ToolboxException Handling
possible exception catched(C++-Wrapper) and returned toMatlabMatlabHLA m-files provide optionalerror return valuecomplex error handling in Matlabfederate possible
Matlab Example...rtiSrv(in1, in2)...err = rtiSrv(in1, in2)switch errcase ’RTIinternalError’...
20 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
21 / 29
libF90HLA
general information:I project developed by RG CEA at the University of WismarI library for use with Fortran90, FORTRAN77 subset of Fortran90I MatlabHLA used as design patternI homepage: http://www.mb.hs-wismar.de/cea/sw_projects.htmlI development: http://savannah.nongnu.org/projects/certi
features:I abbreviated RTI service designatorsI selectable exception handlingI default federate servicesI support of gcc 3.x, gcc 4.x, icc 9.x, icc 10.x
implementation status:I standard: HLA 1.3I Federation Management completeI other management areas partial
22 / 29
libF90HLA
general information:I project developed by RG CEA at the University of WismarI library for use with Fortran90, FORTRAN77 subset of Fortran90I MatlabHLA used as design patternI homepage: http://www.mb.hs-wismar.de/cea/sw_projects.htmlI development: http://savannah.nongnu.org/projects/certi
features:I abbreviated RTI service designatorsI selectable exception handlingI default federate servicesI support of gcc 3.x, gcc 4.x, icc 9.x, icc 10.x
implementation status:I standard: HLA 1.3I Federation Management completeI other management areas partial
22 / 29
libF90HLA
general information:I project developed by RG CEA at the University of WismarI library for use with Fortran90, FORTRAN77 subset of Fortran90I MatlabHLA used as design patternI homepage: http://www.mb.hs-wismar.de/cea/sw_projects.htmlI development: http://savannah.nongnu.org/projects/certi
features:I abbreviated RTI service designatorsI selectable exception handlingI default federate servicesI support of gcc 3.x, gcc 4.x, icc 9.x, icc 10.x
implementation status:I standard: HLA 1.3I Federation Management completeI other management areas partial
22 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLALinkage against libRTI
linkage Fortran C++ not straightforwardI C++/Fortran compiler use non-standardized name mangling (ifort:
modulename_mp_fcnname_, gfortran: __modulename__fcnname)I data types, e.g. C row-major order, Fortran column major-orderI parameters only passed by reference
realizable byI C++ compiler: C style naming (extern "C")→ linkage Fortran CI preprocessor constants for compiler dependenciesI functions for type conversion
PROGRAM CALLC /* rtisrv as c++ function with C-style naming */! extern "C" {IMPLICIT NONE void rtisrv_(int *a);! }INTEGER :: a!CALL rtisrv(a) ---> void rtisrv_(int *a) {! RTItype a_rti = fortranInt2RTItype(*a);! rtiAmb.rtiSrv(a_rti);! }END PROGRAM CALLC
23 / 29
libF90HLABidirectional Communication
RTI ServicesI F90 federate invokes RTI services
by calling the rtiModSrv fcnI signature analysis and C fcn callI C++ type conversion, call rtiAmb
methodFederate Services
I libRTI calls implemented federateservices
I type conversion from C/C++ typesinto Fortran types
I appropriate Fortran90 federateservice implementation is called
24 / 29
libF90HLABidirectional Communication
RTI ServicesI F90 federate invokes RTI services
by calling the rtiModSrv fcnI signature analysis and C fcn callI C++ type conversion, call rtiAmb
methodFederate Services
I libRTI calls implemented federateservices
I type conversion from C/C++ typesinto Fortran types
I appropriate Fortran90 federateservice implementation is called
24 / 29
libF90HLAObject Instantiation
similar to MatlabHLA-ToolboxRTIamb, fedAmb staticallyinstantiated in libF90HLA (rtiOn)plain procedural interface towardslibRTI
25 / 29
libF90HLAFunction Overloading
F90 allows optional functionparametersintrinsic function present can testexistence of optional parameterstests performed in F90 module
rtiSrvMod.f90subroutine rtiSrv(in1, in2)!implicit none!integer, intent(in) :: in1integer, intent(in), optional :: in2...if (present(in2)) then
...end if...end subroutine rtiSrv
26 / 29
libF90HLAFunction Overloading
F90 allows optional functionparametersintrinsic function present can testexistence of optional parameterstests performed in F90 module
rtiSrvMod.f90subroutine rtiSrv(in1, in2)!implicit none!integer, intent(in) :: in1integer, intent(in), optional :: in2...if (present(in2)) then...
end if...end subroutine rtiSrv
26 / 29
libF90HLAException Handling
similar method to realize selectableexception handlingdefault: program terminationoptional error parameter allowsexception handling in F90 fed
rtiSrvMod.f90subroutine rtiSrv(err)...integer, intent(out), optional :: errinteger :: tmpErr = 0...call rtisrvwrap(tmpErr)if (present(err)) then
err = tmpErrelse
if (tmpErr.lt.0) thenwrite(*,*) "Error = ", tmpErrstop "Terminating"
end ifend if...
27 / 29
libF90HLAException Handling
similar method to realize selectableexception handlingdefault: program terminationoptional error parameter allowsexception handling in F90 fed
rtiSrvMod.f90subroutine rtiSrv(err)...integer, intent(out), optional :: errinteger :: tmpErr = 0...call rtisrvwrap(tmpErr)if (present(err)) then
err = tmpErrelse
if (tmpErr.lt.0) thenwrite(*,*) "Error = ", tmpErrstop "Terminating"
end ifend if...
27 / 29
Outline
1 Introduction
2 Non-Commercial RTIs
3 CERTI BindingsBasic AspectsBindings to MatlabBindings to Fortran
4 Summary and Outlook
28 / 29
Summary and Outlook
SummaryI at present two noteworthy open source RTIs: poRTIco, CERTI→ CERTI
I CERTI well tested RTI, remarkable development site at SavannahI introduction of two new open source projects: MatlabHLA,
libF90HLAI CERTI first RTI with native bindings to Matlab and Fortran
OutlookI completing work at libF90HLAI Simulink-Toolbox on basis of HLA-Toolbox, HLA integration into
other free SCEs (e.g. Octave)I finding bugs, applying patches and looking for help ...
29 / 29