This commit is contained in:
gab-k committed 2024-12-25 20:48:40 +00:00
1 parent 76094a5056
commit 2789165337
24 files changed
+635 -190

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file with editors other than draw.io -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1571px" height="734px" viewBox="-0.5 -0.5 1571 734" content="&lt;mxfile host=&quot;app.diagrams.net&quot; agent=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0&quot; version=&quot;25.0.3&quot; scale=&quot;1&quot; border=&quot;0&quot;&gt;&#xA; &lt;diagram id=&quot;4yrCjKYynwCaxiwjl_Zd&quot; name=&quot;Page-1&quot;&gt;&#xA; &lt;mxGraphModel dx=&quot;2049&quot; dy=&quot;1117&quot; grid=&quot;1&quot; gridSize=&quot;10&quot; guides=&quot;1&quot; tooltips=&quot;1&quot; connect=&quot;1&quot; arrows=&quot;1&quot; fold=&quot;1&quot; page=&quot;1&quot; pageScale=&quot;1&quot; pageWidth=&quot;1654&quot; pageHeight=&quot;1169&quot; background=&quot;none&quot; math=&quot;0&quot; shadow=&quot;0&quot;&gt;&#xA; &lt;root&gt;&#xA; &lt;mxCell id=&quot;0&quot; /&gt;&#xA; &lt;mxCell id=&quot;1&quot; parent=&quot;0&quot; /&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-2&quot; value=&quot;Speed Helper&quot; style=&quot;rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;&quot; parent=&quot;1&quot; vertex=&quot;1&quot;&gt;&#xA; &lt;mxGeometry x=&quot;265&quot; y=&quot;150&quot; width=&quot;150&quot; height=&quot;70&quot; as=&quot;geometry&quot; /&gt;&#xA; &lt;/mxCell&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-10&quot; value=&quot;&quot; style=&quot;edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;startArrow=none;&quot; parent=&quot;1&quot; target=&quot;-WzbCRYT-x1LrtJJFd-d-6&quot; edge=&quot;1&quot;&gt;&#xA; &lt;mxGeometry relative=&quot;1&quot; as=&quot;geometry&quot;&gt;&#xA; &lt;mxPoint x=&quot;920&quot; y=&quot;420&quot; as=&quot;sourcePoint&quot; /&gt;&#xA; &lt;/mxGeometry&gt;&#xA; &lt;/mxCell&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-4&quot; value=&quot;&amp;lt;div&amp;gt;&amp;lt;b&amp;gt;Motor Controller&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;PID MODE&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;or&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;STARTUP MODE&amp;lt;br&amp;gt;&amp;lt;/div&amp;gt;&quot; style=&quot;rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;&quot; parent=&quot;1&quot; vertex=&quot;1&quot;&gt;&#xA; &lt;mxGeometry x=&quot;610&quot; y=&quot;340&quot; width=&quot;340&quot; height=&quot;160&quot; as=&quot;geometry&quot; /&gt;&#xA; &lt;/mxCell&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-6&quot; value=&quot;Motor Driver&quot; style=&quot;rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;&quot; parent=&quot;1&quot; vertex=&quot;1&quot;&gt;&#xA; &lt;mxGeometry x=&quot;1070&quot; y=&quot;385&quot; width=&quot;150&quot; height=&quot;70&quot; as=&quot;geometry&quot; /&gt;&#xA; &lt;/mxCell&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-7&quot; value=&quot;ADC&quot; style=&quot;rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;&quot; parent=&quot;1&quot; vertex=&quot;1&quot;&gt;&#xA; &lt;mxGeometry x=&quot;610&quot; y=&quot;715&quot; width=&quot;150&quot; height=&quot;70&quot; as=&quot;geometry&quot; /&gt;&#xA; &lt;/mxCell&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-12&quot; value=&quot;Motor&quot; style=&quot;rounded=0;whiteSpace=wrap;html=1;fontFamily=Verdana;fontSize=18;fontColor=#ffffff;fillColor=#647687;strokeColor=#314354;&quot; parent=&quot;1&quot; vertex=&quot;1&quot;&gt;&#xA; &lt;mxGeometry x=&quot;1325&quot; y=&quot;385&quot; width=&quot;150&quot; height=&quot;70&quot; as=&quot;geometry&quot; /&gt;&#xA; &lt;/mxCell&gt;&#xA; &lt;mxCell id=&quot;-WzbCRYT-x1LrtJJFd-d-29&quot; value=&quot;&quot; style=&quot;endArrow=classic;html=1;rounded=0;strokeColor=#647687;exitX=0.5;exitY=1;exitDx=0;exitDy=0;shape=flexArrow;strokeWidth=2;fillColor=default;gradientColor=none;width=32;endSize=11.67;entryX=0.5;entryY=0;entryDx=0;entryDy=0;horizontal=0;&quot; parent=&quot;1&quot; source=&quot;-WzbCRYT-x1LrtJJFd-d-2&quot; target=&quot;-WzbCRYT-x1LrtJJFd-d-81&quot; edge=&quot;1&quot;&gt;&#xA; &lt;mxGeometry width=&quot;50&quot; height=&quot;50&quot; relative=&quot;1&quot; as=&quot;geometry&quot;&gt;&#xA; &lt;mxPoint x=&quot;330&quot; y=&quot;280&quot; as=&quot;sourcePoint&quot; /&gt;&#xA; &lt;mxPoint x=&quot;210&quot; y=&quot;320&quot; as=&quot;targetPoint&quot; /&gt;&#xA; &lt;Array as=&quot;points&quot; /&gt;&#xA; &lt;/mxGeometry&gLine truncated

After

Width:  |  Height:  |  Size: 191 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file with editors other than diagrams.net -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1010px" height="342px" viewBox="-0.5 -0.5 1010 342" content="&lt;mxfile host=&quot;app.diagrams.net&quot; modified=&quot;2022-08-01T21:22:27.892Z&quot; agent=&quot;5.0 (X11)&quot; etag=&quot;6cE2MGuarYsOfXY5ymrM&quot; version=&quot;20.2.2&quot; type=&quot;device&quot;&gt;&lt;diagram id=&quot;4yrCjKYynwCaxiwjl_Zd&quot; name=&quot;Page-1&quot;&gt;7Vxbc5s4FP41ntl9cAZx92OcS7dtuu00O9t2X3ZkkIENRi7IiZNfvwIkgxBgYmNiN/FDBh2JAzqX71yAjLSLxfpdDJf+J+yicKQq7nqkXY5UdWID+jclPOYE3ZjkBC8O3JwECsJt8IQYUWHUVeCiRFhIMA5JsBSJDo4i5BCBBuMYP4jL5jgUr7qEHpIItw4MZeq3wCU+o5qGXkz8gQLP55cGJtvgDDp3XoxXEbvgSNWU7JdPLyBnxgiJD138UCJpVyPtIsaY5EeL9QUKU9lyueXnXTfMbm48RhHpcsL429Ps4uuPv8ZrcBOTDx+u3bE7ttk272G4Qnwf2d2SRy4iFLnnqaTpyAlhkgTOSJv6ZBFSAqCHmQxQehWFjhIS4zt0gUMcZ6drpm6ZtpXO+HCZspyHaM0YstVc8lQm03kQhvxsF83hKqS7m3oxdAO6UT4T4Yiymj6wE7X0THqfzL4AODOtjELix+/sxrLBj3RwZvDh5bo8efnIRrJouWnC2EOkRZ5MnMgVrI4p5B3CC0SvQxc8FLZmMPvwS1bGaTEKIQnuRVuFzOS9DbvNFb7ggN6xqjDv1GzGhzsnt0XOIsGr2EHsrLLtVBkZIiPNNkRGuWAkRlTN8LG0bJkuSMor6EFJMAUpM95nGDLHk1ZDplq5ZUMcEx97OILhVUGtmHKx5gbjJbP2/xAhj8zO4Ipg0RcSKgjCvYUZaaM15dJv3VRXe9rTUIBqbLGUBgX3pT4Zhj6OVDNz/WQ1o4deevie0+g1SmRJ0aIaH/yAoNslzET9QKOYqLI5jsg1XARhuvW/UezCCDIyhxObjUuoNs9+FbwS0K6KgxrQNRpVWuzhHsUErVv1zGZ1u8EfS7gClBpgsZRm0xB0+mz/A5IGj97/ekPzPb3P1neD6b6cbzJcDoDWAfnOzkmPS/GYjopwnA54ND6dvGFn9H/67CAQ//RtzZg5+Pz208J5N1a1jmbaPUwMk3ZYQLRnAxid7Pn5jjFk2vGnY1/7KF6CyeTfJ+OjZ4T/RGNVcp33tbB3A2e0bhJcBoaBF6X+RA0DUducpvAf0MrknE0sAtfNURElwROcZfxSM2PbocyN6ci4FIOVqjTHtIYws6mu2DVGm5qlbLbN0NEYpsbKmWaKgaoXAwOqUseVM8DzeYIOg5R2pzzly1ueUp+nbBDm5fIURXbZg0W704lcPo6DJ2o5MNwllG2NUNxvjiRAaZOe6mLdqgCRuW+A6nbDKsv3C0/IOfZbUneqqd8Sw30aSj22AIZxHaBoFd8B+pluTorfbp60cwdiwBZTTY37eUWWK3IsKZ9s5q2J4NbsrkCAriljWyqo67baiw0Ol+8BoL2ObKFAsB8CgNXD2S5gvTsE8uTh9OpgyxIgDdg7phm21O47TJoBlGq+3nOeUVtDy6j65VgAdZAamoFMG3Qqpj0RFMOFti+ScijlhqUPhqzcVwVkzatmN7gXtG/+XGEezMZJpqJzuoCKdp0phM8Xdba5CX77MoKLtAyPZslykDG1mWmpeZDvQNwVJWcCEqlHJLMNr1lcc+8nuaVh1K7sLbgqaoZhsEyyRKC9twSTZf5yxTxYp5lKNWfhry6kAy/NcdhxmELydPMiRCX7yGdx7KK4MpPcIeL4jEnnDlZDA+zZja2EyiGIvK8s4Gdoz2g3aJ6SxlnCxGhTTAheUGpPTTEKfQ3hvJSW2DVpSTXq79IUq33S0OXZ3S+Q5I76qdnLeWj9g5ujykJ7a3YZlQrdVPd9CaTbDRtGv0lom862NPYv3xr7zIgqhYKhyhB2sMZ+rQItSYHJ61OLWXWdF1fLgO8WnE5oOVj/pA3atoYt66jCllF99j/ZMWxZ1YZ1ldGQjeX69GvA/OvUnrOIjUmwxbF6fgHHkD3nNBqPffkOUMy+nadj57HvpK+28yg39y9lx/s1Oo8twPOM13d6en6jC0zH2iGe59RvWE7ze+gSKXPoiOdwpUmtpCuKTXFjU2ffdHWDorUA3RwU6qG7/oliQ8unWFAbqRrCgIz8PSTB0pNkjs7lJJibchl9NfVASTCQXxvrT9mapOzaDOA6+3VSdnl1D/rQqtFIkV9Wt2qCoXaomkSVcR+kBf3+Ojn1enHQ7whac66Kbn5LRhfXo/RrtSn4/fXpaaIcW12vdoC0Ey7sd6iSDvpuWFvBvr0fzXzqWKoTqb+rn5mmyKVrgSI5hvGCHybWC/+tA/bibxDpXR1FOypHMaqOYu74HY1V9ZIqowN6CR0W37jny4t/JKBd/Q8=&lt;/diagram&gt;&lt;/mxfile&gt;"><defs/><g><path d="M 132 186.5 L 132 153.5 L 192.99 153.5 L 192.99 142.5 L 230 170 L 192.99 197.5 L 192.99 186.5 Z" fill="rgb(255, 255, 255)" stroke="#647687" stroke-width="2" stroke-miterlimit="10" pointer-events="all"/><path d="M 871 170 L 994.63 170" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 999.88 170 L 992.88 173.5 L 994.63 170 L 992.88 166.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><rect x="231" y="135" width="100" height="70" fill="#647687" stroke="#314354" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 170px; margin-left: 232px;"><div style="box-sizing: border-box; font-size: 0px; text-align: center;" data-drawio-colors="color: #ffffff; "><div style="display: inline-block; font-size: 18px; font-family: Verdana; color: rgb(255, 255, 255); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">K<sub>I</sub></div></div></div></foreignObject><text x="281" y="175" fill="#ffffff" font-family="Verdana" font-size="18px" text-anchor="middle">KI</text></switch></g><path d="M 591 170 L 337.37 170" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/><path d="M 332.12 170 L 339.12 166.5 L 337.37 170 L 339.12 173.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/><path d="M 542 186.5 L 542 153.5 L 752.99 153.5 L 752.99 142.5 L 790 170 L 752.99 197.5 L 752.99 186.5 Z" fill="rgb(255, 255, 255)" stroke="#647687" stroke-width="2" stroke-miterlimit="10" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsLine truncated

