Difference between revisions of "TestIT:Programming Functions"

From Nolek Wiki
Jump to navigation Jump to search
Line 275: Line 275:
 
|String or String symbol
 
|String or String symbol
 
|String value to test
 
|String value to test
|}
 
 
==5.3.2 Misc (Miscellaneous)==
 
===Move===
 
'''Description:''' <br />
 
It will move a value into a symbol.
 
 
'''Code example:'''
 
:<code>Misc.Move(_IN01,2)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|Int symbol or Double symbol
 
|Symbol to move value to
 
|-
 
|Value
 
|Int, Double, Int symbol or Double symbol
 
|Value to move into symbol
 
|}
 
 
===Set===
 
'''Description:''' <br />
 
It will set symbols in symbol array to true.
 
 
'''Code example:'''
 
:<code>Misc.Set(_B01;_B02;_B03)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Bool Symbols
 
|Symbol array
 
|Bool symbols to set
 
|}
 
 
===Reset===
 
'''Description:''' <br />
 
It will reset symbols in symbol array to false.
 
 
'''Code example:'''
 
:<code>Misc.Reset(_B01;_B02;_B03)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Bool Symbols
 
|Symbol array
 
|Bool symbols to reset
 
|}
 
 
===SetUniqueID===
 
'''Description:''' <br />
 
It will set the Unique ID to the value. The Unique ID will be logged together with results in the database.
 
 
'''Code example:'''
 
:<code>Misc.SetUniqueID(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Unique ID
 
|String symbol
 
|Unique ID
 
|}
 
 
===GetUniqueID===
 
'''Description:''' <br />
 
It will return a Unique ID for the Unique ID Device. The Unique ID will be logged together with results in the database.
 
 
'''Code example:'''
 
:<code>Misc.GetUniqueID(Unique,_ST01,_B01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Device name
 
|String or String symbol
 
|The device name
 
|-
 
|Unique ID
 
|String symbol
 
|Receive the unique ID from the device
 
|-
 
|Set as Object ID
 
|Bool symbol
 
|If true, the Object ID in the production will be set to this unique ID. If Object ID is selected, max length is 50
 
|}
 
 
===AddResult===
 
'''Description:''' <br />
 
It will add a result to the production window. If LogToDB is set to true, the result will be logged to the database as well.
 
All the results which are logged in the database can be found in Report/Results.
 
 
'''Code example:'''
 
:<code>Misc.AddResult(1010,"Leak result","Result from S9",_ST01,LeakResult,"Pa",0,2,3,ObjectStatus,AlwON)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Number
 
|Int or Int symbol
 
|Result number
 
|-
 
|Result name
 
|String or String symbol
 
|Result name (Max 50 char)
 
|-
 
|Description Short
 
|String or String symbol
 
|Description Short (Max 50 char)
 
|-
 
|Description Long
 
|String or String symbol
 
|Description Long (Max 250 char, is not shown on screen)
 
|-
 
|Result Symbol
 
|Number symbol
 
|Symbol value will be logged as result
 
|-
 
|Unit
 
|String or String symbol
 
|String to describe the unit
 
|-
 
|Min
 
|Int, Double, Int symbol or Double symbol
 
|Minimum value
 
|-
 
|Max
 
|Int, Double, Int symbol or Double symbol
 
|Maximum value
 
|-
 
|Icon
 
|Int
 
|Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning)
 
|-
 
|Object Status
 
|Bool symbol
 
|Symbol value will be logged as overall result
 
|-
 
|LogToDB
 
|Bool symbol
 
|Log to database if true
 
|}
 
 
===AddResultValidate===
 
'''Description:''' <br />
 
It will add a result to the production window and validate OK/NOK. If LogToDB is set to true, the result will be logged to the database as well. It will show the OK/NOK icon according to the validation and set the object status as well.
 
All the results which are logged in the database can be found in Report/Results.
 
 
'''Code example:'''
 
:<code>Misc.AddResultValidate(1010,"Leak result","Result from S9",_ST01,LeakResult,"Pa",0,2,3,2,ObjectStatus,AlwON)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Number
 
|Int or Int symbol
 
|Result number
 
|-
 
|Result name
 
|String or String symbol
 
|Result name (Max 50 char)
 
|-
 
|Description Short
 
|String or String symbol
 
|Description Short (Max 50 char)
 
|-
 
|Description Long
 
|String or String symbol
 
|Description Long (Max 250 char, is not shown on screen)
 
