Migrating Configuration Files.
Configuration files created for earlier versions of RPA 2.x are not compatible with the JSON format used in RPA 4. A command-line scripting utility script is provided to facilitate the migration of existing configuration files to the new JSON format.
Configuration files for both versions are stored as ASCI files using different formats.
RPA 2.x is using library libconfig v.1.4. The configuration file is stored in a custom format which looks liek a mix of JSON and properties.
<RPA-2>/examples/Aestus.cfg |
version = 1.2; name = "Aestus"; info = "Test case"; generalOptions : { multiphase = true; ions = true; flowSeparation = true; }; combustionChamberConditions : { pressure : { value = 11.0; unit = "bar"; }; }; nozzleFlow : { calculateNozzleFlow = true; nozzleInletConditions : { contractionAreaRatio = 2.3843; }; nozzleExitConditions : { areaRatio = 84.0; supersonic = true; }; nozzleStations = ( ); }; propellant : { components : { ratio : { value = 2.05; unit = "O/F"; }; oxidizer = ( { name = "N2O4(L)"; massFraction = 1.0; p : { value = 0.0; unit = "MPa"; }; } ); fuel = ( { name = "CH6N2(L)"; massFraction = 1.0; p : { value = 0.0; unit = "MPa"; }; } ); }; }; engineSize : { throatDiameter : { value = 136.0; unit = "mm"; }; chambersNo = 1; chamberGeometry : { length : { value = 0.31; unit = "m"; }; characteristicLength = false; contractionAngle = 35.0; R1_to_Rt_ratio = 0.8; Rn_to_Rt_ratio = 0.382; R2_to_R2max_ratio = 1.0; TOC = true; }; }; propelantFeedSystem : { };
RPA 4 is using Google Protocol Buffers. The configuration file is stored in a standard JSON format.
<RPA-4>/examples/Aestus.cfg |
{ "version":4, "application":"RPA", "engineDefinition":{ "name":"Aestus", "description":"Test case\nConverted from configuration file for RPA 2.x:\n/home/alex/workspace/RPA/distr/build/files/standard2/examples/Aestus.cfg", "chamberPressure":{ "value":11, "units":"bar" }, "bipropellantMixture":{ "oxidizer":[ { "name":"N2O4(L)", "massFraction":1 } ], "fuel":[ { "name":"CH6N2(L)", "massFraction":1 } ], "mixtureRatio":{ "value":2.05 } } }, "nozzleConditions":{ "nozzleInletConditions":{ "areaRatio":2.3843 }, "nozzleExitConditions":{ "areaRatio":84 }, "equilibriumFlow":{ "shifting":true }, "reactionEficiency":{ "estimateReactionEfficiency":true }, "nozzleEficiency":{ "estimateBellNozzleEfficicncy":true, "estimateOverexpansionPerformance":true }, "nozzleFlowEffcets":{ "multiphase":true, "ionization":true } }, "thrustChamberSize":{ "sizing":{ "numberOfChambers":1, "throatDiameter":{ "value":136 } }, "combustionChamberGeometry":{ "chamberLength":{ "value":{ "value":0.31, "units":"m" } }, "contractionAngle":35, "R1toRt":1 }, "nozzleGeometry":{ "ticContour":{ }, "RntoRt":0.382 } } }
To convert configuration file from old format to new one, RPA 4 provides script located in the directory with exmples for scriptinng utility: <RPA-4>/examples/scripting/migrate_cfg.js
.
The script accepts two parameters:
- Input file path: Path to the old configuration file
- Output file path: Path where the new JSON configuration file will be saved
To execute the script, open the command line console (Windows) or terminal (Linux), change to the RPA 4 installation directory, and execute the following command:
> RPA-Script.exe --input ./examples/scripting/migrate_cfg.js old_config.cfg new_config.cfg
Example for converting configuration file <RPA-2>/examples/Aestus.cfg
to <RPA-4>/examples/Aestus-converted.cfg
:
> RPA-Script.exe --input examples\scripting\migrate_cfg.js C:\RPA-2\examples\Aestus.cfg C:\RPA-4\examples\Aestus-converted.cfg Starting in scripting batch mode. Migrating file 'C:\RPA-2\examples\Aestus.cfg' to 'C:\RPA-4\examples\Aestus-converted.cfg'... Provided configuration file succesfully processed. Created file 'C:\RPA-4\examples\Aestus-converted.cfg' Done!