p.

itemis CREATE for Visual Studio Code

With itemis CREATE for Visual Studio Code, you can easily create complex systems in a visual way. Simulate and test your system’s behavior already while you are modeling. Code generators translate your state machine into high-quality source code for different target platforms.

Previously available exclusively as an Eclipse-based tool, itemis CREATE now comes as a modern and streamlined Visual Studio Code extension, bringing the power of state machine modeling and simulation to a broader developer audience.

You can download itemis CREATE for Visual Studio Code directly from the marketplace.

Installing itemis CREATE for Visual Studio Code

To install itemis CREATE in Visual Studio Code, open the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window. In the search box, type “itemis CREATE” and select the extension from the list. Click the Install button to add it to your Visual Studio Code setup.

Or you can download itemis CREATE for Visual Studio Code directly from the marketplace.

Once installed, you can start using itemis CREATE features directly within your editor.

Editing statecharts

Designing a robust and well-structured system starts with creating a clear and accurate model. The Editing & Validation capabilities of itemis CREATE make this process both intuitive and error-resistant.
With a new developed, user-friendly graphical editor, you can visually model your system’s states and transitions, ensuring that complex system logic is easy to comprehend and maintain. Drag-and-drop functionality, alongside context-sensitive tools, allows you to quickly build, modify, and refine your models with minimal effort.

Editing Statecharts in Visual Studio Code

Key Features:

- Graphical Statechart Editing: Create, modify, and connect states and transitions effortlessly.
- Seamless Editor Integration: Integrate state machine editing directly into your VS Code workflow. The `.scm` files are recognized as statechart models, and you can edit them as part of your regular development cycle, with itemis CREATE providing the full modeling, simulation, and code-generation functionality.
- Real-Time Validation: Avoid mistakes as you work. itemis CREATE provides instant feedback by validating your model in real time. Errors and warnings are highlighted, guiding you to resolve issues early in the development process.
- Syntax and Semantics Checks: Ensure your models adhere to the rules of statecharts and reflect your intended system logic. This reduces costly debugging later on.
- Consistent Documentation: Automatically maintain clear and consistent documentation of your system’s design as part of your modeling workflow.

By enabling rapid iterations and immediate feedback, the Editing & Validation tools empower you to design robust systems with confidence and precision, laying the foundation for successful simulations, testing, and code generation.

To create a new statechart in Visual Studio Code, follow these steps:

1. Add a New File: Create a new file in your workspace with the `.scm` extension. An initial statechart will be automatically generated for you.
2. Edit the Statechart:
- Open the statechart file to access the graphical editor.
- Use the Properties View in the itemis CREATE panel to customize elements like states, transitions, priorities, and more.

An Examples View is included in the itemis CREATE View, providing a convenient way to explore and learn from pre-built examples.

To get started:

- Open the Examples View in the itemis CREATE View.
- Browse the tree view, which organizes examples by categories.
- Select an example to open its description in an integrated webview.

A webview displays a detailed description of the example, outlining its purpose and functionality. If you want to work with the example, simply click the Open button in the tree view. This will add the example to your workspace, allowing you to explore and modify it as needed.

These examples serve as practical demonstrations of itemis CREATE’s features and are valuable for both beginners and advanced users. They not only help new users get started but also provide hands-on examples for advanced use cases, such as integrating the generated code into embedded systems and other complex scenarios.

Simulating statecharts

Time and cost pressures often result in loss of quality. Especially in embedded systems, program errors are getting more expensive the later they are detected; and even worse, they can harm lives.

With itemis CREATE, you can simulate and test your system’s behavior – before writing a single line of code! This dramatically speeds up your code-compile-test cycles.

Editing State Charts in Visual Studio Code

You can simulate your statechart in two ways:

1. Using the Graphical Editor:

- Open your statechart file. - Click the Run Simulation button (green arrow icon) in the editor toolbar to start the simulation.

2. Using a `launch.json` Configuration:
- Add the following configuration to your `launch.json` file to your `.vscode` folder:

