User Template


For the extern simulation program named "ExSim", the script file "ExSim.ops" has to be created. The scripting language can be either Visual Basic or C# and bases on the .NET framework technology. The language can be set by the item Global Scripts of the Explorer. The template can be written with the script editor and has e.g. the following structure in Visual Basic:

Dim UserSim, UserDoc, UserFile, UserKey As Object
Public Sub UserOpenFile(ByVal User As OptiY.Interop.User)
End Sub

Public Sub UserSetOptions(ByVal User As OptiY.Interop.User)
End Sub

Public Sub UserListParameters(ByVal User As OptiY.Interop.User)
End Sub

Public Sub UserListResults(ByVal User As OptiY.Interop.User)
End Sub

Public Sub UserSetParameters(ByVal User As OptiY.Interop.User)
End Sub

Public Sub UserStartSimulation(ByVal User As OptiY.Interop.User)
End Sub

Public Sub UserReadResults(ByVal User As OptiY.Interop.User)
End Sub

The variable User is predefined and it can be used in the script. The 5 variables UserSim, UserDoc, UserFile, UserKey, UserSub are served as global variable in the script template and they will be modified by OptiY.  The script template must contain all above procedures. Other user-defined  procedures must have the prefix "UserSub" of the name (e.g. Public Sub UserSub_Calculation(ByVal X As Double)). The communication with OptiY is done by its COM-interface. It is very recommended to use the free Visual Studio Express Edition of Microsoft to program and to test the script. If the script runs bug-free, its source codes can be copied into the user template. Finally, the script file has to be saved in the system folder of OptiY (...\OptiY GmbH\OptiY x.x\UserIntegration\ExSim.ops).

If great classes or modules are required for the template, it can be programmed as a separate assembly inside of Visual Studio. Then compile the assembly to a DLL-file. The compiled DLL-file must be saved in the 2 system folders of OptiY:

If the experiment starts, all DLL-files saved in these folders will be linked as reference automatically. Thus, the assemblies can be used inside of OptiY.

After the template file "ExSim.ops" is saved into system folder of OptiY (...\OptiY GmbH\OptiY x.x\UserIntegration\ExSim.ops), We can start OptiY and see in the menu: Insert/Simulation Model the item ExSim of the extern simulation program. It can now insert it into OptiY.