On this page
As of Version 18.4, Magic Model Analyst can export simulation results to a CSV file.
A new configuration, called CSV Export, has been added to export simulation results to a CSV file. CSV files take the following properties:
- File Name
The name of the file that the exported results are written into. The path is the same as the project directory (by default). Alternatively, a full path may be specified as D:\ExportedCSVResults.csv - Record Time
If true (by default), time will be recorded in the first column of the exported CSV file. - Represents
Specifies the Classifier represented by the Configuration. - Value
Specifies the properties of the Classifier (including nested properties) whose values will be recorded and written to the CSV file. - Write At The End
Records values only once at the end of execution, right before termination, rather than listening and recording value changes during the execution. When Number of runs is more than 1 in the main configuration, the values are recorded once in each iteration.
To export simulation results to a CSV file
- Open a sample simulation project from the samples folder of Magic Model Analyst. Here the HingeMonteCarloAnalysis sample is used.
- Drag the CSV Export Configuration from the toolbox to the Simulation Configuration diagram.
Double-click the CSV Export Configuration and fill in values for File Name, Represents, and Value from its Specification window. The File Name property is the name of the file in the project's working directory. The Record Time property is for recording time in the first column of the exported CSV file. The Represents property specifies the Classifier represented by the Configuration, and the Values property refers to the values selected which will be written to the exported CSV file. Optionally, you can also set the Write At The End property to record values only once at the end of execution before termination. The following figure shows the parameters of CSV Export configuration.
Set the created CSV export as a tagged value of the executionListeners tag definition of the Simulation Configuration. This step is important for the results to be written to file. See the CSV export configuration below:
- Run the simulation and then stop it. The results will be written to the File Name specified in Step 3. See the parameters of CSV Export configuration below:
Support of Part properties
Not only can CSV export the values of properties with primitive types, e.g., Real, Integer, etc., but it can also export the types of the properties that are not primitive. Selected Part names in the value tag will be used as headers, and type names will be used as values of exported CSVs as shown in the figure below.