diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..47098b0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + labels: + - "dependencies" + - "github-actions" \ No newline at end of file diff --git a/.github/workflows/Eval.yml b/.github/workflows/Eval.yml index a160936..dd0fecb 100644 --- a/.github/workflows/Eval.yml +++ b/.github/workflows/Eval.yml @@ -20,11 +20,11 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Set up Julia - name: "Set up Julia" - uses: julia-actions/setup-julia@v1 + uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} arch: ${{ matrix.julia-arch }} @@ -32,7 +32,7 @@ jobs: # Set up cache - name: "Set up cache" - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-artifacts with: diff --git a/.github/workflows/TestLTS.yml b/.github/workflows/TestLTS.yml index 33dc030..ffd9d00 100644 --- a/.github/workflows/TestLTS.yml +++ b/.github/workflows/TestLTS.yml @@ -26,18 +26,18 @@ jobs: steps: # Checks-out your repository - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Set up Julia - name: "Set up Julia" - uses: julia-actions/setup-julia@v1 + uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} arch: ${{ matrix.julia-arch }} # Set up cache - name: "Set up cache" - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-artifacts with: diff --git a/.github/workflows/TestLatest.yml b/.github/workflows/TestLatest.yml index 06da0c5..53a2bd1 100644 --- a/.github/workflows/TestLatest.yml +++ b/.github/workflows/TestLatest.yml @@ -26,18 +26,18 @@ jobs: steps: # Checks-out your repository - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Set up Julia - name: "Set up Julia" - uses: julia-actions/setup-julia@v1 + uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} arch: ${{ matrix.julia-arch }} # Set up cache - name: "Set up cache" - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: cache-artifacts with: diff --git a/src/FMI2/ext.jl b/src/FMI2/ext.jl index 957c9e4..9036f7b 100644 --- a/src/FMI2/ext.jl +++ b/src/FMI2/ext.jl @@ -107,7 +107,8 @@ function createFMU2( directories = [joinpath("binaries", "win64"), joinpath("binaries", "x86_64-windows")] else - directories = [joinpath("binaries", "win32"), joinpath("binaries","x86-windows")] + directories = + [joinpath("binaries", "win32"), joinpath("binaries", "x86-windows")] end osStr = "Windows" fmuExt = "dll" diff --git a/src/FMI2/md.jl b/src/FMI2/md.jl index 7afb2a8..0a4d955 100644 --- a/src/FMI2/md.jl +++ b/src/FMI2/md.jl @@ -437,7 +437,7 @@ end # ToDo: Comment function parseDerivatives(md::fmi2ModelDescription, nodes::EzXML.Node) @assert (nodes.name == "Derivatives") "Wrong element name." - + md.modelStructure.derivatives = [] for node in eachelement(nodes) if node.name == "Unknown" diff --git a/src/FMI2/prep.jl b/src/FMI2/prep.jl index ccfc7b0..7f239f1 100644 --- a/src/FMI2/prep.jl +++ b/src/FMI2/prep.jl @@ -189,7 +189,7 @@ function prepareSolveFMU( if instantiate || reset # autoInstantiated - if !setup + if !setup @debug "[AUTO] setup" fmi2SetupExperiment(c, t_start, t_stop; tolerance = tolerance) @@ -199,7 +199,7 @@ function prepareSolveFMU( handleEvents(c) end - + c.fmu.hasStateEvents = (c.fmu.modelDescription.numberOfEventIndicators > 0) c.fmu.hasTimeEvents = isTrue(c.eventInfo.nextEventTimeDefined) end diff --git a/src/FMI3/ext.jl b/src/FMI3/ext.jl index 9952df2..a9b5068 100644 --- a/src/FMI3/ext.jl +++ b/src/FMI3/ext.jl @@ -84,9 +84,11 @@ function createFMU3(fmuPath, fmuZipPath; type::Union{Symbol,Nothing} = nothing) if Sys.iswindows() if juliaArch == 64 - directories = [joinpath("binaries", "win64"), joinpath("binaries","x86_64-windows")] - else - directories = [joinpath("binaries", "win32"), joinpath("binaries","x86-windows")] + directories = + [joinpath("binaries", "win64"), joinpath("binaries", "x86_64-windows")] + else + directories = + [joinpath("binaries", "win32"), joinpath("binaries", "x86-windows")] end osStr = "Windows" fmuExt = "dll" diff --git a/src/FMI3/prep.jl b/src/FMI3/prep.jl index 801c78f..d916626 100644 --- a/src/FMI3/prep.jl +++ b/src/FMI3/prep.jl @@ -189,7 +189,7 @@ function prepareSolveFMU( if instantiate || reset # autoInstantiated @debug "[AUTO] setup" - if !setup + if !setup fmi3EnterInitializationMode(c, t_start, t_stop; tolerance = tolerance) fmi3ExitInitializationMode(c) end diff --git a/src/binary.jl b/src/binary.jl index 8f60623..99f460f 100644 --- a/src/binary.jl +++ b/src/binary.jl @@ -59,7 +59,7 @@ function loadFMU( unpackPath::Union{String,Nothing} = nothing, cleanup::Bool = true, type::Union{Symbol,Nothing} = nothing, - kwargs... + kwargs..., ) unzippedAbsPath, zipAbsPath = diff --git a/src/info.jl b/src/info.jl index c553040..c6cf7d4 100644 --- a/src/info.jl +++ b/src/info.jl @@ -11,7 +11,7 @@ function printValueReferences(fmu, vrs; max = 10) println("\t\t$(vr) $(valueReferenceToString(fmu, vr))") end else - half = floor(Integer, max/2) - 1 + half = floor(Integer, max / 2) - 1 for vr in vrs[1:half] println("\t\t$(vr) $(valueReferenceToString(fmu, vr))") end diff --git a/test/FMI2/getter_setter.jl b/test/FMI2/getter_setter.jl index 4ea28cd..ec30315 100644 --- a/test/FMI2/getter_setter.jl +++ b/test/FMI2/getter_setter.jl @@ -83,23 +83,23 @@ tmp = Random.randstring(8) rndString = [tmp, tmp] cacheReal = fmi2Real.([0.0, 0.0]) -cacheInteger = [fmi2Integer(0), fmi2Integer(0)] +cacheInteger = [fmi2Integer(0), fmi2Integer(0)] cacheBoolean = [fmi2Boolean(false), fmi2Boolean(false)] cacheString = [pointer(""), pointer("")] @test fmi2SetReal(comp, realValueReferences, rndReal) == 0 if Sys.WORD_SIZE == 64 - @test fmi2GetReal(comp, realValueReferences) == rndReal + @test fmi2GetReal(comp, realValueReferences) == rndReal else - @info "not testing fmi2GetReal for arrays on 32-bit systems" + @info "not testing fmi2GetReal for arrays on 32-bit systems" end fmi2GetReal!(comp, realValueReferences, cacheReal) @test cacheReal == rndReal @test fmi2SetReal(comp, realValueReferences, -rndReal) == 0 if Sys.WORD_SIZE == 64 - @test fmi2GetReal(comp, realValueReferences) == -rndReal + @test fmi2GetReal(comp, realValueReferences) == -rndReal else - @info "not testing fmi2GetReal for arrays on 32-bit systems" + @info "not testing fmi2GetReal for arrays on 32-bit systems" end fmi2GetReal!(comp, realValueReferences, cacheReal) @test cacheReal == -rndReal @@ -131,18 +131,23 @@ fmi2GetString!(comp, stringValueReferences, cacheString) # Testing input/output derivatives dirs = fmi2GetRealOutputDerivatives(comp, ["y_real"], ones(fmi2Integer, 1)) if Sys.WORD_SIZE == 64 - @test dirs == -Inf # at this point, derivative is undefined + @test dirs == -Inf # at this point, derivative is undefined else - @test dirs == 0.0 # on 32-bit systems, this seems to be 0.0 (might be just a Dymola bug) + @test dirs == 0.0 # on 32-bit systems, this seems to be 0.0 (might be just a Dymola bug) end -@test fmi2SetRealInputDerivatives(comp, ["u_real"], ones(fmi2Integer, 1), zeros(fmi2Real, 1)) == 0 +@test fmi2SetRealInputDerivatives( + comp, + ["u_real"], + ones(fmi2Integer, 1), + zeros(fmi2Real, 1), +) == 0 @test fmi2ExitInitializationMode(comp) == 0 if Sys.WORD_SIZE == 64 - @test fmi2DoStep(comp, fmi2Real(0.1)) == 0 + @test fmi2DoStep(comp, fmi2Real(0.1)) == 0 else - @info "not testing fmi2DoStep on 32-bit systems, because Dymola 32-Bit is probably broken" -end + @info "not testing fmi2DoStep on 32-bit systems, because Dymola 32-Bit is probably broken" +end dirs = fmi2GetRealOutputDerivatives(comp, ["y_real"], ones(fmi2Integer, 1)) @test dirs == 0.0 diff --git a/test/FMI2/model_description.jl b/test/FMI2/model_description.jl index 00f6a3a..4a08a02 100644 --- a/test/FMI2/model_description.jl +++ b/test/FMI2/model_description.jl @@ -67,10 +67,18 @@ info(myFMU) # check if there is an error thrown @test length(getDerivativeNames(myFMU.modelDescription)) == 2 @test length(getDerivativeNames(myFMU)) == 2 -@test getDerivativeNames(myFMU; mode=:first) == ["der(mass.s)", "mass.a_relfric"] +@test getDerivativeNames(myFMU; mode = :first) == ["der(mass.s)", "mass.a_relfric"] # @test getDerivativeNames(myFMU; mode=:flat) == ["der(mass.s)", "mass.a_relfric", "mass.a", "der(mass.v)"] -@test issetequal(getDerivativeNames(myFMU; mode=:flat) ,["der(mass.s)", "mass.a_relfric", "mass.a", "der(mass.v)"]) -@test all(issetequal.(getDerivativeNames(myFMU; mode=:group) ,[["der(mass.s)"], ["mass.a_relfric", "mass.a", "der(mass.v)"]])) +@test issetequal( + getDerivativeNames(myFMU; mode = :flat), + ["der(mass.s)", "mass.a_relfric", "mass.a", "der(mass.v)"], +) +@test all( + issetequal.( + getDerivativeNames(myFMU; mode = :group), + [["der(mass.s)"], ["mass.a_relfric", "mass.a", "der(mass.v)"]], + ), +) @test length(getNamesAndDescriptions(myFMU.modelDescription)) == 50 @test length(getNamesAndDescriptions(myFMU)) == 50 diff --git a/test/FMI3/getter_setter.jl b/test/FMI3/getter_setter.jl index 8f63190..e7cf44b 100644 --- a/test/FMI3/getter_setter.jl +++ b/test/FMI3/getter_setter.jl @@ -8,7 +8,7 @@ ############### myFMU = loadFMU("Feedthrough", "ModelicaReferenceFMUs", "0.0.30", "3.0") -inst = fmi3InstantiateCoSimulation!(myFMU; loggingOn=false) +inst = fmi3InstantiateCoSimulation!(myFMU; loggingOn = false) @test inst != 0 @test fmi3EnterInitializationMode(inst) == 0 diff --git a/test/FMI3/state.jl b/test/FMI3/state.jl index c7978ad..822b36a 100644 --- a/test/FMI3/state.jl +++ b/test/FMI3/state.jl @@ -10,7 +10,7 @@ import FMIImport.FMICore: fmi3FMUState myFMU = loadFMU("BouncingBall", "ModelicaReferenceFMUs", "0.0.30", "3.0") -inst = fmi3InstantiateCoSimulation!(myFMU; loggingOn=true) +inst = fmi3InstantiateCoSimulation!(myFMU; loggingOn = true) @test inst != 0 @test fmi3EnterInitializationMode(inst) == 0