Portico is an open source, cross-platform, fully supported HLA RTI implementation. Designed with modularity and flexibility in mind, Portico is a production-grade RTI for the Simulation and Training Community, so come say hi!
// Create the Federation. Will raise an error if already created
// but you can ignore it.
// We must pass a FOM at this time. I will use the Standard MIM.
private void createFederation( String federationName ) throws Exception {
log( "Creating Federation " + federationName );
try {
URL[] modules = new URL[]{
(new File("foms/HLAstandardMIM.xml")).toURI().toURL(),
(new File("foms/unit.xml")).toURI().toURL()
};
rtiamb.createFederationExecution( federationName, modules );
log( "Created Federation. HLA Version " + rtiamb.getHLAversion() );
} catch( FederationExecutionAlreadyExists exists ) {
log( "Didn't create federation, it already existed." );
} catch( MalformedURLException urle ) {
log( "Exception loading one of the FOM modules from disk: " + urle.getMessage() );
urle.printStackTrace();
return;
}
}
// Join our Federate to the Federation.
// We must pass the SOM. Here we will use our SOM file.
// I recommend you to read this file.
private void joinFederation( String federationName, String federateName ) throws Exception {
URL[] joinModules = new URL[]{
(new File("foms/tank.xml")).toURI().toURL()
};
rtiamb.joinFederationExecution( federateName, "TankFederateType", federationName, joinModules );
log( "Joined Federation as " + federateName );
}
Error: hla.rti1516e.exceptions.NameNotFound: HLAobjectRoot.BasicUnit.Tank where Tank is defined in foms/tank.xml.
This IS WORKING:
// Create the Federation. Will raise an error if already created
// but you can ignore it.
// We must pass a FOM at this time. I will use the Standard MIM.
private void createFederation( String federationName ) throws Exception {
log( "Creating Federation " + federationName );
try {
URL[] modules = new URL[]{
(new File("foms/HLAstandardMIM.xml")).toURI().toURL(),
(new File("foms/unit.xml")).toURI().toURL(),
(new File("foms/tank.xml")).toURI().toURL()
};
rtiamb.createFederationExecution( federationName, modules );
log( "Created Federation. HLA Version " + rtiamb.getHLAversion() );
} catch( FederationExecutionAlreadyExists exists ) {
log( "Didn't create federation, it already existed." );
} catch( MalformedURLException urle ) {
log( "Exception loading one of the FOM modules from disk: " + urle.getMessage() );
urle.printStackTrace();
return;
}
}
// Join our Federate to the Federation.
// We must pass the SOM. Here we will use our SOM file.
// I recommend you to read this file.
private void joinFederation( String federationName, String federateName ) throws Exception {
rtiamb.joinFederationExecution( federateName, "TankFederateType", federationName);
log( "Joined Federation as " + federateName );
}
Note all XML files passed at same time in Federation creation. The SOM and FOM are ok because the second option works fine.
I'm running the RTI in one machine and the federate in another one.
19:00:44,584 INFO portico.rti:
19:00:44,588 INFO portico.rti: ##########################################################
19:00:44,588 INFO portico.rti: # Portico Open RTI #
19:00:44,588 INFO portico.rti: # Welcome to Portico for the HLA! #
19:00:44,589 INFO portico.rti: # #
19:00:44,589 INFO portico.rti: # Portico is distributed by under the terms of #
19:00:44,589 INFO portico.rti: # the Apache Software License (Version 2). For a #
19:00:44,589 INFO portico.rti: # copy of the license, see the LICENSE file included #
19:00:44,589 INFO portico.rti: # in your Portico installation directory. #
19:00:44,589 INFO portico.rti: # #
19:00:44,589 INFO portico.rti: ##########################################################
19:00:44,590 INFO portico.rti: # #
19:00:44,590 INFO portico.rti: # System Information #
19:00:44,590 INFO portico.rti: # #
19:00:44,591 INFO portico.rti: # Portico Version: 2.2.0 (build 0) #
19:00:44,591 INFO portico.rti: # Platform: amd64 #
19:00:44,592 INFO portico.rti: # CPUs: 8 #
19:00:44,592 INFO portico.rti: # Operating System: Linux #
19:00:44,592 INFO portico.rti: # 3.10.0-957.1.3.el7.x86_64 #
19:00:44,592 INFO portico.rti: # Java Version: 1.8.0_222 #
19:00:44,592 INFO portico.rti: # Java Vendor: Private Build #
19:00:44,592 INFO portico.rti: # #
19:00:44,595 INFO portico.rti: # Startup Time: Nov 21, 2019 - 7:00:44 PM #
19:00:44,595 INFO portico.rti: # RID File: ./RTI.rid #
19:00:44,595 INFO portico.rti: # Log Level: INFO #
19:00:44,596 INFO portico.rti: # #
19:00:44,596 INFO portico.rti: ##########################################################
This is not working:
Error:
hla.rti1516e.exceptions.NameNotFound: HLAobjectRoot.BasicUnit.Tank
whereTank
is defined infoms/tank.xml
.This IS WORKING:
Note all XML files passed at same time in Federation creation. The SOM and FOM are ok because the second option works fine.
I'm running the RTI in one machine and the federate in another one.