|-
 
|Result Symbol
 
|Number symbol
 
|Symbol value will be logged as result
 
|-
 
|Unit
 
|String or String symbol
 
|String to describe the unit
 
|-
 
|Min
 
|Int, Double, Int symbol or Double symbol
 
|Minimum value
 
|-
 
|Max
 
|Int, Double, Int symbol or Double symbol
 
|Maximum value
 
|-
 
|IconOK
 
|Int
 
|Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning)
 
|-
 
|IconNOK
 
|Int
 
|Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning)
 
|-
 
|Object Status
 
|Bool symbol
 
|Symbol value will be logged as overall result
 
|-
 
|LogToDB
 
|Bool symbol
 
|Log to database if true
 
|}
 
 
===ValidateObject===
 
'''Description:''' <br />
 
It will validate the status of the actual object and show the Icons Good or Bad in the production window.
 
 
'''Code example:'''
 
:<code>Misc.ValidateObject(ValidationResult,ObjectResult,3,Retest,Lamp01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol
 
|Symbol to receive result [1:Retest,2:Can retest,3:Max retest,4:Failed,5:TestOK]
 
|-
 
|Object result
 
|Bool symbol
 
|Symbol representing the object status
 
|-
 
|Max retest
 
|Int or Int symbol
 
|Max retest count
 
|-
 
|Actual test count
 
|Int symbol
 
|Symbol to hold actual retest count
 
|-
 
|Object Failed
 
|Bool symbol
 
|Set true if failed. Can turn on indicator if failed
 
|}
 
 
===IsNewProduct===
 
'''Description:''' <br />
 
It will return a Boolean whether the current product is running for the first time or not
 
 
'''Code example:'''
 
:<code>Misc.IsNewProduct(_B01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|IsNewProduct
 
|Bool symbol
 
|Symbol for is new product
 
|}
 
 
===IsDeviceActive===
 
'''Description:''' <br />
 
It will check if the device is set to active.
 
 
'''Code example:'''
 
:<code>Misc.IsDeviceActive(_B01, _ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True if device is active
 
|-
 
|Device name
 
|String or String symbol
 
|Name of the device
 
|}
 
 
===GetBatchNumber===
 
'''Description:''' <br />
 
It will return the current batch number.
 
 
'''Code example:'''
 
:<code>Misc.GetBatchNumber(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Receive current batch number
 
|}
 
 
===GetProductName===
 
'''Description:''' <br />
 
It will return the current product name.
 
 
'''Code example:'''
 
:<code>Misc.GetProductName(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Receive current product name
 
|}
 
 
===GetCurrentLanguage===
 
'''Description:''' <br />
 
It will return the language TestIT is set to.
 
 
'''Code example:'''
 
:<code>Misc.GetCurrentLanguage(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Get current language code
 
|}
 
 
===GetTestCountOK===
 
'''Description:''' <br />
 
It will return the current OK test count.
 
 
'''Code example:'''
 
:<code>Misc.GetTestCountOK(_IN01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol
 
|Receive current OK test count
 
|}
 
 
===GetTestCountNOK===
 
'''Description:''' <br />
 
It will return the current NOK test count.
 
 
'''Code example:'''
 
:<code>Misc.GetTestCountNOK(_IN01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol
 
|Receive current NOK test count
 
|}
 
 
===GetUserName===
 
'''Description:''' <br />
 
It will return the username of the active user.
 
 
'''Code example:'''
 
:<code>Misc.GetUserName(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Receive current user name
 
|}
 
 
===GetGuideObjectID===
 
'''Description:''' <br />
 
It will return the object ID from the current guide.
 
 
'''Code example:'''
 
:<code>Misc.GetGuideObjectID(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Receive current guide objectID
 
|}
 
 
===StartFlash===
 
'''Description:''' <br />
 
It will start flashing a bool symbol, and continues the code.
 
 
'''Code example:'''
 
:<code>Misc.StartFlash(_B01,500,1000,MS,_B02)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol to flash
 
|Bool symbol
 
|Symbol to flash
 
|-
 
|On time
 
|Int or Int symbol
 
|Length of on/set state
 
|-
 
|Off time
 
|Int or Int symbol
 
|Length of off/reset state
 
|-
 
|Time unit
 
|String
 
|Time unit
 
|-
 
|Stop flash symbol
 
|Bool symbol
 
|Set symbol to stop flash
 
|}
 
 
==5.3.3 Display==
 
