Main
Overview
Getting Started
Components
API Reference
Videos
Sample Files
Update History

AI Builder 3 API Reference

In the table below is the complete listing of the AI Builder 3 Runtime Library. All functions are located within the aib3runtime.dll file distributed with the AI Builder 3 IDE. Functions can be called from any C/C++, Visual Basic or .Net application.

NOTE: The runtime is automatically distributed with the AI Builder 3 IDE download. To export an AI System from the AI Builder 3 IDE, select the button from the IDE as depicted in the picture to the right. To complete the export, you will need to have purchased a license to the AI Builder 2 Developer Runtime. You can instantly license and unlock this feature by purchasing via the pricing and information page and/or the dialog box provided when the button is clicked.

Below are the recommended steps, (function name in bold blue), for utilizing the AI system at runtime:
  1. Load the exported AI system file  [tmAISystem_Load ]
  2. Set the values of the AI system inputs [tmAISystem_SetValue ]
  3. Perform a cycle of AI system execution [tmAISystem_Execute ]
  4. Retrieve and act on the values of the AI system outputs that hold the result of the AI system execution, repeat step 2 either continuously or manually [tmAISystem_GetSystemOutputValue ]
  5. Unload the exported AI system file [tmAISystem_Unload ]

-- sample code below listing -

Locating the Export Button in the IDE (click to enlarge)
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 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.

Visual Basic API Declarations

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

Sample Visual Basic Implementation Code        (function name in red)

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

 

C/C++ API Declarations

Copy and or download the "aib2runtime.h" header file and add to your project. The runtime header file is provided here: header file

Sample C/C++ Implementation Code

Coming soon...


Copyright © TinMan Systems, Inc. 2010-2015. All Rights Reserved.
Questions or comments: support@tinmansystems.com