UTILITIES

All Functions

  • all_component_names(sys; num2keep = 1, unique_only = true)
  • check_for_var(var; tofind = :ṁ)
  • component_names(eqs, tofind; unique_only = true)
  • component_names(eqs; unique_only = true, num2keep = 1)
  • connection_equations(BaseSys)
  • connection_equations2(BaseSys; flagvec = [])
  • convert_pressure(val::Real, from_unit::Symbol)
  • convert_pressure(val::Real, from_unit::Symbol, to_unit::Symbol)
  • enforce_lowercase(x = insym)
  • find_flow_vars(BaseSys; tofind = :ṁ)
  • gas_connect(pins...)
  • heat_connect(pins...)
  • join_variable_str(splitvar, num2keep::Int; joinstr = "₊")
  • plantsys(Plant; compoenent_level = 2)
  • showSpecificSol(c, sol)
  • showsol(c, prob::ODEProblem; prob_attr = nothing)
  • showsol(c, sol::ODESolution)
  • showsys(sys)
  • split_variable_sym(var)
  • sys2dict(sys::ODESystem)
  • sys2dict(sys::Vector{ODESystem})
  • system2graph(ODESYS::ODESystem; verbose = false)
  • system_details(sys::ODESystem; alias_elimate = true)
  • systems(p::ODESystem)
  • updateGraphSoln(G,soln)
  • variable2symbol(var)
  • work_connect(pins...)

Functions

gas_connect(pins)

  • DESCRIPTION:

    Connect gas pins
    # Arguments:
    - `pins`: Pins of the same domain to apply conservation laws to

work_connect(pins)

  • DESCRIPTION:

    Connect work
    # Arguments:
    - `pins`: Pins of the same domain to apply conservation laws to

heat_connect(pins)

  • DESCRIPTION:

    Connect heat pins
    # Arguments:
    - `pins`: Pins of the same domain to apply conservation laws to

showsol(c, sol::ODESolution)

  • DESCRIPTION:

    Prints the solution for all components in vector C for solution sol
    # Arguments:
    - `c`: Vector of ODE_systems to evaluate
    - `sol::ODESolution`: DESCRIPTION

variable2symbol(var)

  • DESCRIPTION:

    Converts modeling toolkit variable to symbol
    # Arguments:
    - `var`: ModelingToolkit variable

showsol(c, prob::ODEProblem; prob_attr = nothing)

  • DESCRIPTION:

    # Arguments:
    - `c`: Vector of ODE_systems to evaluate
    - `prob::ODEProblem`: DESCRIPTION
    OPTIONAL INPUTS
    - `prob_attr = nothing`: DESCRIPTION

showSpecificSol(c, sol)

  • DESCRIPTION:

    # Arguments:
    - `c`: Vector of ODE_systems to evaluate
    - `sol`: DESCRIPTION

showsys(sys)

  • DESCRIPTION:

    Prints sys.systems
    # Arguments:
    - `sys`: ODESystem

sys2dict(sys::Vector{ODESystem})

  • DESCRIPTION:

    Returns a dict d for subsytems within sys
    where d[:subsys_name] => subsys_object
    # Arguments:
    - `sys::Vector{ODESystem}`: Vector of ODESystems

sys2dict(sys::ODESystem)

  • DESCRIPTION:

    Returns a dict d for subsytems within sys
    where d[:subsys_name] => subsys_object
    # Arguments:
    - `sys::ODESystem`: Top level ODE System

plantsys(Plant; compoenent_level = 2)

  • DESCRIPTION:

    Traverses to a depth given by component level where depth represents
    Plant.level1.level2....
    Returns a dict
    # Arguments:
    - `Plant`: ODE_system with subsystems
    OPTIONAL INPUTS
    - `compoenent_level = 2`: DESCRIPTION

systems(p::ODESystem)

  • DESCRIPTION:

    Returns p.systems
    # Arguments:
    - `p::ODESystem`: DESCRIPTION

connection_equations(BaseSys)

  • DESCRIPTION:

    Gathers all equations within a system which represent connections rather than intercomponent equations
    i.e. all equations which are formed during component connections
    returns all connection equations
    # Arguments:
    - `BaseSys`: DESCRIPTION

check_for_var(var; tofind = :ṁ)

  • DESCRIPTION:

    checks if a an array of variables are "tofind" variables
    returns false is any of the input variables are not the "tofind" variable
    Useful for identifying balance equations within a larger system equations vector
    example mass flow continuity: ṁ_in + ṁ_out = 0
    only variables in that equations are ṁ
    # Arguments:
    - `var`: MTK variable
    - tofind: Symbol to look for

