Skip to content

Commit

Permalink
fixed cross checks (#208)
Browse files Browse the repository at this point in the history
* fixed cross chekcs

* fixed input fct

* fixed LTS tests

* fixed LTS, version inc

* fixed version test in performance test

* fixed version tag
  • Loading branch information
ThummeTo authored Nov 21, 2023
1 parent 3bedc81 commit 9e96d68
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FMI"
uuid = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
authors = ["TT <tobias.thummerer@informatik.uni-augsburg.de>", "LM <lars.mikelsons@informatik.uni-augsburg.de>", "JK <josef.kircher@student.uni-augsburg.de>"]
version = "0.13.0"
version = "0.13.1"

[deps]
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Expand All @@ -14,12 +14,12 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
ThreadPools = "b189fb0b-2eb5-4ed4-bc0c-d34c51242431"

[compat]
DifferentialEquations = "7.10.0 - 7.11.0"
DifferentialEquations = "7.7.0 - 7.11"
Downloads = "1"
FMIExport = "0.3.0"
FMIImport = "0.16.0"
LinearAlgebra = "1"
ProgressMeter = "1.7.0 - 1.9.0"
ProgressMeter = "1.7.0 - 1.9"
Requires = "1.3.0"
ThreadPools = "2.1.1"
julia = "1.6"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[![Run PkgEval](https://github.com/ThummeTo/FMI.jl/actions/workflows/Eval.yml/badge.svg)](https://github.com/ThummeTo/FMI.jl/actions/workflows/Eval.yml)
[![Coverage](https://codecov.io/gh/ThummeTo/FMI.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ThummeTo/FMI.jl)
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![FMI Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/FMI)](https://pkgs.genieframework.com?packages=FMI).
[![FMI Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/FMI)](https://pkgs.genieframework.com?packages=FMI)


## How can I use FMI.jl?
Expand Down Expand Up @@ -89,7 +89,7 @@ To keep dependencies nice and clean, the original package [*FMI.jl*](https://git
- [*FMICore.jl*](https://github.com/ThummeTo/FMICore.jl): C-code wrapper for the FMI-standard
- [*FMISensitivity.jl*](https://github.com/ThummeTo/FMISensitivity.jl): Static and dynamic sensitivities over FMUs
- [*FMIBuild.jl*](https://github.com/ThummeTo/FMIBuild.jl): Compiler/Compilation dependencies for FMIExport.jl
- [*FMIFlux.jl*](https://github.com/ThummeTo/FMIFlux.jl): Machine Learning with FMUs (differentiation over FMUs)
- [*FMIFlux.jl*](https://github.com/ThummeTo/FMIFlux.jl): Machine Learning with FMUs
- [*FMIZoo.jl*](https://github.com/ThummeTo/FMIZoo.jl): A collection of testing and example FMUs

## What Platforms are supported?
Expand Down
1 change: 1 addition & 0 deletions cross_checks/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
FMI = "14a09403-18e3-468f-ad8a-74f8dda2d9ac"
Expand Down
13 changes: 9 additions & 4 deletions cross_checks/cross_check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ using DelimitedFiles
using Tables
using Statistics

import Base64

include("cross_check_config.jl")
include("cross_check_lib.jl")

# Main Array that holds all information about the excecuted cross checks and results
crossChecks = []

getInputValues = t -> t
getInputValues = function(t, u)
return nothing
end

function parse_commandline()
s = ArgParseSettings()
Expand Down Expand Up @@ -89,11 +93,12 @@ function runCrossCheckFmu(checkPath::String, resultPath::String, check::FmuCross
if isfile(joinpath(checkPath, "$(check.fmuCheck)_in.csv"))
inputValues = CSV.File(joinpath(checkPath, "$(check.fmuCheck)_in.csv")) |> Tables.rowtable
hasInputValues = true
getInputValues = function(t)
getInputValues = function(t, u)
for (valIndex, val) in enumerate(inputValues)
if val.time >= t
a = collect(inputValues[valIndex])[2:end]
return a
u[:] = inputValues[valIndex][2:end]
# a = collect(inputValues[valIndex])[2:end]
# return a
break;
end
end
Expand Down
6 changes: 6 additions & 0 deletions test/FMI2/sim_ME.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ dataLength = length(solution.states.u)
@test solution.values.t[1] == t_start
@test solution.values.t[end] == t_stop

# value/state getters
@test solution.states.t == fmi2GetSolutionTime(solution)
@test collect(s[1] for s in solution.values.saveval) == fmi2GetSolutionValue(solution, 1; isIndex=true)
@test collect(u[1] for u in solution.states.u ) == fmi2GetSolutionState(solution, 1; isIndex=true)
@test isapprox(fmi2GetSolutionState(solution, 2; isIndex=true), fmi2GetSolutionDerivative(solution, 1; isIndex=true); atol=1e-4)

# reference values from Simulation in Dymola2020x (Dassl)
@test sum(abs.(solution.states.u[1] - [0.5, 0.0])) < 1e-4
@test sum(abs.(solution.states.u[end] - [1.05444, 1e-10])) < 0.01
Expand Down
10 changes: 7 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ function runtestsFMI2(exportingTool)
end
end

@info "Performance (performance.jl)"
@testset "Performance" begin
include("FMI2/performance.jl")
if VERSION >= v"1.9.0"
@info "Performance (performance.jl)"
@testset "Performance" begin
include("FMI2/performance.jl")
end
else
@info "Julia Version $(VERSION), skipping performance tests ..."
end

@info "Plotting (plots.jl)"
Expand Down

2 comments on commit 9e96d68

@ThummeTo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/95711

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.13.1 -m "<description of version>" 9e96d6850b8a15ddd605e66da1dcde0cddc5e0cb
git push origin v0.13.1

Please sign in to comment.