Skip to content

Commit ad8be92

Browse files
committed
special case known metadata from PowerDynamics
1 parent 4631c27 commit ad8be92

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/show.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Base.show(io::IO, s::KAAggregator) = print(io, "KAAggregator($(repr(s.f)))")
4848
Base.show(io::IO, s::SequentialAggregator) = print(io, "SequentialAggregator($(repr(s.f)))")
4949
Base.show(io::IO, s::PolyesterAggregator) = print(io, "PolyesterAggregator($(repr(s.f)))")
5050

51-
function Base.show(io::IO, ::MIME"text/plain", c::ComponentModel)
51+
function Base.show(io::IO, mime::MIME"text/plain", c::ComponentModel)
5252
type = string(typeof(c))
5353
print(io, type, styled" {NetworkDynamics_name::$(c.name)}")
5454
print(io, styled" {NetworkDynamics_fftype:$(fftype(c))}")
@@ -64,6 +64,14 @@ function Base.show(io::IO, ::MIME"text/plain", c::ComponentModel)
6464
styling = Dict{Int,Symbol}()
6565

6666
print_states_params(io, c, styling)
67+
68+
# special known metadata of PowerDynamics
69+
if has_metadata(c, :pfmodel)
70+
pfm = get_metadata(c, :pfmodel)
71+
printstyled(io, "\nPowerflow model ", color=:blue, bold=true)
72+
print(io, ":", pfm.name)
73+
pdim(pfm) > 0 && print(io, styled" with $(stylesymbolarray(pfm.psym, _pdef(pfm), _pguess(pfm)))")
74+
end
6775
end
6876

6977
function print_states_params(io, @nospecialize(c::ComponentModel), styling)

0 commit comments

Comments
 (0)