After

Width:  |  Height:  |  Size: 18 KiB

+131
View File
@@ -0,0 +1,131 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="1369pt" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1369 657" height="657pt">
<title>gl2ps_renderer figure</title>
<desc>
Creator: GL2PS 1.4.2, (C) 1999-2020 C. Geuzaine
For: Octave
CreationDate: Thu Aug 4 01:55:04 2022
</desc>
<defs/>
<polygon fill="#ffffff" points="0,0 1369,0 1369,657 0,657"/>
<g>
<polygon fill="#ffffff" points="0,657 1369,657 1369,0 0,0" shape-rendering="crispEdges"/>
<clipPath id="cp001369657">
<polygon points="0,657 1369,657 1369,0 0,0"/>
</clipPath>
<g clip-path="url(#cp001369657)">
<polygon fill="#ffffff" shape-rendering="crispEdges" points="178.09,584.849 1239.78,584.849 1239.78,49.2852 178.09,49.2852"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,584.849 178.09,574.241"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,49.2852 178.09,59.8931"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="443.512,584.849 443.512,574.241"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="443.512,49.2852 443.512,59.8931"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="708.934,584.849 708.934,574.241"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="708.934,49.2852 708.934,59.8931"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="974.356,584.849 974.356,574.241"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="974.356,49.2852 974.356,59.8931"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,584.849 1239.78,574.241"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,49.2852 1239.78,59.8931"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(175.09,600.343) rotate(-0,3,-8)" font-size="10">
<tspan x="0 " fill="rgb(38,38,38)" y="-0">0</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(434.512,600.343) rotate(-0,9,-8)" font-size="10">
<tspan x="0 6 12 " fill="rgb(38,38,38)" y="-0">500</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(696.934,600.343) rotate(-0,12,-8)" font-size="10">
<tspan x="0 6 12 18 " fill="rgb(38,38,38)" y="-0">1000</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(962.356,600.343) rotate(-0,12,-8)" font-size="10">
<tspan x="0 6 12 18 " fill="rgb(38,38,38)" y="-0">1500</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(1227.78,600.343) rotate(-0,12,-8)" font-size="10">
<tspan x="0 6 12 18 " fill="rgb(38,38,38)" y="-0">2000</tspan>
</text>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,584.849 188.704,584.849"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,584.849 1229.16,584.849"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,450.958 188.704,450.958"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,450.958 1229.16,450.958"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,317.067 188.704,317.067"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,317.067 1229.16,317.067"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,183.176 188.704,183.176"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,183.176 1229.16,183.176"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="178.09,49.2852 188.704,49.2852"/>
<polyline stroke-width="0.5" stroke="#262626" fill="none" stroke-linecap="butt" stroke-linejoin="miter" points="1239.78,49.2852 1229.16,49.2852"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(167.091,588.849) rotate(-0,6,-4)" font-size="10">
<tspan x="0 " fill="rgb(38,38,38)" y="-0">0</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(167.091,454.958) rotate(-0,6,-4)" font-size="10">
<tspan x="0 " fill="rgb(38,38,38)" y="-0">5</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(161.091,321.067) rotate(-0,12,-4)" font-size="10">
<tspan x="0 6 " fill="rgb(38,38,38)" y="-0">10</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(161.091,187.176) rotate(-0,12,-4)" font-size="10">
<tspan x="0 6 " fill="rgb(38,38,38)" y="-0">15</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(161.091,53.285) rotate(-0,12,-4)" font-size="10">
<tspan x="0 6 " fill="rgb(38,38,38)" y="-0">20</tspan>
</text>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="178.09,584.849 1239.78,584.849"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="178.09,49.2852 1239.78,49.2852"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="178.09,584.849 178.09,49.2852"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1239.78,584.849 1239.78,49.2852"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(703.434,615.343) rotate(-0,5.5,-10)" font-size="11">
<tspan x="0 5 " fill="rgb(38,38,38)" y="-3">sp</tspan>
</text>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(140.091,317.067) rotate(-90,16,0)" font-size="11">
<tspan x="0 " fill="rgb(38,38,38)" y="-4">k</tspan>
<tspan x="6 " fill="rgb(38,38,38)" y="-2" font-size="7.7">p</tspan>
<tspan x="10 13 17 22 28 " fill="rgb(38,38,38)" y="-4"> (sp)</tspan>
</text>
<polyline stroke-width="0.5" stroke="#0071bc" fill="none" stroke-linecap="butt" stroke-linejoin="round" points="178.09,49.2852 232.023,504.515 1202.83,544.682"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="175.09,49.2852 181.09,49.2852"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="178.09,46.2852 178.09,52.2852"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="175.968,47.1636 180.211,51.4062"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="175.968,51.4062 180.211,47.1636"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="229.023,504.515 235.023,504.515"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="232.023,501.515 232.023,507.515"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="229.902,502.393 234.145,506.636"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="229.902,506.636 234.145,502.393"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1199.83,544.682 1205.83,544.682"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1202.83,541.682 1202.83,547.682"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1200.71,542.561 1204.95,546.803"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1200.71,546.803 1204.95,542.561"/>
</g>
<clipPath id="cp001369657">
<polygon points="0,657 1369,657 1369,0 0,0"/>
</clipPath>
<g clip-path="url(#cp001369657)">
<polygon fill="#ffffff" shape-rendering="crispEdges" points="1171.73,120.717 1231.37,120.717 1231.37,57.6943 1171.73,57.6943"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1171.73,120.717 1231.37,120.717"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1171.73,57.6943 1231.37,57.6943"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1171.73,120.717 1171.73,57.6943"/>
<polyline stroke-width="0.5" stroke-dasharray="16,0" stroke="#262626" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1231.37,120.717 1231.37,57.6943"/>
<polyline stroke-width="0.5" stroke="#0071bc" fill="none" stroke-linecap="butt" stroke-linejoin="round" points="1175.94,67.8989 1196.96,67.8989"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(1201.16,73.8989) rotate(-0,-0,-6)" font-size="9">
<tspan x="0 " fill="rgb(0,0,0)" y="-4">k</tspan>
<tspan x="5 " fill="rgb(0,0,0)" y="-2" font-size="6.3">p</tspan>
</text>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1183.45,83.1035 1189.45,83.1035"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1186.45,80.1035 1186.45,86.1035"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1184.33,80.9824 1188.57,85.2246"/>
<polyline stroke-width="0.5" stroke="#ff0000" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1184.33,85.2246 1188.57,80.9824"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(1201.16,88.1035) rotate(-0,-0,-5)" font-size="9">
<tspan x="0 4 9 11 13 15 17 21 " fill="rgb(0,0,0)" y="-2">x0 | y0</tspan>
</text>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1183.45,97.3081 1189.45,97.3081"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1186.45,94.3081 1186.45,100.308"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1184.33,95.187 1188.57,99.4297"/>
<polyline stroke-width="0.5" stroke="#00ff00" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1184.33,99.4297 1188.57,95.187"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(1201.16,102.308) rotate(-0,-0,-5)" font-size="9">
<tspan x="0 4 9 11 13 15 17 21 " fill="rgb(0,0,0)" y="-2">x1 | y1</tspan>
</text>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1183.45,111.513 1189.45,111.513"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1186.45,108.513 1186.45,114.513"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1184.33,109.392 1188.57,113.634"/>
<polyline stroke-width="0.5" stroke="#0000ff" fill="none" stroke-linecap="square" stroke-linejoin="miter" points="1184.33,113.634 1188.57,109.392"/>
<text xml:space="preserve" font-family="FreeSans" font-style="normal" font-weight="normal" transform="translate(1201.16,116.513) rotate(-0,-0,-5)" font-size="9">
<tspan x="0 4 9 11 13 15 17 21 " fill="rgb(0,0,0)" y="-2">x2 | y2</tspan>
</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

