    

 ## On this page

  

 

 # Class CoSimulatorAPI

 Last update: 16.07.2025 

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](https://learn.microsoft.com/dotnet/api/system.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

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

The document to create the scalar input.

`unit` UnitName

The unit of the scalar input.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name of the scalar input.

#### Returns

Obj

The new  object that is created by this API.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

Will be thrown if 'document' is null.

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

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](https://learn.microsoft.com/dotnet/api/system.string)

The name of the scalar output.

#### Returns

Obj

The new  object that is created by this API.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

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

The M file generation to excute process.

`strFileName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file name of a matlab file to be generated.

`strFileDir` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of matlab file to be generated.

`inputs` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;Obj&gt;

The inputs of the M file generation setting.

`outputs` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;Obj&gt;

The outputs of the M file generation setting.

`strInterfacePath` [string](https://learn.microsoft.com/dotnet/api/system.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](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

[ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

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

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

The file generation to excute process.

`strFileName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file name of a fmu file to be generated.

`strFileDir` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of a fmu file to be generated.

`strInterfacePath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The interface folder path.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

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

The file generation to export matlab model.

`inputs` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;Obj&gt;

The inputs of the matlab file generation setting.

`outputs` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;Obj&gt;

The outputs of the matlab file generation setting.

`strFileName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file name of a matlab file to be generated.

`strFileDir` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of a matlab file to be generated.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

### ExportModel(Obj, IEnumerable&lt;Obj&gt;, IEnumerable&lt;Obj&gt;, string, string, string, FMIVersionType, ExpressionValueVariable?, string)

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.")

```

#### Parameters

`fileGen` Obj

The file generation to export model.

`inputs` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;Obj&gt;

The inputs of the file generation setting.

`outputs` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;Obj&gt;

The outputs of the file generation setting.

`strFileName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file name of fmu file to be generated.

`strFileDir` [string](https://learn.microsoft.com/dotnet/api/system.string)

The file path of files to be generated.

`strInterfacePath` [string](https://learn.microsoft.com/dotnet/api/system.string)

The interface folder path.

`version` [FMIVersionType](VM.API.Pre.CoSimulator.FMIVersionType.md)

The version of the file generation setting.

`interfaceTimeStep` ExpressionValueVariable?

The interface time step of the file generation setting.

`modelDescription` [string](https://learn.microsoft.com/dotnet/api/system.string)

The model description of the file generation setting.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

[ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

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

[ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

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

### GenerateFile(SubSystemDocument, string)

Create .

```csharp
[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](https://learn.microsoft.com/dotnet/api/system.string)

The name of the file generation setting of FMI version.

#### Returns

Obj

The new  object that is created by this API.

#### Exceptions

[ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

Will be thrown if 'document' is null.

### GenerateMatlabFile(SubSystemDocument, string)

Create .

```csharp
[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](https://learn.microsoft.com/dotnet/api/system.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](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

Will be thrown if 'document' is null.