Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed cross checks #208

Merged
merged 6 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>", "LM <[email protected]>", "JK <[email protected]>"]
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
Loading