find_flow_vars(BaseSys; tofind = :ṁ)

  • DESCRIPTION:

    this returns all system variables with mass flow
    # Arguments:
    - `BaseSys`: MTK ststem
    Optional
    - tofind: Symbol to look for

find_flow_vars(BaseSys; tofind = :ṁ)

  • DESCRIPTION:

    splits apart MTK variable at levels
    :divertor_circulator₊p₊ṁ => ["divertor_circulator", "p", "ṁ"]
    # Arguments
    var: variable

join_variable_str(splitvar, num2keep::Int; joinstr = ₊)

  • DESCRIPTION:

    Joins MTK variable string that has been split using split_variable_sym
    # Arguments:
    - `splitvar`: DESCRIPTION
    - `num2keep::Int`: DESCRIPTION
    OPTIONAL INPUTS
    - `joinstr = ₊`: DESCRIPTION

component_names(eqs; unique_only = true, num2keep = 1)

  • DESCRIPTION:

    returns all component names found within a vecotr of equations
    # Arguments:
    - `eqs`: DESCRIPTION
    OPTIONAL INPUTS
    - `unique_only = true`: DESCRIPTION
    - `num2keep = 1`: DESCRIPTION

component_names(eqs, tofind; unique_only = true)

  • DESCRIPTION:

    returns all component names found within a vecotr of equations
    # Arguments:
    - `eqs`: DESCRIPTION
    - `tofind`: DESCRIPTION
    OPTIONAL INPUTS
    - `unique_only = true`: DESCRIPTION

all_component_names(sys; num2keep = 1, unique_only = true)

  • DESCRIPTION:

    returns all component names found within a vecotr of equations
    # Arguments:
    - `sys`: DESCRIPTION
    OPTIONAL INPUTS
    - `num2keep = 1`: DESCRIPTION
    - `unique_only = true`: DESCRIPTION

system_details(sys::ODESystem; alias_elimate = true)

  • DESCRIPTION:

    Displays system equation information after alias alias_elimination
    Use to confirm the DOF and constraints for a top level system
    # Arguments:
    - `sys::ODESystem`: DESCRIPTION
    OPTIONAL INPUTS
    - `alias_elimate = true`: DESCRIPTION

connection_equations2(BaseSys; flagvec)

  • DESCRIPTION:

    Connection equations
    # Arguments:
    - `BaseSys`: DESCRIPTION
    OPTIONAL INPUTS
    - `flagvec`: DESCRIPTION

system2graph(ODESYS::ODESystem; verbose = false)

  • DESCRIPTION:

    # Arguments:
    - `ODESYS::ODESystem`: DESCRIPTION
    OPTIONAL INPUTS
    - `verbose = false`: DESCRIPTION

system2graph2(ODESYS::ODESystem, utility_vector::Vector{Symbol}; verbose = false, soln = nothing)

  • DESCRIPTION:

    # Arguments:
    - `ODESYS::ODESystem`: DESCRIPTION
    - `utility_vector::Vector{Symbol}`: DESCRIPTION
    OPTIONAL INPUTS
    - `verbose = false`: DESCRIPTION
    - `soln = nothing`: DESCRIPTION

add_graph_connection!(sys, g, component_dict, vertex_dict, Component_Variable, edge_power_dict; flip_dir = false, verbose = false)

  • DESCRIPTION:

    # Arguments:
    - `sys`: DESCRIPTION
    - `g`: DESCRIPTION
    - `component_dict`: DESCRIPTION
    - `vertex_dict`: DESCRIPTION
    - `Component_Variable`: DESCRIPTION
    - `edge_power_dict`: DESCRIPTION
    OPTIONAL INPUTS
    - `flip_dir = false`: DESCRIPTION
    - `verbose = false`: DESCRIPTION

system2metagraph(sys::ODESystem, utility_vector::Vector{Symbol}; verbose = false, soln = nothing)

  • DESCRIPTION:

    # Arguments:
    - `sys::ODESystem`: DESCRIPTION
    - `utility_vector::Vector{Symbol}`: DESCRIPTION
    OPTIONAL INPUTS
    - `verbose = false`: DESCRIPTION
    - `soln = nothing`: DESCRIPTION

convert_pressure(val::Real,from_unit::Symbol,to_unit::Symbol)

  • DESCRIPTION:

    convert pressure units, optional to specify to_unit, default = bar because that is what XSTeam uses