Unlocking the Power of MBSE: SAM Bicycle Example

Categories: ,

Introduction

Recently, I’ve been spending more and more time within the Ansys System Architecture Modeler, or SAM for short. This Systems Modeling tool adheres to the SysML 2.0 standard and is available for customers to evaluate and use today. If you’re not familiar with MBSE or Systems Architecture, I invite you to read my last blog post within this series, Unlocking the Power of MBSE: A High-Level Overview.

Today, I want to provide a brief tutorial on the Bicycle Example within the System Architecture Modeler User Guide on Ansys Help. This example takes you through the process of importing an architecture and applying attribute values and units to the various definitions within the model. After that, we proceed to link architecture and analysis variables, perform analyses, and evaluate requirements and results. Finally, we can pass those updated values back into the system architecture.

First, there are some prerequisite steps you must consider. I won’t be providing detailed steps in setting up the prerequisites within this blog. However, if you’re a PADT customer, reaching out to swsupport@padtinc.com is the fastest way to receive product support for SAM and any other Ansys tools.

After verifying you’ve completed all the prerequisite steps, you can follow along via the video tutorial. In addition, the instructions are written out below, as well.

Prerequisites

The prerequisites for this example are stored in Section 6.1 of the SAM user guide. I’ve also included them below. To run the example, you will need:

  • the latest version of Ansys ModelCenter Desktop
  • the latest version of Ansys ModelCenter MBSE SAM Connector
  • the latest version of Ansys ModelCenter Remote Execution (MCRE)
  • the Bicycle model example: Download
  • some knowledge of basic scripting is helpful

In addition, you need to use the Ansys MBSE Portal to set up your Bicycle project:

  1. Log in to the Ansys MBSE Portal and click the + New project button.
  2. In the Create a New Project page, click the SysML v2 tile, then click the Import File tile.
  3. In the Project Name text field, give your project a name, such as Bicycle.
  4. Click the Choose File button and select the Bicycle.xmi file you downloaded and unzipped.
  5. Click the Import button.

Video Tutorial

Written Instructions

SAM

To begin using the sample project, complete these steps:

  1. In Ansys SAM, open the Bicycle model you created (the steps are described in Prerequisites). Explore the structure tree and its Definition packages, Usage packages, and diagrams. Open Usage package > Diagrams package > bike diagram. Note that the bike usage contains the parts of the bicycle, each with its own weight. The bike itself has the combined weight of the parts. In addition, the model includes a requirement for the maximum bicycle weight, less than 8 Kg in the example.
  2. Import the SI Unit library.
    • The SI Unit library is based on the international systems. You will use it to assign units to the bicycle parts.
      • Right-click the Bicycle root package and choose Import Library.
      • Click Standard Libraries to expand the drop-down.
      • Select SI, then click the Import button.
    • Import SI appears at the top level of the Project list.

Next you will assign units and values to the bicyle parts.

  1. In the Bike block diagram (Definition package > Diagrams package > Bike diagram), find the part-definition for the Frame and click the Weight attribute.
  2. In the Properties panel, on the Value line, enter 2, and click the drop-down and select kg. Then change the Definition to real. Continue adding weights for the parts as follows:
    • Tire: 2 kg
    • Rim: 1 kg
    • Wheel: 3 kg
    • Bike: 15 kg
  3. Repeat the previous two steps for all structural element usages in the block diagram Bike.

ModelCenter

Now open the model in ModelCenter.

  1. Select File > Open in ModelCenter.
    • ModelCenter opens. Under Systems Model Structure you see the Bicycle project. In the Requirements List, you see the project Weight requirement.
  2. Expand Bicycle to load the model structure.

Next connect the System Architecture Model to simple ModelCenter analyses to compute the weights of the bicycle frame and each wheel.

  1. Click the New file icon located under the ModelCenter File menu and select New Analysis….
    • The Analysis Editor opens. Notice that the Bicycle project appears in the Map Analysis Variables window in the Systems Model Structure tab. You can click it to expand it.

First Script

For the weight analysis, a ModelCenter script wrapper that calculates the sum of two variables is required.

  1. To create the wrapper, copy the following code and paste it to an empty file using a text editor such as Notepad. In your preferred ModelCenter Remote Execution (MCRE) Analysis path (MCRE > Configure > Directories > Analyses Path), save the file as SumTwo.scriptWrapper.

    variable: x1 double input
    variable: x2 double input
    variable: sum double output

    script: language="java"
    void run()
    {
    sum.setValue(x1.getValue() + x2.getValue());
    }

  2. In the Server Browser window, select SumTwo from the folder where you saved it and double-click it.
    • When you double-click it, you see its variables appear in the Analysis Editor in the AnalysisVariables panel. You can now connect the system architecture model to the script.
  3. In the Systems Model Structure, expand the model to Usage > Structure > bike > frontWheel, then expand frontWheelrim, and tire.
  4. For frontWheel, click weight and drag to the Analysis Variables panel, to sum.
    • This links frontWheel.weight to the output of the SumTwo analysis.
    • Repeat this step for the rim.weight to x1 and tire.weight to x2. This links the rim and tire weights to the two inputs of the SumTwo analysis.
  5. Enter a name for your analysis (such as frontWheelWeight) in the Analysis Name text field below Analysis Variables and click OK. In ModelCenter, frontWheel analysis is listed in the Analyses List panel.
  6. Repeat steps 12-14 for the rear wheel and give your analysis the name RearWheelWeight.

