Skip to content

Commit

Permalink
V0.11.3 (ThummeTo#167)
Browse files Browse the repository at this point in the history
* Update Project.toml

* Update sim.jl

typo

* Update sim_CS.jl

corrected broken test

* Update sim_CS.jl

* Update sim_CS.jl

* Update sim_CS.jl
  • Loading branch information
ThummeTo authored Feb 7, 2023
1 parent 9055475 commit 7d3b6d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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.11.2"
version = "0.11.3"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
2 changes: 1 addition & 1 deletion src/FMI2/sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ function fmi2SimulateCS(fmu::FMU2, c::Union{FMU2Component, Nothing}=nothing, tsp
if hasmethod(inputFunction, Tuple{fmi2Real})
_inputFunction = (c, t) -> inputFunction(t)
else
_inputFunction = inputFunctiont
_inputFunction = inputFunction
end
@assert hasmethod(_inputFunction, Tuple{FMU2Component, fmi2Real}) "The given input function does not fit the needed input function pattern for CS-FMUs, which are: \n- `inputFunction(t::fmi2Real)`\n- `inputFunction(comp::FMU2Component, t::fmi2Real)`"
end
Expand Down
12 changes: 4 additions & 8 deletions test/FMI2/sim_CS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ function extForce_t(t)
[sin(t)]
end

function extForce_cxt(c::FMU2Component, x::Union{AbstractArray{fmi2Real}, Nothing}, t::fmi2Real)
x1 = 0.0
if x != nothing
x1 = x[1]
end
[sin(t) * x1]
function extForce_ct(c::Union{FMU2Component, Nothing}, t::fmi2Real)
[sin(t)]
end

myFMU = fmiLoad("SpringPendulumExtForce1D", ENV["EXPORTINGTOOL"], ENV["EXPORTINGVERSION"])
Expand All @@ -79,10 +75,10 @@ elseif envFMUSTRUCT == "FMUCOMPONENT"
end
@assert fmuStruct !== nothing "Unknown fmuStruct, environment variable `FMUSTRUCT` = `$envFMUSTRUCT`"

for inpfct in [extForce_cxt, extForce_t]
for inpfct in [extForce_ct, extForce_t]
global solution

solution = fmiSimulateCS(fmuStruct, (t_start, t_stop); dt=1e-2, recordValues=["mass.s", "mass.v"], inputValueReferences=["extForce"], inputFunction=extForce_t)
solution = fmiSimulateCS(fmuStruct, (t_start, t_stop); dt=1e-2, recordValues=["mass.s", "mass.v"], inputValueReferences=["extForce"], inputFunction=inpfct)
@test solution.success
@test length(solution.values.saveval) > 0
@test length(solution.values.t) > 0
Expand Down

0 comments on commit 7d3b6d2

Please sign in to comment.