    

 ## On this page

  

 

 # Class CoSimulatorAPI

 Last update: 09.03.2026 

<a id="VM_API_Pre_CoSimulator_CoSimulatorAPI"></a>

Namespace: [VM.API.Pre.CoSimulator](VM.API.Pre.CoSimulator.md)  
Assembly: VM.API.Pre.CoSimulator.dll

This class implements APIs for  and  class.

```csharp
public static class CoSimulatorAPI

```

#### Inheritance

object ← [CoSimulatorAPI](VM.API.Pre.CoSimulator.CoSimulatorAPI.md)

#### Extension Methods

[LinkPropertyItemCache.GetLinkProperties(object, LinkPropertyType)](VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkProperties_System_Object_VM_Models_Pre_LinkPropertyType_), [LinkPropertyItemCache.GetLinkPropertiesAndValues(object, LinkPropertyType)](VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkPropertiesAndValues_System_Object_VM_Models_Pre_LinkPropertyType_), [LinkPropertyItemCache.GetLinkedObjects&lt;T&gt;(object, LinkPropertyType)](VM.Models.Pre.Cache.LinkPropertyItemCache.md#VM_Models_Pre_Cache_LinkPropertyItemCache_GetLinkedObjects__1_System_Object_VM_Models_Pre_LinkPropertyType_)

## Methods

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_CreateSInput_VM_Managed_DAFUL_SubSystemDocument_VM_Models_Pre_UnitName_System_String_"></a> CreateSInput(SubSystemDocument, UnitName, string)

Create .

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

```

#### Parameters

`document` [SubSystemDocument](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/Data/VMDFBase/SubSystemDocument.cs)

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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

The new  object that is created by this API.

#### Exceptions

ArgumentNullException

Will be thrown if 'document' is null.

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_CreateSOutput_VM_Managed_DAFUL_SubSystemDocument_VM_API_Pre_Obj_VM_Models_Pre_UnitName_System_String_"></a> CreateSOutput(SubSystemDocument, Obj, UnitName, string)

Create .

```csharp
[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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/Data/VMDFBase/SubSystemDocument.cs)

The document to create the scalar output.

`formula` [Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

The formula of the scalar output.

`unit` UnitName

The unit of the scalar output.

`name` string

The name of the scalar output.

#### Returns

[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

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 .

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_ExecuteMatlabProcess_VM_API_Pre_Obj_System_String_System_String_System_Collections_Generic_IEnumerable_VM_API_Pre_Obj__System_Collections_Generic_IEnumerable_VM_API_Pre_Obj__System_String_System_Nullable_VM_Models_Pre_ExpressionValueVariable__"></a> ExecuteMatlabProcess(Obj, string, string, IEnumerable&lt;Obj&gt;, IEnumerable&lt;Obj&gt;, string, ExpressionValueVariable?)

Execute process using .

```csharp
[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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

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&lt;[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)&gt;

The inputs of the M file generation setting.

`outputs` IEnumerable&lt;[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)&gt;

The outputs of the M file generation setting.

`strInterfacePath` string

The interface folder path of the M file generation setting.

`interfaceTimeStep` [ExpressionValueVariable](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/Pre/Data/VM.Models.Pre/Models/ExpressionValueVariable.cs)?

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.

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_ExecuteProcess_VM_API_Pre_Obj_System_String_System_String_System_String_"></a> ExecuteProcess(Obj, string, string, string)

Execute process using .

```csharp
[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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

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 .

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_ExportMatlabModel_VM_API_Pre_Obj_System_Collections_Generic_IEnumerable_VM_API_Pre_Obj__System_Collections_Generic_IEnumerable_VM_API_Pre_Obj__System_String_System_String_"></a> ExportMatlabModel(Obj, IEnumerable&lt;Obj&gt;, IEnumerable&lt;Obj&gt;, string, string)

Export matlab model using .

```csharp
[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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

The file generation to export matlab model.

`inputs` IEnumerable&lt;[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)&gt;

The inputs of the matlab file generation setting.

`outputs` IEnumerable&lt;[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)&gt;

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 .

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_ExportModel_VM_API_Pre_Obj_System_Collections_Generic_IEnumerable_VM_API_Pre_Obj__System_Collections_Generic_IEnumerable_VM_API_Pre_Obj__System_String_System_String_System_String_VM_API_Pre_CoSimulator_FMIVersionType_System_Nullable_VM_Models_Pre_ExpressionValueVariable__System_String_System_Double_System_Int32_"></a> ExportModel(Obj, IEnumerable&lt;Obj&gt;, IEnumerable&lt;Obj&gt;, string, string, string, FMIVersionType, ExpressionValueVariable?, string, double, int)

Export model using ..

```csharp
[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.", double scaleFactor = 0.1, int messageLevel = 1)

```

#### Parameters

`fileGen` [Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

The file generation to export model.

`inputs` IEnumerable&lt;[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)&gt;

The inputs of the file generation setting.

`outputs` IEnumerable&lt;[Obj](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)&gt;

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](VM.API.Pre.CoSimulator.FMIVersionType.md)

The version of the file generation setting.

`interfaceTimeStep` [ExpressionValueVariable](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/Pre/Data/VM.Models.Pre/Models/ExpressionValueVariable.cs)?

The interface time step of the file generation setting.

`modelDescription` string

The model description of the file generation setting.

`scaleFactor` double

The scale factor of the file generation setting.

`messageLevel` int

The message level of the file generation setting. None=0, Partial=1, Full=2

#### 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.

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_GenerateFile_VM_Managed_DAFUL_SubSystemDocument_System_String_"></a> GenerateFile(SubSystemDocument, string)

Create .

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

```

#### Parameters

`document` [SubSystemDocument](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/Data/VMDFBase/SubSystemDocument.cs)

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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

The new  object that is created by this API.

#### Exceptions

ArgumentNullException

Will be thrown if 'document' is null.

### <a id="VM_API_Pre_CoSimulator_CoSimulatorAPI_GenerateMatlabFile_VM_Managed_DAFUL_SubSystemDocument_System_String_"></a> GenerateMatlabFile(SubSystemDocument, string)

Create .

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

```

#### Parameters

`document` [SubSystemDocument](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/Data/VMDFBase/SubSystemDocument.cs)

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](https://github.com/AnsysVirtualMotion/DAFUL/blob/9110677a5f6a53d7604f8dfd35b4c5fceb59e8e0/DAFUL/ClassicPre/API/VM.API.Pre/Models/Obj.cs)

The new  object that is created by this API.

#### Exceptions

ArgumentNullException

Will be thrown if 'document' is null.