samples/subsys/smf/hsm_psicc2/README.html · samples/subsys/smf/hsm_psicc2/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · SMF

PSiCC2 기반 계층형 상태 머신

4-level state nesting, entry·run·exit와 parent event propagation을 관찰합니다.

Official pathsamples/subsys/smf/hsm_psicc2/README.html
Source filesamples/subsys/smf/hsm_psicc2/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Event A~I와 terminate command, unsupported UML transition의 차이를 설명합니다.

Framework

State Machine Framework

Reference

PSiCC2 Figure 2.11

Control

event A-I · terminate

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 65A5786F7A40E97FC7BA33CEA2897C6235211D0D790603918970E140C25A9698
.. zephyr:code-sample:: smf_hsm_psicc2
   :name: Hierarchical State Machine Demo based on example from PSiCC2
   :relevant-api: smf

   Implement an event-driven hierarchical state machine using State Machine Framework (SMF).

Overview
********

This sample demonstrates the :ref:`State Machine Framework <smf>` subsystem.

Building and Running
********************

It should be possible to build and run this sample on almost any board or emulator.

Building and Running for ST Disco L475 IOT01 (B-L475E-IOT01A)
=============================================================
The sample can be built and executed for the :ref:`disco_l475_iot1_board` as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/smf/psicc2
   :board: disco_l475_iot1
   :goals: build flash
   :compact:

For other boards just replace the board name.

Instructions for Use
====================
This application implements the statechart shown in Figure 2.11 of
Practical UML Statecharts in C/C++, 2nd Edition, by Miro Samek (PSiCC2). Ebook available from
https://www.state-machine.com/psicc2 This demo was chosen as it contains all possible transition
topologies up to four levels of state nesting and is used with permission of the author.

For each state, the entry, run, and exit actions are logged to the console, as well as logging
when a state handles an event, or explicitly ignores it and passes it up to the parent state.

There are two shell commands defined for controlling the operation.

* ``psicc2 event <event>`` sends the event (from A to I) to the state machine. These correspond to
  events A through I in PSiCC2 Figure 2.11
* ``psicc2 terminate`` sends the ``EVENT_TERMINATE`` event to terminate the state machine. There
  is no way to restart the state machine once terminated, and future events are ignored.

Comparison to PSiCC2 Output
===========================
Not all transitions modelled in UML may be supported by the :ref:`State Machine Framework <smf>`.
Unsupported transitions may lead to results different to the example run of the application in
PSiCC2 Section 2.3.15. The differences will not be listed here as it is hoped :ref:`SMF <smf>`
will support these transitions in the future and the list would become outdated.

Part 3

한국어 전문 번역

개요

Zephyr State Machine Framework(SMF) subsystem을 사용해 event-driven hierarchical state machine을 구현하는 sample입니다.

빌드 및 실행

거의 모든 board 또는 emulator에서 build하고 실행할 수 있습니다.

ST Disco L475 IOT01(B-L475E-IOT01A)용 빌드 및 실행

다음 command로 disco_l475_iot1용 sample을 build하고 flash합니다. 다른 board에서는 board 이름만 바꿉니다.

west build -b disco_l475_iot1 samples/subsys/smf/psicc2
west flash

사용 방법

Application은 Miro Samek의 Practical UML Statecharts in C/C++, 2nd Edition(PSiCC2) Figure 2.11에 나온 statechart를 구현합니다. 이 demo는 네 단계 state nesting까지 가능한 모든 transition topology를 포함하기 때문에 선택되었으며 저자의 허가를 받아 사용합니다.

각 state의 entry, run, exit action이 console에 기록됩니다. State가 event를 직접 처리하는 경우뿐 아니라 명시적으로 무시하고 parent state로 전달하는 경우도 log에 나타납니다.

동작을 제어하는 shell command는 두 개입니다.

  • psicc2 event <event>: A부터 I까지 event를 state machine에 보냅니다. PSiCC2 Figure 2.11의 event A~I에 대응합니다.
  • psicc2 terminate: EVENT_TERMINATE를 보내 state machine을 종료합니다. 종료한 뒤 다시 시작할 방법은 없으며 이후 event는 무시됩니다.

PSiCC2 출력과 비교

UML에 model된 transition 가운데 일부는 현재 SMF가 지원하지 않을 수 있습니다. Unsupported transition은 PSiCC2 Section 2.3.15의 example run과 다른 결과를 만들 수 있습니다. 향후 SMF가 지원하면 곧 낡을 수 있으므로 문서는 차이 목록을 고정해 두지 않습니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.