Last updated on April 10, 2022
Learn how to use Graphviz to visualize OPC UA Information Models
To create a graphical visualization of your OPC UA Model, the OPC Foundation defines different shapes and arrow types which sould be used.
See also: OPC UA ModelDesign Cheat Sheet & Graphical Annotation
You can use MS Visio and the provided Template to draw your models.
Note that on some downloadable MS Word specification files, the corresponding visual drawings are embedded Visio files.
The Template is available here as UA Shapes Visio Template
https://opcfoundation.org/guidelines-and-templates/
Alternatively, you can also use Graphviz to create a similar looking visualization as shown in this post.
Using Graphviz to visualize OPC UA Information Models
OPC UA standard conform node and edge attribute definition in dot
language for Graphviz.
The following graph holds representations of all OPC UA model elements and serves as a template.
Shadow is substituted by color gradient. Objects and type definitions are hard to discern visually either way due to the low color contrast.

digraph U{ ################################################################################ # This dot document will generate a graph with graphviz. # All nodes and edges adhere to the normative graphical representations used by # the OPC Foundation. # # This document defines: # * type defintions # * instances # * references ################################################################################ ################################################################################ # TYPE DEFINITIONS ############################################################# # ObjectTypes ################################################################## node [shape=box style="filled" fillcolor="#e8edf7;0.75:#d2def0" gradientangle=275] ObjectType # VariableTypes ################################################################ node [shape=rectangle, style="rounded,filled" fillcolor="#e8edf7;0.75:#d2def0" gradientangle=275] VariableType # DataTypes #################################################################### node [shape=hexagon style="filled" fillcolor="#e8edf7;0.75:#d2def0" gradientangle=275] DataType # ReferenceTypes ############################################################### node [shape=cds style="filled" orientation=180 fillcolor="#e8edf7;0.75:#d2def0" gradientangle=275] ReferenceType node [orientation=0] # reset ################################################################################ # INSTANCES #################################################################### # Objects ###################################################################### node [shape=rectanlge style="filled" fillcolor="#e8edf7"] Object # Variables #################################################################### node [shape=rectanlge, style="filled,rounded" fillcolor="#e8edf7"] Variable ################################################################################ # set appearance of Method node [shape=oval style="filled" fillcolor="#e8edf7"] Method # Views ######################################################################## node [shape=trapezium style="filled" fillcolor="#e8edf7"] View node [shape="", style="" orientation=0 fillcolor="" gradientangle=0] # reset ################################################################################ # REFERENCES ################################################################### # symmetric ReferenceType ###################################################### edge [ dir="both"] A -> B [label="symmetric ReferenceType"] edge [ dir=""] # reset # asymmetric ReferenceType ##################################################### edge [] # default attributes already correct C -> D [label="asymmetric ReferenceType"] # hierarchial ReferenceType #################################################### edge [arrowhead="vee"] E -> F [label="hierarchial ReferenceType"] # HasComponent ################################################################# edge [arrowhead="nonetee"] G -> H [label="HasComponent"] # HasProperty ################################################################## edge [arrowhead="noneteetee"] I -> J [label="HasProperty"] # HasTypeDefinition ############################################################ edge [arrowhead="normalnormal"] K -> L [label="HasTypeDefinition"] # HasSubtype ################################################################### edge [arrowhead="onormalonormal"] M -> N [label="HasSubtype"] # HasEventSource ############################################################### edge [arrowhead="onormal"] O -> P [label="HasEventSource"] }
For example, the following image and its respective dot
code implement a model from a 3rd party tutorial.

digraph U{ ################################################################################ # TYPE DEFINITIONS ############################################################# # ObjectTypes ################################################################## node [] # reset node properties node [shape=box style="filled" fillcolor="#e8edf7;0.75:#d2def0" gradientangle=275] BaseObjectType ControllerType AirConditioner Furnace # VariableTypes ################################################################ node [] # reset node properties node [shape=rectangle, style="rounded,filled" fillcolor="#e8edf7;0.75:#d2def0" gradientangle=275] BaseDataVariableType DataItemType AnalogItemType ################################################################################ # INSTANCES #################################################################### # Variables #################################################################### node [] # reset node properties node [shape=rectangle, style="filled,rounded" fillcolor="#e8edf7"] State Temperature TemperatureSetPoint PowerConsumption Humidity HumiditySetPoint GasFlow ################################################################################ # REFERENCES ################################################################### # HasComponent ################################################################# edge [] # reset edge properties edge [arrowhead="nonetee"] ControllerType -> State ControllerType -> Temperature ControllerType -> TemperatureSetPoint ControllerType -> PowerConsumption AirConditioner -> Humidity AirConditioner -> HumiditySetPoint Furnace -> GasFlow # HasTypeDefinition ############################################################ edge [] # reset edge properties edge [arrowhead="normalnormal"] Humidity -> AnalogItemType HumiditySetPoint -> AnalogItemType # HasSubtype ################################################################### edge [] # reset edge properties edge [arrowhead="onormalonormal"] ControllerType -> BaseObjectType DataItemType -> BaseDataVariableType AnalogItemType -> DataItemType AirConditioner -> ControllerType Furnace -> ControllerType }
Note: You may improve the graph’s layout by using properties
Be First to Comment