Second Script

Next, create a simple script to analyze the requirement and determine whether the bicycle model meets it. The script computes the bicycle weight and compares the computed weight to the weight requirement.

  1. Under the ModelCenter File menu, click the New file icon and select New Analysis….
  2. For writing a script, in the Analysis Editor, under Analysis Type, select Script Analysis.
  3. In Analysis Selection, click the Edit button.
    The Script Editor opens.
  4. In the Script panel, replace the default script with the following script.
    sub run
    BikeWeight = frontWheelWeight + rearWheelWeight + frameWeight
    IsSatisfied = BikeWeight < UpperMargin
    Margin = UpperMargin - BikeWeight
    end sub
  5. In the Variables panel, add BikeWeight and define it as Output from the drop-down list.
    Repeat this for the variables IsSatisfied and Margin. Then repeat the step to define the following variables as Input.
    • UpperMargin
    • frontWheelWeight
    • rearWheelWeight
    • frameWeight
  6. Change the type of IsSatisfied to Boolean. Make sure all the other created variables are type double.
  7. Click OK to save your work and close the editor.
  8. Back in the Analysis Editor, in the Analysis Variables panel, the list of variables appears. Enter a name for your script, such as BikeWeightReq.

Next, link the variables in the analysis to the system architecture model.

  1. Under the System Model Structure tab, expand the Bicycle model to Usage > Structure > Bike, then expand the bike parts FramefrontWheel, and rearWheel.
  2. Now connect the weight for each part to the corresponding variable in Analysis Variables.
    • Bike.weight to BikeWeight
    • frame.weight to FrameWeight
    • frontWheel.weight to FrontWheelWeight
    • rearWheel.weight to RearWheelWeight
  3. Now click the Requirements List tab and connect the requirement usage weight (lower-case) to the corresponding variables in Analysis Variables.
    • Is Satisfied to IsSatisfied
    • Margin to Margin
  4. In the Analysis Variables panel, click UpperMargin and in the Set Constant Value text field, enter 8 and click the green check mark.
  5. Click the OK button.

Perform Analyses

Now add all analysis scripts to the execution plan.

  1. The Analyses List lists the three analysis scripts. Drag and drop each of these to the Analyses panel.
  2. Click the disk icon to save your file.

Verify the requirement by running your script.

  1. To run the analysis script, click the green Play icon.
    The results are listed in the Requirements panel at the bottom. A red X indicates the requirement is not satisfied for the defined values.
  2. Optional: Click the disk icon to save your result.

You can change the values and try another validation.

  1. In the Structure Elements panel, for the front wheel, change the tire weight from 2 to 1.5.
  2. For the rear wheel, change the tire weight from 2 to 1.
  3. Click the green Play icon.
    This time, a green check mark appears in the Satisfied column. Your model has passed validation, and the passing margin is listed in the Margin column.
  4. Click the disk icon to save your successful design and execution plan.
  5. Return to Ansys SAM. In the project tree, a ModelCenter folder has been added. It contains the analysis from above.
  6. Click the folder and subfolders to see the scripts, analyses, and results.

Save as new baseline

  1. In the Results tab, right-click the structural element bike and select Save Baseline Values.
    Verify that the weight value attributes are updated in Ansys SAM.

Conclusion

This guide walked through a basic example, showing how to link architecture and requirements from SAM to analyses within ModelCenter. This connection is bi-directional and can be updated as your model gains complexity and/or fidelity.

If Model Based Systems Engineering is a topic you’re curious about, don’t hesitate to reach out to PADT for more information. We’d be happy to provide an overview of the MBSE tools, materials, or even a demonstration depending on your needs.

This is Noah, signing out. Have a great day!

Share this post:

Upcoming Events

Dec 11
, 2024
Structural Updates (3) in Ansys 2024 R2 - Materials, Contact and Joint Elements, & HPC - Webinar
Dec 11
, 2024
Tech the Halls
Dec 11
, 2024
YesPHX Winter Social 2024
Jan 07
- Jan 10
, 2025
CES 2025
Jan 22
- Jan 25
, 2025
Arizona Photonics Days 2025
Feb 04
- Feb 06
, 2025
MD&M West 2025
Feb 04
- Feb 06
, 2025
2025 Transformative Vertical Flight
Apr 07
- Apr 10
, 2025
40th Space Symposium

Search the PADT Site

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: