Skip to content

Commit 91523a7

Browse files
committed
further adjustments
1 parent 24ee1e5 commit 91523a7

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

examples/src/growing_horizon_ME.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,8 @@
641641
"outputs": [],
642642
"source": [
643643
"# train\n",
644+
"paramsNet = Flux.params(neuralFMU)\n",
645+
"\n",
644646
"optim = Adam()\n",
645647
"FMIFlux.train!(lossSum, neuralFMU, Iterators.repeated((), 1000), optim; cb=()->callb(paramsNet)) "
646648
]

examples/src/juliacon_2023.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,13 @@
465465
" gates, # compute resulting dx from ANN + FMU\n",
466466
" dx -> cacheRetrieve(1:4, dx)) # stack together: dx[1,2,3,4] from cache + dx[5,6] from gates\n",
467467
"\n",
468+
" solver = Tsit5()\n",
469+
" \n",
468470
" # new NeuralFMU \n",
469471
" neuralFMU = ME_NeuralFMU(f, # the FMU used in the NeuralFMU \n",
470472
" model, # the model we specified above \n",
471473
" (tStart, tStop), # a default start ad stop time for solving the NeuralFMU\n",
474+
" solver;\n",
472475
" saveat=tSave) # the time points to save the solution at\n",
473476
" neuralFMU.modifiedState = false # speed optimization (NeuralFMU state equals FMU state)\n",
474477
" \n",

examples/src/juliacon_2023_helpers.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import FMIFlux: roundToLength
88
import FMIZoo: movavg
99

1010
import FMI: FMU2Solution
11+
import FMI.DifferentialEquations: Tsit5
1112
import FMIZoo: VLDM, VLDM_Data
1213

1314
function fmiSingleInstanceMode(fmu::FMU2, mode::Bool)

examples/src/mdpi_2022.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"using FMIFlux.Flux # Machine Learning in Julia\n",
109109
"\n",
110110
"import FMI.DifferentialEquations: Tsit5 # import the Tsit5-solver\n",
111+
"import FMI: FMU2Solution\n",
111112
"using JLD2 # data format for saving/loading parameters\n",
112113
"\n",
113114
"# plotting\n",

src/neural.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,10 @@ function (nfmu::ME_NeuralFMU)(x_start::Union{Array{<:Real}, Nothing} = nfmu.x0,
12871287
prob = ODEProblem{true}(ff, nfmu.x0, nfmu.tspan, p)
12881288

12891289
if isnothing(sensealg)
1290-
if isimplicit(solver)
1290+
if !isnothing(solver)
1291+
@assert false "currently no solver specified!"
1292+
1293+
elseif isimplicit(solver)
12911294
@assert !(alg_autodiff(solver) isa AutoForwardDiff) "Implicit solver using `autodiff=true` detected for NeuralFMU.\nThis is currently not supported, please use `autodiff=false` as solver keyword.\nExample: `Rosenbrock23(autodiff=false)` instead of `Rosenbrock23()`."
12921295

12931296
logWarning(nfmu.fmu, "Implicit solver detected for NeuralFMU.\nContinuous adjoint method is applied, which requires solving backward in time.\nThis might be not supported by every FMU.", 1)

0 commit comments

Comments
 (0)