bc.. { “version”: “0.2.0”, “configurations”: [ { “type”: “simulation”, “request”: “launch”, “name”: “Simulate Statechart”, “statechart”: "<path to your statechart>" } ] } - Open the Run and Debug view in VS Code and select the simulation task to run.

When the simulation starts, VS Code automatically switches to the Run and Debug View. Alongside the standard panels — Variables, Watch, Call Stack, and Breakpoints — a dedicated Simulation View is available. This view provides powerful tools to:

- Raise events dynamically.
- Inspect and modify variable values in real-time, enabling in-depth testing and debugging.

Additionally, a control bar for your session appears, offering options such as Restart and Stop to manage your simulation easily. You can even run multiple simulation sessions in parallel, making it possible to test and compare different scenarios simultaneously.

Key Features:

- State Machine Simulation: Simulate your state machine directly within itemis CREATE to visualize and validate its behavior in real time.
- Debug Integration: Integrate simulation directly into your VS Code workflow using `launch.json`. You can start the simulation as part of your normal debugging and development cycle, providing a streamlined approach for testing and iterating your state machine models.
- Event Triggering: Raise events manually during the simulation to test how your system reacts to different inputs and scenarios.
- Variable Management: Set and read the values of variables on the fly, ensuring your system’s logic is functioning as expected under various conditions.
- Debugging Support: Monitor the current state, active transitions, and variable changes during the simulation, enabling efficient debugging and fine-tuning of your model.
- Interactive Exploration: Explore alternative scenarios and edge cases dynamically without needing to compile or deploy code.

These features ensure that your state machine behaves as intended, helping you catch and resolve issues early in the design process.

Generate statecharts

Handwritten code needs to be continuously quality assured by time-consuming code reviews to comply with the desired industry coding standards for safety-critical systems. Any change in domain logic may lead to new errors. Especially under time pressure, this becomes a problem for software developers.

With itemis CREATE, this is no longer needed. Your state machine is automatically translated into high-quality source code for different target platforms – no matter if it’s C, C++, Java, or Python. And because state machines are platform-independent, your system is future-proof even if your underlying technology changes.

Generate Code in Visual Studio Code

Key Features:

- Multi-Language Code Generation: Automatically generate high-quality code for C, C++, Java, and Python from the same model, ensuring flexibility across different platforms and projects.
- Workflow Integration: Easily integrate the code generation process into your VS Code workflow. With `tasks.json`, you can incorporate code generation into your build process, making it a natural part of your regular development cycle.
- Consistent Model-to-Code Workflow: Any changes made to the model are instantly reflected in the generated code, eliminating the need for manual implementation and reducing errors.
- Tested Code: The generated code is designed to follow best practices and high-quality standards, ensuring reliability and consistency for a wide range of applications.
- Time-Saving Automation: Skip time-consuming manual coding processes. With just a few clicks, create platform-independent, production-ready code that aligns perfectly with your model logic.

This approach allows you to focus on designing robust systems while relying on itemis CREATE to handle the implementation details, accelerating your development process and ensuring high-quality results.

In favor to a seamless integration into Visual Studio Code, we dropped the .sgen files for code generator configuration.
Code generation is handled through a `tasks.json` file instead, which also must be located in your `.vscode` folder. Add the following configuration to your `tasks.json`:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Code Generator",
      "type": "codegenerator",
      "generator": {
        "statechart": "<path to your statechart>",
        "features": {
          "Outlet": {
            "targetProject": ".",
            "targetFolder": "src-gen"
          }
        },
        "type": "create::<language>"
      },
      "group": "build"
    }
  ]
}


p.

Once configured, you can execute the task using the Terminal > Run Task command or by integrating it into your build process or you can open the `tasks.json` file and click on **Run Task: Code Generator**.
All code generator options remain the same. Have a look at the detailed configurations here:

* "C":../user-guide/code_generation_c.html#codegen_c_code_generator
* "C++":../user-guide/code_generation_csharp.html#codegen_cpp_code_generator
* "C#":../user-guide/code_generation_c.html#codegen_csharp_code_generator
* "Java":../user-guide/code_generation_java.html#codegen_java_code_generator
* "Python":../user-guide/code_generation_python.html#codegen_python_code_generator