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:
- Log in to the Ansys MBSE Portal and click the + New project button.
- In the Create a New Project page, click the SysML v2 tile, then click the Import File tile.
- In the Project Name text field, give your project a name, such as
Bicycle
. - Click the Choose File button and select the
Bicycle.xmi
file you downloaded and unzipped. - Click the Import button.
Video Tutorial
Written Instructions
SAM
To begin using the sample project, complete these steps:
- 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. - 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.
- The SI Unit library is based on the international systems. You will use it to assign units to the bicycle parts.
Next you will assign units and values to the bicyle parts.
- In the Bike block diagram (Definition package > Diagrams package > Bike diagram), find the part-definition for the Frame and click the Weight attribute.
- In the Properties panel, on the Value line, enter
2
, and click the drop-down and selectkg
. Then change the Definition toreal
. Continue adding weights for the parts as follows:- Tire: 2 kg
- Rim: 1 kg
- Wheel: 3 kg
- Bike: 15 kg
- Repeat the previous two steps for all structural element usages in the block diagram Bike.
ModelCenter
Now open the model in ModelCenter.
- 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.
- ModelCenter opens. Under Systems Model Structure you see the
- 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.
- 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.
- The Analysis Editor opens. Notice that the
First Script
For the weight analysis, a ModelCenter script wrapper that calculates the sum of two variables is required.
- 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());
} - 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.
- In the Systems Model Structure, expand the model to
Usage
>Structure
>bike
>frontWheel
, then expandfrontWheel
,rim
, andtire
. - For
frontWheel
, click weight and drag to the Analysis Variables panel, tosum
.- 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.
- 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. - 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.
- Under the ModelCenter File menu, click the
New file
icon and select New Analysis…. - For writing a script, in the Analysis Editor, under Analysis Type, select Script Analysis.
- In Analysis Selection, click the Edit button.
The Script Editor opens. - 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 - In the Variables panel, add
BikeWeight
and define it as Output from the drop-down list.
Repeat this for the variablesIsSatisfied
andMargin
. Then repeat the step to define the following variables as Input.- UpperMargin
- frontWheelWeight
- rearWheelWeight
- frameWeight
- Change the type of IsSatisfied to Boolean. Make sure all the other created variables are type double.
- Click OK to save your work and close the editor.
- 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.
- Under the System Model Structure tab, expand the
Bicycle
model toUsage
>Structure
>Bike
, then expand the bike partsFrame
,frontWheel
, andrearWheel
. - 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
- Bike.weight to
- 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
- Is Satisfied to
- In the Analysis Variables panel, click
UpperMargin
and in the Set Constant Value text field, enter8
and click the green check mark. - Click the OK button.
Perform Analyses
Now add all analysis scripts to the execution plan.
- The Analyses List lists the three analysis scripts. Drag and drop each of these to the Analyses panel.
- Click the disk icon to save your file.
Verify the requirement by running your script.
- 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. - Optional: Click the disk icon to save your result.
You can change the values and try another validation.
- In the Structure Elements panel, for the front wheel, change the tire weight from 2 to 1.5.
- For the rear wheel, change the tire weight from 2 to 1.
- 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. - Click the disk icon to save your successful design and execution plan.
- Return to Ansys SAM. In the project tree, a
ModelCenter
folder has been added. It contains the analysis from above. - Click the folder and subfolders to see the scripts, analyses, and results.
Save as new baseline
- 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!