-- sample code below listing -
Function Name | Description |
tmAISystem_GetVersion (void) | Retrieves current library version |
tmAISystem_Load (const char* szFileName, int idAISystem, PSYSFEEDBACK pFeedback) | Loads and prepares exported AI System |
tmAISystem_Unload (int idAISystem) | Unloads exported AI System |
tmAISystem_Execute (int idAISystem) | Performs one complete cycle of AI System computation using the current values of the System Inputs. The result populates the values of the System Outputs. |
tmAISystem_SetValue (int idAISystem, int idInput, double dValue) | Sets the value of a system input by input ID |
tmAISystem_SetArrayValues (int idInput, double* pdValues, int iCountValues) | Sets the pointer / location of an array of double values for a system input by input ID |
tmAISystem_GetCountSystemInputs (int idAISystem) | Returns the count of system inputs in the currently loaded AI System |
tmAISystem_GetCountSystemOutputs (int idAISystem) | Returns the count of system outputs in the currently loaded AI System |
tmAISystem_GetSystemInputInfo (int idAISystem, int idInput, PSYSTEMINPUT pInputOUT) | Fills information structure, along with pointer to value for direct access, with detail for the System Input with the provided system input ID. |
tmAISystem_GetSystemInputValue (int idAISystem, int idInput, double* pdValue) | Gets the current value of a System Input by system input ID |
tmAISystem_GetSystemOutputInfo (int idAISystem, int idOutput, PSYSTEMOUTPUT pOutputOUT) | Fills information structure, along with pointer to value for direct access, with detail for the System Output with the provided system output ID. |
tmAISystem_GetSystemOutputValue (int idAISystem, int idOutput, double* pdValue) | Gets the current value of a System Output by system output ID |
tmAISystem_GetAllSystemInputs (int idAISystem, PSYSTEMINPUT pInputsOUT) | Retrieves detailed information for all System Inputs by filling in structure for each. Function is provided an array of empty Input structures. |
tmAISystem_GetAllSystemOutputs (int idAISystem, PSYSTEMOUTPUT putputsOUT) | Retrieves detailed information for all System Outputs by filling in structure for each. Function is provided an array of empty Output structures. |
For convenience, copy and past the following API declarations into your Visual Basic form or module file. Then in your Visual Basic form events, load the exported runtime file, set the input values, execute, and get the output value results. (To see a step by step tutorial for integrating with a Visual Basic app, go here.)
Public Structure SYSFEEDBACK
Public iResponseCode As Integer ' will contain an code other than 0 if function could not be completed...
Public bMsgAvailable As Boolean ' flag indicating a string msg is available in the szMsg param...
Public szMsg As String ' system information in form of string msg (if any)
End Structure
Declare Function tmAISystem_GetVersion Lib "aib2runtime.dll" () As Double Declare Function tmAISystem_Load Lib "aib2runtime.dll" (ByVal szFileName As String, _ ByVal idAISystem As Integer, pFeedback As SYSFEEDBACK) As Integer Declare Function tmAISystem_Unload Lib "aib2runtime.dll" (ByVal idAISystem As Integer) As Integer Declare Function tmAISystem_Execute Lib "aib2runtime.dll" (ByVal idAISystem As Integer) As Integer Declare Function tmAISystem_SetValue Lib "aib2runtime.dll" (ByVal idInput As Integer, ByVal dValue As Double) As Integer Declare Function tmAISystem_SetArrayValues Lib "aib2runtime.dll" (ByVal idInput As Integer, _ ByRef pdValues As Double, ByVal iCountValues As Integer) As Integer Declare Function tmAISystem_GetCountSystemInputs Lib "aib2runtime.dll" (ByVal idAISystem As Integer) As Integer Declare Function tmAISystem_GetCountSystemOutputs Lib "aib2runtime.dll" (ByVal idAISystem As Integer) As Integer Declare Function tmAISystem_GetSystemInputValue Lib "aib2runtime.dll" (ByVal idAISystem As Integer, _ ByVal idInput As Integer, ByRef pdValue As Double) As Integer Declare Function tmAISystem_GetSystemOutputValue Lib "aib2runtime.dll" (ByVal idAISystem As Integer, ByVal idOutput As Integer, _ ByRef pdValue As Double) As Integer
Getting the runtime version number:
Dim dVersion As Double
dVersion = tmAISystem_GetVersion()
TextBox1.Text = dVersion
Loading your AI system file:
Dim iResult As Integer
Dim szFileName As String
Dim structFeedback As SYSFEEDBACK
structFeedback.szMsg = ""
szFileName = "your_aisystem_file.t2r"
iResult = tmAISystem_Load(szFileName, 0, structFeedback)
If iResult = 1 Then
'success...
Else
' could not load...
End If
Setting the Input Values:
Dim idInput1 As Integer
Dim inputValue1 As Double
Dim idInput2 As Integer
Dim inputValue2 As Double
idInput1 = 25879 ' the unique id given the input in the IDE at
design time...
idInput2 = 18720
inputValue1 = TextBoxInput1.Text ' or any other value - here we are
taking the value of an input box
inputValue2 = TextBoxInput2.Text
tmAISystem_SetValue(idInput1,
inputValue1)
tmAISystem_SetValue(idInput2,
inputValue2)
Executing one Cycle:
tmAISystem_Execute(0)
Retrieving the Resulting Output Value(s):
Dim idOutput1 As Integer
Dim idOutput2 As Integer
Dim pdValueResult As Double
Dim pdValueArray(512) As Double
'this output is an example of an
array output...
idOutput1 = 15355
' the unique id given the output in the IDE at
design time...
idOutput2 = 11209
pdValueResult = 0
tmAISystem_GetSystemOutputValue(0, idOutput1, pdValueResult)
TextBoxResult1.Text = pdValueResult.ToString()
' display the resulting value in a text box
- example...
tmAISystem_GetSystemOutputValue(0, idOutput2, pdValueArray(0))
'we are passing the address of the first element of the dimensioned array...
TextBoxResult2.Text = pdValueArray(0).ToString()
' display the first element of the array in a text box...
Copy and or download the "aib2runtime.h" header file and add to your project. The runtime header file is provided here: header file
Coming soon...