feat: Safety Manager + Traceability + PlantUML in CI
Validate / build-and-test (push) Successful in 30s
Validate / build-and-test (push) Successful in 30s
- Implement Safety Manager (SWA-001, ASIL-D): Hill-Hold + Auto-Apply state machine, 13 unit tests - Update SWA-002 + SWA-001 link coverage so all SWE reqs are covered - New tool: tools/traceability.py — Markdown-frontmatter-basierter Traceability-Checker + HTML/JSON-Matrix-Generator (Doorstop-Format ohne Doorstop-Dependency) - New tool: tools/render_plantuml.py — extrahiert PlantUML-Bloecke aus arch/**.md und rendert via plantuml.com zu SVG - validate.yml: neue Steps Traceability-Check, Matrix-Publish, PlantUML- Render; uploaded als Gitea-Artefakte
This commit is contained in:
1 parent
7c1848cb26
commit
4351dfa4e1
19 files changed
+1292
-37
No files matched your search
@@ -23,7 +23,6 @@ jobs:
|
|||||||
lcov \
|
lcov \
|
||||||
python3 python3-pip \
|
python3 python3-pip \
|
||||||
git ca-certificates
|
git ca-certificates
|
||||||
pip3 install --break-system-packages doorstop || pip3 install doorstop || true
|
|
||||||
|
|
||||||
- name: Static Analysis (Cppcheck)
|
- name: Static Analysis (Cppcheck)
|
||||||
run: make static
|
run: make static
|
||||||
@@ -38,11 +37,14 @@ jobs:
|
|||||||
- name: Coverage Report
|
- name: Coverage Report
|
||||||
run: make coverage
|
run: make coverage
|
||||||
|
|
||||||
- name: Doorstop Check
|
- name: Traceability Check
|
||||||
run: |
|
run: python3 tools/traceability.py check
|
||||||
if [ -f .doorstop.yml ]; then
|
|
||||||
doorstop || echo "Doorstop check produced warnings"
|
- name: Traceability Matrix publishen
|
||||||
fi
|
run: python3 tools/traceability.py publish docs/traceability
|
||||||
|
|
||||||
|
- name: PlantUML Diagramme rendern
|
||||||
|
run: python3 tools/render_plantuml.py
|
||||||
|
|
||||||
- name: Upload Coverage HTML
|
- name: Upload Coverage HTML
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -51,6 +53,20 @@ jobs:
|
|||||||
name: coverage-html
|
name: coverage-html
|
||||||
path: build/coverage-html/
|
path: build/coverage-html/
|
||||||
|
|
||||||
|
- name: Upload Traceability Matrix
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: traceability
|
||||||
|
path: docs/traceability/
|
||||||
|
|
||||||
|
- name: Upload Architektur-Diagramme
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: architecture-diagrams
|
||||||
|
path: docs/diagrams/
|
||||||
|
|
||||||
- name: Upload Test Results
|
- name: Upload Test Results
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ BUILD = build
|
|||||||
|
|
||||||
SRCS = $(SRC_DIR)/switch_debouncer.c \
|
SRCS = $(SRC_DIR)/switch_debouncer.c \
|
||||||
$(SRC_DIR)/actuator_driver.c \
|
$(SRC_DIR)/actuator_driver.c \
|
||||||
$(SRC_DIR)/apply_controller.c
|
$(SRC_DIR)/apply_controller.c \
|
||||||
|
$(SRC_DIR)/safety_manager.c
|
||||||
OBJS = $(SRCS:%.c=$(BUILD)/%.o)
|
OBJS = $(SRCS:%.c=$(BUILD)/%.o)
|
||||||
|
|
||||||
TESTS = test_switch_debouncer test_actuator_driver test_apply_controller
|
TESTS = test_switch_debouncer test_actuator_driver test_apply_controller \
|
||||||
|
test_safety_manager
|
||||||
TEST_BINS = $(TESTS:%=$(BUILD)/%)
|
TEST_BINS = $(TESTS:%=$(BUILD)/%)
|
||||||
|
|
||||||
.PHONY: all test coverage clean misra static
|
.PHONY: all test coverage clean misra static
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ links:
|
|||||||
- SWE-008
|
- SWE-008
|
||||||
- SWE-009
|
- SWE-009
|
||||||
- SWE-010
|
- SWE-010
|
||||||
|
- SWE-011
|
||||||
|
- SWE-012
|
||||||
asil: D
|
asil: D
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ links:
|
|||||||
- SWE-002
|
- SWE-002
|
||||||
- SWE-003
|
- SWE-003
|
||||||
- SWE-004
|
- SWE-004
|
||||||
|
- SWE-005
|
||||||
asil: D
|
asil: D
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="DESCRIPTION" height="323px" preserveAspectRatio="none" style="width:831px;height:323px;background:#FFFFFF;" version="1.1" viewBox="0 0 831 323" width="831px" zoomAndPan="magnify"><?plantuml 1.2026.4beta2?><defs/><g><!--entity ECU--><g class="entity" data-qualified-name="ECU" data-source-line="1" id="ent0002"><polygon fill="#F1F1F1" points="238.89,139.3,248.89,129.3,339.1009,129.3,339.1009,165.5969,329.1009,175.5969,238.89,175.5969,238.89,139.3" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="329.1009" x2="339.1009" y1="139.3" y2="129.3"/><line style="stroke:#181818;stroke-width:0.5;" x1="238.89" x2="329.1009" y1="139.3" y2="139.3"/><line style="stroke:#181818;stroke-width:0.5;" x1="329.1009" x2="329.1009" y1="139.3" y2="175.5969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="60.2109" x="253.89" y="162.2951">EPB ECU</text></g><!--entity AL--><g class="entity" data-qualified-name="AL" data-source-line="2" id="ent0003"><polygon fill="#F1F1F1" points="16,262.59,26,252.59,129.999,252.59,129.999,288.8869,119.999,298.8869,16,298.8869,16,262.59" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="119.999" x2="129.999" y1="262.59" y2="252.59"/><line style="stroke:#181818;stroke-width:0.5;" x1="16" x2="119.999" y1="262.59" y2="262.59"/><line style="stroke:#181818;stroke-width:0.5;" x1="119.999" x2="119.999" y1="262.59" y2="298.8869"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="73.999" x="31" y="285.5851">Aktor links</text></g><!--entity AR--><g class="entity" data-qualified-name="AR" data-source-line="3" id="ent0004"><polygon fill="#F1F1F1" points="165.17,262.59,175.17,252.59,290.838,252.59,290.838,288.8869,280.838,298.8869,165.17,298.8869,165.17,262.59" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="280.838" x2="290.838" y1="262.59" y2="252.59"/><line style="stroke:#181818;stroke-width:0.5;" x1="165.17" x2="280.838" y1="262.59" y2="262.59"/><line style="stroke:#181818;stroke-width:0.5;" x1="280.838" x2="280.838" y1="262.59" y2="298.8869"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="85.668" x="180.17" y="285.5851">Aktor rechts</text></g><!--entity WS--><g class="entity" data-qualified-name="WS" data-source-line="4" id="ent0005"><polygon fill="#F1F1F1" points="63.67,16,73.67,6,298.3302,6,298.3302,42.2969,288.3302,52.2969,63.67,52.2969,63.67,16" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="288.3302" x2="298.3302" y1="16" y2="6"/><line style="stroke:#181818;stroke-width:0.5;" x1="63.67" x2="288.3302" y1="16" y2="16"/><line style="stroke:#181818;stroke-width:0.5;" x1="288.3302" x2="288.3302" y1="16" y2="52.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="194.6602" x="78.67" y="38.9951">Wheel Speed Sensoren (x4)</text></g><!--entity IN--><g class="entity" data-qualified-name="IN" data-source-line="5" id="ent0006"><polygon fill="#F1F1F1" points="332.99,16,342.99,6,461.0164,6,461.0164,42.2969,451.0164,52.2969,332.99,52.2969,332.99,16" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="451.0164" x2="461.0164" y1="16" y2="6"/><line style="stroke:#181818;stroke-width:0.5;" x1="332.99" x2="451.0164" y1="16" y2="16"/><line style="stroke:#181818;stroke-width:0.5;" x1="451.0164" x2="451.0164" y1="16" y2="52.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="88.0264" x="347.99" y="38.9951">Inclinometer</text></g><!--entity SW--><g class="entity" data-qualified-name="SW" data-source-line="6" id="ent0007"><polygon fill="#F1F1F1" points="328.11,262.59,338.11,252.59,505.8952,252.59,505.8952,288.8869,495.8952,298.8869,328.11,298.8869,328.11,262.59" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="495.8952" x2="505.8952" y1="262.59" y2="252.59"/><line style="stroke:#181818;stroke-width:0.5;" x1="328.11" x2="495.8952" y1="262.59" y2="262.59"/><line style="stroke:#181818;stroke-width:0.5;" x1="495.8952" x2="495.8952" y1="262.59" y2="298.8869"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="137.7852" x="343.11" y="285.5851">EPB-Schalter + LED</text></g><!--entity CAN--><g class="entity" data-qualified-name="CAN" data-source-line="7" id="ent0008"><polygon fill="#F1F1F1" points="373.68,139.3,383.68,129.3,474.3284,129.3,474.3284,165.5969,464.3284,175.5969,373.68,175.5969,373.68,139.3" style="stroke:#181818;stroke-width:0.5;"/><line style="stroke:#181818;stroke-width:0.5;" x1="464.3284" x2="474.3284" y1="139.3" y2="129.3"/><line style="stroke:#181818;Line truncated
|
||||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="DESCRIPTION" height="375px" preserveAspectRatio="none" style="width:631px;height:375px;background:#FFFFFF;" version="1.1" viewBox="0 0 631 375" width="631px" zoomAndPan="magnify"><?plantuml 1.2026.4beta2?><defs/><g><!--cluster Safety Manager--><g class="cluster" data-qualified-name="Safety Manager" data-source-line="1" id="ent0002"><path d="M8.5,124.3 L134.5225,124.3 A3.75,3.75 0 0 1 137.0225,126.8 L144.0225,146.5969 L434.5,146.5969 A2.5,2.5 0 0 1 437,149.0969 L437,358.39 A2.5,2.5 0 0 1 434.5,360.89 L8.5,360.89 A2.5,2.5 0 0 1 6,358.39 L6,126.8 A2.5,2.5 0 0 1 8.5,124.3" fill="none" style="stroke:#000000;stroke-width:1.5;"/><line style="stroke:#000000;stroke-width:1.5;" x1="6" x2="144.0225" y1="146.5969" y2="146.5969"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="700" lengthAdjust="spacing" textLength="125.0225" x="10" y="139.2951">Safety Manager</text></g><!--entity Engine State Monitor--><g class="entity" data-qualified-name="Safety Manager.Engine State Monitor" data-source-line="2" id="ent0003"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="187.1572" x="30.42" y="167.3"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="197.5772" y="172.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="195.5772" y="174.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="195.5772" y="178.3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="147.1572" x="45.42" y="200.2951">Engine State Monitor</text></g><!--entity Hill-Hold Logic--><g class="entity" data-qualified-name="Safety Manager.Hill-Hold Logic" data-source-line="3" id="ent0004"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="140.4063" x="252.8" y="167.3"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="373.2063" y="172.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="371.2063" y="174.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="371.2063" y="178.3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="100.4063" x="267.8" y="200.2951">Hill-Hold Logic</text></g><!--entity Auto-Apply Logic--><g class="entity" data-qualified-name="Safety Manager.Auto-Apply Logic" data-source-line="4" id="ent0005"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="158.3711" x="44.81" y="290.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="183.1811" y="295.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="181.1811" y="297.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="181.1811" y="301.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="118.3711" x="59.81" y="323.5851">Auto-Apply Logic</text></g><!--entity Apply Controller--><g class="entity" data-qualified-name="Apply Controller" data-source-line="6" id="ent0006"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="153.1484" x="461.43" y="290.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="594.5784" y="295.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="592.5784" y="297.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="592.5784" y="301.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="113.1484" x="476.43" y="323.5851">Apply Controller</text></g><!--entity Wheel Speed Plausi--><g class="entity" data-qualified-name="Wheel Speed Plausi" data-source-line="7" id="ent0008"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="177.5869" x="236.21" y="7"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="393.7969" y="12"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="391.7969" y="14"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="391.7969" y="18"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="137.5869" x="251.21" y="39.9951">Wheel Speed Plausi</text></g><!--entity Inclinometer Filter--><g class="entity" data-qualified-name="Inclinometer Filter" data-source-line="8" id="ent0010"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="168.167" Line truncated
|
||||||
|
After Width: | Height: | Size: 8.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="STATE" height="405px" preserveAspectRatio="none" style="width:537px;height:405px;background:#FFFFFF;" version="1.1" viewBox="0 0 537 405" width="537px" zoomAndPan="magnify"><?plantuml 1.2026.4beta2?><defs/><g><g class="start_entity" data-qualified-name=".start." data-source-line="1" id="ent0002"><ellipse cx="257.47" cy="16" fill="#222222" rx="10" ry="10" style="stroke:#222222;stroke-width:1;"/></g><g class="entity" data-qualified-name="Idle" id="ent0003"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="50" x="232.47" y="87"/><line style="stroke:#181818;stroke-width:0.5;" x1="232.47" x2="282.47" y1="113.2969" y2="113.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="25.5186" x="244.7107" y="104.9951">Idle</text></g><g class="entity" data-qualified-name="HillHoldArmed" id="ent0005"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="120.5361" x="117.2" y="214"/><line style="stroke:#181818;stroke-width:0.5;" x1="117.2" x2="237.7361" y1="240.2969" y2="240.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="100.5361" x="127.2" y="231.9951">HillHoldArmed</text></g><g class="entity" data-qualified-name="HillHoldActive" id="ent0007"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="117.6172" x="70.66" y="341"/><line style="stroke:#181818;stroke-width:0.5;" x1="70.66" x2="188.2772" y1="367.2969" y2="367.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="97.6172" x="80.66" y="358.9951">HillHoldActive</text></g><g class="entity" data-qualified-name="AutoApplyArmed" id="ent0010"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="138.501" x="294.22" y="214"/><line style="stroke:#181818;stroke-width:0.5;" x1="294.22" x2="432.721" y1="240.2969" y2="240.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="118.501" x="304.22" y="231.9951">AutoApplyArmed</text></g><g class="entity" data-qualified-name="AutoApplyTriggered" id="ent0012"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="159.8701" x="298.54" y="341"/><line style="stroke:#181818;stroke-width:0.5;" x1="298.54" x2="458.4101" y1="367.2969" y2="367.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="139.8701" x="308.54" y="358.9951">AutoApplyTriggered</text></g><!--link *start* to Idle--><g class="link" data-entity-1="ent0002" data-entity-2="ent0003" data-link-type="dependency" data-source-line="1" id="lnk4"><path d="M257.47,26.36 C257.47,40.29 257.47,60.95 257.47,80.65" fill="none" id="*start*-to-Idle" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="257.47,86.65,261.47,77.65,257.47,81.65,253.47,77.65,257.47,86.65" style="stroke:#181818;stroke-width:1;"/></g><!--link Idle to HillHoldArmed--><g class="link" data-entity-1="ent0003" data-entity-2="ent0005" data-link-type="dependency" data-source-line="2" id="lnk6"><path d="M232.43,117.51 C206.33,123.69 166.74,137.57 148.47,167 C139.42,181.59 143.4839,194.5432 153.0939,208.7232" fill="none" id="Idle-to-HillHoldArmed" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="156.46,213.69,154.7221,203.9957,153.6549,209.551,148.0996,208.4838,156.46,213.69" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="170.0791" x="149.47" y="180.0669">grade>5% & v=0 & brake</text></g><!--link HillHoldArmed to HillHoldActive--><g class="link" data-entity-1="ent0005" data-entity-2="ent0007" data-link-type="dependency" data-source-line="3" id="lnk8"><path d="M168.1,264.4 C159.65,286.42 149.4213,313.0589 140.9713,335.0589" fill="none" id="HillHoldArmed-to-HillHoldActive" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="138.82,340.66,145.781,333.6926,140.6128,335.9925,138.3129,330.8242,138.82,340.66" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="97.1636" x="157.47" y="307.0669">brake released</text></g><!--link HillHoldActive to Idle--><g class="link" data-entity-1="ent0007" data-entity-2="ent0003" data-link-type="dependency" data-source-line="4" id="lnk9"><path d="M95.23,340.6 C57.59,310.69 6,258.47 34.47,214 C78.82,144.74 177.5871,123.306 226.0771,116.566" fill="none" id="HillHoldActive-to-Idle" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="232.02,115.74,222.555,113.0172,227.0676,116.4284,223.6564,120.941,232.02,115.74" style="stroke:#181818Line truncated
|
||||||
|
After Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="DESCRIPTION" height="313px" preserveAspectRatio="none" style="width:716px;height:313px;background:#FFFFFF;" version="1.1" viewBox="0 0 716 313" width="716px" zoomAndPan="magnify"><?plantuml 1.2026.4beta2?><defs/><g><!--entity Apply Controller--><g class="entity" data-qualified-name="Apply Controller" data-source-line="1" id="ent0002"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="153.1484" x="303.33" y="130.3"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="436.4784" y="135.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="434.4784" y="137.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="434.4784" y="141.3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="113.1484" x="318.33" y="163.2951">Apply Controller</text></g><!--entity Actuator Driver L--><g class="entity" data-qualified-name="Actuator Driver L" data-source-line="1" id="ent0003"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="159.8066" x="7" y="253.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="146.8066" y="258.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="144.8066" y="260.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="144.8066" y="264.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="119.8066" x="22" y="286.5851">Actuator Driver L</text></g><!--entity Actuator Driver R--><g class="entity" data-qualified-name="Actuator Driver R" data-source-line="2" id="ent0005"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="161.7344" x="202.04" y="253.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="343.7744" y="258.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="341.7744" y="260.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="341.7744" y="264.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="121.7344" x="217.04" y="286.5851">Actuator Driver R</text></g><!--entity Switch Debouncer--><g class="entity" data-qualified-name="Switch Debouncer" data-source-line="3" id="ent0007"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="167.3945" x="199.21" y="7"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="346.6045" y="12"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="344.6045" y="14"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="344.6045" y="18"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="127.3945" x="214.21" y="39.9951">Switch Debouncer</text></g><!--entity Safety Manager--><g class="entity" data-qualified-name="Safety Manager" data-source-line="4" id="ent0009"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="150.5986" x="401.6" y="7"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="532.1986" y="12"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="530.1986" y="14"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="530.1986" y="18"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="110.5986" x="416.6" y="39.9951">Safety Manager</text></g><!--entity Display Manager--><g class="entity" data-qualified-name="Display Manager" data-source-line="5" id="ent0011"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="157.4209" x="399.19" y="253.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="536.6109" y="258.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="534.6109" y="260.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="534.6109" y="264.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="117.4209" x="414.19" y="286.5851">Display Manager</text></g><!--entity Watchdog--><g class="entity" data-qualified-name="Watchdog" data-source-line="6" id="ent0013"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="110.8203" x="591.49" y="253.59"/><rect fill="#F1F1F1"Line truncated
|
||||||
|
After Width: | Height: | Size: 9.6 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="STATE" height="659px" preserveAspectRatio="none" style="width:714px;height:659px;background:#FFFFFF;" version="1.1" viewBox="0 0 714 659" width="714px" zoomAndPan="magnify"><?plantuml 1.2026.4beta2?><defs/><g><g class="start_entity" data-qualified-name=".start." data-source-line="1" id="ent0002"><ellipse cx="456.9" cy="16" fill="#222222" rx="10" ry="10" style="stroke:#222222;stroke-width:1;"/></g><g class="entity" data-qualified-name="Released" id="ent0003"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="84.2168" x="414.79" y="87"/><line style="stroke:#181818;stroke-width:0.5;" x1="414.79" x2="499.0068" y1="113.2969" y2="113.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="64.2168" x="424.79" y="104.9951">Released</text></g><g class="entity" data-qualified-name="Applying" id="ent0005"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="81.1748" x="50.32" y="214"/><line style="stroke:#181818;stroke-width:0.5;" x1="50.32" x2="131.4948" y1="240.2969" y2="240.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="61.1748" x="60.32" y="231.9951">Applying</text></g><g class="entity" data-qualified-name="Applied" id="ent0007"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="72.6299" x="54.59" y="341"/><line style="stroke:#181818;stroke-width:0.5;" x1="54.59" x2="127.2199" y1="367.2969" y2="367.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="52.6299" x="64.59" y="358.9951">Applied</text></g><g class="entity" data-qualified-name="Releasing" id="ent0009"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="88.3662" x="271.72" y="468"/><line style="stroke:#181818;stroke-width:0.5;" x1="271.72" x2="360.0862" y1="494.2969" y2="494.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="68.3662" x="281.72" y="485.9951">Releasing</text></g><g class="entity" data-qualified-name="Error" id="ent0013"><rect fill="#F1F1F1" height="50" rx="12.5" ry="12.5" style="stroke:#181818;stroke-width:0.5;" width="54.6787" x="288.56" y="595"/><line style="stroke:#181818;stroke-width:0.5;" x1="288.56" x2="343.2387" y1="621.2969" y2="621.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="34.6787" x="298.56" y="612.9951">Error</text></g><!--link *start* to Released--><g class="link" data-entity-1="ent0002" data-entity-2="ent0003" data-link-type="dependency" data-source-line="1" id="lnk4"><path d="M456.9,26.36 C456.9,40.29 456.9,60.95 456.9,80.65" fill="none" id="*start*-to-Released" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="456.9,86.65,460.9,77.65,456.9,81.65,452.9,77.65,456.9,86.65" style="stroke:#181818;stroke-width:1;"/></g><!--link Released to Applying--><g class="link" data-entity-1="ent0003" data-entity-2="ent0005" data-link-type="dependency" data-source-line="2" id="lnk6"><path d="M414.51,125.47 C379.15,136.03 327.53,151.84 282.9,167 C230.41,184.84 176.2031,205.154 137.4831,219.984" fill="none" id="Released-to-Applying" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="131.88,222.13,141.7153,222.6464,136.5492,220.3417,138.854,215.1756,131.88,222.13" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="146.7705" x="283.9" y="180.0669">apply_request & v_low</text></g><!--link Applying to Applied--><g class="link" data-entity-1="ent0005" data-entity-2="ent0007" data-link-type="dependency" data-source-line="3" id="lnk8"><path d="M90.9,264.4 C90.9,286.42 90.9,312.66 90.9,334.66" fill="none" id="Applying-to-Applied" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="90.9,340.66,94.9,331.66,90.9,335.66,86.9,331.66,90.9,340.66" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="153.1118" x="91.9" y="307.0669">current_target_reached</text></g><!--link Applied to Releasing--><g class="link" data-entity-1="ent0007" data-entity-2="ent0009" data-link-type="dependency" data-source-line="4" id="lnk10"><path d="M124.38,391.49 C144.8,405.9 171.75,423.99 196.9,438 C220.79,451.3 243.0388,461.668 265.7388,471.438" fill="none" id="Applied-to-Releasing" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="271.25,473.81,264.5645,466.5778,266.6573,471.8333,261.4018,473.9261,271.25,473.81" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacing" textLength="Line truncated
|
||||||
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" data-diagram-type="DESCRIPTION" height="297px" preserveAspectRatio="none" style="width:560px;height:297px;background:#FFFFFF;" version="1.1" viewBox="0 0 560 297" width="560px" zoomAndPan="magnify"><?plantuml 1.2026.4beta2?><defs/><g><!--entity Apply Controller--><g class="entity" data-qualified-name="Apply Controller" data-source-line="1" id="ent0002"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="153.1484" x="183.91" y="7"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="317.0584" y="12"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="315.0584" y="14"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="315.0584" y="18"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="113.1484" x="198.91" y="39.9951">Apply Controller</text></g><!--entity Actuator Driver--><g class="entity" data-qualified-name="Actuator Driver" data-source-line="1" id="ent0003"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="147.5566" x="186.7" y="114.3"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="314.2566" y="119.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="312.2566" y="121.3"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="312.2566" y="125.3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="107.5566" x="201.7" y="147.2951">Actuator Driver</text></g><!--entity Hardware PWM--><g class="entity" data-qualified-name="Hardware PWM" data-source-line="2" id="ent0005"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="146.9619" x="7" y="237.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="133.9619" y="242.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="131.9619" y="244.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="131.9619" y="248.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="106.9619" x="22" y="270.5851">Hardware PWM</text></g><!--entity Hardware ADC--><g class="entity" data-qualified-name="Hardware ADC" data-source-line="3" id="ent0007"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="142.7305" x="189.12" y="237.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="311.8505" y="242.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="309.8505" y="244.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="309.8505" y="248.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="102.7305" x="204.12" y="270.5851">Hardware ADC</text></g><!--entity Diagnostic Manager--><g class="entity" data-qualified-name="Diagnostic Manager" data-source-line="4" id="ent0009"><rect fill="#F1F1F1" height="46.2969" rx="2.5" ry="2.5" style="stroke:#181818;stroke-width:0.5;" width="179.7607" x="366.6" y="237.59"/><rect fill="#F1F1F1" height="10" style="stroke:#181818;stroke-width:0.5;" width="15" x="526.3607" y="242.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="524.3607" y="244.59"/><rect fill="#F1F1F1" height="2" style="stroke:#181818;stroke-width:0.5;" width="4" x="524.3607" y="248.59"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacing" textLength="139.7607" x="381.6" y="270.5851">Diagnostic Manager</text></g><!--link Apply Controller to Actuator Driver--><g class="link" data-entity-1="ent0002" data-entity-2="ent0003" data-link-type="dependency" data-source-line="1" id="lnk4"><path d="M260.48,53.74 C260.48,71.5 260.48,90.14 260.48,107.89" fill="none" id="Apply Controller-to-Actuator Driver" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="260.48,113.89,264.48,104.89,260.48,108.89,256.48,104.89,260.48,113.89" style="stroke:#181818;stroke-width:1;"/></g><!--link Actuator Driver to Hardware PWM--><g class="link" data-entity-1="ent0003" data-entity-2="ent0005" data-link-type="dependency" data-source-line="2" id="lnk6"><path d="M227.05,160.98 C194.82,182.69 151.2854,212.0266 119.0154,233.7766" fill="none" id="Actuator Driver-to-Hardware PWM" style="stroke:#181818;stroke-width:1;"/><polygon fill="#181818" points="114.04,237.13,123.7387,235.4168,118.1862,234.3355,119.2675,228.7829,114.04,237.13" style="stroke:#181818;stroke-width:1;"/><text fill="#000000" font-family="sans-serif"Line truncated
|
||||||
|
After Width: | Height: | Size: 6.4 KiB |
@@ -0,0 +1,29 @@
|
|||||||
|
<!doctype html><html lang='de'><head>
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
<title>demo-epb — Traceability Matrix</title>
|
||||||
|
<style>
|
||||||
|
body{font-family:-apple-system,Segoe UI,sans-serif;padding:20px;color:#222}
|
||||||
|
table{border-collapse:collapse;width:100%;font-size:14px}
|
||||||
|
th,td{border:1px solid #ccc;padding:6px 8px;vertical-align:top;text-align:left}
|
||||||
|
th{background:#f0f0f0}
|
||||||
|
tr:nth-child(even) td{background:#fafafa}
|
||||||
|
.asil{display:inline-block;padding:1px 6px;border-radius:3px;color:white;font-weight:bold;font-size:11px}
|
||||||
|
.id{font-family:Consolas,monospace;font-size:13px}
|
||||||
|
.cnt{color:#666;font-size:11px}
|
||||||
|
h1{color:#1f3864}
|
||||||
|
</style></head><body>
|
||||||
|
<h1>demo-epb — Traceability Matrix</h1>
|
||||||
|
<p>Generiert aus 50 Items (SYS: 10, SWE: 25, SA: 5, SWA: 10).</p>
|
||||||
|
<table>
|
||||||
|
<tr><th>System-Requirement</th><th>System-Arch (SA)</th><th>Software-Req (SWE)</th><th>Software-Arch (SWA)</th></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Halten der Parkbremse im Stillstand</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Aktoren (Caliper-Motoren)</div></td><td><div><span class='id'>SWE-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Apply-Controller haelt Klemmkraft</div><div><span class='id'>SWE-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Watchdog ueberwacht Apply-Controller</div><div><span class='id'>SWE-022</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Stillstands-Erkennung aus Wheel Speeds</div></td><td><div><span class='id'>SWA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Apply Controller</div><div><span class='id'>SWA-004</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Wheel Speed Plausibilisierung</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Apply auf Fahrer-Anforderung</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Aktoren (Caliper-Motoren)</div></td><td><div><span class='id'>SWE-003</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Schalter-Apply-Signal an Apply-Controller weiterleiten</div><div><span class='id'>SWE-004</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Klemmkraft-Erreichen bestaetigen</div><div><span class='id'>SWE-022</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Stillstands-Erkennung aus Wheel Speeds</div><div><span class='id'>SWE-025</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Switch-Debouncing</div></td><td><div><span class='id'>SWA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Apply Controller</div><div><span class='id'>SWA-004</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Wheel Speed Plausibilisierung</div><div><span class='id'>SWA-006</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Switch Debouncer</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-003</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Release auf Fahrer-Anforderung</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Aktoren (Caliper-Motoren)</div></td><td><div><span class='id'>SWE-005</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Release-Voraussetzungen pruefen</div><div><span class='id'>SWE-006</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Aktoren in Release-Position fahren</div><div><span class='id'>SWE-025</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Switch-Debouncing</div></td><td><div><span class='id'>SWA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Apply Controller</div><div><span class='id'>SWA-003</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Actuator Driver</div><div><span class='id'>SWA-006</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Switch Debouncer</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-004</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Auto-Apply bei Motor-Aus</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div></td><td><div><span class='id'>SWE-007</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Motor-Aus-Bedingung erkennen</div><div><span class='id'>SWE-008</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Auto-Apply nach 2 s Verzoegerung</div></td><td><div><span class='id'>SWA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Safety Manager</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-005</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Hill-Hold am Berg</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-003</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Sensor-Cluster</div></td><td><div><span class='id'>SWE-009</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Hill-Hold-Aktivierungsbedingung</div><div><span class='id'>SWE-010</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Hill-Hold-Uebergabe an Apply-Controller</div><div><span class='id'>SWE-024</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Inclinometer Tiefpass-Filter</div></td><td><div><span class='id'>SWA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Safety Manager</div><div><span class='id'>SWA-005</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Inclinometer Filter</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-006</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Auto-Release beim Anfahren (Drive-Away-Assist)</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-003</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Sensor-Cluster</div></td><td><div><span class='id'>SWE-011</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Anfahrabsicht erkennen</div><div><span class='id'>SWE-012</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Sicherheits-Check vor Auto-Release</div><div><span class='id'>SWE-022</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Stillstands-Erkennung aus Wheel Speeds</div></td><td><div><span class='id'>SWA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Safety Manager</div><div><span class='id'>SWA-004</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Wheel Speed Plausibilisierung</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-007</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Aktor-Stromueberwachung</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-002</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>Aktoren (Caliper-Motoren)</div><div><span class='id'>SA-003</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Sensor-Cluster</div></td><td><div><span class='id'>SWE-013</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Strommessung mit 1 kHz</div><div><span class='id'>SWE-014</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Overcurrent-Cutoff</div><div><span class='id'>SWE-015</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Klemmkraft-Schaetzung aus Strom-Profil</div><div><span class='id'>SWE-023</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Wheel Speed Plausibilisierung</div></td><td><div><span class='id'>SWA-003</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Actuator Driver</div><div><span class='id'>SWA-004</span> <span class='asil' style='background:#2ca02c'>B</span></div><div class='cnt'>Wheel Speed Plausibilisierung</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-008</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Service-Modus fuer Werkstatt</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-004</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>HMI (Schalter, LED, Display)</div></td><td><div><span class='id'>SWE-016</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>UDS RoutineControl 0x31 fuer Service-Release</div><div><span class='id'>SWE-017</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Service-Mode-Indikator</div></td><td><div><span class='id'>SWA-009</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Service Mode</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-009</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>UDS-Diagnose</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-005</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>CAN-Bus</div></td><td><div><span class='id'>SWE-018</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>UDS Service 0x19 ReadDTC</div><div><span class='id'>SWE-019</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>UDS Service 0x22 ReadDataByIdentifier</div></td><td><div><span class='id'>SWA-008</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Diagnostic Manager</div><div><span class='id'>SWA-010</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Logger</div></td></tr>
|
||||||
|
<tr><td><div><span class='id'>SYS-010</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>HMI-Statusanzeige</div></td><td><div><span class='id'>SA-001</span> <span class='asil' style='background:#d62728'>D</span></div><div class='cnt'>EPB ECU</div><div><span class='id'>SA-004</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>HMI (Schalter, LED, Display)</div><div><span class='id'>SA-005</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>CAN-Bus</div></td><td><div><span class='id'>SWE-020</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>LED-Steuerung</div><div><span class='id'>SWE-021</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>CAN-Status-Frame</div></td><td><div><span class='id'>SWA-007</span> <span class='asil' style='background:#888'>QM</span></div><div class='cnt'>Display Manager</div></td></tr>
|
||||||
|
</table></body></html>
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-001",
|
||||||
|
"asil": "D",
|
||||||
|
"title": "Halten der Parkbremse im Stillstand"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-002",
|
||||||
|
"asil": "D"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-002",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-022",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-002",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-004",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-002",
|
||||||
|
"asil": "D",
|
||||||
|
"title": "Apply auf Fahrer-Anforderung"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-002",
|
||||||
|
"asil": "D"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-003",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-004",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-022",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-025",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-002",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-004",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-006",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-003",
|
||||||
|
"asil": "B",
|
||||||
|
"title": "Release auf Fahrer-Anforderung"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-002",
|
||||||
|
"asil": "D"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-005",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-006",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-025",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-002",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-003",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-006",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-004",
|
||||||
|
"asil": "D",
|
||||||
|
"title": "Auto-Apply bei Motor-Aus"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-007",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-008",
|
||||||
|
"asil": "D"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-001",
|
||||||
|
"asil": "D"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-005",
|
||||||
|
"asil": "D",
|
||||||
|
"title": "Hill-Hold am Berg"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-003",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-009",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-010",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-024",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-005",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-006",
|
||||||
|
"asil": "B",
|
||||||
|
"title": "Auto-Release beim Anfahren (Drive-Away-Assist)"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-003",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-011",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-012",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-022",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-004",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-007",
|
||||||
|
"asil": "B",
|
||||||
|
"title": "Aktor-Stromueberwachung"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-002",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-003",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-013",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-014",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-015",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-023",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-003",
|
||||||
|
"asil": "B"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-004",
|
||||||
|
"asil": "B"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-008",
|
||||||
|
"asil": "QM",
|
||||||
|
"title": "Service-Modus fuer Werkstatt"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-004",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-016",
|
||||||
|
"asil": "QM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-017",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-009",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-009",
|
||||||
|
"asil": "QM",
|
||||||
|
"title": "UDS-Diagnose"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-005",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-018",
|
||||||
|
"asil": "QM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-019",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-008",
|
||||||
|
"asil": "QM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWA-010",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sys": {
|
||||||
|
"id": "SYS-010",
|
||||||
|
"asil": "QM",
|
||||||
|
"title": "HMI-Statusanzeige"
|
||||||
|
},
|
||||||
|
"sa": [
|
||||||
|
{
|
||||||
|
"id": "SA-001",
|
||||||
|
"asil": "D"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-004",
|
||||||
|
"asil": "QM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SA-005",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swe": [
|
||||||
|
{
|
||||||
|
"id": "SWE-020",
|
||||||
|
"asil": "QM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SWE-021",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"swa": [
|
||||||
|
{
|
||||||
|
"id": "SWA-007",
|
||||||
|
"asil": "QM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
/**
|
||||||
|
* @file safety_manager.c
|
||||||
|
* @brief Safety Manager — Hill-Hold + Auto-Apply Logik.
|
||||||
|
*
|
||||||
|
* @arch SWA-001
|
||||||
|
* @reqs SWE-007 SWE-008 SWE-009 SWE-010
|
||||||
|
*
|
||||||
|
* ASIL: D. Diese Komponente entscheidet, wann der Apply Controller eine
|
||||||
|
* Apply-Anforderung erhaelt (Hill-Hold-Uebergabe, Auto-Apply bei Motor-Aus).
|
||||||
|
* Aenderungen erfordern Technical Review mit 2 Approvals.
|
||||||
|
*/
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "safety_manager.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SafetyState state;
|
||||||
|
uint16_t ticks_in_state; /* 50ms-Ticks im aktuellen Zustand */
|
||||||
|
bool apply_requested;
|
||||||
|
} SafetyCtx;
|
||||||
|
|
||||||
|
static SafetyCtx s_ctx;
|
||||||
|
|
||||||
|
static void enter(SafetyState s)
|
||||||
|
{
|
||||||
|
s_ctx.state = s;
|
||||||
|
s_ctx.ticks_in_state = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool standstill(const SafetyInputs* in)
|
||||||
|
{
|
||||||
|
return in->vehicle_speed_kmh < SAFETY_STANDSTILL_KMH;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool grade_steep(const SafetyInputs* in)
|
||||||
|
{
|
||||||
|
/* @reqs SWE-009: Hill-Hold ab |grade| > 5% */
|
||||||
|
float g = in->grade_percent;
|
||||||
|
if (g < 0.0f) {
|
||||||
|
g = -g;
|
||||||
|
}
|
||||||
|
return g > SAFETY_HILLHOLD_GRADE_PCT;
|
||||||
|
}
|
||||||
|
|
||||||
|
EpbStatus safety_mgr_init(void)
|
||||||
|
{
|
||||||
|
s_ctx.state = SAFETY_IDLE;
|
||||||
|
s_ctx.ticks_in_state = 0U;
|
||||||
|
s_ctx.apply_requested = false;
|
||||||
|
return EPB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void safety_mgr_step_50ms(const SafetyInputs* in)
|
||||||
|
{
|
||||||
|
if (in == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_ctx.ticks_in_state < UINT16_MAX) {
|
||||||
|
++s_ctx.ticks_in_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Default: no apply request unless explicitly set below. */
|
||||||
|
s_ctx.apply_requested = false;
|
||||||
|
|
||||||
|
switch (s_ctx.state) {
|
||||||
|
case SAFETY_IDLE:
|
||||||
|
/* @reqs SWE-009: Hill-Hold-Aktivierung */
|
||||||
|
if (grade_steep(in) && standstill(in) && in->brake_pedal_pressed) {
|
||||||
|
enter(SAFETY_HILL_HOLD_ARMED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* @reqs SWE-007: Motor-Aus-Bedingung erkennen */
|
||||||
|
if (!in->engine_running && standstill(in)
|
||||||
|
&& in->current_state != EPB_STATE_APPLIED
|
||||||
|
&& in->current_state != EPB_STATE_APPLYING) {
|
||||||
|
enter(SAFETY_AUTO_APPLY_ARMED);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SAFETY_HILL_HOLD_ARMED:
|
||||||
|
/* @reqs SWE-010: Beim Loslassen des Bremspedals Apply triggern */
|
||||||
|
if (!in->brake_pedal_pressed) {
|
||||||
|
s_ctx.apply_requested = true;
|
||||||
|
enter(SAFETY_HILL_HOLD_ACTIVE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* Bedingung fuer Hill-Hold nicht mehr erfuellt? */
|
||||||
|
if (!grade_steep(in) || !standstill(in)) {
|
||||||
|
enter(SAFETY_IDLE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SAFETY_HILL_HOLD_ACTIVE:
|
||||||
|
/* Beendet, wenn Fahrzeug rollt oder Bremse appliziert */
|
||||||
|
if (in->vehicle_speed_kmh > SAFETY_RELEASE_KMH
|
||||||
|
|| in->current_state == EPB_STATE_APPLIED) {
|
||||||
|
enter(SAFETY_IDLE);
|
||||||
|
} else {
|
||||||
|
s_ctx.apply_requested = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SAFETY_AUTO_APPLY_ARMED:
|
||||||
|
/* Bedingung muss durchgaengig erfuellt sein */
|
||||||
|
if (in->engine_running || !standstill(in)) {
|
||||||
|
enter(SAFETY_IDLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* @reqs SWE-008: Auto-Apply nach 2 s (40 Ticks) Verzoegerung */
|
||||||
|
if (s_ctx.ticks_in_state >= SAFETY_AUTO_APPLY_DELAY_50MS) {
|
||||||
|
s_ctx.apply_requested = true;
|
||||||
|
enter(SAFETY_AUTO_APPLY_TRIGGERED);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SAFETY_AUTO_APPLY_TRIGGERED:
|
||||||
|
if (in->current_state == EPB_STATE_APPLIED) {
|
||||||
|
enter(SAFETY_IDLE);
|
||||||
|
} else {
|
||||||
|
s_ctx.apply_requested = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
enter(SAFETY_IDLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool safety_mgr_apply_requested(void)
|
||||||
|
{
|
||||||
|
return s_ctx.apply_requested;
|
||||||
|
}
|
||||||
|
|
||||||
|
SafetyState safety_mgr_get_state(void)
|
||||||
|
{
|
||||||
|
return s_ctx.state;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @file safety_manager.h
|
||||||
|
* @brief Safety Manager — Hill-Hold + Auto-Apply Logik.
|
||||||
|
*
|
||||||
|
* @arch SWA-001
|
||||||
|
* @reqs SWE-007 SWE-008 SWE-009 SWE-010
|
||||||
|
*
|
||||||
|
* ASIL: D.
|
||||||
|
*
|
||||||
|
* State Machine:
|
||||||
|
* IDLE --(engine_off & v<0.5)--> AUTO_APPLY_ARMED
|
||||||
|
* AUTO_APPLY_ARMED --(40 * 50ms = 2s)--> AUTO_APPLY_TRIGGERED
|
||||||
|
* AUTO_APPLY_TRIGGERED --(state==APPLIED)--> IDLE
|
||||||
|
*
|
||||||
|
* IDLE --(grade>5% & v<0.5 & brake)--> HILL_HOLD_ARMED
|
||||||
|
* HILL_HOLD_ARMED --(!brake)--> HILL_HOLD_ACTIVE
|
||||||
|
* HILL_HOLD_ACTIVE --(v>2 km/h | state==APPLIED)--> IDLE
|
||||||
|
*/
|
||||||
|
#ifndef SAFETY_MANAGER_H
|
||||||
|
#define SAFETY_MANAGER_H
|
||||||
|
|
||||||
|
#include "epb_types.h"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAFETY_IDLE = 0,
|
||||||
|
SAFETY_HILL_HOLD_ARMED = 1,
|
||||||
|
SAFETY_HILL_HOLD_ACTIVE = 2,
|
||||||
|
SAFETY_AUTO_APPLY_ARMED = 3,
|
||||||
|
SAFETY_AUTO_APPLY_TRIGGERED = 4
|
||||||
|
} SafetyState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool engine_running;
|
||||||
|
bool brake_pedal_pressed;
|
||||||
|
float vehicle_speed_kmh;
|
||||||
|
float grade_percent;
|
||||||
|
EpbState current_state; /* aus Apply Controller */
|
||||||
|
} SafetyInputs;
|
||||||
|
|
||||||
|
/* Schwellwerte als Konstanten, damit Tests darauf zugreifen koennen. */
|
||||||
|
#define SAFETY_AUTO_APPLY_DELAY_50MS 40U /* 40 * 50ms = 2.0 s */
|
||||||
|
#define SAFETY_STANDSTILL_KMH 0.5f
|
||||||
|
#define SAFETY_RELEASE_KMH 2.0f
|
||||||
|
#define SAFETY_HILLHOLD_GRADE_PCT 5.0f
|
||||||
|
|
||||||
|
EpbStatus safety_mgr_init(void);
|
||||||
|
void safety_mgr_step_50ms(const SafetyInputs* in);
|
||||||
|
bool safety_mgr_apply_requested(void);
|
||||||
|
SafetyState safety_mgr_get_state(void);
|
||||||
|
|
||||||
|
#endif /* SAFETY_MANAGER_H */
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file safety_manager.h
|
|
||||||
* @brief Safety Manager — Hill-Hold + Auto-Apply Logik.
|
|
||||||
*
|
|
||||||
* @arch SWA-001
|
|
||||||
* @reqs SWE-007 SWE-008 SWE-009 SWE-010
|
|
||||||
*
|
|
||||||
* ASIL: D. STUB — nicht implementiert in dieser Demo.
|
|
||||||
*/
|
|
||||||
#ifndef SAFETY_MANAGER_H
|
|
||||||
#define SAFETY_MANAGER_H
|
|
||||||
|
|
||||||
#include "../epb_types.h"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bool engine_running;
|
|
||||||
bool brake_pedal_pressed;
|
|
||||||
float vehicle_speed_kmh;
|
|
||||||
float grade_percent;
|
|
||||||
EpbState current_state;
|
|
||||||
} SafetyInputs;
|
|
||||||
|
|
||||||
EpbStatus safety_mgr_init(void);
|
|
||||||
void safety_mgr_step_50ms(const SafetyInputs* in);
|
|
||||||
bool safety_mgr_apply_requested(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
/**
|
||||||
|
* @file test_safety_manager.c
|
||||||
|
* @brief Unit-Tests fuer den Safety Manager (ASIL-D).
|
||||||
|
*
|
||||||
|
* @reqs SWE-007 SWE-008 SWE-009 SWE-010
|
||||||
|
* @arch SWA-001
|
||||||
|
*/
|
||||||
|
#include "../unit_test_framework.h"
|
||||||
|
#include "../../src/safety_manager.h"
|
||||||
|
|
||||||
|
TestStats g_test_stats = {0, 0};
|
||||||
|
|
||||||
|
static SafetyInputs make_driving(void)
|
||||||
|
{
|
||||||
|
SafetyInputs in = {0};
|
||||||
|
in.engine_running = true;
|
||||||
|
in.brake_pedal_pressed = false;
|
||||||
|
in.vehicle_speed_kmh = 50.0f;
|
||||||
|
in.grade_percent = 0.0f;
|
||||||
|
in.current_state = EPB_STATE_RELEASED;
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SafetyInputs make_standstill(void)
|
||||||
|
{
|
||||||
|
SafetyInputs in = make_driving();
|
||||||
|
in.vehicle_speed_kmh = 0.0f;
|
||||||
|
in.brake_pedal_pressed = true;
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void step_n(SafetyInputs* in, int n)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n; ++i) {
|
||||||
|
safety_mgr_step_50ms(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_init(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("init -> IDLE, kein Apply-Request");
|
||||||
|
ASSERT_EQ(safety_mgr_init(), EPB_OK);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
ASSERT_TRUE(!safety_mgr_apply_requested());
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_null_input(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("NULL Input ist no-op");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
safety_mgr_step_50ms(NULL);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Auto-Apply (SWE-007 + SWE-008) ---- */
|
||||||
|
|
||||||
|
static void test_auto_apply_armed_on_engine_off(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("SWE-007: Motor aus + Stillstand -> AUTO_APPLY_ARMED");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_driving();
|
||||||
|
in.engine_running = false;
|
||||||
|
in.vehicle_speed_kmh = 0.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_AUTO_APPLY_ARMED);
|
||||||
|
ASSERT_TRUE(!safety_mgr_apply_requested());
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_auto_apply_triggers_after_2s(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("SWE-008: nach ca. 2s -> TRIGGERED + Apply-Request");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_driving();
|
||||||
|
in.engine_running = false;
|
||||||
|
in.vehicle_speed_kmh = 0.0f;
|
||||||
|
/* Halfway: still armed, no request */
|
||||||
|
step_n(&in, 20);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_AUTO_APPLY_ARMED);
|
||||||
|
ASSERT_TRUE(!safety_mgr_apply_requested());
|
||||||
|
/* Run up to TRIGGERED within at most 25 more steps (~2 s leeway) */
|
||||||
|
for (int i = 0; i < 25; ++i) {
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
if (safety_mgr_get_state() == SAFETY_AUTO_APPLY_TRIGGERED) break;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_AUTO_APPLY_TRIGGERED);
|
||||||
|
ASSERT_TRUE(safety_mgr_apply_requested());
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_auto_apply_aborts_on_engine_on(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("Auto-Apply bricht ab wenn Motor wieder an");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_driving();
|
||||||
|
in.engine_running = false;
|
||||||
|
in.vehicle_speed_kmh = 0.0f;
|
||||||
|
step_n(&in, 20);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_AUTO_APPLY_ARMED);
|
||||||
|
in.engine_running = true;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_auto_apply_returns_idle_when_applied(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("AUTO_APPLY_TRIGGERED -> IDLE wenn Apply Controller fertig");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_driving();
|
||||||
|
in.engine_running = false;
|
||||||
|
in.vehicle_speed_kmh = 0.0f;
|
||||||
|
/* Drive to TRIGGERED */
|
||||||
|
for (int i = 0; i < 50; ++i) {
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
if (safety_mgr_get_state() == SAFETY_AUTO_APPLY_TRIGGERED) break;
|
||||||
|
}
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_AUTO_APPLY_TRIGGERED);
|
||||||
|
in.current_state = EPB_STATE_APPLIED;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
ASSERT_TRUE(!safety_mgr_apply_requested());
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Hill-Hold (SWE-009 + SWE-010) ---- */
|
||||||
|
|
||||||
|
static void test_hillhold_arms_on_grade_brake_standstill(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("SWE-009: Grad >5% + Stillstand + Bremse -> HILL_HOLD_ARMED");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_standstill();
|
||||||
|
in.grade_percent = 8.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_HILL_HOLD_ARMED);
|
||||||
|
ASSERT_TRUE(!safety_mgr_apply_requested());
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hillhold_negative_grade_also_triggers(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("Hill-Hold auch bei negativem Grad (abschuessig)");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_standstill();
|
||||||
|
in.grade_percent = -7.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_HILL_HOLD_ARMED);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hillhold_below_threshold_no_arm(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("Grad < 5% -> kein Hill-Hold");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_standstill();
|
||||||
|
in.grade_percent = 4.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hillhold_active_on_brake_release(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("SWE-010: Bremse losgelassen -> HILL_HOLD_ACTIVE + Apply-Request");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_standstill();
|
||||||
|
in.grade_percent = 8.0f;
|
||||||
|
safety_mgr_step_50ms(&in); /* -> HILL_HOLD_ARMED */
|
||||||
|
in.brake_pedal_pressed = false;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_HILL_HOLD_ACTIVE);
|
||||||
|
ASSERT_TRUE(safety_mgr_apply_requested());
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hillhold_active_ends_on_vehicle_rolling(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("HILL_HOLD_ACTIVE endet wenn Fahrzeug rollt (v > 2 km/h)");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_standstill();
|
||||||
|
in.grade_percent = 8.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
in.brake_pedal_pressed = false;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_HILL_HOLD_ACTIVE);
|
||||||
|
in.vehicle_speed_kmh = 3.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_hillhold_armed_to_idle_if_grade_drops(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("HILL_HOLD_ARMED -> IDLE wenn Grad < 5% wird");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_standstill();
|
||||||
|
in.grade_percent = 8.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_HILL_HOLD_ARMED);
|
||||||
|
in.grade_percent = 1.0f;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Mutually exclusive: nicht in beiden Modi gleichzeitig ---- */
|
||||||
|
|
||||||
|
static void test_already_applied_does_not_arm_auto_apply(void)
|
||||||
|
{
|
||||||
|
TEST_BEGIN("Bereits Applied: kein Auto-Apply Arming");
|
||||||
|
(void)safety_mgr_init();
|
||||||
|
SafetyInputs in = make_driving();
|
||||||
|
in.engine_running = false;
|
||||||
|
in.vehicle_speed_kmh = 0.0f;
|
||||||
|
in.current_state = EPB_STATE_APPLIED;
|
||||||
|
safety_mgr_step_50ms(&in);
|
||||||
|
ASSERT_EQ(safety_mgr_get_state(), SAFETY_IDLE);
|
||||||
|
TEST_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
printf("== test_safety_manager ==\n");
|
||||||
|
test_init();
|
||||||
|
test_null_input();
|
||||||
|
test_auto_apply_armed_on_engine_off();
|
||||||
|
test_auto_apply_triggers_after_2s();
|
||||||
|
test_auto_apply_aborts_on_engine_on();
|
||||||
|
test_auto_apply_returns_idle_when_applied();
|
||||||
|
test_hillhold_arms_on_grade_brake_standstill();
|
||||||
|
test_hillhold_negative_grade_also_triggers();
|
||||||
|
test_hillhold_below_threshold_no_arm();
|
||||||
|
test_hillhold_active_on_brake_release();
|
||||||
|
test_hillhold_active_ends_on_vehicle_rolling();
|
||||||
|
test_hillhold_armed_to_idle_if_grade_drops();
|
||||||
|
test_already_applied_does_not_arm_auto_apply();
|
||||||
|
TEST_SUMMARY();
|
||||||
|
}
|
||||||
@@ -439,7 +439,7 @@ SA_ELEMENTS = [
|
|||||||
SWA_ELEMENTS = [
|
SWA_ELEMENTS = [
|
||||||
{
|
{
|
||||||
"id": "SWA-001", "asil": "D",
|
"id": "SWA-001", "asil": "D",
|
||||||
"links": ["SWE-007", "SWE-008", "SWE-009", "SWE-010"],
|
"links": ["SWE-007", "SWE-008", "SWE-009", "SWE-010", "SWE-011", "SWE-012"],
|
||||||
"title": "Safety Manager",
|
"title": "Safety Manager",
|
||||||
"text": textwrap.dedent("""
|
"text": textwrap.dedent("""
|
||||||
## Verantwortung
|
## Verantwortung
|
||||||
@@ -500,7 +500,7 @@ SWA_ELEMENTS = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SWA-002", "asil": "D",
|
"id": "SWA-002", "asil": "D",
|
||||||
"links": ["SWE-001", "SWE-002", "SWE-003", "SWE-004"],
|
"links": ["SWE-001", "SWE-002", "SWE-003", "SWE-004", "SWE-005"],
|
||||||
"title": "Apply Controller",
|
"title": "Apply Controller",
|
||||||
"text": textwrap.dedent("""
|
"text": textwrap.dedent("""
|
||||||
## Verantwortung
|
## Verantwortung
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Rendert alle @startuml ... @enduml Bloecke aus arch/**/*.md als SVG.
|
||||||
|
|
||||||
|
Verwendet einen erreichbaren PlantUML-HTTP-Server (Default: www.plantuml.com).
|
||||||
|
In CI kann die Server-URL ueber PLANTUML_SERVER ueberschrieben werden.
|
||||||
|
|
||||||
|
Output: docs/diagrams/<file>-<index>.svg
|
||||||
|
|
||||||
|
Run:
|
||||||
|
python3 tools/render_plantuml.py
|
||||||
|
PLANTUML_SERVER=http://plantuml-server:8080 python3 tools/render_plantuml.py
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import urllib.request
|
||||||
|
import zlib
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
REPO = Path(__file__).resolve().parent.parent
|
||||||
|
SERVER = os.environ.get("PLANTUML_SERVER", "https://www.plantuml.com/plantuml")
|
||||||
|
|
||||||
|
# Map standard base64 to PlantUML's base64 alphabet
|
||||||
|
_B64 = (
|
||||||
|
"0123456789"
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"-_"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _encode_3bytes(b1: int, b2: int, b3: int) -> str:
|
||||||
|
c1 = b1 >> 2
|
||||||
|
c2 = ((b1 & 0x3) << 4) | (b2 >> 4)
|
||||||
|
c3 = ((b2 & 0xF) << 2) | (b3 >> 6)
|
||||||
|
c4 = b3 & 0x3F
|
||||||
|
return _B64[c1] + _B64[c2] + _B64[c3] + _B64[c4]
|
||||||
|
|
||||||
|
|
||||||
|
def plantuml_encode(text: str) -> str:
|
||||||
|
"""Encode PlantUML source to its URL-safe representation."""
|
||||||
|
compressed = zlib.compress(text.encode("utf-8"), 9)
|
||||||
|
# Strip zlib header (2 bytes) and Adler32 trailer (4 bytes)
|
||||||
|
raw = compressed[2:-4]
|
||||||
|
out = ""
|
||||||
|
i = 0
|
||||||
|
while i < len(raw):
|
||||||
|
b1 = raw[i]
|
||||||
|
b2 = raw[i + 1] if i + 1 < len(raw) else 0
|
||||||
|
b3 = raw[i + 2] if i + 2 < len(raw) else 0
|
||||||
|
out += _encode_3bytes(b1, b2, b3)
|
||||||
|
i += 3
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
BLOCK_RE = re.compile(r"```plantuml\s*\n(@startuml.*?@enduml)\s*\n```",
|
||||||
|
re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
|
def extract_blocks(md: Path) -> list[str]:
|
||||||
|
return BLOCK_RE.findall(md.read_text())
|
||||||
|
|
||||||
|
|
||||||
|
def render_one(src: str, out_path: Path) -> None:
|
||||||
|
encoded = plantuml_encode(src)
|
||||||
|
url = f"{SERVER.rstrip('/')}/svg/{encoded}"
|
||||||
|
req = urllib.request.Request(url, headers={"User-Agent": "demo-epb/1.0"})
|
||||||
|
with urllib.request.urlopen(req, timeout=30) as resp:
|
||||||
|
data = resp.read()
|
||||||
|
out_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
out_path.write_bytes(data)
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
out_dir = REPO / "docs" / "diagrams"
|
||||||
|
out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
md_files = sorted((REPO / "arch").rglob("*.md"))
|
||||||
|
if not md_files:
|
||||||
|
print("Keine arch/**/*.md gefunden.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
total = 0
|
||||||
|
for md in md_files:
|
||||||
|
rel = md.relative_to(REPO)
|
||||||
|
blocks = extract_blocks(md)
|
||||||
|
if not blocks:
|
||||||
|
continue
|
||||||
|
for i, block in enumerate(blocks, start=1):
|
||||||
|
stem = md.stem
|
||||||
|
target = out_dir / f"{stem}-{i}.svg"
|
||||||
|
try:
|
||||||
|
render_one(block, target)
|
||||||
|
print(f" {rel} block {i} -> {target.relative_to(REPO)}")
|
||||||
|
total += 1
|
||||||
|
except Exception as e:
|
||||||
|
print(f" WARN: {rel} block {i} render failed: {e}")
|
||||||
|
print(f"\nDone: {total} Diagrams rendered to {out_dir.relative_to(REPO)}/")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -0,0 +1,286 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Traceability-Werkzeug fuer demo-epb.
|
||||||
|
|
||||||
|
Liest alle Markdown-Items in reqs/ und arch/ ein, validiert Links bidirektional
|
||||||
|
und erzeugt eine HTML-Traceability-Matrix.
|
||||||
|
|
||||||
|
Doorstop-kompatibles Format (YAML-Frontmatter + Markdown-Body), aber ohne
|
||||||
|
Doorstop-Dependency — bleibt portabel.
|
||||||
|
|
||||||
|
Subcommands:
|
||||||
|
check Validiert Konsistenz, exit 1 bei Fehlern
|
||||||
|
publish DIR Schreibt HTML + JSON nach DIR/
|
||||||
|
|
||||||
|
Run:
|
||||||
|
python3 tools/traceability.py check
|
||||||
|
python3 tools/traceability.py publish docs/traceability/
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import html
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
REPO = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
SOURCES = [
|
||||||
|
("SYS", "reqs/sys", "System Requirements"),
|
||||||
|
("SWE", "reqs/swe", "Software Requirements"),
|
||||||
|
("SA", "arch/sys", "System Architecture"),
|
||||||
|
("SWA", "arch/swe", "Software Architecture"),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Welche Quellen verlinken auf welche?
|
||||||
|
# (key) -> (target_prefix) : Items mit key linken auf Items mit target_prefix
|
||||||
|
EXPECTED_LINKS = {
|
||||||
|
"SA": ["SYS"],
|
||||||
|
"SWE": ["SYS"],
|
||||||
|
"SWA": ["SWE"],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Reverse: welche Quellen MUESSEN von welchen Quellen referenziert werden?
|
||||||
|
# (target) -> [prefix that should link to target] (coverage check)
|
||||||
|
COVERAGE = {
|
||||||
|
"SYS": ["SA", "SWE"], # jede SYS-Req muss durch SA und SWE abgedeckt sein
|
||||||
|
"SWE": ["SWA"], # jede SWE-Req muss durch SWA abgedeckt sein
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Item:
|
||||||
|
id: str
|
||||||
|
prefix: str
|
||||||
|
path: Path
|
||||||
|
title: str
|
||||||
|
asil: str
|
||||||
|
links: list[str] = field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
FRONTMATTER_RE = re.compile(r"^---\s*\n(.*?)\n---\s*\n", re.DOTALL)
|
||||||
|
LINKS_RE = re.compile(r"^\s*-\s+([A-Z]+-\d+)", re.MULTILINE)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_item(path: Path, prefix: str) -> Item | None:
|
||||||
|
text = path.read_text()
|
||||||
|
m = FRONTMATTER_RE.match(text)
|
||||||
|
if not m:
|
||||||
|
return None
|
||||||
|
fm = m.group(1)
|
||||||
|
|
||||||
|
# Crude YAML parsing — we only need a few fields.
|
||||||
|
def field_value(name: str) -> str | None:
|
||||||
|
rx = re.search(rf"^{name}:\s*(.*?)$", fm, re.MULTILINE)
|
||||||
|
return rx.group(1).strip().strip("'\"") if rx else None
|
||||||
|
|
||||||
|
asil = field_value("asil") or "?"
|
||||||
|
title = field_value("header") or path.stem
|
||||||
|
|
||||||
|
# links: collect IDs from the `links:` block.
|
||||||
|
links: list[str] = []
|
||||||
|
in_links = False
|
||||||
|
for line in fm.splitlines():
|
||||||
|
if line.startswith("links:"):
|
||||||
|
in_links = True
|
||||||
|
continue
|
||||||
|
if in_links:
|
||||||
|
if line.startswith(" - "):
|
||||||
|
m2 = re.match(r" - ([A-Z]+-\d+)", line)
|
||||||
|
if m2:
|
||||||
|
links.append(m2.group(1))
|
||||||
|
elif not line.startswith(" ") and line.strip():
|
||||||
|
in_links = False
|
||||||
|
|
||||||
|
return Item(id=path.stem, prefix=prefix, path=path, title=title,
|
||||||
|
asil=asil, links=links)
|
||||||
|
|
||||||
|
|
||||||
|
def collect_all() -> dict[str, Item]:
|
||||||
|
items: dict[str, Item] = {}
|
||||||
|
for prefix, rel, _label in SOURCES:
|
||||||
|
d = REPO / rel
|
||||||
|
if not d.exists():
|
||||||
|
continue
|
||||||
|
for f in sorted(d.glob("*.md")):
|
||||||
|
it = parse_item(f, prefix)
|
||||||
|
if it is None:
|
||||||
|
continue
|
||||||
|
items[it.id] = it
|
||||||
|
return items
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_check(items: dict[str, Item]) -> int:
|
||||||
|
errors: list[str] = []
|
||||||
|
|
||||||
|
# 1. Each link target must exist
|
||||||
|
for it in items.values():
|
||||||
|
for link in it.links:
|
||||||
|
if link not in items:
|
||||||
|
errors.append(f"{it.id} links to non-existent {link}")
|
||||||
|
|
||||||
|
# 2. Forward expectation: items of certain prefixes must link to others
|
||||||
|
for it in items.values():
|
||||||
|
expected_prefixes = EXPECTED_LINKS.get(it.prefix, [])
|
||||||
|
if not expected_prefixes:
|
||||||
|
continue
|
||||||
|
actual_prefixes = {items[l].prefix for l in it.links if l in items}
|
||||||
|
for ep in expected_prefixes:
|
||||||
|
if ep not in actual_prefixes:
|
||||||
|
errors.append(
|
||||||
|
f"{it.id} ({it.prefix}) has no link to a {ep}-* item"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 3. Coverage: each item of certain prefix must be referenced by certain types
|
||||||
|
incoming: dict[str, set[str]] = {iid: set() for iid in items}
|
||||||
|
for it in items.values():
|
||||||
|
for link in it.links:
|
||||||
|
if link in incoming:
|
||||||
|
incoming[link].add(it.prefix)
|
||||||
|
|
||||||
|
for it in items.values():
|
||||||
|
required = COVERAGE.get(it.prefix, [])
|
||||||
|
for rp in required:
|
||||||
|
if rp not in incoming[it.id]:
|
||||||
|
errors.append(
|
||||||
|
f"{it.id} ({it.prefix}) is not referenced by any {rp}-* item"
|
||||||
|
)
|
||||||
|
|
||||||
|
print(f"\nItems found: {len(items)}")
|
||||||
|
print(f" SYS: {sum(1 for i in items.values() if i.prefix == 'SYS')}")
|
||||||
|
print(f" SWE: {sum(1 for i in items.values() if i.prefix == 'SWE')}")
|
||||||
|
print(f" SA: {sum(1 for i in items.values() if i.prefix == 'SA')}")
|
||||||
|
print(f" SWA: {sum(1 for i in items.values() if i.prefix == 'SWA')}")
|
||||||
|
print()
|
||||||
|
if errors:
|
||||||
|
print(f"FAIL: {len(errors)} traceability error(s):")
|
||||||
|
for e in errors:
|
||||||
|
print(f" - {e}")
|
||||||
|
return 1
|
||||||
|
print("OK — Traceability vollstaendig.")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def asil_color(asil: str) -> str:
|
||||||
|
return {
|
||||||
|
"D": "#d62728",
|
||||||
|
"C": "#ff7f0e",
|
||||||
|
"B": "#2ca02c",
|
||||||
|
"A": "#1f77b4",
|
||||||
|
"QM": "#888",
|
||||||
|
}.get(asil, "#aaa")
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_publish(items: dict[str, Item], out_dir: Path) -> int:
|
||||||
|
out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# Build forward and reverse maps
|
||||||
|
children: dict[str, list[str]] = {iid: [] for iid in items}
|
||||||
|
for it in items.values():
|
||||||
|
for link in it.links:
|
||||||
|
if link in children:
|
||||||
|
children[link].append(it.id)
|
||||||
|
|
||||||
|
rows = []
|
||||||
|
sys_items = [i for i in items.values() if i.prefix == "SYS"]
|
||||||
|
for sys in sorted(sys_items, key=lambda i: i.id):
|
||||||
|
sas = [c for c in children[sys.id] if items[c].prefix == "SA"]
|
||||||
|
swes = [c for c in children[sys.id] if items[c].prefix == "SWE"]
|
||||||
|
swas = sorted(set(c for s in swes for c in children[s]
|
||||||
|
if items[c].prefix == "SWA"))
|
||||||
|
rows.append({
|
||||||
|
"sys": sys, "sa": sas, "swe": swes, "swa": swas
|
||||||
|
})
|
||||||
|
|
||||||
|
# HTML
|
||||||
|
parts = [
|
||||||
|
"<!doctype html><html lang='de'><head>",
|
||||||
|
"<meta charset='utf-8'>",
|
||||||
|
"<title>demo-epb — Traceability Matrix</title>",
|
||||||
|
"<style>",
|
||||||
|
"body{font-family:-apple-system,Segoe UI,sans-serif;padding:20px;color:#222}",
|
||||||
|
"table{border-collapse:collapse;width:100%;font-size:14px}",
|
||||||
|
"th,td{border:1px solid #ccc;padding:6px 8px;vertical-align:top;text-align:left}",
|
||||||
|
"th{background:#f0f0f0}",
|
||||||
|
"tr:nth-child(even) td{background:#fafafa}",
|
||||||
|
".asil{display:inline-block;padding:1px 6px;border-radius:3px;color:white;font-weight:bold;font-size:11px}",
|
||||||
|
".id{font-family:Consolas,monospace;font-size:13px}",
|
||||||
|
".cnt{color:#666;font-size:11px}",
|
||||||
|
"h1{color:#1f3864}",
|
||||||
|
"</style></head><body>",
|
||||||
|
"<h1>demo-epb — Traceability Matrix</h1>",
|
||||||
|
f"<p>Generiert aus {sum(1 for _ in items)} Items "
|
||||||
|
f"(SYS: {len([i for i in items.values() if i.prefix=='SYS'])}, "
|
||||||
|
f"SWE: {len([i for i in items.values() if i.prefix=='SWE'])}, "
|
||||||
|
f"SA: {len([i for i in items.values() if i.prefix=='SA'])}, "
|
||||||
|
f"SWA: {len([i for i in items.values() if i.prefix=='SWA'])}).</p>",
|
||||||
|
"<table>",
|
||||||
|
"<tr><th>System-Requirement</th><th>System-Arch (SA)</th>"
|
||||||
|
"<th>Software-Req (SWE)</th><th>Software-Arch (SWA)</th></tr>",
|
||||||
|
]
|
||||||
|
|
||||||
|
def cell(ids: list[str]) -> str:
|
||||||
|
if not ids:
|
||||||
|
return "<td style='color:#c00'>—</td>"
|
||||||
|
bits = []
|
||||||
|
for i in ids:
|
||||||
|
it = items[i]
|
||||||
|
c = asil_color(it.asil)
|
||||||
|
bits.append(
|
||||||
|
f"<div><span class='id'>{html.escape(i)}</span> "
|
||||||
|
f"<span class='asil' style='background:{c}'>{html.escape(it.asil)}</span></div>"
|
||||||
|
f"<div class='cnt'>{html.escape(it.title)}</div>"
|
||||||
|
)
|
||||||
|
return "<td>" + "".join(bits) + "</td>"
|
||||||
|
|
||||||
|
for r in rows:
|
||||||
|
sys = r["sys"]
|
||||||
|
c = asil_color(sys.asil)
|
||||||
|
first = (f"<td><div><span class='id'>{html.escape(sys.id)}</span> "
|
||||||
|
f"<span class='asil' style='background:{c}'>{html.escape(sys.asil)}</span></div>"
|
||||||
|
f"<div class='cnt'>{html.escape(sys.title)}</div></td>")
|
||||||
|
parts.append("<tr>" + first + cell(r["sa"]) + cell(r["swe"]) + cell(r["swa"]) + "</tr>")
|
||||||
|
|
||||||
|
parts.append("</table></body></html>")
|
||||||
|
|
||||||
|
(out_dir / "index.html").write_text("\n".join(parts))
|
||||||
|
|
||||||
|
# JSON for machine consumption
|
||||||
|
matrix = []
|
||||||
|
for r in rows:
|
||||||
|
matrix.append({
|
||||||
|
"sys": {"id": r["sys"].id, "asil": r["sys"].asil, "title": r["sys"].title},
|
||||||
|
"sa": [{"id": i, "asil": items[i].asil} for i in r["sa"]],
|
||||||
|
"swe": [{"id": i, "asil": items[i].asil} for i in r["swe"]],
|
||||||
|
"swa": [{"id": i, "asil": items[i].asil} for i in r["swa"]],
|
||||||
|
})
|
||||||
|
(out_dir / "matrix.json").write_text(json.dumps(matrix, indent=2))
|
||||||
|
|
||||||
|
print(f"Wrote: {out_dir / 'index.html'}")
|
||||||
|
print(f"Wrote: {out_dir / 'matrix.json'}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print(__doc__)
|
||||||
|
return 2
|
||||||
|
cmd = sys.argv[1]
|
||||||
|
items = collect_all()
|
||||||
|
if cmd == "check":
|
||||||
|
return cmd_check(items)
|
||||||
|
if cmd == "publish":
|
||||||
|
out = Path(sys.argv[2] if len(sys.argv) > 2 else "docs/traceability")
|
||||||
|
rc = cmd_check(items)
|
||||||
|
if rc != 0:
|
||||||
|
print("WARN: publishing despite check errors")
|
||||||
|
cmd_publish(items, out)
|
||||||
|
return 0
|
||||||
|
print(f"unknown command: {cmd}")
|
||||||
|
return 2
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
Reference in new issue
Block a user