===OpAddSymbol===
 
'''Description:''' <br />
 
It will add a symbol or symbols to the operator display.
 
 
'''Code example:'''
 
:<code>Display.OpAddSymbol(_ST01;_B01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol Array
 
|Symbol array
 
|Symbol or symbol array to add to the operator display
 
|}
 
 
===OpRemoveSymbol===
 
'''Description:''' <br />
 
It will remove symbol or symbols to operator display.
 
 
'''Code example:'''
 
:<code>Display.OpRemoveSymbol(_ST01;_B01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol Array
 
|Symbol array
 
|Symbol or symbol array to remove from the operator display
 
|}
 
 
===OpClear===
 
'''Description:''' <br />
 
It will clear operator display.
 
 
'''Code example:'''
 
:<code>Display.OpClear()</code>
 
 
''No parameters''
 
 
===UpAddButton===
 
'''Description:''' <br />
 
It will add a button to the user prompt.
 
 
'''Code example:'''
 
:<code>Display.UpAddButton(_B01;_B02)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Bool Symbols
 
|Symbol array
 
|Bool symbols to add to the user prompt
 
|}
 
 
===UpShow===
 
'''Description:''' <br />
 
It will display the user prompt.
 
 
'''Code example:'''
 
:<code>Display.UpShow(_B01,"Header","Text for info",1)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|}
 
 
===UpScanShow===
 
'''Description:''' <br />
 
It will display the user scan prompt.
 
 
'''Code example:'''
 
:<code>Display.UpScanShow(_B01,_ScannedValue,"Header","Text for info",1)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|ScannedValue
 
|String symbol
 
|Symbol to hold the scanned value
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|}
 
 
===Message===
 
'''Description:''' <br />
 
It will set a text message in the production window.
 
 
'''Code example:'''
 
:<code>Display.Message(1010,"Pressure OK",3)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Message number
 
|Int or Int symbol
 
|Message number
 
|-
 
|Message
 
|String or String symbol
 
|Symbol or string message to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (0 = None, 1 = Info, 2 = Error, 3 = Success, 4 = Warning)
 
|}
 
 
===UpShowYesNo===
 
'''Description:''' <br />
 
It will display the user prompt with Yes/No buttons.
 
 
'''Code example:'''
 
:<code>Display.UpShowYesNo(_B01,_ScannedValue,"Header","Text for info",1)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|UP Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|Question Result
 
|Bool symbol
 
|Symbol receive result of the question
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|}
 
 
===TestCountShow===
 
'''Description:''' <br />
 
It will show test count.
 
 
'''Code example:'''
 
:<code>Display.TestCountShow()</code>
 
 
''No parameters''
 
 
===TestCountReset===
 
'''Description:''' <br />
 
It will reset test counter.
 
 
'''Code example:'''
 
:<code>Display.TestCountReset()</code>
 
 
''No parameters''
 
 
===TestCountAddOK===
 
'''Description:''' <br />
 
It will add one to OK test counter.
 
 
'''Code example:'''
 
:<code>Display.TestCountAddOK()</code>
 
 
''No parameters''
 
 
===TestCountAddNOK===
 
'''Description:''' <br />
 
It will add one to NOK test counter.
 
 
'''Code example:'''
 
:<code>Display.TestCountAddNOK()</code>
 
 
''No parameters''
 
 
==5.3.4 Image==
 
 
===UpImageShow===
 
'''Description:''' <br />
 
It will display the user image prompt.
 
 
'''Code example:'''
 
:<code>Display.UpImageShow(_B01,"Verify parts","Verify all parts - when ready press OK",1,ImageFolder,Parts)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|-
 
|Device name
 
|String or String symbol
 
|Image folder device name
 
|-
 
|Image name
 
|String or String symbol
 
|Image name
 
|}
 
 
===UpImageShowIO===
 
'''Description:''' <br />
 
It will display the user image prompt with I/O connection.
 
 
'''Code example:'''
 
:<code>Display.UpShowYesNo(_B01,"ConnectIT","Select number 1020 in ConnectIT box",5,ImageFolder,200,B201,AlwON)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|-
 
|Device name
 
|String or String symbol
 
|Image folder device name
 
|-
 
|Image name
 
|String or String symbol
 
|Image name
 
|-
 
|IO symbol
 
|Bool symbol
 
|Can be used to accept with an IO eg. a button
 
|-
 
|Show button
 
