Skip to main content

Generate Code with Workflows

Now that you have a Component based system design all wired up, it is time to use Tangram Pro™ to generate a Component Software Interface (CSI) - code that will allow Components to pass the messages you specified to other Components or systems. I know what you might be thinking..."Generated code is rubbish! It just spits out a template, but you still have to do all the real work." Well, in the case of our generated CSI, it is fully executable and the "real work" is done for you, saving you a ton of time on the tedious code, so that you can work on the code that matters to you. Plus, the output is your choice, C++ or Java!

You'll learn how to:

  • Create a Workflow
  • Add tasks to a Workflow
  • Configure Workflow tasks
  • Run a Workflow to generate a CSI

Step 1: Create a Workflow#

In Tangram Pro™, Workflows are a key piece to tightening the linkages between system engineers and software developers to help cross that treacherous gap. Using the available task plug-ins, Workflows can be created at the Component or system level, and persist as part of the system design model even as changes are made in the code base. Of course, Workflows can be easily updated to meet new design requirements too.

How to create a Workflow#

For this Workflow, we are going to genrate the CSI for the Communication Component.

  1. Hover over and click the “meatball menu” icon on the top right corner of the UAS Communication.First System Component
  2. Click Open New Tab
  3. Click the Workflow icon on the far left side of the Workspace to expand the Workflow fly-out menu
  4. Click + New Workflow
  5. Type the name, UAS Comms Workflow , in the Workflow Name text box
  6. Click Create Workflow

Now it's time to add some tasks to that Workflow

Step 2: Add tasks to a Workflow#

Tasks are selected from the menu of available plug-ins in Tangram Pro™. By adding tasks to a Workflow you are telling the platform to put those plug-ins to work on your whole Component based system design, or just a part of it.

To add tasks to a Workflow#

  1. Click UAS Comms Workflow in the Workflow fly-out menu
  2. Click + Tasks
  3. Click and drag the Code Gen 3.0 plug-in into the Workflow editor
  4. Click and drag the cppcheck plug-in into the Workflow editor

Step 3: Configure Workflow tasks#

Configuring Workflow tasks allow you specify a sequence of tasks applied to a Component. You can also select things like the output language and preferred transport library in Tangram Pro™.

How to configure Workflow tasks#

  1. Click the Make Connection icon of the Code Gen 3.0 plug-in
  2. Click the anywhere in the cppcheck plug-in box to create a dependency line

In the Workflow editor, tasks will run in parallel if a dependency is not created. You can also remove a dependency line by hovering over the line and clicking the X.

  1. Click the Settings icon of the Code Gen 3.0 plug-in
  2. Select Code Gen to Generate a CSI
  3. Select false as the configuration setting for Allow failure
  4. Select cpp as the configuration setting for Output Language
  5. Select ZeroMQ as the configuration setting for Transport Library
  6. Notice Tangram Pro™ populates an name output folder field, which you can change or keep

Now, time to configure cppcheck

  1. Click the Settings icon of the cppcheck plug-in
  2. Click the dropdown menu and click Text output: Directory as the Select Configuration option
  3. Select code-gen-3/ as the configuration setting for Source Directory
  4. Select false as the configuration setting for Allow failure
  5. Select cppcheck_text_output as the configuration setting for Output Location
  6. Click ✔ Done
  7. Click Close in the top right corner of the Workflow editor

Step 4: Run your Workflow#

Generating executable C++ code and applying a static analysis tool, like cppcheck, by running a Workflow is incredibly easy with Tangram Pro™.

How to run a Workflow#

  1. Click Close to exit the Workflow editor
  2. Click Run to kick off the Workflow you just created

Download the artifacts from the Code Gen 3.0 and cppcheck plug-ins to see the results of the Tangram Pro™ Workflow.


By completing this tutorial, you've learned to generate a CSI by running a Workflow in Tangram Pro™!

Check out what you accomplished:

  • Created a Workflow
  • Added multiple tasks to a Workflow
  • Configured the task dependencies and settings
  • Ran your Workflow to produce an executable CSI and static analysis artifacts

Our blog is another great place to learn more!


Join Discuss, our Tangram Flex community to find out more about Workflows, ask questions, or provide feedback.

Ready to see you how your CSI in action? Make your way to the next tutorial below!


Additional items available in Tangram Pro™, but not discussed in this tutorial

  • Additional Code Generation plug-ins
  • Additional software analysis (assurance) plug-ins
  • Customizable Workflow plug-ins
  • Workflow outputs in Java
  • Choose between ActiveMQ, ZeroMQ, RabbitMQ, and Kafka message brokers
  • Webhooks that trigger Workflows when changes are made to a Component's repository