Main Data Generation Routine

To perform all needed steps for data generation the following functions have to be executed:

  1. profiling
  2. generateFMU
  3. addEqInterface2FMU
  4. generateTrainingData

These functionalities are bundled in main.

Functions

NonLinearSystemNeuralNetworkFMU.mainFunction
main(modelName,
     moFiles;
     options=OMOptions(workingDir=joinpath(pwd(), modelName)),
     dataGenOptions=DataGenOptions(method = RandomMethod(), n=1000, nBatches=Threads.nthreads()),
     reuseArtifacts=false)

Main routine to generate training data from Modelica file(s). Generate BSON artifacts and FMUs for each step. Artifacts can be re-used when restarting main routine to skip already performed stepps.

Will perform profiling, min-max value compilation, FMU generation and data generation for all non-linear equation systems of modelName.

Arguments

  • modelName::String: Name of Modelica model to simulate.
  • moFiles::Array{String}: Path to .mo file(s).

Keywords

  • omOptions::OMOptions: Settings for OpenModelcia compiler.
  • dataGenOptions::DataGenOptions Settings for data generation.
  • reuseArtifacts=false: Use artifacts to skip already performed steps if true.

Returns

  • csvFiles::Array{String}: Array of generate CSV files with training data.
  • fmu::String: Path to unmodified 2.0 ME FMU.
  • profilingInfo::Array{ProfilingInfo}: Array of profiling information for each non-linear equation system.

See also profiling, minMaxValuesReSim, generateFMU, addEqInterface2FMU, generateTrainingData.

source

Example

julia> using NonLinearSystemNeuralNetworkFMU
julia> modelName = "simpleLoop";
julia> moFiles = [joinpath("test","simpleLoop.mo")];
julia> omOptions = OMOptions(workingDir="tempDir")OMOptions("/usr/bin/omc", "tempDir", "csv", false, " --preOptModules-=wrapFunctionCalls --postOptModules-=wrapFunctionCalls", "")
julia> dataGenOptions = DataGenOptions(method=NonLinearSystemNeuralNetworkFMU.RandomMethod(), n=10, nBatches=2)DataGenOptions(RandomMethod(), 10, 2, 1, false, true)
julia> (csvFiles, fmu, profilingInfo) = main(modelName, moFiles; omOptions=omOptions, dataGenOptions=dataGenOptions, reuseArtifacts=false)[ Info: Profile simpleLoop [ Info: Slowest eq 14: ncall: 2512, time: 0.000467616, maxTime: 1.5793e-5, fraction without overhead: 0.7878623478370752, fraction with overhead: 0.145134468256801 [ Info: Generate default FMU [ Info: Generate extended FMU [ Info: Compilation log file: tempDir/temp-extendfmu/simpleLoop.interface_compile.log ┌ Warning: Environment variable ORT_DIR not set. └ @ NonLinearSystemNeuralNetworkFMU ~/work/NonLinearSystemNeuralNetworkFMU.jl/NonLinearSystemNeuralNetworkFMU.jl/src/genFMUs.jl:275 [ Info: Generate training data [ Info: Starting data generation for eq 14 on 2 batches with 1 threads. [ Info: Writing CSV file (["/home/runner/work/NonLinearSystemNeuralNetworkFMU.jl/NonLinearSystemNeuralNetworkFMU.jl/tempDir/data/eq_14.csv"], "tempDir/simpleLoop.fmu", ProfilingInfo[ProfilingInfo(EqInfo(14, 2512, 0.000467616, 1.5793e-5, 0.145134468256801), ["y"], [11], ["s", "r"], String[], MinMaxBoundaryValues{Float64}([0.0, 0.95], [1.4087228258248679, 3.15]))])