diff --git a/src/FMI2/additional.jl b/src/FMI2/additional.jl index f77c7f4d..d6be6c2c 100644 --- a/src/FMI2/additional.jl +++ b/src/FMI2/additional.jl @@ -17,8 +17,11 @@ using FMIImport: fmi2CallbackFunctions, fmi2Component import FMIImport: fmi2VariableNamingConventionFlat, fmi2VariableNamingConventionStructured """ -Returns how a variable depends on another variable based on the model description. + fmi2VariableDependsOnVariable(fmu::FMU2, vr1::fmi2ValueReference, vr2::fmi2ValueReference) + +Return the dependence of the variable described by `vr1` on another variable described by `vr2` based on the model description of the `fmu`. +See also [`fmi2GetDependencies`](@ref). """ function fmi2VariableDependsOnVariable(fmu::FMU2, vr1::fmi2ValueReference, vr2::fmi2ValueReference) i1 = fmu.modelDescription.valueReferenceIndicies[vr1] @@ -27,23 +30,16 @@ function fmi2VariableDependsOnVariable(fmu::FMU2, vr1::fmi2ValueReference, vr2:: end """ - fmi2GetDependencies(fmu::FMU2) -Building dependency matrix `dim x dim` for fast look-ups on variable dependencies (`dim` is number of states). - -# Arguments -- `fmu::FMU2`: Mutable Struct representing a FMU. - -# Retruns -- `fmu.dependencies::Matrix{Union{fmi2DependencyKind, Nothing}}`: Returns the FMU's dependency-matrix for fast look-ups on dependencies between value references. Entries are from type fmi2DependencyKind. +Build dependency `Matrix{Union{fmi2DependencyKind, Nothing}}` of dimension `n x n` for fast look-ups on dependencies between value references (`n` is number of states of the `fmu`). # Source - FMISpec2.0.2 Link: [https://fmi-standard.org/](https://fmi-standard.org/) - FMISpec2.0.2[p.22]: 2.1.4 Inquire Platform and Version Number of Header Files - FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions -See also [`fmi2GetDependencies`](@ref). +See also [`fmi2PrintDependencies`](@ref), [`fmi2VariableDependsOnVariable`](@ref). """ function fmi2GetDependencies(fmu::FMU2) if !isdefined(fmu, :dependencies) @@ -85,6 +81,13 @@ function fmi2GetDependencies(fmu::FMU2) fmu.dependencies end +""" + fmi2PrintDependencies(fmu::FMU2) + +Print the dependency matrix for `fmu` as returned by [`fmi2GetDependencies`](@ref). + +See also [`fmi2GetDependencies`](@ref). +""" function fmi2PrintDependencies(fmu::FMU2) dep = fmi2GetDependencies(fmu) ni, nj = size(dep) @@ -99,16 +102,9 @@ function fmi2PrintDependencies(fmu::FMU2) end """ - fmi2Info(fmu::FMU2) -Prints FMU related information. - -# Arguments -- `fmu::FMU2`: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard. - -# Returns -- Prints FMU related information. +Print information about the `fmu`. # Source - FMISpec2.0.2 Link: [https://fmi-standard.org/](https://fmi-standard.org/) diff --git a/src/FMI2/extensions/Plots.jl b/src/FMI2/extensions/Plots.jl index dc361e24..02cc6c0a 100644 --- a/src/FMI2/extensions/Plots.jl +++ b/src/FMI2/extensions/Plots.jl @@ -7,40 +7,17 @@ using FMIImport: FMU2Solution import FMIImport.ForwardDiff """ - - fmiPlot(solution::FMU2Solution; states::Union{Bool, Nothing}=nothing, - values::Union{Bool, Nothing}=nothing, - stateEvents::Union{Bool, Nothing}=nothing, - timeEvents::Union{Bool, Nothing}=nothing, - stateIndices=nothing, - valueIndices=nothing, - maxLabelLength=64, - plotkwargs...) - -Plots data from a ME-FMU. - -Optional `t_in_solution` controls if the first state in the solution is interpreted as t(ime). - -# Arguments -- `solution::FMU2Solution`: Struct contains information about the solution `value`, `success`, `state` and `events` of a specific FMU. - -# Keywords -- `states::Union{Bool, Nothing}`: controls if states should be ploted (default = nothing) -- `values::Union{Bool, Nothing}`: controls if values should be ploted (default = nothing) -- `timeEvents::Union{Bool, Nothing}=nothing`: controls if timeEvents should be ploted (default = noting ) -- `stateIndices=nothing`: controls the number of ploted states -- `valueIndices=nothing`: controls the number of ploted values -- `maxLabelLength=64`: controls the maximum length for legend labels (too long labels are cut from front) - -# Returns -- `fig `: Returns a figure containing the plotted data from a ME-FMU. - +function no longer here... (hopefully) """ function fmiPlot(solution::FMU2Solution; kwargs...) fig = Plots.plot(; xlabel="t [s]") fmiPlot!(fig, solution; kwargs...) return fig end + +""" +function no longer here... (hopefully) +""" function fmiPlot!(fig, solution::FMU2Solution; states::Union{Bool, Nothing}=nothing, values::Union{Bool, Nothing}=nothing, @@ -196,9 +173,7 @@ function fmiPlot!(fig, solution::FMU2Solution; end """ -Extended the original plot-command by plotting FMUs. - -For further information seek `?fmiPlot`. +function no longer here... (hopefully) """ function Plots.plot(solution::FMU2Solution, args...; kwargs...) fmiPlot(solution, args...; kwargs...) diff --git a/src/FMI3/additional.jl b/src/FMI3/additional.jl index 625d2407..dce30415 100644 --- a/src/FMI3/additional.jl +++ b/src/FMI3/additional.jl @@ -16,8 +16,12 @@ using FMIImport: fmi3DependencyKindDependent, fmi3DependencyKindFixed using FMIImport: fmi3CallbackLogger, fmi3CallbackIntermediateUpdate, fmi3CallbackClockUpdate, fmi3Instance import FMIImport: fmi3VariableNamingConventionFlat, fmi3VariableNamingConventionStructured -""" -Returns how a variable depends on another variable based on the model description. +""" + fmi3VariableDependsOnVariable(fmu::FMU3, vr1::fmi3ValueReference, vr2::fmi3ValueReference) + +Return the dependence of the variable described by `vr1` on another variable described by `vr2` based on the model description of the `fmu`. + +See also [`fmi3GetDependencies`](@ref). """ function fmi3VariableDependsOnVariable(fmu::FMU3, vr1::fmi3ValueReference, vr2::fmi3ValueReference) i1 = fmu.modelDescription.valueReferenceIndicies[vr1] @@ -26,9 +30,11 @@ function fmi3VariableDependsOnVariable(fmu::FMU3, vr1::fmi3ValueReference, vr2:: end """ -Returns the FMU's dependency-matrix for fast look-ups on dependencies between value references. + fmi3GetDependencies(fmu::FMU3) -Entries are from type fmi3DependencyKind. +Build dependency `Matrix{Union{fmi3DependencyKind, Nothing}}` of dimension `n x n` for fast look-ups on dependencies between value references (`n` is number of states of the `fmu`). + +See also [`fmi3PrintDependencies`](@ref), [`fmi3VariableDependsOnVariable`](@ref). """ function fmi3GetDependencies(fmu::FMU3) if !isdefined(fmu, :dependencies) @@ -70,7 +76,14 @@ function fmi3GetDependencies(fmu::FMU3) fmu.dependencies end -function fmi3PrintDependencies(fmu::FMU2) +""" + fmi3PrintDependencies(fmu::FMU3) + +Print the dependency matrix for `fmu` as returned by [`fmi3GetDependencies`](@ref). + +See also [`fmi3GetDependencies`](@ref). +""" +function fmi3PrintDependencies(fmu::FMU3) dep = fmi3GetDependencies(fmu) ni, nj = size(dep) @@ -84,7 +97,9 @@ function fmi3PrintDependencies(fmu::FMU2) end """ -Prints FMU related information. + fmi3Info(fmu::FMU3) + +Print information about the `fmu`. """ function fmi3Info(fmu::FMU3) println("#################### Begin information for FMU ####################") diff --git a/src/FMI3/extensions/Plots.jl b/src/FMI3/extensions/Plots.jl index 4ebb927c..3ab8c141 100644 --- a/src/FMI3/extensions/Plots.jl +++ b/src/FMI3/extensions/Plots.jl @@ -7,16 +7,17 @@ using FMIImport: FMU3Solution import FMIImport.ForwardDiff """ -Plots data from a ME-FMU. - -Optional `t_in_solution` controls if the first state in the solution is interpreted as t(ime). -Optional keyword argument `maxLabelLength` controls the maximum length for legend labels (too long labels are cut from front). +function no longer here... (hopefully) """ function fmiPlot(solution::FMU3Solution; kwargs...) fig = Plots.plot(; xlabel="t [s]") fmiPlot!(fig, solution; kwargs...) return fig end + +""" +function no longer here... (hopefully) +""" function fmiPlot!(fig, solution::FMU3Solution; states::Union{Bool, Nothing}=nothing, values::Union{Bool, Nothing}=nothing, @@ -168,9 +169,7 @@ function fmiPlot!(fig, solution::FMU3Solution; end """ -Extended the original plot-command by plotting FMUs. - -For further information seek `?fmiPlot`. +function no longer here... (hopefully) """ function Plots.plot(solution::FMU3Solution, args...; kwargs...) fmiPlot(solution, args...; kwargs...)