|String or String symbol
 
|Show button on prompt if true
 
|}
 
 
===UpImageShowScan===
 
'''Description:''' <br />
 
It will display the user scan prompt.
 
 
'''Code example:'''
 
:<code>Display.UpImageShowScan(_B01,"ConnectIT","Select number 1020 in ConnectIT box",5,ImageFolder,200,_ScannedValue)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|-
 
|Device name
 
|String or String symbol
 
|Image folder device name
 
|-
 
|Image name
 
|String or String symbol
 
|Image name
 
|-
 
|Scanned Value
 
|String symbol
 
|Receive the scanned value
 
|}
 
 
===UpImageShowYesNo===
 
'''Description:''' <br />
 
It will display the user image Yes/No prompt.
 
 
'''Code example:'''
 
:<code>Display.UpImageShowScan(_B01,"ConnectIT","Select number 1020 in ConnectIT box",5,ImageFolder,200,_ScannedValue)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Bool symbol
 
|True when command is done
 
|-
 
|Header
 
|String or String symbol
 
|Header to display
 
|-
 
|Text
 
|String or String symbol
 
|Text to display
 
|-
 
|Icon
 
|Int
 
|Select Icon (Icon: 1 = Message; 2= Alert; 3 = Question)
 
|-
 
|Device name
 
|String or String symbol
 
|Image folder device name
 
|-
 
|Image name
 
|String or String symbol
 
|Image name
 
|-
 
|Question Result
 
|Bool symbol
 
|Receive the result of the question
 
|}
 
 
==5.3.5 Math==
 
 
===Add===
 
'''Description:''' <br />
 
It will add two numbers.
 
 
'''Code example:'''
 
:<code>Math.Add(_D01,1,3)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol or Double symbol
 
|Symbol to receive result
 
|-
 
|Value1
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|-
 
|Value2
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|}
 
 
===Subtract===
 
'''Description:''' <br />
 
It will subtract one number from another.
 
 
'''Code example:'''
 
:<code>Math.Subtract(_IN01,4,3)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol or Double symbol
 
|Symbol to receive result
 
|-
 
|Value1
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|-
 
|Value2
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|}
 
 
===Divide===
 
'''Description:''' <br />
 
It will divide two numbers.
 
 
'''Code example:'''
 
:<code>Math.Divide(_D01,4,2)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol or Double symbol
 
|Symbol to receive result
 
|-
 
|Value1
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|-
 
|Value2
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|}
 
 
===Multiply===
 
'''Description:''' <br />
 
It will multiply two numbers.
 
 
'''Code example:'''
 
:<code>Math.Multiply(_D01,2,2)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol or Double symbol
 
|Symbol to receive result
 
|-
 
|Value1
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|-
 
|Value2
 
|Int, Double, Int symbol or Double symbol
 
|Value or symbol to use
 
|}
 
 
===Average (Avg)===
 
'''Description:''' <br />
 
It will get the average of an array of numbers.
 
 
'''Code example:'''
 
:<code>Math.Avg(_D01,1;2,3;5;90)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Double symbol
 
|Symbol to receive result
 
|-
 
|Number Symbols
 
|Symbol array
 
|Array of numbers to get average from
 
|}
 
 
===Minimum (Min)===
 
'''Description:''' <br />
 
It will return the minimum/lowest value from an array.
 
 
'''Code example:'''
 
:<code>Math.Min(_D01,1;2,3;5;90)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Double symbol
 
|Symbol to receive result
 
|-
 
|Number Symbols
 
|Symbol array
 
|Array of numbers to get minimum from
 
|}
 
 
===Maximum (Max)===
 
'''Description:''' <br />
 
It will return the maximum/highest value from an array.
 
 
'''Code example:'''
 
:<code>Math.Max(_D01,1;2,3;5;90)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Double symbol
 
|Symbol to receive result
 
|-
 
|Number Symbols
 
|Symbol array
 
|Array of numbers to get maximum from
 
|}
 
 
==5.3.6 DateTime==
 
 
===Now===
 
'''Description:''' <br />
 
It will return the current date and time (yyyy/MM/dd HH:mm:SS,fff).
 
 
'''Code example:'''
 
:<code>DateTime.Now(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Symbol to receive result
 
|}
 
 
===Date===
 
'''Description:''' <br />
 
It will get the current date.
 
 
'''Code example:'''
 
:<code>DateTime.Date(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|String symbol
 
|Symbol to receive result
 
|}
 
 
===DayOfWeek===
 
