Wire or Block diagram is a subproject included in PlantUML that may help you to design block diagram, wire or wiring diagram.
You can use @startwire and @endwire keywords.
"There are many requests for block diagrams.
The good news is that we have started to do some experiments...
This is really a preliminary version so don't expect anything real useful right now. However, you can play with the syntax and tell us what you think about it."
Component of the wire diagram are declared with an ID starting with * and containing only letters, digit or underscore. When printed, underscores is changed to spaces. You can optionally provide a dimension to components.
@startwire
* first
* second_box [100x50]
* third
@endwire
You can start new column using -- as separator
Components can be nested using indentations (like in Python)
@startwire
* first
* second_box [100x50]
* third
--
* big_container
* foo1
* foo2
* foo3
@endwire
You can change the placement using two directives:
move for relative movement
goto for absolute movement
@startwire
* first [70x70]
move(10,20)
* second_box [90x70]
* third [70x70]
goto(100,10)
* last [70x70]
goto(300,5)
* big_container
* foo1 #lightBlue
* foo2 #AAA
* foo3
@endwire
Local reference
Each component implicitely create a local referential you can use.
The spot directive allows to show a point on the diagram.
It is possible to add horizontal or vertical arrows on the diagram.
It's important to note that those lines do not change the layout of the element.
Furthermore, those arrows are always straight.
You can put text on arrows and change their color.
Suggestions and ideas about the new 1.2020.24 syntax
The PlantUML Team:
We are waiting for users feedback :-)
Wanted features or examples of expecting syntax
General
General feature requests that did not come from a QA.
Most wire diagrams have the same "device/component" in multiple locations. For instance, you could have the exact same temperature sensor in multiple spots (as if spread out over the board). A great feature would be to setup components with their connection points then replicated them throughout the layout. See item #5 in the "first impressions" section at the bottom.
support "rankDir" or left to right vs top to bottom layout. sometimes I would rather new componets layout left to right instead of vertically.
Add the possibility to give hspace (horizontal space)
DONE
(with move)
Putting block in block with defined size
DONE
The vspace inside block do nothing
Add left, middle and right (or absolute offset) for lateral positionning of blocks
Name blocks and IO to be able to connect easily after. Connections are often 1 to 1, but sometimes 1 -> n or n -> 1.
Instead of:
"right:" and "left:"
"connector "RTN" is left" and "connector "VCC" is top" would make it more clear. -> to debate
proposal syntax:
=> can represent a thicker arrow like a bus
DONE
-> will represent a single wire and should try to be a straight as possible.
DONE
left of, right of should be for component placement. All left of X should be vertically aligned and stacked; while X should expand vertically to accept straight wires (unless absolute size is specified).
prefer right angles for wire connections and direction changing
the render of the wire will assume the same overlay layer as the highest connection point. That is, if a component(x) is overlayed another component, any wire to that component(x) will overlay the same components that the component(x) overlays
the name of the bus/wire will be centered on the wire and re-rendered for each "section" between connections or breaks (overlay breaks).
Could you add padding for text on double arrow <=>?
3. Component Label Positioning
I think centering the label inside a box would be a better default
scaling the label size with the size of the box might also be a nice feature.
4. Component Declaration syntax
The use of `*` to declare a component is incongruent with the rest of plantuml, where one explicitly types out the type of component they want, such as:
state myState
actor myActor
class myClass
I would much prefer to keep plantuml readable and suggest changing the syntax to either use "component/device/etc" over the `*`.
or, you could just assume (like other diagrams) the type by way of the startwire; thus you know that any object typed in should be a box of type "device/component/*".
This would also allow for defining specifics about a "device" by use of brackets (just like the rest of plantuml).
device DDR3 {
label is center
connector 1 left
connector 2 right
connector 3 left
connector VDD right
connector gpio1 left
connector GND right
}
If you could declare a device as above, then that could set you up for replication; because we often have a lot of the same components on the same bus (e.g. 6 temperature sensors on the same spi bus).
device tmp125 {
label: TMP125 \n 30Mhz
connector somi is right
connector simo is left
connector vdd is top
connector gnd is bottom
# lightgrey
}
component tmp125 as tmp1
component tmp125 as tmp2
component tmp125 as tmp3
component MicroProc{
connector somi is right
connector simo is right
}
MicroProc.simo -> tmp1.simo
MicroProc.simo -> tmp2.simo
MicroProc.simo -> tmp3.simo
tmp1.somi -> MicroProc.somi
tmp2.somi -> MicroProc.somi
tmp3.somi -> MicroProc.somi
Here would be the current method of "rendering" the above.
@startwire
* MicroProc
* SOMI
* SIMO
* SCLK
-------
* TMP125_1
* SOMI
* SIMO
* SCLK
* TMP125_2
* SOMI
* SIMO
* SCLK
* TMP125_3
* SOMI
* SIMO
* SCLK
MicroProc.SIMO -> TMP125_1 : SIMO
MicroProc.SIMO -> TMP125_2 : SIMO
MicroProc.SIMO -> TMP125_3 : SIMO
TMP125_1.SOMI -> MicroProc.SOMI : SOMI
TMP125_2.SOMI -> MicroProc.SOMI : SOMI
TMP125_3.SOMI -> MicroProc.SOMI : SOMI
@endwire
5. Component Sizing
The sizing of a component should be dynamic. It should start out just big enough for the label+padding; then expand if it needs to fit stuff inside of it. like connection points+padding or other blocks/devices contained within (which should follow the same sizing rules).