Skip to content

Commit

Permalink
Merge pull request #2872 from hersle/export_some_more
Browse files Browse the repository at this point in the history
Export more functions relating to system initialization
  • Loading branch information
ChrisRackauckas authored Jul 18, 2024
2 parents c723155 + bb4baaf commit f9226f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,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
Expand Down
24 changes: 23 additions & 1 deletion src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f9226f9

Please sign in to comment.