Skip to main content

Motion Standalone Preprocessor C# library 2024 R2

Class CoSimulatorAPI

Last update: 16.07.2025

Namespace: VM.API.Pre.CoSimulator
Assembly: VM.API.Pre.CoSimulator.dll

This class implements APIs for and class.

public static class CoSimulatorAPI

Inheritance

object ← CoSimulatorAPI

Extension Methods

LinkPropertyItemCache.GetLinkProperties(object, LinkPropertyType), LinkPropertyItemCache.GetLinkPropertiesAndValues(object, LinkPropertyType), LinkPropertyItemCache.GetLinkedObjects<T>(object, LinkPropertyType)

Methods

CreateSInput(SubSystemDocument, UnitName, string)

Create .

[NotNull(new string[] { "document" })]
public static Obj CreateSInput(this SubSystemDocument document, UnitName unit = UnitName.None, string name = "")

Parameters

document SubSystemDocument

The document to create the scalar input.

unit UnitName

The unit of the scalar input.

name string

The name of the scalar input.

Returns

Obj

The new object that is created by this API.

Exceptions

ArgumentNullException

Will be thrown if 'document' is null.

CreateSOutput(SubSystemDocument, Obj, UnitName, string)

Create .

[NotNull(new string[] { "document" })]
[NotNullObj(new string[] { "formula" })]
[MatchTypeObj(new object[] { "formula", typeof(Function) })]
public static Obj CreateSOutput(this SubSystemDocument document, Obj formula, UnitName unit = UnitName.None, string name = "")

Parameters

document SubSystemDocument

The document to create the scalar output.

formula Obj

The formula of the scalar output.

unit UnitName

The unit of the scalar output.

name string

The name of the scalar output.

Returns

Obj

The new object that is created by this API.

Exceptions

ArgumentNullException

Will be thrown if 'document', 'formula' is null.

ArgumentException

Will be thrown if the type of 'formula' is not .

ExecuteMatlabProcess(Obj, string, string, IEnumerable<Obj>, IEnumerable<Obj>, string, ExpressionValueVariable?)

Execute process using .

[NotNullObj(new string[] { "fileGen" })]
[NotNullOrEmpty(new string[] { "strFileName", "strFileDir", "strInterfacePath" })]
[MatchTypeObj(new object[] { "fileGen", typeof(MFileGen) })]
public static void ExecuteMatlabProcess(this Obj fileGen, string strFileName, string strFileDir, IEnumerable<Obj> inputs, IEnumerable<Obj> outputs, string strInterfacePath, ExpressionValueVariable? interfaceTimeStep = null)

Parameters

fileGen Obj

The M file generation to excute process.

strFileName string

The file name of a matlab file to be generated.

strFileDir string

The file path of matlab file to be generated.

inputs IEnumerable<Obj>

The inputs of the M file generation setting.

outputs IEnumerable<Obj>

The outputs of the M file generation setting.

strInterfacePath string

The interface folder path of the M file generation setting.

interfaceTimeStep ExpressionValueVariable?

The interface time step of the M file generation setting.

Exceptions

ArgumentNullException

Will be thrown if 'fileGen', 'strFileName' 'strFileDir', 'strInterfacePath' arguments are empty.

ArgumentException

Will be thrown if the type of 'fileGen' is not .

ArgumentException

Will be thrown if the type of 'inputs' is not or if the type of 'output' is not .

ArgumentOutOfRangeException

Will be thrown if 'interfaceTimeStep' value is equal to or less than 0.

ExecuteProcess(Obj, string, string, string)

Execute process using .

[NotNullObj(new string[] { "fileGen" })]
[NotNullOrEmpty(new string[] { "strFileName", "strFileDir", "strInterfacePath" })]
[MatchTypeObj(new object[] { "fileGen", typeof(FileGen) })]
public static void ExecuteProcess(this Obj fileGen, string strFileName, string strFileDir, string strInterfacePath)

Parameters

fileGen Obj

The file generation to excute process.

strFileName string

