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

Mini bug fix in sim.jl #207

Merged
merged 1 commit into from
Nov 15, 2023
Merged
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
14 changes: 7 additions & 7 deletions src/FMI2/sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import LinearAlgebra: eigvals
import ProgressMeter
import ThreadPools

import FMIImport.FMICore: EMPTY_fmi2Real, EMPTY_fmi2ValueReference
using FMIImport.FMICore: EMPTY_fmi2Real, EMPTY_fmi2ValueReference, ERR_MSG_CONT_TIME_MODE

############ Model-Exchange ############

Expand Down Expand Up @@ -50,7 +50,7 @@ end
# Returns the event indicators for an FMU.
function condition(c::FMU2Component, out, x, t, integrator, inputFunction)

@assert c.state == fmi2ComponentStateContinuousTimeMode "condition(...):\n" * FMICore.ERR_MSG_CONT_TIME_MODE
@assert c.state == fmi2ComponentStateContinuousTimeMode "condition(...):\n" * ERR_MSG_CONT_TIME_MODE

indicators!(c, out, x, t, inputFunction)

Expand All @@ -61,7 +61,7 @@ end
# Sets a new state for the solver from the FMU (if needed).
function affectFMU!(c::FMU2Component, integrator, idx, inputFunction, solution::FMU2Solution)

@assert c.state == fmi2ComponentStateContinuousTimeMode "affectFMU!(...):\n" * FMICore.ERR_MSG_CONT_TIME_MODE
@assert c.state == fmi2ComponentStateContinuousTimeMode "affectFMU!(...):\n" * ERR_MSG_CONT_TIME_MODE

c.solution.evals_affect += 1

Expand Down Expand Up @@ -105,7 +105,7 @@ end
# This callback is called every time the integrator finishes an (accpeted) integration step.
function stepCompleted(c::FMU2Component, x, t, integrator, inputFunction, progressMeter, tStart, tStop, solution::FMU2Solution)

@assert c.state == fmi2ComponentStateContinuousTimeMode "stepCompleted(...):\n" * FMICore.ERR_MSG_CONT_TIME_MODE
@assert c.state == fmi2ComponentStateContinuousTimeMode "stepCompleted(...):\n" * ERR_MSG_CONT_TIME_MODE

c.solution.evals_stepcompleted += 1

Expand Down Expand Up @@ -137,7 +137,7 @@ end
# save FMU values
function saveValues(c::FMU2Component, recordValues, x, t, integrator, inputFunction)

@assert c.state == fmi2ComponentStateContinuousTimeMode "saveValues(...):\n" * FMICore.ERR_MSG_CONT_TIME_MODE
@assert c.state == fmi2ComponentStateContinuousTimeMode "saveValues(...):\n" * ERR_MSG_CONT_TIME_MODE

c.solution.evals_savevalues += 1

Expand All @@ -149,7 +149,7 @@ end

function saveEventIndicators(c::FMU2Component, recordEventIndicators, x, t, integrator, inputFunction)

@assert c.state == fmi2ComponentStateContinuousTimeMode "saveEventIndicators(...):\n" * FMICore.ERR_MSG_CONT_TIME_MODE
@assert c.state == fmi2ComponentStateContinuousTimeMode "saveEventIndicators(...):\n" * ERR_MSG_CONT_TIME_MODE

c.solution.evals_saveeventindicators += 1

Expand All @@ -162,7 +162,7 @@ end

function saveEigenvalues(c::FMU2Component, x, t, integrator, inputFunction)

@assert c.state == fmi2ComponentStateContinuousTimeMode "saveEigenvalues(...):\n" * FMICore.ERR_MSG_CONT_TIME_MODE
@assert c.state == fmi2ComponentStateContinuousTimeMode "saveEigenvalues(...):\n" * ERR_MSG_CONT_TIME_MODE

c.solution.evals_saveeigenvalues += 1

Expand Down
Loading