'''Description:''' <br />
 
It will get the number of the current day of the week (1-7).
 
 
'''Code example:'''
 
:<code>DateTime.DayOfWeek(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
===WeekNumber===
 
'''Description:''' <br />
 
It will return the current week of the year (1-52).
 
 
'''Code example:'''
 
:<code>DateTime.WeekNumber(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
===Month===
 
'''Description:''' <br />
 
It will return the current month of the year (1-12).
 
 
'''Code example:'''
 
:<code>DateTime.Month(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
===Year===
 
'''Description:''' <br />
 
It will return the current year.
 
 
'''Code example:'''
 
:<code>DateTime.Year(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
===DateDiff===
 
'''Description:''' <br />
 
It will get the difference between two dates in either days, hours, minutes, seconds, or milliseconds.
 
 
'''Code example:'''
 
:<code>DateTime.DateDiff (_ST01,_Start,_End,S)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|-
 
|From
 
|String symbol
 
|Symbol value to set as start
 
|-
 
|To
 
|String symbol
 
|Symbol value to set as end
 
|-
 
|Interval
 
|String
 
|Select Interval eg. D = Day, H = Hour, M = minute, S = seconds, MS = milliseconds
 
|}
 
 
===Hour===
 
'''Description:''' <br />
 
It will return the current hour of the day (0-23).
 
 
'''Code example:'''
 
:<code>DateTime.Hour(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
===Minute===
 
'''Description:''' <br />
 
It will return the current minute of the hour (0-59).
 
 
'''Code example:'''
 
:<code>DateTime.Minute(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
===Second===
 
'''Description:''' <br />
 
It will return current second of a minute (0-59).
 
 
'''Code example:'''
 
:<code>DateTime.Second(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Result
 
|Int symbol, double symbol or String symbol
 
|Symbol to receive result
 
|}
 
 
==5.3.7 Text==
 
 
===StringClear===
 
'''Description:''' <br />
 
It will set symbol value to empty string.
 
 
'''Code example:'''
 
:<code>Text.StringClear(_ST01)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to clear
 
|}
 
 
===StringMove===
 
'''Description:''' <br />
 
It will move text value to symbol.
 
 
'''Code example:'''
 
:<code>Text.StringMove(_ST01,"New text")</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|}
 
 
===StringConcatenate===
 
'''Description:''' <br />
 
It will combine two symbol values to one text string.
 
 
'''Code example:'''
 
:<code>Text.StringConcatenate(_ST01,"New ","text")</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|}
 
 
===StringMid===
 
'''Description:''' <br />
 
It will return a part of a text value.
 
 
'''Code example:'''
 
:<code>Text.StringMid(_ST01,"New text", 5, 3)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|-
 
|Start character
 
|Int or Int symbol
 
|Start character
 
|-
 
|Number of characters
 
|Int or Int symbol
 
|Number of characters
 
|}
 
 
===StringRemove===
 
'''Description:''' <br />
 
It will remove part of a text value.
 
 
'''Code example:'''
 
:<code>Text.StringRemove(_ST01,"New text", 4, 3)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|-
 
|Start Index
 
|Int or Int symbol
 
|Start character
 
|-
 
|Number of characters
 
|Int or Int symbol
 
|Number of characters
 
|}
 
 
===StringReplace===
 
'''Description:''' <br />
 
It will replace every occurrence of a value with another.
 
 
'''Code example:'''
 
:<code>Text.StringReplace(_ST01,"New text", "e", "o")</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|-
 
|From
 
|String or String symbol
 
|From character
 
|-
 
|To
 
|String or String symbol
 
|To character
 
|}
 
 
===StringLength===
 
'''Description:''' <br />
 
It will measure the length of the string.
 
 
'''Code example:'''
 
:<code>Text.StringLength(_IN01,"New text")</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|Int symbol or Double symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to move
 
|}
 
 
===StringToVal===
 
'''Description:''' <br />
 
It will convert a text value to a number.
 
 
'''Code example:'''
 
:<code>Text.StringToVal(_IN01,"9")</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|Int symbol or Double symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|String or String symbol
 
|Value or symbol to use
 
|}
 
 
===StringValueToString===
 
'''Description:''' <br />
 
It will convert a number value to a text value.
 
 
'''Code example:'''
 
