Cameo Simulation Toolkit introduces a built-in support for Monte Carlo analysis, allowing you to manage uncertainties and estimate how random variation of sensitive parameters affects the overall performance of the system being modeled. The HingeMonteCarloAnalysis sample model demonstrates the following steps.
1. Create a Block structure along with other parts in the Block Definition diagram. Apply distributions stereotypes to get a set of random inputs on value properties of the parts (e.g., the Hinge Block with AB, C, and D Blocks as parts with «uniform» and «normal» stereotypes on width value properties accordingly).
The Block Definition diagram of the Hinge model with distributed value properties applied.
2. Create a Constraint Block of those value properties in the Parametric diagram according to the requirement (e.g., clearance = d – (a + b + c)).
The Parametric diagram of the Hinge model.
3. Create another Block Definition diagram to include an analysis context definition. In the Containment tree pane, click and select Show Auxiliary Resources. Drag the predefined MonteCarloAnalysis Block from the MD Customization for SysML library (available in every SysML project) into the Block Definition diagram.
4. Inherit your analysis context definition (e.g., the Hinge Analysis Block from MonteCarloAnalysis Block) to get N, Mean, Deviation, and OutOfSpec properties. Finally, you must set the Hinge Block as part of the Hinge Analysis Block.
Inheriting the Hinge Analysis Block from the predefined MonteCarloAnalysis Block and setting the Hinge Block as part of the Hinge Analysis Block.
5. Specify a parameter target, e.g., the clearance value property, of the Monte Carlo analysis in another Parametric diagram. Statistical values will be recorded in the Mean as a result of termination of the analysis loop. You must create Constraint Blocks and connect them to the requirement verification (R1) and the OutOfSpec property (R2) respectively.
Specifying the requirement verification (R1) and OutOfSpec property (R2) of the Monte Carlo analysis in another Parametric diagram.
6. Create a Simulation Configuration diagram, add a «SimulationConfig» to the diagram, and set the following tags:
- executionTarget: Hinge Analysis Block.
- numberOfRuns: the number of runs, e.g., 5000.
- resultLocation: an Instance table, e.g., Analysis results.
- silent: true (for the optimum performance of the Monte Carlo simulation).
Note
- For a model that has Behaviors (Classifier Behavior and/or Part Property with Behaviors), see the autoStart tag in SimulationConfig.
- If numberOfRuns of any table (executionTarget) is more than 1, it will be ignored in the Monte Carlo simulation. The table, however, will be run only once.
- If silent is set to false, the simulation will run with animation and idle time for each iteration, which is not practical for the Monte Carlo simulation.
7. Drag a Histogram control from the Simulation toolbar to the Simulation Configuration diagram. You can use the histogram as a local user interface. Set the represents and value tags to the Hinge Analysis Block and to the clearance value property respectively. Set the dynamic tag to true to view the histogram that dynamically updates those statistical values (setting to false will open the histogram at the end of executions). You can also record the values of every iteration using the CSV Export control by setting the represents and value tags to the Hinge Block and other related value properties, e.g., a.width, to be in the exported CSV file.
8. Drag the Histogram and CSV Export controls to the «SimulationConfig». UI and executionListeners tags will be updated with the names of the Histogram control as Histogram and CSVExport controls as clearance.
«SimulationConfig» setting with numberOfRuns, Histogram, CSV Export, and Instance Table.
9. Run «SimulationConfig». The histogram will dynamically show the estimated distribution of the values of the analysis context definition of hinge.clearance during the simulation at the top right of the histogram. The simulation progress bar is shown and allows the user to cancel the simulation.
The histogram dynamically shows statistical results during the simulation.
10. Analysis results will be recorded in the Instance table along with verification status. You can also see the detail of the constraint failure in the tooltip when hovering the mouse over any highlighted red values. The value properties with distributions stereotypes applied are exported to the clearance.CSV file.