+159
View File
@@ -0,0 +1,159 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg width="1369pt" height="657pt" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1369 657" xmlns="http://www.w3.org/2000/svg">
<title>gl2ps_renderer figure</title>
<desc>
Creator: GL2PS 1.4.2, (C) 1999-2020 C. Geuzaine
For: Octave
CreationDate: Mon Aug 1 18:41:06 2022
</desc>
<defs/>
<polygon points="0,0 1369,0 1369,657 0,657" fill="#ffffff"/>
<g>
<polygon points="0,657 1369,657 1369,0 0,0" shape-rendering="crispEdges" fill="#ffffff"/>
<clipPath id="cp001369657">
<polygon points="0,657 1369,657 1369,0 0,0"/>
</clipPath>
<g clip-path="url(#cp001369657)">
<polygon points="178.09,584.849 1239.78,584.849 1239.78,49.2852 178.09,49.2852" shape-rendering="crispEdges" fill="#ffffff"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,584.849 178.09,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,49.2852 178.09,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="390.427,584.849 390.427,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="390.427,49.2852 390.427,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="602.765,584.849 602.765,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="602.765,49.2852 602.765,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="815.103,584.849 815.103,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="815.103,49.2852 815.103,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1027.44,584.849 1027.44,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1027.44,49.2852 1027.44,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,584.849 1239.78,574.241" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,49.2852 1239.78,59.8931" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(175.09,600.343) rotate(-0,3,-8)">
<tspan y="-0" x="0 " fill="rgb(38,38,38)">0</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(381.427,600.343) rotate(-0,9,-8)">
<tspan y="-0" x="0 6 12 " fill="rgb(38,38,38)">500</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(590.765,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(803.103,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1500</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1015.44,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1227.78,600.343) rotate(-0,12,-8)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2500</tspan>
</text>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,584.849 188.704,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,584.849 1229.16,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,477.736 188.704,477.736" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,477.736 1229.16,477.736" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,370.624 188.704,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,370.624 1229.16,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,263.511 188.704,263.511" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,263.511 1229.16,263.511" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,156.398 188.704,156.398" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,156.398 1229.16,156.398" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="178.09,49.2852 188.704,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#262626" stroke-linecap="butt" points="1239.78,49.2852 1229.16,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(167.091,588.849) rotate(-0,6,-4)">
<tspan y="-0" x="0 " fill="rgb(38,38,38)">0</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,481.736) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">1000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,374.624) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">2000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,267.511) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">3000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,160.398) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">4000</tspan>
</text>
<text font-size="10" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(149.091,53.285) rotate(-0,24,-4)">
<tspan y="-0" x="0 6 12 18 " fill="rgb(38,38,38)">5000</tspan>
</text>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,584.849 1239.78,584.849" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,49.2852 1239.78,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="178.09,584.849 178.09,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1239.78,584.849 1239.78,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="11" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(703.434,615.343) rotate(-0,5.5,-10)">
<tspan y="-3" x="0 5 " fill="rgb(38,38,38)">sp</tspan>
</text>
<text font-size="11" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(105.591,317.067) rotate(-90,38.5,0)">
<tspan y="-3" x="0 7 17 26 30 36 42 47 53 55 58 62 67 73 " fill="rgb(38,38,38)">PWM-Level (sp)</tspan>
</text>
<polyline stroke="#0071bc" stroke-linecap="butt" points="178.09,370.624 1041.03,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<polyline stroke="#d85218" stroke-linecap="butt" points="178.09,381.335 1041.03,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.09,370.624 181.09,370.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="178.09,367.624 178.09,373.624" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,368.502 180.211,372.745" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,372.745 180.211,368.502" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.03,49.2852 1044.03,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1041.03,46.2852 1041.03,52.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,47.1636 1043.15,51.4062" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,51.4062 1043.15,47.1636" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.09,381.335 181.09,381.335" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="178.09,378.335 178.09,384.335" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,379.213 180.211,383.456" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="175.968,383.456 180.211,379.213" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.03,49.2852 1044.03,49.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1041.03,46.2852 1041.03,52.2852" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,47.1636 1043.15,51.4062" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1038.91,51.4062 1043.15,47.1636" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="9,7" stroke="#00ff00" stroke-linecap="butt" points="609.56,584.849 609.56,49.2852" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
</g>
<clipPath id="cp001369657">
<polygon points="0,657 1369,657 1369,0 0,0"/>
</clipPath>
<g clip-path="url(#cp001369657)">
<polygon points="1103.73,159.161 1231.37,159.161 1231.37,57.6943 1103.73,57.6943" shape-rendering="crispEdges" fill="#ffffff"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,159.161 1231.37,159.161" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,57.6943 1231.37,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1103.73,159.161 1103.73,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke-dasharray="16,0" stroke="#262626" stroke-linecap="square" points="1231.37,159.161 1231.37,57.6943" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#0071bc" stroke-linecap="butt" points="1107.94,66.3989 1128.96,66.3989" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,70.8989) rotate(-0,-0,-4.5)">
<tspan y="-1" x="0 3 8 11 18 23 26 " fill="rgb(0,0,0)">forward</tspan>
</text>
<polyline stroke="#d85218" stroke-linecap="butt" points="1107.94,79.5186 1128.96,79.5186" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,82.5184) rotate(-0,-0,-3)">
<tspan y="-0" x="0 3 8 12 17 20 24 " fill="rgb(0,0,0)">reverse</tspan>
</text>
<polyline stroke="#ff0000" stroke-linecap="square" points="1115.45,93.1377 1121.45,93.1377" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1118.45,90.1377 1118.45,96.1377" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,91.0166 1120.57,95.2593" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,95.2593 1120.57,91.0166" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,98.1379) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 41 46 " fill="rgb(0,0,0)">x1 | y1 (fwd)</tspan>
</text>
<polyline stroke="#00ff00" stroke-linecap="square" points="1115.45,107.342 1121.45,107.342" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1118.45,104.342 1118.45,110.342" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,105.221 1120.57,109.464" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,109.464 1120.57,105.221" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,112.342) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 41 46 " fill="rgb(0,0,0)">x2 | y2 (fwd)</tspan>
</text>
<polyline stroke="#ff0000" stroke-linecap="square" points="1115.45,121.547 1121.45,121.547" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1118.45,118.547 1118.45,124.547" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,119.426 1120.57,123.668" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#ff0000" stroke-linecap="square" points="1116.33,123.668 1120.57,119.426" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,126.547) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 39 43 " fill="rgb(0,0,0)">x1 | y1 (rev)</tspan>
</text>
<polyline stroke="#00ff00" stroke-linecap="square" points="1115.45,135.752 1121.45,135.752" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1118.45,132.752 1118.45,138.752" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,133.63 1120.57,137.873" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<polyline stroke="#00ff00" stroke-linecap="square" points="1116.33,137.873 1120.57,133.63" stroke-linejoin="miter" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,140.752) rotate(-0,-0,-5)">
<tspan y="-2" x="0 4 9 11 13 15 17 21 26 28 31 34 39 43 " fill="rgb(0,0,0)">x2 | y2 (rev)</tspan>
</text>
<polyline stroke-dasharray="9,7" stroke="#00ff00" stroke-linecap="butt" points="1107.94,149.957 1128.96,149.957" stroke-linejoin="round" fill="none" stroke-width="0.5"/>
<text font-size="9" font-style="normal" xml:space="preserve" font-family="FreeSans" font-weight="normal" transform="translate(1133.16,154.956) rotate(-0,-0,-5)">
<tspan y="-2" x="0 5 10 12 17 21 24 31 36 41 44 46 49 54 57 62 66 71 76 78 83 85 89 " fill="rgb(0,0,0)">adjustment threshold y2</tspan>
</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB

@@ -1,8 +1,9 @@
Overview
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/Block_Diagram_Hardware.svg
:alt: Block Diagram
:align: center
Harware block diagram
@@ -22,7 +23,7 @@ The above block diagram gives a general overview regarding the operation of comp
- Crystal oscillator
Electrical Characteristics
====================
==============================
.. table:: Electrical Characteristics & Absolute Maximum Ratings
:widths: auto
@@ -46,10 +47,11 @@ Electrical Characteristics
(2): According to: `T2N7002BK Datasheet <https://toshiba.semicon-storage.com/info/T2N7002BK_datasheet_en_20191025.pdf?did=30376&prodName=T2N7002BK>`_
Input Stage
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/Input_Stage.svg
:alt: Input Stage
:align: center
Input stage
@@ -58,20 +60,22 @@ D1 Rectifies the DCC square-wave into +V, the amplitude is not critical as long
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V\ :sub:`GS`\ > V\ :sub:`GS,th`\), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V\ :sub:`GS`\ doesn't exceed ±20V.
Motor Driver
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/Motor_Driver.svg
:alt: Motor Driver
:align: center
Motor driver
The Motor Driver is a special H-Bridge IC that is made for DC motors. To control the motor, it is necessary to measure the back-EMF voltage, which is directly related to the motor's speed. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B. The two resistors work together as a voltage divider.
Auxiliary Outputs
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/Aux_Outputs.svg
:alt: Auxiliary Outputs
:align: center
Auxiliary Outputs
@@ -79,31 +83,33 @@ Switching of loads can be done using four N-Channel MOSFETs (Q2 to Q5). The amou
GPIO
====================
==============================
To switch lighter loads, six GPIO soldering pads are connected to GPIO0 to GPIO5 pins. Although not yet set up in the software, they could be used as inputs as well (e.g. reed switch). GPIO0 and GPIO1 can also be used to facilitate stdio logging via UART, which can easily be set up in CMakeLists.txt.
Microcontroller
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/Microcontroller.svg
:alt: Microcontroller
:align: center
Microcontroller, flash memory, crystal oscillator, ...
The Microcontroller needs a crystal oscillator for its clock. External flash memory holds the configuration variables and the program itself. R3 & C14 are used to filter ADC_AVDD (ADC Reference Voltage).
Complete Schematic
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/RP2040-Decoder.svg
:alt: Complete Schematic
:align: center
Complete Schematic
BOM & Alternative Parts
====================
==============================
.. table:: BOM
:widths: auto
@@ -142,14 +148,16 @@ Alternative for HT7533S:
.. _wiring_rev_0_3:
Wiring the Decoder
====================
==============================
.. figure:: ../../../../svg/hw/rev_0_3/Wiring_diagram.svg
:width: 700
:alt: Wiring Diagram
:align: center
:width: 700
:alt: Wiring Diagram
Wiring Diagram
Wiring Diagram
The illustration above provides an example of a wiring configuration.
It supports the connection of up to 4 transistor-switched outputs and 6 GPIOs for lighter loads or custom applications.
@@ -1,7 +1,8 @@
Overview
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/Block_Diagram_Hardware.svg
:align: center
:alt: Block Diagram
Harware block diagram
@@ -23,7 +24,7 @@ The above block diagram gives a general overview regarding the operation of comp
- USB Connector
Electrical Characteristics
====================
==============================
.. table:: Electrical Characteristics & Absolute Maximum Ratings
:widths: auto
@@ -49,9 +50,10 @@ Electrical Characteristics
(3): T\ :sub:`Case`\ = 25°C, keep power dissipation, thermal resistance the corresponding temperature rise ΔT and switching losses in PWM mode in mind!
Input Stage
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/Input_Stage.svg
:align: center
:alt: Input Stage
Input stage
@@ -60,9 +62,10 @@ D2 Rectifies the DCC square-wave into VDC, the amplitude is not critical as long
The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V\ :sub:`GS`\ > V\ :sub:`GS,th`\), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V\ :sub:`GS`\ doesn't exceed ±12V.
Motor Driver
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/Motor_Driver.svg
:align: center
:alt: Motor Driver
Motor driver
@@ -70,9 +73,10 @@ Motor Driver
The Motor Driver is a special H-Bridge IC that is made for DC motors. To control the motor, it is necessary to measure the back-EMF voltage, which is directly related to the motor's speed. This is done by the ADC, which measures at Points ADC_EMF_A and ADC_EMF_B. The two resistors work together as a voltage divider.
Auxiliary Outputs
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/Aux_Outputs.svg
:align: center
:alt: Auxiliary Outputs
Auxiliary Outputs
@@ -80,14 +84,15 @@ Auxiliary Outputs
Switching of loads can be done using four N-Channel MOSFETs (Q2 to Q5). The amount of current is somewhat dependend on either static R\ :sub:`DS(on)`\ losses and/or switching losses using PWM. They are switching on the low-side, which means the load effectively gets connected to GND potential as the transistor starts to conduct. GPIO24 - GPIO27 are used.
GPIO
====================
==============================
To switch lighter loads, six GPIO soldering pads are connected to GPIO0 to GPIO5 pins. Although not yet set up in the software, they could be used as inputs as well (e.g. reed switch). GPIO0 and GPIO1 can also be used to facilitate stdio logging via UART, which can easily be set up in CMakeLists.txt.
Microcontroller
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/Microcontroller.svg
:align: center
:alt: Microcontroller
Microcontroller, flash memory, crystal oscillator, USB connector, ...
@@ -95,15 +100,16 @@ Microcontroller
The Microcontroller needs a crystal oscillator for its clock. External flash memory holds the configuration variables and the program itself. The USB connector can be used to flash the software onto the decoder and also for logging via stdio (can be enabled via CMakeLists.txt). D3 is used as a status LED. R11 & C13 are used to filter ADC_AVDD (ADC Reference Voltage).
Complete Schematic
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/RP2040-Decoder.svg
:align: center
:alt: Complete Schematic
Complete Schematic
BOM & Alternative Parts
====================
==============================
.. table:: BOM
:widths: auto
@@ -142,12 +148,14 @@ Alternative for HT7533S:
.. _wiring_rev_1_0:
Wiring the Decoder
====================
==============================
.. figure:: ../../../../svg/hw/rev_1_0/Wiring_diagram.svg
:width: 700
:alt: Wiring Diagram
:align: center
Wiring Diagram
-1
View File
@@ -15,4 +15,3 @@ RP2040-Decoder Documentation
software/index
other/index
other/troubleshooting
other/debugging
@@ -1,20 +1,21 @@
Getting started
===============
==================================
1. Where to get the board?
--------------------------
----------------------------------
You can choose any PCB manufacturer you like.The PCB is designed to fit with JLCPCB.com's capabilities and constraints.You can assemble the board yourself, but it's best not to do so if you're not familiar with soldering small components. Alternatively, you can order the board fully or partly assembled.Soldering the back of the PCB by hand is not too difficult. All parts are normally available at LCSC.com, who supply parts to JLCPCB.com.
2. Production files?
---------------------
----------------------------------
In order to export the production files (Gerber/BOM/Pick and Place), you need `KiCad <https://www.kicad.org/download/>`_ which is open source.
In case you are ordering from JLCPCB it is recommended to use the `Fabrication-Toolkit KiCad plugin by bennymeg <https://github.com/bennymeg/Fabrication-Toolkit>`_
.. _building_the_software:
3. Building the software
------------------------
----------------------------------
If you got a RP2040-Decoder with USB the easiest way to get the RP2040-Decoder up and running is to just use the precompiled .uf2 file and ignore the rest of this section.
@@ -22,8 +23,10 @@ However sometimes you might want to build by yourself, be it for debugging or to
The easiest way to do this is to just use `Visual Studio Code <https://code.visualstudio.com/>`_ and the Raspberry Pi Pico extension.
The `official documentation <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension>`_ of the Pi Pico does a great job of explaining this in detail.
Note: If you are building for Hardware Rev 0.3 or below change the board defintion in your CMakeLists.txt file to: "RP2040-Decoder-board-legacy.h"
4. Flashing the software
------------------------
----------------------------------
For RP2040-Decoders with USB there is two ways of flashing the software:
@@ -37,21 +40,21 @@ For RP2040-Decoders with USB there is two ways of flashing the software:
For RP2040-Decoders without USB the only way of flashing the software is via SWD
4.1. Flashing the software via .uf2 file
^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When first plugged in the RP2040 boots into Mass Storage Device mode. To flash the software, you need to drag the '.uf2' file onto the disk using any file explorer.
This will write the file to the Flash and restart the RP2040.
In case you want to repeat the flasing process, temporarily connect the solder bridge called JP1 on the back side of the board and power cycle the device.
This procedure is also described in the `Raspberry Pi Pico Datasheet Chapter 4.1 <https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf#_programming_the_flash>`_
4.2. Flashing the software via SWD
^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Flashing via SWD is a little more complicated but also comes with great advantages in terms of debugging.
The book on `Getting started with Raspberry Pi Pico-series <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf>`_ does a great job of explaining how debugging works.
As already suggested in :ref:`3. <building_the_software>` it is recommended to use the `Visual Studio Code Extension <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension>`_.
Most relevant in the book are `Chapter 4.3. Debug <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#_debug>`_ and `Appendix A: Debugprobe <https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#debugprobe_section>`_
5. Wiring
---------
----------------------------------
| Please refer to the hardware section for your board:
| :ref:`Wiring Rev 1.0 <wiring_rev_1_0>`
@@ -2,27 +2,27 @@ Header files
=================
core0.h
-------
--------------
.. doxygenfile:: core0.h
:project: RP2040-Decoder
core1.h
-------
--------------
.. doxygenfile:: core1.h
:project: RP2040-Decoder
shared.h
-------
--------------
.. doxygenfile:: shared.h
:project: RP2040-Decoder
CV.h
-------
--------------
.. doxygenfile:: CV.h
:project: RP2040-Decoder
@@ -1,82 +0,0 @@
# Software Description
## Overview
The Software is structured as follows:
* Core0.c
- DCC package detection & decoding
- Programming mode (Modify and read CVs on programming track)
- ADC-Offset measurement
- Feed-forward base PWM measurement
* Core1.c
- PID motor controller
* CV.h
- Default configuration variables
Conveniently The Raspberry Pi Foundation provides a well documented [SDK](https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf) for the RP2040. The SDK provides abstraction to a higher level and therefore there is no need to access any registers directly. Everything is written using the SDK so hopefully the code is easier to understand. In the following, the motor control and the decoding of the DCC signals will be explained.
## Motor control overview
![Block Diagram](https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Block_Diagram_Control.svg)
***
**Block diagram - Motor control**
The above block diagram in essence describes the functionality of the control loop. While the central component is the PID controller, there is an additional block called [Feed-forward](https://en.wikipedia.org/wiki/Feed_forward_(control)) that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint, this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block is corresponding to the speed_helper() function which delays changing the setpoint according to the configured deceleration/acceleration rates.
## PID Controller
![PID Controller](https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/Block_Diagram_PID.svg)
The block diagram above shows the PID controller in the s-domain. The derivative part contains an additional digital low pass filter used to filter out high-frequency noise.
Output = E * (K<sub>P</sub> + K<sub>I</sub>/s + (K<sub>D</sub>*s)/(sτ+1)) = P + I + D
* P = E * K<sub>P</sub>
* I = E * K<sub>I</sub>/s
* D = E * (K<sub>D</sub>*s)/(sτ+1)
The continuous-time system representation can now be transformed into a discrete-time representation using [bilinear transform](https://en.wikipedia.org/wiki/Bilinear_transform) [ s = 2*(z-1) / T<sub>s</sub>*(z+1) ].
This results in the following difference equations which are then implemented in software:
* p<sub>n</sub> = K<sub>P</sub> * e<sub>n</sub>
* i<sub>n</sub> = 0.5K<sub>I</sub> * (e<sub>n</sub> + e<sub>n-1</sub>) + i<sub>n-1</sub>
* d<sub>n</sub> = [ 2K<sub>D</sub> * (e<sub>n</sub> - e<sub>n-1</sub>) + (2τ - T<sub>s</sub>) * d<sub>n-1</sub> ] / [ 2τ + T<sub>s</sub>]
=> output<sub>n</sub> = p<sub>n</sub> + i<sub>n</sub> + d<sub>n</sub>
Also note that instead of using derivative of error, derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint.
### Gain scheduling
![K_P](https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/adaptive_kp.svg)
Another aspect to consider is the implementation of [gain scheduling](https://en.wikipedia.org/wiki/Gain_scheduling). K<sub>P</sub> is a function of the current setpoint. Often it is favorable to have a higher proportional gain K<sub>P</sub> for slow speeds, achieving better control results. The illustration above shows the default setting for K<sub>P</sub>. CV_54 & CV_55 are used to set K<sub>P</sub> @ x<sub>0</sub>, CV_56 & CV_57 for K<sub>P</sub> @ x<sub>1</sub> and CV_58 & CV_59 for K<sub>P</sub> @ x<sub>2</sub>. Additionally CV_60 is used to shift x<sub>1</sub> from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).
### Feed-forward
![Feed-forward](https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/feed_forward.svg)
To achieve better control [Feed-forward](https://en.wikipedia.org/wiki/Feed_forward_(control)) is used. On startup the decoder will check for a configuration regarding Feed-forward control - when no configuration is found the decoder automatically runs a calibration to establish a base pwm level (y<sub>1</sub>) for both directions. The base pwm level (y<sub>1</sub>) will vary depending on load, motor and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y<sub>2</sub> is corrected automatically when i<sub>n</sub> reaches 0.5i<sub>min</sub> or 0.5i<sub>max</sub>. CV_47 can be used to set how sensitive this correction is.
### Back-EMF voltage measurement
To provide a feedback signal which is proportional to the motor speed the ADC is used to measure the [Back-EMF voltage](https://en.wikipedia.org/wiki/Counter-electromotive_force). The measurement works by setting the PWM duty cycle to 0%, waiting for a certain delay time (CV_62) and then measuring x times (x = CV_63). While measuring the array with measurement values are being sorted using insertion sort. Afterwards y elements (y = CV_63) from the left (lowest values) and z elements (z = CV_64) from the right (highest values) will be dismissed to mitigate the impact of potential outliers in measurement. The average value of the remaining values will be computed and fed back into the control algorithm. Considering default settings (100us delay, 100 samples, ~2µs sampling time) the complete measurement run including averaging takes about 0.3ms to 0.35ms which effectively reduces the maximum possible duty cycle to about 93% to 94%.
## DCC signal decoding
The detection of the DCC signal works by looking at every rising and falling edge and calculating the time between them. When the time between rising and falling edge is greater than 87μs then this is equivalent to "0", else "1" - This value then gets shifted into a 64-Bit variable.
Decoding is done after every falling edge. It starts with an error detection which when not passed will dismiss the received command. Then the address will be decoded and compared to the address stored in the configuration. If the address matches the command/instruction will be decoded.
Only a few instructions are currently implemented, only 128 speed step instructions are supported.
**Implemented instructions:**
* 0011-1111 - (128 Speed Step Control) - 2 Byte length
* 10XX-XXXX - (Function Group Instruction) (F0 - F12)
* 110X-XXXX - Expansion Instruction (F13 - F31)
All DCC instructions can be found in Section 9.2, 9.2.1 and 9.2.1.1 of the [NMRA Communications Standard ](https://www.nmra.org/index-nmra-standards-and-recommended-practices)
@@ -0,0 +1,151 @@
Software Description
==============================
Overview
------------------------------
Software files high level overview:
- **core0.c / core0.h**
- DCC package detection & decoding
- Programming mode (Modify and read CVs on programming track)
- ADC-Offset measurement
- **core1.c / core0.h**
- PID motor controller
- Back-EMF voltage measurement
- **shared.c / shared.h** (used by both cores)
- Error handling
- Helper functions for retrieving CV's
- **CV.h**
- Default configuration variables
- **CMakeLists.txt**
- CMake version, SDK version, C standard version
- Board definitions
- Compile/Build options
- Sources files, header files
- Debug logging configuration (via stdio using UART/USB)
- Linked libraries
- **RP2040-Decoder-board.h or RP2040-Decoder-board-legacy.h**
- Flash Size
- Pin specification
- LED pin when available
- UART_TX/UART_RX when used
- DCC input pin
- Motor Control PWM pins
- ADC pins
Conveniently, The Raspberry Pi Foundation provides a well-documented `SDK <https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf>`_ for the RP2040. The SDK provides abstraction to a higher level, and therefore there is no need to access any registers directly. Everything is written using the SDK, so hopefully, the code is easier to understand.
Motor control
------------------------------
.. figure:: ../../../svg/sw/Block_Diagram_Control.svg
:alt: Block Diagram
:align: center
Motor control - Block diagram
The above block diagram in essence describes the functionality of the control loop. While the central component is the PID controller, there is an additional block called `Feed-forward <https://en.wikipedia.org/wiki/Feed_forward_(control)>`_ that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the ``speed_helper()`` function, which delays changing the setpoint according to the configured deceleration/acceleration rates.
PID Controller
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ../../../svg/sw/Block_Diagram_PID.svg
:alt: PID Controller figure
:align: center
PID Controller
The block diagram above shows the PID controller in the s-domain. The derivative part contains an additional digital low-pass filter used to filter out high-frequency noise.
.. math::
\begin{align}
\text{Output} &= E \cdot \left(K_P + \frac{K_I}{s} + \frac{K_D \cdot s}{s \tau + 1}\right) = P + I + D \\
P &= E \cdot K_P \\
I &= E \cdot \frac{K_I}{s} \\
D &= E \cdot \frac{K_D \cdot s}{s \tau + 1}
\end{align}
With :math:`T_s` being the sampling time / controller update rate / time step of the discrete system.
And :math:`\tau` being the filter time constant of the digital filter
The continuous-time system representation can now be transformed into a discrete-time representation using `bilinear transform <https://en.wikipedia.org/wiki/Bilinear_transform>`_ :math:`s = \frac{2 \cdot (z - 1)}{T_s \cdot (z + 1)}`.
This results in the following difference equations which are then implemented in software:
.. math::
\begin{align}
p_n &= K_P \cdot e_n \\
i_n &= 0.5 \cdot K_I \cdot \left(e_n + e_{n-1}\right) + i_{n-1} \\
d_n &= \frac{2 K_D \cdot \left(e_n - e_{n-1}\right) + \left(2 \tau - T_s\right) \cdot d_{n-1}}{2 \tau + T_s} \\
\text{output}_n &= p_n + i_n + d_n
\end{align}
Also note that instead of using the derivative of error, the derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint.
Gain Scheduling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ../../../svg/sw/adaptive_kp.svg
:alt: Gain Scheduling figure
:align: center
Gain Scheduling
Another aspect to consider is the implementation of `gain scheduling <https://en.wikipedia.org/wiki/Gain_scheduling>`_. K\ :sub:`P` is a function of the current setpoint. Often it is favorable to have a higher proportional gain K\ :sub:`P` for slow speeds, achieving better control results. The illustration above shows the default setting for K\ :sub:`P`. CV_54 & CV_55 are used to set K\ :sub:`P` @ x\ :sub:`0`, CV_56 & CV_57 for K\ :sub:`P` @ x\ :sub:`1`, and CV_58 & CV_59 for K\ :sub:`P` @ x\ :sub:`2`. Additionally, CV_60 is used to shift x\ :sub:`1` from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).
Feed-forward
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. figure:: ../../../svg/sw/feed_forward.svg
:alt: Feed forward figure
:align: center
Feed-forward
TODO: Update this part:
To achieve better control, `Feed-forward <https://en.wikipedia.org/wiki/Feed_forward_(control)>`_ is used. On startup, the decoder will check for a configuration regarding Feed-forward control. When no configuration is found, the decoder automatically runs a calibration to establish a base PWM level (y\ :sub:`1`) for both directions. The base PWM level (y\ :sub:`1`) will vary depending on load, motor, and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y\ :sub:`2` is corrected automatically when i\ :sub:`n` reaches 0.5i\ :sub:`min` or 0.5i\ :sub:`max`. CV_47 can be used to set how sensitive this correction is.
Back-EMF voltage measurement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To provide a feedback signal proportional to the motor speed, the ADC is used to measure the `Back-EMF voltage <https://en.wikipedia.org/wiki/Counter-electromotive_force>`_. The measurement works by setting the PWM duty cycle to 0%, waiting for a certain delay time (CV_62), and then measuring x times (x = CV_63). While measuring, the array with measurement values is sorted using insertion sort. Afterwards, y elements (y = CV_63) from the left (lowest values) and z elements (z = CV_64) from the right (highest values) will be dismissed to mitigate the impact of potential outliers in measurement. The average value of the remaining values will be computed and fed back into the control algorithm. Considering default settings (100us delay, 100 samples, ~2µs sampling time), the complete measurement run, including averaging, takes about 0.3ms to 0.35ms, which effectively reduces the maximum possible duty cycle to about 93% to 94%.
DCC signal decoding
------------------------------
The detection of the DCC signal works by looking at every rising and falling edge and calculating the time between them. When the time between rising and falling edge is greater than 87μs, then this is equivalent to "0"; otherwise, "1". This value then gets shifted into a 64-Bit variable.
Decoding is done after every falling edge. It starts with an error detection, which, when not passed, dismisses the received command. Then the address will be decoded and compared to the address stored in the configuration. If the address matches, the command/instruction will be decoded.
Only a few instructions are currently implemented; only 128 speed step instructions are supported.
**Implemented instructions:**
- ``0011-1111`` - (128 Speed Step Control) - 2 Byte length
- ``10XX-XXXX`` - (Function Group Instruction) (F0 - F12)
- ``110X-XXXX`` - Expansion Instruction (F13 - F31)
All DCC instructions can be found in Section 9.2, 9.2.1, and 9.2.1.1 of the `NMRA Communications Standard <https://www.nmra.org/index-nmra-standards-and-recommended-practices>`_.
@@ -102,7 +102,7 @@
<section id="overview">
<h1>Overview<a class="headerlink" href="#overview" title="Link to this heading"></a></h1>
<figure class="align-default" id="id1">
<figure class="align-center" id="id1">
<img alt="Block Diagram" src="../../_images/Block_Diagram_Hardware.svg" />
<figcaption>
<p><span class="caption-text">Harware block diagram</span><a class="headerlink" href="#id1" title="Link to this image"></a></p>
@@ -207,7 +207,7 @@
</section>
<section id="input-stage">
<h1>Input Stage<a class="headerlink" href="#input-stage" title="Link to this heading"></a></h1>
<figure class="align-default" id="id3">
<figure class="align-center" id="id3">
<img alt="Input Stage" src="../../_images/Input_Stage.svg" />
<figcaption>
<p><span class="caption-text">Input stage</span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
@@ -218,7 +218,7 @@
</section>
<section id="motor-driver">
<h1>Motor Driver<a class="headerlink" href="#motor-driver" title="Link to this heading"></a></h1>
<figure class="align-default" id="id4">
<figure class="align-center" id="id4">
<img alt="Motor Driver" src="../../_images/Motor_Driver.svg" />
<figcaption>
<p><span class="caption-text">Motor driver</span><a class="headerlink" href="#id4" title="Link to this image"></a></p>
@@ -228,7 +228,7 @@
</section>
<section id="auxiliary-outputs">
<h1>Auxiliary Outputs<a class="headerlink" href="#auxiliary-outputs" title="Link to this heading"></a></h1>
<figure class="align-default" id="id5">
<figure class="align-center" id="id5">
<img alt="Auxiliary Outputs" src="../../_images/Aux_Outputs.svg" />
<figcaption>
<p><span class="caption-text">Auxiliary Outputs</span><a class="headerlink" href="#id5" title="Link to this image"></a></p>
@@ -242,7 +242,7 @@
</section>
<section id="microcontroller">
<h1>Microcontroller<a class="headerlink" href="#microcontroller" title="Link to this heading"></a></h1>
<figure class="align-default" id="id6">
<figure class="align-center" id="id6">
<img alt="Microcontroller" src="../../_images/Microcontroller.svg" />
<figcaption>
<p><span class="caption-text">Microcontroller, flash memory, crystal oscillator, …</span><a class="headerlink" href="#id6" title="Link to this image"></a></p>
@@ -252,7 +252,7 @@
</section>
<section id="complete-schematic">
<h1>Complete Schematic<a class="headerlink" href="#complete-schematic" title="Link to this heading"></a></h1>
<figure class="align-default" id="id7">
<figure class="align-center" id="id7">
<img alt="Complete Schematic" src="../../_images/RP2040-Decoder.svg" />
<figcaption>
<p><span class="caption-text">Complete Schematic</span><a class="headerlink" href="#id7" title="Link to this image"></a></p>
@@ -383,7 +383,7 @@
</section>
<section id="wiring-the-decoder">
<span id="wiring-rev-0-3"></span><h1>Wiring the Decoder<a class="headerlink" href="#wiring-the-decoder" title="Link to this heading"></a></h1>
<figure class="align-default" id="id9">
<figure class="align-center" id="id9">
<a class="reference internal image-reference" href="../../_images/Wiring_diagram.svg"><img alt="Wiring Diagram" src="../../_images/Wiring_diagram.svg" style="width: 700px;" />
</a>
<figcaption>
@@ -101,7 +101,7 @@
<section id="overview">
<h1>Overview<a class="headerlink" href="#overview" title="Link to this heading"></a></h1>
<figure class="align-default" id="id1">
<figure class="align-center" id="id1">
<img alt="Block Diagram" src="../../_images/Block_Diagram_Hardware1.svg" />
<figcaption>
<p><span class="caption-text">Harware block diagram</span><a class="headerlink" href="#id1" title="Link to this image"></a></p>
@@ -208,7 +208,7 @@
</section>
<section id="input-stage">
<h1>Input Stage<a class="headerlink" href="#input-stage" title="Link to this heading"></a></h1>
<figure class="align-default" id="id3">
<figure class="align-center" id="id3">
<img alt="Input Stage" src="../../_images/Input_Stage1.svg" />
<figcaption>
<p><span class="caption-text">Input stage</span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
@@ -217,8 +217,8 @@
<p>D2 Rectifies the DCC square-wave into VDC, the amplitude is not critical as long as it’s within the 25V limit. The rectified voltage VDC is then provided to the 3.3V voltage regulator and to the motor driver. The shottky diode D1 and the bridge rectifier D2 ensure a logical “or” linkage of the VBUS supply voltages and the DCC input voltage</p>
<p>The MOSFET on the right effectively translates the rather high DCC voltage to a suitable level for the microcontroller to process. When Q1 is turned off GPIO21 is pulled high by the RP2040 internal pull-up resistor, as soon as Q1 gets turned on (V<sub>GS</sub>&gt; V<sub>GS,th</sub>), GPIO21 gets pulled to GND potential. R1 and R2 ensure that V<sub>GS</sub>doesn’t exceed ±12V.
Motor Driver
====================</p>
<figure class="align-default" id="id4">
==============================</p>
<figure class="align-center" id="id4">
<img alt="Motor Driver" src="../../_images/Motor_Driver1.svg" />
<figcaption>
<p><span class="caption-text">Motor driver</span><a class="headerlink" href="#id4" title="Link to this image"></a></p>
@@ -228,7 +228,7 @@ Motor Driver
</section>
<section id="auxiliary-outputs">
<h1>Auxiliary Outputs<a class="headerlink" href="#auxiliary-outputs" title="Link to this heading"></a></h1>
<figure class="align-default" id="id5">
<figure class="align-center" id="id5">
<img alt="Auxiliary Outputs" src="../../_images/Aux_Outputs1.svg" />
<figcaption>
<p><span class="caption-text">Auxiliary Outputs</span><a class="headerlink" href="#id5" title="Link to this image"></a></p>
@@ -242,7 +242,7 @@ Motor Driver
</section>
<section id="microcontroller">
<h1>Microcontroller<a class="headerlink" href="#microcontroller" title="Link to this heading"></a></h1>
<figure class="align-default" id="id6">
<figure class="align-center" id="id6">
<img alt="Microcontroller" src="../../_images/Microcontroller1.svg" />
<figcaption>
<p><span class="caption-text">Microcontroller, flash memory, crystal oscillator, USB connector, …</span><a class="headerlink" href="#id6" title="Link to this image"></a></p>
@@ -252,7 +252,7 @@ Motor Driver
</section>
<section id="complete-schematic">
<h1>Complete Schematic<a class="headerlink" href="#complete-schematic" title="Link to this heading"></a></h1>
<figure class="align-default" id="id7">
<figure class="align-center" id="id7">
<img alt="Complete Schematic" src="../../_images/RP2040-Decoder1.svg" />
<figcaption>
<p><span class="caption-text">Complete Schematic</span><a class="headerlink" href="#id7" title="Link to this image"></a></p>
@@ -383,7 +383,7 @@ Motor Driver
</section>
<section id="wiring-the-decoder">
<span id="wiring-rev-1-0"></span><h1>Wiring the Decoder<a class="headerlink" href="#wiring-the-decoder" title="Link to this heading"></a></h1>
<figure class="align-default" id="id9">
<figure class="align-center" id="id9">
<a class="reference internal image-reference" href="../../svg/hw/rev_1_0/Wiring_diagram.svg"><img alt="Wiring Diagram" src="../../svg/hw/rev_1_0/Wiring_diagram.svg" style="width: 700px;" />
</a>
<figcaption>
+1
View File
@@ -18,6 +18,7 @@
<script src="_static/documentation_options.js?v=6bd3bce2"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="_static/dark_mode_js/default_dark.js?v=fd565c74"></script>
<script src="_static/dark_mode_js/theme_switcher.js?v=358d3910"></script>
<script src="_static/js/theme.js"></script>
+1
View File
@@ -108,6 +108,7 @@ In case you are ordering from JLCPCB it is recommended to use the <a class="refe
<p>However sometimes you might want to build by yourself, be it for debugging or to make your own modifications to the source code.
The easiest way to do this is to just use <a class="reference external" href="https://code.visualstudio.com/">Visual Studio Code</a> and the Raspberry Pi Pico extension.
The <a class="reference external" href="https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf#vscode-extension">official documentation</a> of the Pi Pico does a great job of explaining this in detail.</p>
<p>Note: If you are building for Hardware Rev 0.3 or below change the board defintion in your CMakeLists.txt file to: “RP2040-Decoder-board-legacy.h”</p>
</section>
<section id="flashing-the-software">
<h2>4. Flashing the software<a class="headerlink" href="#flashing-the-software" title="Link to this heading"></a></h2>
+1 -1
View File
@@ -1 +1 @@
Search.setIndex({"alltitles": {"1. Where to get the board?": [[5, "where-to-get-the-board"]], "2. Production files?": [[5, "production-files"]], "3. Building the software": [[5, "building-the-software"]], "4. Flashing the software": [[5, "flashing-the-software"]], "4.1. Flashing the software via .uf2 file": [[5, "flashing-the-software-via-uf2-file"]], "4.2. Flashing the software via SWD": [[5, "flashing-the-software-via-swd"]], "5. Wiring": [[5, "wiring"]], "6. Resolving issues": [[5, "resolving-issues"]], "Alternative for HT7533S:": [[1, "alternative-for-ht7533s"], [2, "alternative-for-ht7533s"]], "Alternatives for BDR6133:": [[1, "alternatives-for-bdr6133"], [2, "alternatives-for-bdr6133"]], "Auxiliary Outputs": [[1, "auxiliary-outputs"], [2, "auxiliary-outputs"]], "BOM": [[1, "id8"], [2, "id8"]], "BOM & Alternative Parts": [[1, "bom-alternative-parts"], [2, "bom-alternative-parts"]], "Back-EMF voltage measurement": [[10, "back-emf-voltage-measurement"]], "CV List": [[4, "cv-list"]], "CV.h": [[8, "cv-h"]], "CV_1 - Basic address": [[4, "cv-1-basic-address"]], "CV_11 - Packet timeout": [[4, "cv-11-packet-timeout"]], "CV_112, CV_113, CV_114, CV_115 - GPIO PWM Configuration": [[4, "cv-112-cv-113-cv-114-cv-115-gpio-pwm-configuration"]], "CV_116 to CV_171 - PWM Slice configuration": [[4, "cv-116-to-cv-171-pwm-slice-configuration"]], "CV_12 - Permitted operating modes": [[4, "cv-12-permitted-operating-modes"]], "CV_17 & CV_18 - 14-Bit extended/long address": [[4, "cv-17-cv-18-14-bit-extended-long-address"]], "CV_172 - ADC Offset": [[4, "cv-172-adc-offset"]], "CV_173 - ADC offset measurement cycles": [[4, "cv-173-adc-offset-measurement-cycles"]], "CV_174 - Additional motor-PWM clock divider.": [[4, "cv-174-additional-motor-pwm-clock-divider"]], "CV_175 - speed_helper timer delay": [[4, "cv-175-speed-helper-timer-delay"]], "CV_176, CV_177, CV_178, CV_179 - Base PWM Level used in feed-forward control": [[4, "cv-176-cv-177-cv-178-cv-179-base-pwm-level-used-in-feed-forward-control"]], "CV_2 - V_min": [[4, "cv-2-v-min"]], "CV_257 to CV_512 - Function Mapping CVs": [[4, "cv-257-to-cv-512-function-mapping-cvs"]], "CV_29 - Decoder Configuration": [[4, "cv-29-decoder-configuration"]], "CV_3 - Acceleration rate": [[4, "cv-3-acceleration-rate"]], "CV_31 & CV_32 - Extended CV pointer (Read-Only)": [[4, "cv-31-cv-32-extended-cv-pointer-read-only"]], "CV_4 - Deceleration rate": [[4, "cv-4-deceleration-rate"]], "CV_47 - Feed-forward gain k_ff": [[4, "cv-47-feed-forward-gain-k-ff"]], "CV_48 - Filter time constant (tau) in ms": [[4, "cv-48-filter-time-constant-tau-in-ms"]], "CV_49 - PID Control sampling time t in ms": [[4, "cv-49-pid-control-sampling-time-t-in-ms"]], "CV_5 - V_max": [[4, "cv-5-v-max"]], "CV_50 - PID Control I Factor": [[4, "cv-50-pid-control-i-factor"]], "CV_51 - PID Control D Factor": [[4, "cv-51-pid-control-d-factor"]], "CV_52 & CV_53 - PID Integral Limits": [[4, "cv-52-cv-53-pid-integral-limits"]], "CV_54 & CV_55 - Gain scheduling config k_p @ x0": [[4, "cv-54-cv-55-gain-scheduling-config-k-p-x0"]], "CV_56 & CV_57 - Gain scheduling config k_p @ x1": [[4, "cv-56-cv-57-gain-scheduling-config-k-p-x1"]], "CV_58 & CV_59 - Gain scheduling config k_p @ x2": [[4, "cv-58-cv-59-gain-scheduling-config-k-p-x2"]], "CV_6 - V_mid": [[4, "cv-6-v-mid"]], "CV_60 - Gain scheduling config x1 shift percentage": [[4, "cv-60-gain-scheduling-config-x1-shift-percentage"]], "CV_61 - Measurement Iterations": [[4, "cv-61-measurement-iterations"]], "CV_62 - Measurement Delay": [[4, "cv-62-measurement-delay"]], "CV_63 & CV_64 - Measurement array cutoffs": [[4, "cv-63-cv-64-measurement-array-cutoffs"]], "CV_65 - New flash variable": [[4, "cv-65-new-flash-variable"]], "CV_7 - Version No. (Read-Only)": [[4, "cv-7-version-no-read-only"]], "CV_8 - Manufacturer (Read-Only)": [[4, "cv-8-manufacturer-read-only"]], "CV_9 - Motor PWM Frequency": [[4, "cv-9-motor-pwm-frequency"]], "Complete Schematic": [[1, "complete-schematic"], [2, "complete-schematic"]], "Configuration Variables (CV)": [[4, null]], "Contents:": [[3, null], [6, null], [9, null]], "DCC signal decoding": [[10, "dcc-signal-decoding"]], "Electrical Characteristics": [[1, "electrical-characteristics"], [2, "electrical-characteristics"]], "Electrical Characteristics & Absolute Maximum Ratings": [[1, "id2"], [2, "id2"]], "Feed-forward": [[10, "feed-forward"]], "GPIO": [[1, "gpio"], [2, "gpio"]], "Gain scheduling": [[10, "gain-scheduling"]], "Getting started": [[5, null]], "Hardware": [[0, null]], "Header files": [[8, null]], "Input Stage": [[1, "input-stage"], [2, "input-stage"]], "Microcontroller": [[1, "microcontroller"], [2, "microcontroller"]], "Motor Driver": [[1, "motor-driver"]], "Motor control overview": [[10, "motor-control-overview"]], "Note": [[4, "note"]], "Other": [[6, null]], "Overview": [[1, null], [2, null], [10, "overview"]], "PID Controller": [[10, "pid-controller"]], "RP2040-Decoder Documentation": [[3, null]], "Revision 0.3": [[0, "revision-0-3"]], "Revision 1.0": [[0Line truncated
Search.setIndex({"alltitles": {"1. Where to get the board?": [[5, "where-to-get-the-board"]], "2. Production files?": [[5, "production-files"]], "3. Building the software": [[5, "building-the-software"]], "4. Flashing the software": [[5, "flashing-the-software"]], "4.1. Flashing the software via .uf2 file": [[5, "flashing-the-software-via-uf2-file"]], "4.2. Flashing the software via SWD": [[5, "flashing-the-software-via-swd"]], "5. Wiring": [[5, "wiring"]], "6. Resolving issues": [[5, "resolving-issues"]], "Alternative for HT7533S:": [[1, "alternative-for-ht7533s"], [2, "alternative-for-ht7533s"]], "Alternatives for BDR6133:": [[1, "alternatives-for-bdr6133"], [2, "alternatives-for-bdr6133"]], "Auxiliary Outputs": [[1, "auxiliary-outputs"], [2, "auxiliary-outputs"]], "BOM": [[1, "id8"], [2, "id8"]], "BOM & Alternative Parts": [[1, "bom-alternative-parts"], [2, "bom-alternative-parts"]], "Back-EMF voltage measurement": [[10, "back-emf-voltage-measurement"]], "CV List": [[4, "cv-list"]], "CV.h": [[8, "cv-h"]], "CV_1 - Basic address": [[4, "cv-1-basic-address"]], "CV_11 - Packet timeout": [[4, "cv-11-packet-timeout"]], "CV_112, CV_113, CV_114, CV_115 - GPIO PWM Configuration": [[4, "cv-112-cv-113-cv-114-cv-115-gpio-pwm-configuration"]], "CV_116 to CV_171 - PWM Slice configuration": [[4, "cv-116-to-cv-171-pwm-slice-configuration"]], "CV_12 - Permitted operating modes": [[4, "cv-12-permitted-operating-modes"]], "CV_17 & CV_18 - 14-Bit extended/long address": [[4, "cv-17-cv-18-14-bit-extended-long-address"]], "CV_172 - ADC Offset": [[4, "cv-172-adc-offset"]], "CV_173 - ADC offset measurement cycles": [[4, "cv-173-adc-offset-measurement-cycles"]], "CV_174 - Additional motor-PWM clock divider.": [[4, "cv-174-additional-motor-pwm-clock-divider"]], "CV_175 - speed_helper timer delay": [[4, "cv-175-speed-helper-timer-delay"]], "CV_176, CV_177, CV_178, CV_179 - Base PWM Level used in feed-forward control": [[4, "cv-176-cv-177-cv-178-cv-179-base-pwm-level-used-in-feed-forward-control"]], "CV_2 - V_min": [[4, "cv-2-v-min"]], "CV_257 to CV_512 - Function Mapping CVs": [[4, "cv-257-to-cv-512-function-mapping-cvs"]], "CV_29 - Decoder Configuration": [[4, "cv-29-decoder-configuration"]], "CV_3 - Acceleration rate": [[4, "cv-3-acceleration-rate"]], "CV_31 & CV_32 - Extended CV pointer (Read-Only)": [[4, "cv-31-cv-32-extended-cv-pointer-read-only"]], "CV_4 - Deceleration rate": [[4, "cv-4-deceleration-rate"]], "CV_47 - Feed-forward gain k_ff": [[4, "cv-47-feed-forward-gain-k-ff"]], "CV_48 - Filter time constant (tau) in ms": [[4, "cv-48-filter-time-constant-tau-in-ms"]], "CV_49 - PID Control sampling time t in ms": [[4, "cv-49-pid-control-sampling-time-t-in-ms"]], "CV_5 - V_max": [[4, "cv-5-v-max"]], "CV_50 - PID Control I Factor": [[4, "cv-50-pid-control-i-factor"]], "CV_51 - PID Control D Factor": [[4, "cv-51-pid-control-d-factor"]], "CV_52 & CV_53 - PID Integral Limits": [[4, "cv-52-cv-53-pid-integral-limits"]], "CV_54 & CV_55 - Gain scheduling config k_p @ x0": [[4, "cv-54-cv-55-gain-scheduling-config-k-p-x0"]], "CV_56 & CV_57 - Gain scheduling config k_p @ x1": [[4, "cv-56-cv-57-gain-scheduling-config-k-p-x1"]], "CV_58 & CV_59 - Gain scheduling config k_p @ x2": [[4, "cv-58-cv-59-gain-scheduling-config-k-p-x2"]], "CV_6 - V_mid": [[4, "cv-6-v-mid"]], "CV_60 - Gain scheduling config x1 shift percentage": [[4, "cv-60-gain-scheduling-config-x1-shift-percentage"]], "CV_61 - Measurement Iterations": [[4, "cv-61-measurement-iterations"]], "CV_62 - Measurement Delay": [[4, "cv-62-measurement-delay"]], "CV_63 & CV_64 - Measurement array cutoffs": [[4, "cv-63-cv-64-measurement-array-cutoffs"]], "CV_65 - New flash variable": [[4, "cv-65-new-flash-variable"]], "CV_7 - Version No. (Read-Only)": [[4, "cv-7-version-no-read-only"]], "CV_8 - Manufacturer (Read-Only)": [[4, "cv-8-manufacturer-read-only"]], "CV_9 - Motor PWM Frequency": [[4, "cv-9-motor-pwm-frequency"]], "Complete Schematic": [[1, "complete-schematic"], [2, "complete-schematic"]], "Configuration Variables (CV)": [[4, null]], "Contents:": [[3, null], [6, null], [9, null]], "DCC signal decoding": [[10, "dcc-signal-decoding"]], "Electrical Characteristics": [[1, "electrical-characteristics"], [2, "electrical-characteristics"]], "Electrical Characteristics & Absolute Maximum Ratings": [[1, "id2"], [2, "id2"]], "Feed-forward": [[10, "id2"]], "GPIO": [[1, "gpio"], [2, "gpio"]], "Gain Scheduling": [[10, "gain-scheduling"]], "Getting started": [[5, null]], "Hardware": [[0, null]], "Header files": [[8, null]], "Input Stage": [[1, "input-stage"], [2, "input-stage"]], "Microcontroller": [[1, "microcontroller"], [2, "microcontroller"]], "Motor Driver": [[1, "motor-driver"]], "Motor control": [[10, "motor-control"]], "Note": [[4, "note"]], "Other": [[6, null]], "Overview": [[1, null], [2, null], [10, "overview"]], "PID Controller": [[10, "pid-controller"]], "RP2040-Decoder Documentation": [[3, null]], "Revision 0.3": [[0, "revision-0-3"]], "Revision 1.0": [[0, "revision-1-0"]], "SoftwaLine truncated
+2 -2
View File
@@ -18,6 +18,7 @@
<script src="../_static/documentation_options.js?v=6bd3bce2"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="../_static/dark_mode_js/default_dark.js?v=fd565c74"></script>
<script src="../_static/dark_mode_js/theme_switcher.js?v=358d3910"></script>
<script src="../_static/js/theme.js"></script>
@@ -90,8 +91,7 @@
<ul>
<li class="toctree-l1"><a class="reference internal" href="sw_description.html">Software Description</a><ul>
<li class="toctree-l2"><a class="reference internal" href="sw_description.html#overview">Overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="sw_description.html#motor-control-overview">Motor control overview</a></li>
<li class="toctree-l2"><a class="reference internal" href="sw_description.html#pid-controller">PID Controller</a></li>
<li class="toctree-l2"><a class="reference internal" href="sw_description.html#motor-control">Motor control</a></li>
<li class="toctree-l2"><a class="reference internal" href="sw_description.html#dcc-signal-decoding">DCC signal decoding</a></li>
</ul>
</li>
+112 -54
View File
@@ -18,6 +18,7 @@
<script src="../_static/documentation_options.js?v=6bd3bce2"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="../_static/dark_mode_js/default_dark.js?v=fd565c74"></script>
<script src="../_static/dark_mode_js/theme_switcher.js?v=358d3910"></script>
<script src="../_static/js/theme.js"></script>
@@ -53,10 +54,10 @@
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Software</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">Software Description</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#overview">Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="#motor-control-overview">Motor control overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="#pid-controller">PID Controller</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#gain-scheduling">Gain scheduling</a></li>
<li class="toctree-l4"><a class="reference internal" href="#feed-forward">Feed-forward</a></li>
<li class="toctree-l3"><a class="reference internal" href="#motor-control">Motor control</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#pid-controller">PID Controller</a></li>
<li class="toctree-l4"><a class="reference internal" href="#gain-scheduling">Gain Scheduling</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">Feed-forward</a></li>
<li class="toctree-l4"><a class="reference internal" href="#back-emf-voltage-measurement">Back-EMF voltage measurement</a></li>
</ul>
</li>
@@ -87,7 +88,7 @@
<li class="breadcrumb-item"><a href="index.html">Software</a></li>
<li class="breadcrumb-item active">Software Description</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/software/sw_description.md.txt" rel="nofollow"> View page source</a>
<a href="../_sources/software/sw_description.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
@@ -99,82 +100,139 @@
<h1>Software Description<a class="headerlink" href="#software-description" title="Link to this heading"></a></h1>
<section id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Link to this heading"></a></h2>
<p>The Software is structured as follows:</p>
<ul class="simple">
<li><p>Core0.c</p>
<p>Software files high level overview:</p>
<ul>
<li><p><strong>core0.c / core0.h</strong></p>
<blockquote>
<div><ul class="simple">
<li><p>DCC package detection &amp; decoding</p></li>
<li><p>Programming mode (Modify and read CVs on programming track)</p></li>
<li><p>ADC-Offset measurement</p></li>
<li><p>Feed-forward base PWM measurement</p></li>
</ul>
</div></blockquote>
</li>
<li><p>Core1.c</p>
<ul>
<li><p><strong>core1.c / core0.h</strong></p>
<blockquote>
<div><ul class="simple">
<li><p>PID motor controller</p></li>
<li><p>Back-EMF voltage measurement</p></li>
</ul>
</div></blockquote>
</li>
<li><p>CV.h</p>
<ul>
<li><p><strong>shared.c / shared.h</strong> (used by both cores)</p></li>
<li><p>Error handling</p></li>
<li><p>Helper functions for retrieving CV’s</p></li>
<li><p><strong>CV.h</strong></p></li>
<li><p>Default configuration variables</p></li>
<li><p><strong>CMakeLists.txt</strong></p>
<blockquote>
<div><ul class="simple">
<li><p>CMake version, SDK version, C standard version</p></li>
<li><p>Board definitions</p></li>
<li><p>Compile/Build options</p></li>
<li><p>Sources files, header files</p></li>
<li><p>Debug logging configuration (via stdio using UART/USB)</p></li>
<li><p>Linked libraries</p></li>
</ul>
</div></blockquote>
</li>
<li><p><strong>RP2040-Decoder-board.h or RP2040-Decoder-board-legacy.h</strong></p>
<blockquote>
<div><ul>
<li><p>Flash Size</p></li>
<li><p>Pin specification</p>
<blockquote>
<div><ul class="simple">
<li><p>LED pin when available</p></li>
<li><p>UART_TX/UART_RX when used</p></li>
<li><p>DCC input pin</p></li>
<li><p>Motor Control PWM pins</p></li>
<li><p>ADC pins</p></li>
</ul>
</div></blockquote>
</li>
</ul>
<p>Conveniently The Raspberry Pi Foundation provides a well documented <a class="reference external" href="https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf">SDK</a> for the RP2040. The SDK provides abstraction to a higher level and therefore there is no need to access any registers directly. Everything is written using the SDK so hopefully the code is easier to understand. In the following, the motor control and the decoding of the DCC signals will be explained.</p>
</section>
<section id="motor-control-overview">
<h2>Motor control overview<a class="headerlink" href="#motor-control-overview" title="Link to this heading"></a></h2>
<p><img alt="Block Diagram" src="https://github.com/1nct/RP2040-Decoder/blob/main/docs/svg/Block_Diagram_Control.svg" /></p>
<hr class="docutils" />
<p><strong>Block diagram - Motor control</strong></p>
<p>The above block diagram in essence describes the functionality of the control loop. While the central component is the PID controller, there is an additional block called <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint, this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block is corresponding to the speed_helper() function which delays changing the setpoint according to the configured deceleration/acceleration rates.</p>
</div></blockquote>
</li>
</ul>
<p>Conveniently, The Raspberry Pi Foundation provides a well-documented <a class="reference external" href="https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf">SDK</a> for the RP2040. The SDK provides abstraction to a higher level, and therefore there is no need to access any registers directly. Everything is written using the SDK, so hopefully, the code is easier to understand.</p>
</section>
<section id="motor-control">
<h2>Motor control<a class="headerlink" href="#motor-control" title="Link to this heading"></a></h2>
<figure class="align-center" id="id4">
<img alt="Block Diagram" src="../_images/Block_Diagram_Control.svg" />
<figcaption>
<p><span class="caption-text">Motor control - Block diagram</span><a class="headerlink" href="#id4" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>The above block diagram in essence describes the functionality of the control loop. While the central component is the PID controller, there is an additional block called <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> that has an impact on the control output variable. The Feed-forward block adds an additional offset to the output depending on the setpoint; this is done to achieve better control. A more detailed explanation regarding Feed-forward can be found below. The speed helper block corresponds to the <code class="docutils literal notranslate"><span class="pre">speed_helper()</span></code> function, which delays changing the setpoint according to the configured deceleration/acceleration rates.</p>
<section id="pid-controller">
<h2>PID Controller<a class="headerlink" href="#pid-controller" title="Link to this heading"></a></h2>
<p><img alt="PID Controller" src="https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/Block_Diagram_PID.svg" /></p>
<p>The block diagram above shows the PID controller in the s-domain. The derivative part contains an additional digital low pass filter used to filter out high-frequency noise.</p>
<p>Output = E * (K<sub>P</sub> + K<sub>I</sub>/s + (K<sub>D</sub>*s)/(sτ+1)) = P + I + D</p>
<ul class="simple">
<li><p>P = E * K<sub>P</sub></p></li>
<li><p>I = E * K<sub>I</sub>/s</p></li>
<li><p>D = E * (K<sub>D</sub>*s)/(sτ+1)</p></li>
</ul>
<p>The continuous-time system representation can now be transformed into a discrete-time representation using <a class="reference external" href="https://en.wikipedia.org/wiki/Bilinear_transform">bilinear transform</a> [ s = 2*(z-1) / T<sub>s</sub>*(z+1) ].</p>
<h3>PID Controller<a class="headerlink" href="#pid-controller" title="Link to this heading"></a></h3>
<figure class="align-center" id="id5">
<img alt="PID Controller figure" src="../_images/Block_Diagram_PID.svg" />
<figcaption>
<p><span class="caption-text">PID Controller</span><a class="headerlink" href="#id5" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>The block diagram above shows the PID controller in the s-domain. The derivative part contains an additional digital low-pass filter used to filter out high-frequency noise.</p>
<div class="math notranslate nohighlight">
\[\begin{split}\begin{align}
\text{Output} &amp;= E \cdot \left(K_P + \frac{K_I}{s} + \frac{K_D \cdot s}{s \tau + 1}\right) = P + I + D \\
P &amp;= E \cdot K_P \\
I &amp;= E \cdot \frac{K_I}{s} \\
D &amp;= E \cdot \frac{K_D \cdot s}{s \tau + 1}
\end{align}\end{split}\]</div>
<p>With <span class="math notranslate nohighlight">\(T_s\)</span> being the sampling time / controller update rate / time step of the discrete system.
And <span class="math notranslate nohighlight">\(\tau\)</span> being the filter time constant of the digital filter</p>
<p>The continuous-time system representation can now be transformed into a discrete-time representation using <a class="reference external" href="https://en.wikipedia.org/wiki/Bilinear_transform">bilinear transform</a> <span class="math notranslate nohighlight">\(s = \frac{2 \cdot (z - 1)}{T_s \cdot (z + 1)}\)</span>.</p>
<p>This results in the following difference equations which are then implemented in software:</p>
<ul class="simple">
<li><p>p<sub>n</sub> = K<sub>P</sub> * e<sub>n</sub></p></li>
<li><p>i<sub>n</sub> = 0.5K<sub>I</sub> * (e<sub>n</sub> + e<sub>n-1</sub>) + i<sub>n-1</sub></p></li>
<li><p>d<sub>n</sub> = [ 2K<sub>D</sub> * (e<sub>n</sub> - e<sub>n-1</sub>) + (2τ - T<sub>s</sub>) * d<sub>n-1</sub> ] / [ 2τ + T<sub>s</sub>]</p></li>
</ul>
<p>=&gt; output<sub>n</sub> = p<sub>n</sub> + i<sub>n</sub> + d<sub>n</sub></p>
<p>Also note that instead of using derivative of error, derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint.</p>
<section id="gain-scheduling">
<h3>Gain scheduling<a class="headerlink" href="#gain-scheduling" title="Link to this heading"></a></h3>
<p><img alt="K_P" src="https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/adaptive_kp.svg" /></p>
<p>Another aspect to consider is the implementation of <a class="reference external" href="https://en.wikipedia.org/wiki/Gain_scheduling">gain scheduling</a>. K<sub>P</sub> is a function of the current setpoint. Often it is favorable to have a higher proportional gain K<sub>P</sub> for slow speeds, achieving better control results. The illustration above shows the default setting for K<sub>P</sub>. CV_54 &amp; CV_55 are used to set K<sub>P</sub> &#64; x<sub>0</sub>, CV_56 &amp; CV_57 for K<sub>P</sub> &#64; x<sub>1</sub> and CV_58 &amp; CV_59 for K<sub>P</sub> &#64; x<sub>2</sub>. Additionally CV_60 is used to shift x<sub>1</sub> from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).</p>
<div class="math notranslate nohighlight">
\[\begin{split}\begin{align}
p_n &amp;= K_P \cdot e_n \\
i_n &amp;= 0.5 \cdot K_I \cdot \left(e_n + e_{n-1}\right) + i_{n-1} \\
d_n &amp;= \frac{2 K_D \cdot \left(e_n - e_{n-1}\right) + \left(2 \tau - T_s\right) \cdot d_{n-1}}{2 \tau + T_s} \\
\text{output}_n &amp;= p_n + i_n + d_n
\end{align}\end{split}\]</div>
<p>Also note that instead of using the derivative of error, the derivative on measurement is used. This is done to prevent a high derivative part in the event of a large change in setpoint.</p>
</section>
<section id="feed-forward">
<h3>Feed-forward<a class="headerlink" href="#feed-forward" title="Link to this heading"></a></h3>
<p><img alt="Feed-forward" src="https://github.com/gab-k/RP2040-Decoder/blob/main/docs/svg/feed_forward.svg" />
To achieve better control <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> is used. On startup the decoder will check for a configuration regarding Feed-forward control - when no configuration is found the decoder automatically runs a calibration to establish a base pwm level (y<sub>1</sub>) for both directions. The base pwm level (y<sub>1</sub>) will vary depending on load, motor and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y<sub>2</sub> is corrected automatically when i<sub>n</sub> reaches 0.5i<sub>min</sub> or 0.5i<sub>max</sub>. CV_47 can be used to set how sensitive this correction is.</p>
<section id="gain-scheduling">
<h3>Gain Scheduling<a class="headerlink" href="#gain-scheduling" title="Link to this heading"></a></h3>
<figure class="align-center" id="id6">
<img alt="Gain Scheduling figure" src="../_images/adaptive_kp.svg" />
<figcaption>
<p><span class="caption-text">Gain Scheduling</span><a class="headerlink" href="#id6" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>Another aspect to consider is the implementation of <a class="reference external" href="https://en.wikipedia.org/wiki/Gain_scheduling">gain scheduling</a>. K<sub>P</sub> is a function of the current setpoint. Often it is favorable to have a higher proportional gain K<sub>P</sub> for slow speeds, achieving better control results. The illustration above shows the default setting for K<sub>P</sub>. CV_54 &amp; CV_55 are used to set K<sub>P</sub> &#64; x<sub>0</sub>, CV_56 &amp; CV_57 for K<sub>P</sub> &#64; x<sub>1</sub>, and CV_58 &amp; CV_59 for K<sub>P</sub> &#64; x<sub>2</sub>. Additionally, CV_60 is used to shift x<sub>1</sub> from the leftmost point (0% = 0/255) to the rightmost point (100% = 255/255).</p>
</section>
<section id="id2">
<h3>Feed-forward<a class="headerlink" href="#id2" title="Link to this heading"></a></h3>
<figure class="align-center" id="id7">
<img alt="Feed forward figure" src="../_images/feed_forward.svg" />
<figcaption>
<p><span class="caption-text">Feed-forward</span><a class="headerlink" href="#id7" title="Link to this image"></a></p>
</figcaption>
</figure>
<p>TODO: Update this part:</p>
<p>To achieve better control, <a class="reference external" href="https://en.wikipedia.org/wiki/Feed_forward_(control)">Feed-forward</a> is used. On startup, the decoder will check for a configuration regarding Feed-forward control. When no configuration is found, the decoder automatically runs a calibration to establish a base PWM level (y<sub>1</sub>) for both directions. The base PWM level (y<sub>1</sub>) will vary depending on load, motor, and voltage on the tracks and can be configured with CV_176 - CV_179. If the setpoint is greater than the threshold, y<sub>2</sub> is corrected automatically when i<sub>n</sub> reaches 0.5i<sub>min</sub> or 0.5i<sub>max</sub>. CV_47 can be used to set how sensitive this correction is.</p>
</section>
<section id="back-emf-voltage-measurement">
<h3>Back-EMF voltage measurement<a class="headerlink" href="#back-emf-voltage-measurement" title="Link to this heading"></a></h3>
<p>To provide a feedback signal which is proportional to the motor speed the ADC is used to measure the <a class="reference external" href="https://en.wikipedia.org/wiki/Counter-electromotive_force">Back-EMF voltage</a>. The measurement works by setting the PWM duty cycle to 0%, waiting for a certain delay time (CV_62) and then measuring x times (x = CV_63). While measuring the array with measurement values are being sorted using insertion sort. Afterwards y elements (y = CV_63) from the left (lowest values) and z elements (z = CV_64) from the right (highest values) will be dismissed to mitigate the impact of potential outliers in measurement. The average value of the remaining values will be computed and fed back into the control algorithm. Considering default settings (100us delay, 100 samples, ~2µs sampling time) the complete measurement run including averaging takes about 0.3ms to 0.35ms which effectively reduces the maximum possible duty cycle to about 93% to 94%.</p>
<p>To provide a feedback signal proportional to the motor speed, the ADC is used to measure the <a class="reference external" href="https://en.wikipedia.org/wiki/Counter-electromotive_force">Back-EMF voltage</a>. The measurement works by setting the PWM duty cycle to 0%, waiting for a certain delay time (CV_62), and then measuring x times (x = CV_63). While measuring, the array with measurement values is sorted using insertion sort. Afterwards, y elements (y = CV_63) from the left (lowest values) and z elements (z = CV_64) from the right (highest values) will be dismissed to mitigate the impact of potential outliers in measurement. The average value of the remaining values will be computed and fed back into the control algorithm. Considering default settings (100us delay, 100 samples, ~2µs sampling time), the complete measurement run, including averaging, takes about 0.3ms to 0.35ms, which effectively reduces the maximum possible duty cycle to about 93% to 94%.</p>
</section>
</section>
<section id="dcc-signal-decoding">
<h2>DCC signal decoding<a class="headerlink" href="#dcc-signal-decoding" title="Link to this heading"></a></h2>
<p>The detection of the DCC signal works by looking at every rising and falling edge and calculating the time between them. When the time between rising and falling edge is greater than 87μs then this is equivalent to “0”, else “1” - This value then gets shifted into a 64-Bit variable.</p>
<p>Decoding is done after every falling edge. It starts with an error detection which when not passed will dismiss the received command. Then the address will be decoded and compared to the address stored in the configuration. If the address matches the command/instruction will be decoded.</p>
<p>Only a few instructions are currently implemented, only 128 speed step instructions are supported.</p>
<p>The detection of the DCC signal works by looking at every rising and falling edge and calculating the time between them. When the time between rising and falling edge is greater than 87μs, then this is equivalent to “0”; otherwise, “1”. This value then gets shifted into a 64-Bit variable.</p>
<p>Decoding is done after every falling edge. It starts with an error detection, which, when not passed, dismisses the received command. Then the address will be decoded and compared to the address stored in the configuration. If the address matches, the command/instruction will be decoded.</p>
<p>Only a few instructions are currently implemented; only 128 speed step instructions are supported.</p>
<p><strong>Implemented instructions:</strong></p>
<ul class="simple">
<li><p>0011-1111 - (128 Speed Step Control) - 2 Byte length</p></li>
<li><p>10XX-XXXX - (Function Group Instruction) (F0 - F12)</p></li>
<li><p>110X-XXXX - Expansion Instruction (F13 - F31)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0011-1111</span></code> - (128 Speed Step Control) - 2 Byte length</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">10XX-XXXX</span></code> - (Function Group Instruction) (F0 - F12)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">110X-XXXX</span></code> - Expansion Instruction (F13 - F31)</p></li>
</ul>
<p>All DCC instructions can be found in Section 9.2, 9.2.1 and 9.2.1.1 of the <a class="reference external" href="https://www.nmra.org/index-nmra-standards-and-recommended-practices">NMRA Communications Standard </a></p>
<p>All DCC instructions can be found in Section 9.2, 9.2.1, and 9.2.1.1 of the <a class="reference external" href="https://www.nmra.org/index-nmra-standards-and-recommended-practices">NMRA Communications Standard</a>.</p>
</section>
</section>