<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.sinelabore.com/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>SinelaboreRT - wiki:sysml2</title>
        <description>Productivity for embedded software development</description>
        <link>https://www.sinelabore.com/</link>
        <lastBuildDate>Wed, 08 Apr 2026 06:42:34 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.sinelabore.com/lib/exe/fetch.php/favicon.ico</url>
            <title>SinelaboreRT</title>
            <link>https://www.sinelabore.com/</link>
        </image>
        <item>
            <title>SysML v2 - First Experiments</title>
            <link>https://www.sinelabore.com/doku.php/wiki/sysml2/first_experience</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;sysml_v2_-_first_experiments&quot;&gt;SysML v2 - First Experiments&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
A new release of SysML is upcoming. The latest version is v2.0 beta 1 - it&amp;#039;s a modeling language that helps you design also complex systems.
&lt;/p&gt;

&lt;p&gt;
The standard is developed by the &lt;abbr title=&quot;Object Management Group&quot;&gt;OMG&lt;/abbr&gt; (&lt;a href=&quot;https://www.omg.org/spec/SysML&quot; class=&quot;urlextern&quot; title=&quot;https://www.omg.org/spec/SysML&quot; rel=&quot;ugc nofollow&quot;&gt;https://www.omg.org/spec/SysML&lt;/a&gt;) and its member companies. While SysML v1 has been around for several years and is based on &lt;abbr title=&quot;Unified Modeling Language&quot;&gt;UML&lt;/abbr&gt;, SysML v2 represents a significant evolution.
&lt;/p&gt;

&lt;p&gt;
I wanted to explore the current status of SysML v2 and understand what it would mean to support it as another input or output format for code generation.
&lt;/p&gt;

&lt;p&gt;
A really nice feature of SysML v2 is that it specifies both a textual representation of a model as well as a graphical one. You can work either on text or graphically and can switch between one or the other view – whatever is more convenient for you. Of course, the modeling tool must support this.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;SysML v2 - First Experiments&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;sysml_v2_-_first_experiments&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:1,&amp;quot;range&amp;quot;:&amp;quot;1-855&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit2&quot; id=&quot;what_to_expect_from_this_post&quot;&gt;What to expect from this post&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; A practical introduction to SysML v2 concepts through a familiar example&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Code examples that show how SysML v2 syntax works&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Note: I&amp;#039;m still learning SysML v2 myself, so this is from a practitioner&amp;#039;s perspective&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;What to expect from this post&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;what_to_expect_from_this_post&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:2,&amp;quot;range&amp;quot;:&amp;quot;856-1121&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit3&quot; id=&quot;selecting_a_tool&quot;&gt;Selecting a tool&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
To get started, it is highly recommended to use a tool. I found and the following tools:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;Visual Studio Code plugins&lt;/strong&gt;: Provides syntax highlighting, error hints, and navigation features. Great for learning the syntax (e.g. SysIDE).&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;Eclipse project&lt;/strong&gt;: Similar features to the VSC plugin, plus it supports a new PlantUML version that can directly render selected model parts. This is nice for visualization, but doesn&amp;#039;t work well for larger models. You&amp;#039;ll find many small code snippets with their graphical representations online, but complex models aren&amp;#039;t rendered as nicely.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;strong&gt;SysOn browser-based tool&lt;/strong&gt;: Available as a Docker image and based on the Eclipse Sirius Web platform. Offers a promising user interface and can import/export textual models. Still in development and probably too much for the first steps.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
More is available here: &lt;a href=&quot;https://mbse4u.com/mbse-tools/&quot; class=&quot;urlextern&quot; title=&quot;https://mbse4u.com/mbse-tools/&quot; rel=&quot;ugc nofollow&quot;&gt;https://mbse4u.com/mbse-tools/&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Selecting a tool&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;selecting_a_tool&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:3,&amp;quot;range&amp;quot;:&amp;quot;1122-2040&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit4&quot; id=&quot;getting_started_using_the_eclipse_plugin&quot;&gt;Getting started using the Eclipse plugin&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
A microwave oven is the example used in all the SinelaboreRT manuals and examples. I wanted to model that too in SysML v2. This is a perfect example because it&amp;#039;s a familiar embedded system that combines hardware and software components.
&lt;/p&gt;

&lt;p&gt;
My approach was to break down the oven into its parts (similar to how you might break down a software system into classes or modules) and model the interactions via ports (think of these as interfaces) and the main behavior with a state machine.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Getting started using the Eclipse plugin&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;getting_started_using_the_eclipse_plugin&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:4,&amp;quot;range&amp;quot;:&amp;quot;2041-2580&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit5&quot; id=&quot;defining_parts&quot;&gt;Defining parts&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
This step was quite simple and feels very natural. The physical parts of the oven became model parts . I organized everything in a package .
&lt;/p&gt;

&lt;p&gt;
The language also supports formal documentation, so tools can extract the “doc” parts later for generating documentation. Here&amp;#039;s what the basic structure looks like:
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;private import ScalarValues::*;
&amp;nbsp;
package OvenPackage {
	part def MicrowaveController{
		doc /*
		 * The controller interacting with all the peripheral parts
		 */
	}
&amp;nbsp;
	part def Motor{
		doc /*
		 * Motor driving the rotating plate
		 */
	}
	part def CountDownTimer{
		doc /*
		 * Timer that once started counts down to zero and stops the oven
		 * Can be paused and changed any time.
		 */
	}
&amp;nbsp;
	part def Door{
		doc /**
		 * Representing the door that emits events if closed or opened
		 */
	}
&amp;nbsp;
	part def Display{
		doc /**
		 * General display to show oven status
		 */
	}
&amp;nbsp;
	part def LedDisplay :&amp;gt; Display{
		doc /**
		 *  Specialization of generic display that has only some LEDs to show the oven status
		 */
	}
&amp;nbsp;
	part def TimeWheel{
		doc /**
		 * Rotary wheel that can increment and decrement the cooking time.
		 */
	}
}&lt;/pre&gt;

&lt;p&gt;
The graphical view shows the parts as expected. Notice how each part is represented as a box, similar to a class diagram in &lt;abbr title=&quot;Unified Modeling Language&quot;&gt;UML&lt;/abbr&gt;.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.sinelabore.com/lib/exe/detail.php/wiki/sysml2/oven-part1.png?id=wiki%3Asysml2%3Afirst_experience&quot; class=&quot;media&quot; title=&quot;wiki:sysml2:oven-part1.png&quot;&gt;&lt;img src=&quot;https://www.sinelabore.com/lib/exe/fetch.php/wiki/sysml2/oven-part1.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;{{:wiki:sysml2:oven-part1.png|[Oven Parts - The basic structure showing all the parts of the microwave oven]&quot; alt=&quot;{{:wiki:sysml2:oven-part1.png|[Oven Parts - The basic structure showing all the parts of the microwave oven]&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Defining parts&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;defining_parts&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:0,&amp;quot;secid&amp;quot;:5,&amp;quot;range&amp;quot;:&amp;quot;2581-4042&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit6&quot; id=&quot;how_parts_can_interact&quot;&gt;How parts can interact&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
This is where it gets interesting but also more complex. SysML v2 has many concepts for modeling interactions, and it can feel overwhelming at first. I&amp;#039;m still learning which concepts work best for different scenarios.
But others seem to have similar questions (see &lt;a href=&quot;https://mbse4u.com/2024/12/02/which-sysml-v2-element-to-choose/&quot; class=&quot;urlextern&quot; title=&quot;https://mbse4u.com/2024/12/02/which-sysml-v2-element-to-choose/&quot; rel=&quot;ugc nofollow&quot;&gt;https://mbse4u.com/2024/12/02/which-sysml-v2-element-to-choose/&lt;/a&gt;)
One preferred approach is to let parts interact using &lt;strong&gt;ports&lt;/strong&gt; (I think of these as interfaces or connection points). Ports can transfer events and data flows. Given my background in state-based, event-triggered systems, it felt natural to first model the events I could identify.
&lt;/p&gt;

&lt;p&gt;
My design approach was to let the &lt;code&gt;MicrowaveController&lt;/code&gt; receive events from the &lt;code&gt;Door&lt;/code&gt; and the &lt;code&gt;CountDownTimer&lt;/code&gt;, while it sends events to the &lt;code&gt;Motor&lt;/code&gt; and &lt;code&gt;Radiator&lt;/code&gt;. This creates a clear flow of information and control.
&lt;/p&gt;

&lt;p&gt;
For modeling events, I found several approaches in examples. I ended up modeling them as enums, though attributes and item-based concepts also seem possible.
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;	// definition of events from door sensor
	enum def DoorSensorEvents{
		evDoorOpened;
		evDoorClosed;
	}
&amp;nbsp;
&amp;nbsp;
	// definition of events to control motor
	enum def BinaryCommands{
		On;
		Off;
	}
&amp;nbsp;
	// events from the time selection interface
	enum def TimerEvents{
		evTimeout;
	}
&amp;nbsp;
	enum def TickEvents{
		evTick;
	}&lt;/pre&gt;

&lt;p&gt;
Now let&amp;#039;s define the ports. Think of these as the interfaces that define how parts communicate. The &lt;code&gt;OnOffPort&lt;/code&gt; can be reused for both the Radiator and the Motor since they both respond to simple on/off commands.
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;	// ports to connect parts
&amp;nbsp;
	port def TimerPort{
		out timeEvent : TimerEvents;
		out attribute timeInSec : Positive;
	}
&amp;nbsp;
	port def DoorEventsPort {
		out doorEvt : DoorSensorEvents;
	}
&amp;nbsp;
	port def OnOffPort{
		in motorCmd:BinaryCommands;
	}
&amp;nbsp;
	port def TickPort{
		out tick:TickEvents;
	}&lt;/pre&gt;

&lt;p&gt;
Now let&amp;#039;s add the ports to the parts. Here&amp;#039;s an example showing how to add  ports to parts. The &lt;code&gt;~&lt;/code&gt; symbol indicates a “conjugate” port (the opposite direction - if sometinng is `in` on one side, the conjugate is `out` on the other side).
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;part def Radiator{
  doc /*
       * Element generating the micro waves
       */
       in port onOffPort : OnOffPort;
}
&amp;nbsp;
part def MicrowaveController{
  doc /*
       * The controller interacting with all the peripheral parts
       */
       in port doorPort : ~DoorEventsPort; // receive
       in port timerPort: ~TimerPort; 
       out port motorPort : OnOffPort; // send
       out port radiatorPort : OnOffPort; // send
}&lt;/pre&gt;

&lt;p&gt;
The generated graphical representation now shows the ports on each part.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.sinelabore.com/lib/exe/detail.php/wiki/sysml2/oven-part2.png?id=wiki%3Asysml2%3Afirst_experience&quot; class=&quot;media&quot; title=&quot;wiki:sysml2:oven-part2.png&quot;&gt;&lt;img src=&quot;https://www.sinelabore.com/lib/exe/fetch.php/wiki/sysml2/oven-part2.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;Oven Part 2 - Parts with their ports showing the interface connections&quot; alt=&quot;Oven Part 2 - Parts with their ports showing the interface connections&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Now let&amp;#039;s connect the parts together. SysML allows modeling connections in different ways - you can use explicit interfaces, or connect parts directly. Here&amp;#039;s how to define the complete `Oven` with all its internal connections:
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;	part oven:Oven{
		part controller : MicrowaveController;
		part motor : Motor;
		part cdTimer : CountDownTimer;
		part display : LedDisplay;
		part door: Door;
		part radiator: Radiator;
		part tick:Ticker;
&amp;nbsp;
		connect door.doorPort to controller.doorPort;
		connect cdTimer.timerPort to controller.timerPort;
		connect tick.tickPort to cdTimer.tickPort;
		connect controller.motorPort to motor.motorPort;
		connect controller.radiatorPort to radiator.onOffPort;
	}&lt;/pre&gt;

&lt;p&gt;
The generated diagram shows the complete system structure. Unfortunately, there&amp;#039;s no way yet to control the image layout to make port names more readable - more powerful tools will realize this in a better way for sure. However, the overall structure is clear at first glance. You can also see that the display isn&amp;#039;t connected yet (a task for you:-)).
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.sinelabore.com/lib/exe/detail.php/wiki/sysml2/oven-part3.png?id=wiki%3Asysml2%3Afirst_experience&quot; class=&quot;media&quot; title=&quot;wiki:sysml2:oven-part3.png&quot;&gt;&lt;img src=&quot;https://www.sinelabore.com/lib/exe/fetch.php/wiki/sysml2/oven-part3.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;Oven Part III - Complete system showing all connections between parts&quot; alt=&quot;Oven Part III - Complete system showing all connections between parts&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;How parts can interact&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;how_parts_can_interact&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:1,&amp;quot;secid&amp;quot;:6,&amp;quot;range&amp;quot;:&amp;quot;4043-8001&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit7&quot; id=&quot;adding_attributes_to_parts&quot;&gt;Adding attributes to parts&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
SysML allows adding attributes of various complexity to parts. Attributes can have units, and SysML v2 comes with a comprehensive standard library that defines SI units and much more.
&lt;/p&gt;

&lt;p&gt;
This makes it possible to model real-world properties like power consumption for key parts. Many practical use cases come to mind here - think of reasoning battery life, thermal management, or resource requirements.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.sinelabore.com/lib/exe/detail.php/wiki/sysml2/radiator_watt.png?id=wiki%3Asysml2%3Afirst_experience&quot; class=&quot;media&quot; title=&quot;wiki:sysml2:radiator_watt.png&quot;&gt;&lt;img src=&quot;https://www.sinelabore.com/lib/exe/fetch.php/wiki/sysml2/radiator_watt.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;Radiator with an attribute - Showing power consumption in watts&quot; alt=&quot;Radiator with an attribute - Showing power consumption in watts&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Adding attributes to parts&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;adding_attributes_to_parts&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:5,&amp;quot;secid&amp;quot;:7,&amp;quot;range&amp;quot;:&amp;quot;8002-8543&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit8&quot; id=&quot;adding_state_machine_behavior_to_parts&quot;&gt;Adding state machine behavior to parts&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
This was the most interesting part for me to understand what capabilities the new SysML v2 language offers. State machines are familiar to most embedded software developers - they help model how a system responds to events and changes its behavior over time.
&lt;/p&gt;

&lt;p&gt;
Let&amp;#039;s add a state machine to the &lt;code&gt;MicrowaveController&lt;/code&gt;. Initially, the syntax looks clear and easy. The default state is expressed with &lt;code&gt;entry; then Off;&lt;/code&gt; - this means “start in the Off state.”
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;part def MicrowaveController {
    state MicrowaveControllerStateMachine{
        entry; then Off;
&amp;nbsp;
        state Off{
        }
&amp;nbsp;
        state Run{
        }
&amp;nbsp;
        state Pause{
        }
    }    
}&lt;/pre&gt;

&lt;p&gt;
The generated PlantUML image shows a simple state machine with three states, which looks promising for modeling behavior.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.sinelabore.com/lib/exe/detail.php/wiki/sysml2/sm1.png?id=wiki%3Asysml2%3Afirst_experience&quot; class=&quot;media&quot; title=&quot;wiki:sysml2:sm1.png&quot;&gt;&lt;img src=&quot;https://www.sinelabore.com/lib/exe/fetch.php/wiki/sysml2/sm1.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;Statemachine first step - Basic state machine with Off, Run, and Pause states&quot; alt=&quot;Statemachine first step - Basic state machine with Off, Run, and Pause states&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Now let&amp;#039;s add transitions to the state machine. Here&amp;#039;s how the syntax works:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;first Run&lt;/code&gt; means “from the Run state”&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;accept DoorSensorEvents via doorPort&lt;/code&gt; means “listen for events on the doorPort”&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; The &lt;code&gt;if&lt;/code&gt; statement specifies which specific event triggers the transition&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;then Pause&lt;/code&gt; defines the target state&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
A nice new feature is that transitions can be triggered at defined points in time or after a certain duration. Due to the textual specification option it is now easy to write down. This was always a weak point in &lt;abbr title=&quot;Unified Modeling Language&quot;&gt;UML&lt;/abbr&gt; tools.
&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;Entry/Do/Exit&lt;/code&gt; actions are also possible. In the example, we use &lt;code&gt;Do&lt;/code&gt; actions to send events (the payload) via ports to connected parts. You can also use action calls with input and output parameters.
&lt;/p&gt;
&lt;pre class=&quot;code sysml&quot;&gt;state MicrowaveControllerStateMachine{
  entry; then Off;
&amp;nbsp;
  transition first Run accept DoorSensorEvents via doorPort if (doorPort.doorEvt==DoorSensorEvents::evDoorOpened) then Pause ;
  transition first Pause accept DoorSensorEvents via doorPort if (doorPort.doorEvt==DoorSensorEvents::evDoorClosed) then Run ;
  transition first Off accept DoorSensorEvents via doorPort if (doorPort.doorEvt==DoorSensorEvents::evDoorClosed) then Run ;
  transition first Run  accept TimerEvents via timerPort if (timerPort.timeEvent==TimerEvents::evTimeout) then Off ;			
  transition first Pause  accept TimerEvents via timerPort if (timerPort.timeEvent==TimerEvents::evTimeout) then Off ;
&amp;nbsp;
  state Off{
   do send BinaryCommands::Off via motorPort;
  }
&amp;nbsp;
  state Run{
    do send BinaryCommands::On via motorPort;
  }
&amp;nbsp;
  state Pause{
    do send BinaryCommands::Off via motorPort;
  }
}&lt;/pre&gt;

&lt;p&gt;
The state machine can be visualized, though automatic layout engines have their limitations in creating optimal diagrams.
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.sinelabore.com/lib/exe/detail.php/wiki/sysml2/sm2.png?id=wiki%3Asysml2%3Afirst_experience&quot; class=&quot;media&quot; title=&quot;wiki:sysml2:sm2.png&quot;&gt;&lt;img src=&quot;https://www.sinelabore.com/lib/exe/fetch.php/wiki/sysml2/sm2.png&quot; class=&quot;media&quot; loading=&quot;lazy&quot; title=&quot;Statemachine second step - Complete state machine with all transitions and actions&quot; alt=&quot;Statemachine second step - Complete state machine with all transitions and actions&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
As we&amp;#039;ve seen, SysML v2 allows modeling nested state machines (parallel states are also possible) and defining transitions with relevant actions within states.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Adding state machine behavior to parts&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;adding_state_machine_behavior_to_parts&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:5,&amp;quot;secid&amp;quot;:8,&amp;quot;range&amp;quot;:&amp;quot;8544-11590&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit9&quot; id=&quot;but_wait_-_there_s_something_missing&quot;&gt;But wait - there&amp;#039;s something missing&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
If you&amp;#039;re familiar with &lt;abbr title=&quot;Unified Modeling Language&quot;&gt;UML&lt;/abbr&gt; state machines, you&amp;#039;ll quickly notice that some features aren&amp;#039;t (yet) available. For example, there are no &lt;code&gt;Choice&lt;/code&gt; or &lt;code&gt;Flat/Depp History&lt;/code&gt;. I&amp;#039;m not sure if this will be added later or was excluded by design. To make up your own mind checkout chapter 7.17 page 108ff of the present &lt;abbr title=&quot;specification&quot;&gt;spec&lt;/abbr&gt;.
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;But wait - there&amp;#039;s something missing&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;but_wait_-_there_s_something_missing&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:9,&amp;quot;range&amp;quot;:&amp;quot;11591-11960&amp;quot;} --&gt;
&lt;h1 class=&quot;sectionedit10&quot; id=&quot;summary_and_next_steps&quot;&gt;Summary and Next Steps&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
SysML v2 is very promising, especially because of its textual representation. This opens up many new use cases and makes them much easier to implement. Think about version controlling models in Git, making diffs, and collaborative development - all the practices software developers are familiar with.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Reasoning on models&lt;/strong&gt; will also become normal. Consider the power consumption example above - you could automatically calculate total system power requirements. Or imagine using AI to ask questions about a model. (By the way, current AI tools make many errors when answering questions about SysML v2 syntax - I guess there simply isn&amp;#039;t enough training material yet, or it&amp;#039;s too new.)
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Summary and Next Steps&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;summary_and_next_steps&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:10,&amp;quot;range&amp;quot;:&amp;quot;11961-12689&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit11&quot; id=&quot;why_should_software_developers_care&quot;&gt;Why should software developers care?&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Requirements management: SysML v2 helps bridge the gap between system requirements and software implementation&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Architecture documentation: Models serve as living documentation that stays in sync with your code&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Team communication: Visual models help communicate complex system designs across teams&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Code generation: While not perfect, models can generate skeleton code and interfaces&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Why should software developers care?&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;why_should_software_developers_care&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:11,&amp;quot;range&amp;quot;:&amp;quot;12690-13139&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit12&quot; id=&quot;code_generation_considerations&quot;&gt;Code generation considerations&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
Does it make sense to directly generate C/C++ or any other language code from SysML models? The pure model won&amp;#039;t be sufficient. For example, the interaction of parts via ports can be realized in very different ways depending on the targeted system. So a mapping between the model and implementation is required, and that mapping should be flexible to adapt to concrete needs (e.g., using &lt;abbr title=&quot;Operating System&quot;&gt;OS&lt;/abbr&gt; signals in one case or queues in another).
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Code generation considerations&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;code_generation_considerations&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:12,&amp;quot;range&amp;quot;:&amp;quot;13140-13619&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit13&quot; id=&quot;next_steps_for_learning_more&quot;&gt;Next steps for learning more&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Explore the [&lt;abbr title=&quot;Object Management Group&quot;&gt;OMG&lt;/abbr&gt; SysML v2 specification](&lt;a href=&quot;https://www.omg.org/spec/SysML&quot; class=&quot;urlextern&quot; title=&quot;https://www.omg.org/spec/SysML&quot; rel=&quot;ugc nofollow&quot;&gt;https://www.omg.org/spec/SysML&lt;/a&gt;)&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Try the tools mentioned in this post&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Start with a simple system you&amp;#039;re familiar with&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Consider how SysML v2 could fit into your existing development workflow&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
What do you think? How could you benefit from using SysML v2?
&lt;/p&gt;
&lt;hr /&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Next steps for learning more&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;next_steps_for_learning_more&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:13,&amp;quot;range&amp;quot;:&amp;quot;13620-13980&amp;quot;} --&gt;
&lt;h2 class=&quot;sectionedit14&quot; id=&quot;feedback_welcome&quot;&gt;Feedback Welcome!&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
I&amp;#039;m still learning SysML v2 myself, so if you&amp;#039;re an experienced SysML practitioner and have suggestions for modeling this example more naturally or effectively, I&amp;#039;d love to hear from you! 
&lt;/p&gt;

&lt;p&gt;
Feel free to share:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Better approaches to modeling the microwave oven system&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Alternative ways to structure the parts and their interactions&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Improvements to the state machine design&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Any SysML v2 best practices I might have missed&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Thanks in advance for your insights!
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT{&amp;quot;target&amp;quot;:&amp;quot;section&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;Feedback Welcome!&amp;quot;,&amp;quot;hid&amp;quot;:&amp;quot;feedback_welcome&amp;quot;,&amp;quot;codeblockOffset&amp;quot;:7,&amp;quot;secid&amp;quot;:14,&amp;quot;range&amp;quot;:&amp;quot;13981-&amp;quot;} --&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Mon, 07 Jul 2025 17:37:26 +0000</pubDate>
        </item>
    </channel>
</rss>
