Patterns
EPHS.Patterns
— ModuleThe Patterns
module defines interconnection Pattern
s, which provide a graphical syntax for expressing a power-preserving interconnection of finitely many subsystems into a single composite system. Since subsystems may again have yet simpler subsystems, patterns can be composed, i.e. hierarchically nested. Whenever the outer interface of a pattern matches a subsystem interface of another pattern, the patterns can be composed.
EPHS.Patterns.InnerBox
— TypeInnerBox(ports::Dtry{InnerPort}, filling::F, position::P) where {{F<:Union{Nothing,AbstractSystem},P<:Union{Nothing,Position}}
An InnerBox
represents a subsystem, whose Interface
is given as a directory of ports, see InnerPort
.
To define systems hierarchically, a filling
is assigned, which is a system whose interface matches that of the box.
Fields
ports
: directory of ports defining theInterface
of the boxfilling
:nothing
or anAbstractSystem
filling the boxposition
:nothing
or a gridPosition
EPHS.Patterns.InnerBox
— MethodInnerBox(ports::Dtry{InnerPort}, filling::AbstractSystem, position::Position)
An InnerBox
represents a subsystem, whose Interface
is given as a directory of ports, see InnerPort
.
To define systems hierarchically, a filling
is assigned, which is a system whose interface matches that of the box.
EPHS.Patterns.InnerBox
— MethodInnerBox(ports::Dtry{InnerPort}, filling::AbstractSystem)
An InnerBox
represents a subsystem, whose Interface
is given as a directory of ports, see InnerPort
.
To define systems hierarchically, a filling
is assigned, which is a system whose interface matches that of the box.
EPHS.Patterns.InnerBox
— MethodInnerBox(ports::Dtry{InnerPort}, position::Position)
An InnerBox
represents a subsystem, whose Interface
is given as a directory of ports, see InnerPort
.
EPHS.Patterns.InnerBox
— MethodInnerBox(ports::Dtry{InnerPort})
An InnerBox
represents a subsystem, whose Interface
is given as a directory of ports, see InnerPort
.
EPHS.Patterns.InnerPort
— TypeInnerPort(junction::DtryPath, power::Bool)
An InnerPort
is a port of an InnerBox
, which is connected to the Junction
with the given DtryPath
in the directory of junctions, see Pattern
. If power=false
the port is a state port, which may exchange information about the state of the quantity associated to the junction. If power=true
the port is a power port, which may additionally exchange energy by exchanging the associated quantity.
Fields
junction
:DtryPath
to the assigned junctionpower
:false
means state port,true
means power port
EPHS.Patterns.InnerPort
— MethodInnerPort(junction::DtryPath; power::Bool=true)
An InnerPort
is a port of an InnerBox
, which is connected to the Junction
with the given DtryPath
in the directory of junctions, see Pattern
. If power=false
the port is a state port, which may exchange information about the state of the quantity associated to the junction. If power=true
the port is a power port, which may additionally exchange energy by exchanging the associated quantity.
EPHS.Patterns.Junction
— TypeJunction{P}(quantity::Quantity, position::P, exposed::Bool, power::Bool) where {P<:Union{Nothing,Position}}
A junction represents an energy domain, where the connected ports may exchange information about the state of the given quantity
and where the connected power ports may additionally exchange energy by exchanging the given quantity
. If exposed=true
an outer port is added, which is a power port if power=true
.
Fields
EPHS.Patterns.Junction
— MethodJunction(quantity::Quantity, position::Position; exposed::Bool=false, power::Bool=true)
A junction represents an energy domain, where the connected ports may exchange information about the state of the given quantity
and where the connected power ports may additionally exchange energy by exchanging the given quantity
. If exposed=true
an outer port is added, which is a power port if power=true
.
EPHS.Patterns.Junction
— MethodJunction(quantity::Quantity; exposed::Bool=false, power::Bool=true)
A junction represents an energy domain, where the connected ports may exchange information about the state of the given quantity
and where the connected power ports may additionally exchange energy by exchanging the given quantity
. If exposed=true
an outer port is added, which is a power port if power=true
.
EPHS.Patterns.Pattern
— TypePattern{F,P}(junctions::Dtry{Junction{P}}, boxes::Dtry{InnerBox{F,P}}) where {F<:Union{Nothing,AbstractSystem},P<:Union{Nothing,Position}}
A (interconnection) Pattern
is defined by a directory of (possibly exposed) Junction
s and a directory of InnerBox
es (subsystems), whose ports are assigned to junctions, see InnerPort
. The constructor checks that
- junctions and boxes have disjoint namespaces
- every port is connected/assigned to an existing junction
- every junction has at least one connected inner port
Fields
junctions
: directory of junctionsboxes
: directory of inner boxes (subsystems)
EPHS.Patterns.Pattern
— MethodPattern{Nothing,Nothing}(pattern::Pattern{F,P})
Reduce a Pattern{F,P}
to a Pattern{Nothing,Nothing}
by forgetting the filling of boxes as well as the positions of junctions and boxes.
EPHS.Patterns.Pattern
— MethodPattern(junctions::Dtry{Junction{P}}, boxes::Dtry{InnerBox{F,P}}) where {F<:Union{Nothing,AbstractSystem},P<:Union{Nothing,Position}}
A (interconnection) Pattern
is defined by a directory of (possibly exposed) Junction
s and a directory of InnerBox
es (subsystems), whose ports are assigned to junctions, see InnerPort
. The constructor checks that
- junctions and boxes have disjoint namespaces
- every port is connected/assigned to an existing junction
- every junction has at least one connected inner port
EPHS.Patterns.Position
— TypePosition(r::Int, c::Int)
Position of a Junction
or InnerBox
used to graphically represent a Pattern
.
Fields
r
: row index on gridc
: column index on grid
Base.identity
— Methodidentity(x::Interface) -> Pattern{Nothing,Nothing}
EPHS.AbstractSystems.interface
— Methodinterface(pattern::Pattern, box_path::DtryPath) -> Interface
EPHS.AbstractSystems.interface
— MethodEPHS.Patterns.compose
— Methodcompose(pattern::Pattern{Nothing,Nothing}, fillings::Dtry{Pattern{Nothing,Nothing}}) -> Pattern{Nothing,Nothing}
Composition operation for the Dtry-multicategory of patterns.
Arguments
EPHS.Patterns.grid_dimensions
— MethodGet the dimensions of the outer box on the grid. Returns r_min, r_max, c_min, c_max
(minimal/maximal row/column index).