:<code>Text.StringValueToString(_ST01,9)</code>
 
 
{| class="wikitable"
 
!colspan="3"|Parameters
 
|-
 
|'''Parameter'''
 
|'''Type'''
 
|'''Description'''
 
|-
 
|Symbol
 
|String symbol
 
|Symbol to receive result
 
|-
 
|Value
 
|Int, Double, Bool, Int symbol, Double symbol or Bool symbol
 
|Value or symbol to use
 
 
|}
 
|}

Revision as of 15:27, 14 August 2019

The function window encompasses all the codes, which can be inserted in the program. To get information about the function, then, press on the wanted line and use the info button. When a function is going to be created, the wanted function can be selected, or if the code is known then it is possible to write it. To get help with filling in the function, the Config button can be selected and it will show the parameters. In symbol handler, it is possible to add a symbol, and it is also possible to insert a symbol in the function. To insert a symbol, just double-click on the wanted symbol.

5.3.1 Functions

If

Description:
Evaluates a statement and continues if true and skips if it is not true. It compares two values and is always used together with EndIf.

Code example:

Function.If(_B01,=,1)
'Code will only be executed if _B01 = 1
Function.EndIf()
Parameters
Parameter Type Description
Criteria1 Number or number symbol Value 1
Sign Sign Select sign to use for comparison. Must be (<,>, <>,=, >=, ⇐)
Criteria2 Number or number symbol Value 2

IfMinMax

Description:
Evaluates a value against a min. and max. It continues if the value is between the min. and max, and skips if it is not.

Code example:

Function.IfMinMax(_IN01,1,5)
'Code will only be executed if _IN01 is between 1 and 5
Function.EndIf()
Parameters
Parameter Type Description
Value/Symbol to compare Number or number symbol Value 1
Min value Number or number symbol Minimum value
Max value Number or number symbol Maximum value

EndIf

Description:
It is used together with If or IfMinMax. It will stop the if code.

Code example:

Function.If(_B01,=,1)
'Code will only be executed if _B01 = 1
Function.EndIf()

No parameters

Wait

Description:
It will wait until the time has run out or criteria is met.

Code example:

Function.Wait(_D01,>,10,30,S,_TO01)
Function.If(_TO01, =, 1)
'Code will enter if wait times out
Function.EndIf()
Parameters
Parameter Type Description
Criteria1 Number or number symbol Value 1
Sign Sign Select sign to use for comparison. Must be (<,>, <>,=, >=, ⇐)
Criteria2 Number or number symbol Value 2
Timeout Int or Int symbol Time before command times out
Time unit String Select the time unit from the list
Timeout active Bool symbol True if wait command times out

Sub

Description:
It is used to split the program up in smaller programs. The main sub is the sub which TestIT always starts in. The program cannot run if there is no main sub. It must always end with an EndSub.

Code example:

Function.Sub(1000)
'Execute this sub routine
Function.EndSub()
Parameters
Parameter Type Description
Sub name String Name of the sub. Must be unique in the program

EndSub

Description:
It is the end mark of a sub.

Code example:

Function.Sub(1000)
'Execute this sub routine
Function.EndSub()

No parameters

GoSub

Description:
It will jump to a specific sub.

Code example:

Function.GoSub(1000)
Parameters
Parameter Type Description
Sub name String Name of the sub.

Label

Description:
It will set a fix point to jump to.

Code example:

Function.Label(startLoop)
Parameters
Parameter Type Description
Label name String Name of the label. Must be unique within the sub

GoLabel

Description:
It will jump to a specific label.

Code example:

Function.GoLabel(startLoop)
Parameters
Parameter Type Description
Label name String Name of the label

Delay

Description:
It will delay the program, for a specified time.

Code example:

Function.Delay(30,S)
Parameters
Parameter Type Description
Delay time Int or Int symbol Delay time
Time unit String Time unit

StopTest

Description:
It will go to EndSub() in main sub.

Code example:

Function.StopTest()

No parameters

NewPart

Description:
It will clear the production window, the results, and prepare the production to run a new product.

Code example:

Function.NewPart()

No parameters
The command is often used together with a label that jumps to the beginning of the program.

Code example:

Function.NewPart()
Function.GoLabel(lbl_newPart)

IsValue

Description:
It will convert a symbol to a numeric value if it is possible.

Code example:

Function.IsValue(_D01,_B01,_ST01)
Parameters
Parameter Type Description
Result Double symbol Value or symbol to use
IsValue Bool symbol Time unit
ValueToTest String or String symbol String value to test