Script Editor


The script editor is a integreated OptiY. Within, the scripting text can be input, edited and saved. Further more, the script can be compiled, executed and tested with the programming languages Visual Basic .Net or C# .Net. Double-click on the script item (Global Script, Initial Script and Final Script) on the explorer to open  the script editor.

If the script editor is active, user can compile or run the script using menu "Tools/Script/Compile" or "Tools/Scripting/Run" . The script editor contains only the compiler for Visual Basic or C#. Within, simple codes can be debug. For more complex codes, it is recommended to use the Visual Studio(Visual Basic or C#) from Microsoft parallel with this script editor. It is a comfortable development environment. Thus, the detailed documentation of the programming language is available. After debug and testing the code, user can copy the code into the script editor.

Project Script

The scripting structure of the project contains the following 3 parts:

Global variables and prcedures can be defined here to use in other scripting parts of the project. This global script will be performed once time at the start of optimization process. Its values are valid for the entire optimization process and for all experiments of the project. Normally in this script, there are e.g. commands calling extern simulation programs:

 

     Dim Sim = CreateObject("Excel.Application")

 

This script will performed at the start of the experiment. It can be used for initializing in the experiment.

 

This script will be performed an the end of experiment. It can be used for starting next experiment for a calculation loop or for export data etc...

Script Source Code

If compiling and running, all the scripting parts of the project will be put together into one compiler-unit. The source codes generated can be export by the menu "Tools/Scripting/Script Export". Thus, the intern scripting structure of OptiY can be shown e.g:

Option Strict Off

Option Explicit On

 

Imports OptiY.Interop

Imports System

Imports System.IO

Imports System.Windows.Forms

 

Namespace OptiY

    Public Class MacroClass

        Dim Sim = CreateObject("Excel.Application")

 

        Public Overridable Sub Experiment_Init(ByVal OptiY As OptiY.Interop.Application)

        End Sub

 

        Public Overridable Sub Experiment_Final(ByVal OptiY As OptiY.Interop.Application)

        End Sub

   End Class

End Namespace