The file name of a fmu file to be generated.

strFileDir string

The file path of a fmu file to be generated.

strInterfacePath string

The interface folder path.

Exceptions

ArgumentNullException

Will be thrown if 'fileGen', 'strFileName', 'strFileDir', 'strInterfacePath' arguments are empty.

ArgumentException

Will be thrown if the type of 'fileGen' is not .

ExportMatlabModel(Obj, IEnumerable<Obj>, IEnumerable<Obj>, string, string)

Export matlab model using .

[NotNullObj(new string[] { "fileGen" })]
[NotNullOrEmpty(new string[] { "strFileName", "strFileDir" })]
[MatchTypeObj(new object[] { "fileGen", typeof(MFileGen) })]
public static void ExportMatlabModel(this Obj fileGen, IEnumerable<Obj> inputs, IEnumerable<Obj> outputs, string strFileName, string strFileDir)

Parameters

fileGen Obj

The file generation to export matlab model.

inputs IEnumerable<Obj>

The inputs of the matlab file generation setting.

outputs IEnumerable<Obj>

The outputs of the matlab file generation setting.

strFileName string

The file name of a matlab file to be generated.

strFileDir string

The file path of a matlab file to be generated.

Exceptions

ArgumentNullException

Will be thrown if 'fileGen', 'strFileName', 'strFileDir' arguments are empty.

ArgumentException

Will be thrown if the type of 'fileGen' is not .

ExportModel(Obj, IEnumerable<Obj>, IEnumerable<Obj>, string, string, string, FMIVersionType, ExpressionValueVariable?, string)

Export model using ..

[NotNullObj(new string[] { "fileGen" })]
[NotNullOrEmpty(new string[] { "strFileName", "strFileDir", "strInterfacePath" })]
[MatchTypeObj(new object[] { "fileGen", typeof(FileGen) })]
public static void ExportModel(this Obj fileGen, IEnumerable<Obj> inputs, IEnumerable<Obj> outputs, string strFileName, string strFileDir, string strInterfacePath, FMIVersionType version = FMIVersionType.One, ExpressionValueVariable? interfaceTimeStep = null, string modelDescription = "This is the pendulum models.")

Parameters

fileGen Obj

The file generation to export model.

inputs IEnumerable<Obj>

The inputs of the file generation setting.

outputs IEnumerable<Obj>

The outputs of the file generation setting.

strFileName string

The file name of fmu file to be generated.

strFileDir string

The file path of files to be generated.

strInterfacePath string

The interface folder path.

version FMIVersionType

The version of the file generation setting.

interfaceTimeStep ExpressionValueVariable?

The interface time step of the file generation setting.

modelDescription string

The model description of the file generation setting.

Exceptions

ArgumentNullException

Will be thrown if 'fileGen', 'strFileName', 'strFileDir', 'strInterfacePath' arguments are empty.

ArgumentException

Will be thrown if the type of 'fileGen' is not .

ArgumentException

Will be thrown if the type of 'inputs' is not or if the type of 'output' is not .

ArgumentOutOfRangeException

Will be thrown if 'interfaceTimeStep' value is equal to or less than 0.

GenerateFile(SubSystemDocument, string)

Create .

[NotNull(new string[] { "document" })]
public static Obj GenerateFile(this SubSystemDocument document, string name = "")

Parameters

document SubSystemDocument

The document to create the file generation setting of FMI version.

name string

The name of the file generation setting of FMI version.

Returns

Obj

The new object that is created by this API.

Exceptions

ArgumentNullException

Will be thrown if 'document' is null.

GenerateMatlabFile(SubSystemDocument, string)

Create .

[NotNull(new string[] { "document" })]
public static Obj GenerateMatlabFile(this SubSystemDocument document, string name = "")

Parameters

document SubSystemDocument

The document to create the M file generation setting of matlab version.

name string

The name of the M file generation setting of matlab version.

Returns

Obj

The new object that is created by this API.

Exceptions

ArgumentNullException

Will be thrown if 'document' is null.

Connect with Ansys