SMA (.sma)
Background & Context
-
- System Modeler archive files that include model dependencies.
- File format created by Wolfram Research, Inc.
- Imported result data is represented as a SystemModel.
Import & Export
- Import["file.sma","SMA"] imports the specified models and makes them available as SystemModel.
- Export["file.sma",model,"SMA"] exports the SystemModel model as an SMA file.
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements
Options
- Import option:
-
"TrustExternalFunctions" False whether to trust external functions in file - Export option:
-
"IncludedLibraries" Automatic libraries to include in file - Possible values for "IncludedLibraries" are:
-
Automatic automatically decide what to include None include no dependencies All include all dependencies "User" include dependencies not shipped with the system {lib1,lib2,…} include the explicit libraries libi
Examples
open all close allBasic Examples (2)
Import a total model from an archive:
model = Import["ExampleData/ExampleModelTotal.sma", "SMA"]Examine the model's equations:
model["SystemEquations"]sim = SystemModelSimulate[model, 1]SystemModelPlot[sim, {"x", "y", "y"'}]Export a model with dependencies:
file = Export["Newton.sma", [image], "SMA"]model = Import[file, "SMA"]Simulate for 10 seconds and plot the first stored plot in the model:
SystemModelPlot[{model, 10}, First[model["PlotNames"]]]Clean up by deleting the new file and model:
DeleteFile[file];
DeleteObject[model];Import Options (1)
"TrustExternalFunctions" (1)
Import with evaluation of external functions enabled:
model = Import["ExampleData/WithExternal.sma", "TrustExternalFunctions" -> True]This model contains external functions:
First[model]["ModelicaString"]Simulate the model and plot the simulation results:
SystemModelPlot["MyPackage.MyModel", "z", 10]Export Options (1)
"IncludedLibraries" (1)
Export a model without any dependencies:
file = Export["NoDependencies.sma", [image], "SMA", "IncludedLibraries" -> None]The resulting file size is typically small:
FileSize[file]Including all dependencies, including system libraries, typically results in a large file:
fileAll = Export["AllDependencies.sma", [image], "SMA", "IncludedLibraries" -> All]FileSize[fileAll]DeleteFile[{file, fileAll}]Related Guides
Related Links
History
Introduced in 2018 (11.3)