State Machine Diagram

Shows how states change in response to events and conditions. This example uses UDS diagnostic sessions.

State Machine Diagram

Draw.io source

<mxfile host="65bd71144e">
    <diagram name="UDS Session State Machine" id="uds-session-statemachine">
        <mxGraphModel dx="1081" dy="577" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1200" pageHeight="700" math="0" shadow="0">
            <root>
                <mxCell id="0"/>
                <mxCell id="1" parent="0"/>
                <mxCell id="10" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;strokeColor=#000000;strokeWidth=2;" parent="1" vertex="1">
                    <mxGeometry x="100" y="175" width="30" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="11" value="Initial" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;fontSize=10;" parent="1" vertex="1">
                    <mxGeometry x="85" y="215" width="60" height="20" as="geometry"/>
                </mxCell>
                <mxCell id="20" value="Default Session" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff4e6;strokeColor=#cc9900;fontSize=11;fontStyle=1;verticalAlign=top;align=center;gradientColor=light-dark(#FFCC99,#FFE6CC);gradientDirection=east;" parent="1" vertex="1">
                    <mxGeometry x="220" y="120" width="200" height="140" as="geometry"/>
                </mxCell>
                <mxCell id="21" value="entry / SessionType = 0x01&lt;br&gt;do / S3Timer Reset&lt;br&gt;exit / Save Session State" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;fontSize=10;" parent="1" vertex="1">
                    <mxGeometry x="230" y="150" width="180" height="60" as="geometry"/>
                </mxCell>
                <mxCell id="30" value="Extended Diagnostic" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff4e6;strokeColor=#cc9900;fontSize=11;fontStyle=1;verticalAlign=top;align=center;fontFamily=Helvetica;fontColor=default;gradientColor=light-dark(#FFCC99,#FFE6CC);gradientDirection=east;" parent="1" vertex="1">
                    <mxGeometry x="750" y="120" width="200" height="140" as="geometry"/>
                </mxCell>
                <mxCell id="31" value="entry / SessionType = 0x03&lt;br&gt;do / Enable Extended Services&lt;br&gt;exit / Restore Default" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;fontSize=10;" parent="1" vertex="1">
                    <mxGeometry x="760" y="150" width="180" height="60" as="geometry"/>
                </mxCell>
                <mxCell id="40" value="Programming Session" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff4e6;strokeColor=#cc9900;fontSize=11;fontStyle=1;verticalAlign=top;align=center;fontFamily=Helvetica;fontColor=default;gradientColor=light-dark(#FFCC99,#FFE6CC);gradientDirection=east;" parent="1" vertex="1">
                    <mxGeometry x="480" y="380" width="200" height="140" as="geometry"/>
                </mxCell>
                <mxCell id="41" value="entry / SessionType = 0x02&lt;br&gt;do / Enable Programming&lt;br&gt;exit / Clear Flash Memory" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;fontSize=10;" parent="1" vertex="1">
                    <mxGeometry x="490" y="410" width="180" height="60" as="geometry"/>
                </mxCell>
                <mxCell id="52" value="Final" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;fontSize=10;" parent="1" vertex="1">
                    <mxGeometry x="1060" y="205" width="60" height="20" as="geometry"/>
                </mxCell>
                <mxCell id="100" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="10" target="20" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                    </mxGeometry>
                </mxCell>
                <mxCell id="110" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.25;entryDx=0;entryDy=0;" parent="1" source="20" target="30" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                    </mxGeometry>
                </mxCell>
                <mxCell id="111" value="DiagnosticSessionControl [0x10 0x03]&lt;br&gt;/ Positive Response" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="440" y="120" width="270" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="120" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=0;exitY=0.75;exitDx=0;exitDy=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="30" target="20" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                    </mxGeometry>
                </mxCell>
                <mxCell id="121" value="DiagnosticSessionControl [0x10 0x01]&lt;br&gt;/ Return to Default" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="450" y="190" width="270" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="130" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" parent="1" source="20" target="40" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                        <Array as="points">
                            <mxPoint x="270" y="380"/>
                            <mxPoint x="430" y="380"/>
                            <mxPoint x="430" y="459"/>
                        </Array>
                    </mxGeometry>
                </mxCell>
                <mxCell id="131" value="DiagnosticSessionControl [0x10 0x02]&lt;br&gt;/ Enter Programming Mode" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="140" y="390" width="250" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="140" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;entryX=0.75;entryY=1;entryDx=0;entryDy=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="40" target="20" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="610" y="360" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                    </mxGeometry>
                </mxCell>
                <mxCell id="141" value="ECU Reset [0x11]&lt;br&gt;/ Reset and Return Default" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="410" y="290" width="200" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="150" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" parent="1" source="30" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="630" y="380" as="targetPoint"/>
                        <Array as="points">
                            <mxPoint x="900" y="320"/>
                            <mxPoint x="630" y="320"/>
                        </Array>
                    </mxGeometry>
                </mxCell>
                <mxCell id="151" value="DiagnosticSessionControl [0x10 0x02]&lt;br&gt;/ Switch to Programming" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="680" y="290" width="250" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="160" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=1;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="40" target="30" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                        <Array as="points">
                            <mxPoint x="1010" y="415"/>
                            <mxPoint x="1010" y="225"/>
                        </Array>
                    </mxGeometry>
                </mxCell>
                <mxCell id="161" value="DiagnosticSessionControl [0x10 0x03]&lt;br&gt;/ Switch to Extended" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="965" y="320" width="250" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="170" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=classic;strokeWidth=2;strokeColor=#000000;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="30" target="51" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="1069.9999999999836" y="190" as="targetPoint"/>
                    </mxGeometry>
                </mxCell>
                <mxCell id="171" value="S3 Timeout&lt;br&gt;/ Session Expired" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="950" y="140" width="100" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="180" value="" style="endArrow=classic;html=1;strokeWidth=2;strokeColor=#000000;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" parent="1" source="20" target="20" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                        <Array as="points">
                            <mxPoint x="270" y="80"/>
                            <mxPoint x="370" y="80"/>
                        </Array>
                    </mxGeometry>
                </mxCell>
                <mxCell id="181" value="TesterPresent [0x3E]&lt;br&gt;/ Keep Alive" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="260" y="50" width="120" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="190" value="" style="endArrow=classic;html=1;strokeWidth=2;strokeColor=#000000;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" parent="1" source="30" target="30" edge="1">
                    <mxGeometry width="50" height="50" relative="1" as="geometry">
                        <mxPoint x="500" y="400" as="sourcePoint"/>
                        <mxPoint x="550" y="350" as="targetPoint"/>
                        <Array as="points">
                            <mxPoint x="800" y="80"/>
                            <mxPoint x="900" y="80"/>
                        </Array>
                    </mxGeometry>
                </mxCell>
                <mxCell id="191" value="TesterPresent [0x3E]&lt;br&gt;/ Keep Alive" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=9;" parent="1" vertex="1">
                    <mxGeometry x="790" y="50" width="120" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="195" value="" style="group" parent="1" vertex="1" connectable="0">
                    <mxGeometry x="1075" y="175" width="30" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="51" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#009900;strokeColor=#000000;strokeWidth=2;" parent="195" vertex="1">
                    <mxGeometry width="30" height="30" as="geometry"/>
                </mxCell>
                <mxCell id="194" value="" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;strokeColor=#000000;strokeWidth=2;" parent="195" vertex="1">
                    <mxGeometry x="7.5" y="7.5" width="15" height="15" as="geometry"/>
                </mxCell>
            </root>
        </mxGraphModel>
    </diagram>
</mxfile>

Comments

Loading comments.