From a1269bef2c9b7694825f9b00f3e52684875855b8 Mon Sep 17 00:00:00 2001 From: Herman Sletmoen Date: Thu, 18 Jul 2024 10:08:32 +0200 Subject: [PATCH 1/2] Export more --- src/ModelingToolkit.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ModelingToolkit.jl b/src/ModelingToolkit.jl index 5be9e6dbb2..b1d0e3ba83 100644 --- a/src/ModelingToolkit.jl +++ b/src/ModelingToolkit.jl @@ -235,8 +235,8 @@ export Differential, expand_derivatives, @derivatives export Equation, ConstrainedEquation export Term, Sym export SymScope, LocalScope, ParentScope, DelayParentScope, GlobalScope -export independent_variable, equations, controls, - observed, full_equations +export independent_variable, equations, controls, observed, full_equations +export initialization_equations, guesses, defaults, parameter_dependencies export structural_simplify, expand_connections, linearize, linearization_function export calculate_jacobian, generate_jacobian, generate_function, generate_custom_function From bb4baaf08ec82eb4f8302143824251c6a4b70106 Mon Sep 17 00:00:00 2001 From: Herman Sletmoen Date: Thu, 18 Jul 2024 10:08:42 +0200 Subject: [PATCH 2/2] Document more --- src/systems/abstractsystem.jl | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/systems/abstractsystem.jl b/src/systems/abstractsystem.jl index acade88bdc..f01b658936 100644 --- a/src/systems/abstractsystem.jl +++ b/src/systems/abstractsystem.jl @@ -1093,6 +1093,12 @@ function dependent_parameters(sys::AbstractSystem) end end +""" +$(TYPEDSIGNATURES) +Get the parameter dependencies of the system `sys` and its subsystems. + +See also [`defaults`](@ref) and [`ModelingToolkit.get_parameter_dependencies`](@ref). +""" function parameter_dependencies(sys::AbstractSystem) pdeps = get_parameter_dependencies(sys) if isnothing(pdeps) @@ -1111,6 +1117,13 @@ function full_parameters(sys::AbstractSystem) vcat(parameters(sys), dependent_parameters(sys)) end +""" +$(TYPEDSIGNATURES) + +Get the guesses for variables in the initialization system of the system `sys` and its subsystems. + +See also [`initialization_equations`](@ref) and [`ModelingToolkit.get_guesses`](@ref). +""" function guesses(sys::AbstractSystem) guess = get_guesses(sys) systems = get_systems(sys) @@ -1141,6 +1154,15 @@ end Base.@deprecate default_u0(x) defaults(x) false Base.@deprecate default_p(x) defaults(x) false + +""" +$(TYPEDSIGNATURES) + +Get the default values of the system sys and its subsystems. +If they are not explicitly provided, variables and parameters are initialized to these values. + +See also [`initialization_equations`](@ref), [`parameter_dependencies`](@ref) and [`ModelingToolkit.get_defaults`](@ref). +""" function defaults(sys::AbstractSystem) systems = get_systems(sys) defs = get_defaults(sys) @@ -1199,7 +1221,7 @@ $(TYPEDSIGNATURES) Get the initialization equations of the system `sys` and its subsystems. -See also [`ModelingToolkit.get_initialization_eqs`](@ref). +See also [`guesses`](@ref), [`defaults`](@ref), [`parameter_dependencies`](@ref) and [`ModelingToolkit.get_initialization_eqs`](@ref). """ function initialization_equations(sys::AbstractSystem) eqs = get_initialization_eqs(sys)