Skip to content

Commit

Permalink
adapt system construction to new Connector fields
Browse files Browse the repository at this point in the history
  • Loading branch information
harisorgn committed Dec 19, 2024
1 parent 5f0bbae commit dc6642f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Neurographs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ get_dynamics_bloxs(blox::CompositeBlox) = get_parts(blox)
flatten_graph(g::MetaDiGraph) = mapreduce(get_dynamics_bloxs, vcat, get_bloxs(g))

function connectors_from_graph(g::MetaDiGraph)
conns = get_connector.(get_bloxs(g))
conns = reduce(vcat, get_connector.(get_bloxs(g)))
for edge in edges(g)

blox_src = get_prop(g, edge.src, :blox)
Expand Down Expand Up @@ -188,16 +188,18 @@ function system_from_graph(g::MetaDiGraph, p::Vector{Num}=Num[]; name=nothing, t
throw(UndefKeywordError(:name))
end

bc = connector_from_graph(g)
conns = connectors_from_graph(g)

return system_from_graph(g, bc, p; name, t_block, simplify, kwargs...)
return system_from_graph(g, conns, p; name, t_block, simplify, kwargs...)
end
end

function system_from_graph(g::MetaDiGraph, bc::Connector, p::Vector{Num}=Num[]; name=nothing, t_block=missing, simplify=true, graphdynamics=false, kwargs...)
function system_from_graph(g::MetaDiGraph, conns::AbstractVector{<:Connector}, p::Vector{Num}=Num[]; name=nothing, t_block=missing, simplify=true, graphdynamics=false, kwargs...)
bloxs = get_bloxs(g)
blox_syss = get_system.(bloxs)

bc = isempty(conns) ? Connector(name, name) : reduce(merge!, conns)

eqs = equations(bc)
accumulate_equations!(eqs, bloxs)

Expand Down

0 comments on commit dc6642f

Please sign in to comment.