Writing Scripts

A test script runs as part of the simulation test cycle and, thus is resumed every cycle by the scheduler. It relinquishes execution after doing the work corresponding to the cycle. If it doesn’t relinquish , the test cycle will overrun its allotted time, possibly causing the scheduler to terminate the test.

There can only be one script program running as part of a test. The SimWB scheduler will run the script after the input stage of the test cycle (after values are read from I/O devices and written to the real-time database (RTDB) ). This allows the script to overwrite values obtained during the input cycle in order to affect the behavior of the simulation models that run after it.

The test scripting framework provides a transparent mechanism that starts the script when a test is run, to hook up into the scheduler, and to map the RTDB into the script executable own address space.

Viewing Reports

Reports that detail the success/failure of each step of the test are generated for each run (session). The reports are html and are most easily displayed using your favorite browser. From the server, insure that the httpd daemon is started: sysemctl start httpd. To have the server started on subsequent boots, you must also systemctl enable httpd. You can then direct your browser to http://localhost/SimWB" when on the server, or replace localhost with the server's network name from elsewhere.

Scripting Languages

Scripts can be written in the C programming language. In order to ease the programmer’s task, two additional pseudo-languages are layered on top of the C language.

SWs

Full C programming environment with additional macros. The macros ease access to the RTDB and wait or test for logical conditions on RTDB variables. An SWs file is processed by the sws_pp preprocessor (on the real-time host) to generate a C program that is then compiled and linked by the default gcc compiler.

SWm

Reduced-features pseudo-language. This language provides a very easy way to write programs that access the RTDB and test for logical conditions. An SWm file is processed by the swm_pp preprocessor (on the real-time host) to generate an SWs program.

Both SWs and SWm files always end up as C source files that are compiled and linked to produce a native executable that is run in the test cycle.

Additionally, both SWm and SWs scripts automatically create a test log file for every test run. Execution status of wait logical and test logical conditions are logged to the file with a pass/fail result (see waitcond, testcond). Options can be enabled in a script to halt the test run on error conditions, ignore errors, report errors and continue, etc. At the end of the test run, an html report is generated which gives a line by line account of the test execution.

SWm Language

The SWm language is a simple preprocessed language with limited language constructs from which it is easy to access RTDB variables and place automatic entries in the test log file. It uses automatic variables of numerical or string type. Variables either are local to the test script or exist in the RTDB:

Variables

Local Variables

Local variables must be valid C identifiers (they can be used directly in embedded C code) and may hold either a numeric value (always implemented as a double in C) or a string value (implemented as a char[1024] in C). Local variables may not be named the same as an SWm keyword. The type of local variables is determined by the type of assignment operator used to assign a value to it.

RTDB Variables

RTDB variables may be accessed in one of two ways. First, the R.“variable syntax may be used to access them by name directly. Second - it can be cumbersome to use the whole variable name repeatedly - a shortcut may be defined using the rtdb_ref statement and the shortcut used via the r.shortcut syntax.

Language Syntax

A SWM test script program is a collection of SWM statements. Statements are single line only. A statement must be completely defined on a single line . Multi line statements are not supported.
A statement can be terminated by a semi-colon ; but this is not mandatory. Flow control statements like if, while ,end, goto, etc. are never terminated by a ;.

Statements

A statement occupies one, and only one, line. Multi-line statements are not allowed.

Assignment

Assigns an expression to a variable.

variable = numeric_expression;

variable := string_expression;

Numeric values (including logical values) are assigned to a variable via the = operator; string values via the := operator. Assignment statements must be terminated with a semicolon. If the destination is a local variable, the operator chosen determines the type of the variable, which is not otherwise declared.

Built-in access to Real-Time Flags

The alternate and operator flags for an RTDB variable can be set or reset via the following assignment syntax:

alt

r.shortcut.alt=true;
R.“
variable”.alt=true;

op

r.shortcut.op=true;
R.“
variable”.op=true;

Numerical Expressions

Numerical expressions generally follow regular C syntax, with some enhancements.

The following operators are provided, in order of increasing operator precedence:

Parentheses can be used to override default operator precedence.

Logical Expressions

Logical expressions generally follow regular C syntax.

The following logical operators compare two numerical values and have the usual C meaning: >=, <=, >, <, ==, and !=. The following logical operators compare two string expressions for equality and inequality, respectively: eq and ne.

The following logical operators operate on logical expressions and have the usual C meaning: &&, ||, and !.

Two logical constants are defined: true and false.

Parentheses can be used to override default operator precedence.

String Expressions

The string concatenation operator is the period: ..

Flow Control

if

Conditionally executes statements. An if statement must be terminated by an end or else statement.

if logical_expression
    statements...
else
    
statements...
end

Example:
     if a > 10
       c = d/2;
     else
       c = d/3;
     end
     

else

See if.

end

See if or while.

while

Executes a block of statements while an expression is true. A while must be terminated by an end statement.

while logical_expression
    statements...
end

Example:
     i = 0;
     while i < 10
       c = i*2;
       i = i + 1;
     end
     
goto

Transfers execution of the program to the specified label.

    goto label;
    
statements...
label:
    
statements...

Built-In SWM Constructs

code

Starts a section with embedded C code.

code;
    
C statements...
endcode;

The source statements are placed “as is” in the generated C source file.

ei

Configures the script program to ignore any Failed conditions generated by the script execution. The test will continue running even when a Fail condition is generated.

ei;

endcode

See code/

endsec

Close the currently open section. See section.

errormsg

Writes a C language printf style formatted string to the pseudo standard out and logs the string to the test log.

errormsg pass_or_fail,error_code,format_string,expression_list;

The pass_or_fail parameter is a numeric expression that must evaluate to -1 to log Fail, 1 to log Pass, or 0 for a user condition. The error_code parameter from simerrors.h. A negative value always indicates an error conditions. For user error codes, a value less than -10000 or greater than 10000 should be used.

es

Configures the script program to abort execution of the script and terminate the test run with an error whenever a Fail condition is generated.

es;

ew

Configures the script program to generate a warning when a Fail condition is generated instead of terminating the script.

ew;

failmsg

Writes a C language printf style formatted string to the pseudo standard out and logs a Fail entry to the test log.

failmsg error_code,format_string,expression_list;

The error_code parameter from simerrors.h. A negative value always indicates an error conditions. For user error codes, a value less than -10000 or greater than 10000 should be used.

include

Includes the contents of another file at the line the statement appears at.

include “filename

label

See goto.

logsuccess

Configures whether the script program will log Pass conditions to the test log file.

logsuccess logical_expression;

When the logical_expression is false, successful waitcond and testcond statements are not recorded to the test log file. Only Fail conditions are logged. If true, both Pass and Fail conditions are recorded for waitcond and testcond statements.

See testcond and waitcond.

msg

Writes a C language printf style formatted string to the pseudo standard output and to the test log.

msg format_string,expression_list;

passmsg

Writes a C language printf style formatted string to the pseudo standard out and logs a Pass entry to the test log.

passmsg error_code,format_string,expression_list;

The error_code parameter from simerrors.h. A negative value always indicates an error conditions. For user error codes, a value less than -10000 or greater than 10000 should be used.

print

Writes a C language printf style formatted string to the pseudo standard output.

print format_string,expression_list;

read

Reads from the pseudo standard input and sets the values of the variables specified to the values parsed in the input buffer.

read timeout_seconds,variable_list;

The user must delimit values with a comma or semicolon. If the time out expires without the user providing input, a Failed message is logged to the test log. Specify a negative value for the time out to disable timing out. If the user does not provide enough values, the leftover variables will be undefined.

See ninputs.

rtdb_ref

Defines a shortcut for an RTDB variable.

rtdb_ref “variable”,shortcut;

section

Open a new section in the test log. Writes a C language printf style formatted string to the pseudo standard output and makes an entry in the test log that marks additional entries as part of this section.

section format_string,expression_list;
    
statements...
endsec

Sections may be nested. This organizes the test log and its report file into different sections and subsections.

stop

Stops the script program and terminates the test run.

stop;

sub

Defines a subroutine.

sub subroutine_name;
    
statements...
end

Subroutines do not take parameters, but have access to all local variables.

testcond

Logs the line number of this statement and the result of the logical expression to the test log file as Pass for true and Fail for false.

testcond logical_expression;

Logging of Passed may be disabled by the logsuccess statement.

waitcond

Suspends execution of the script, allowing test cycles to continue executing, until the logical expression evaluates to true or the time out expires.

waitcond logical_expression,timeout_seconds;

The condition is tested once every test cycle. This statement is logged to the test log file as Pass when the logical expression evaluates to true and as Fail when the time out expires. Logging of Pass may be disabled by the logsuccess statement.

waitframe

Suspends execution of the script, allowing the test cycle to continue executing, until the next test cycle frame comes around to the script step.

waitframe;

waitseconds

Suspends execution of the script, allowing test cycles to continue executing, for a number of seconds.

waitseconds seconds;

The time is rounded to an integer multiple of the frame length.

Built-in Functions Returning Strings

left

Extracts the left most portion of the string expression.

string_expression.left(number_of_characters)

If the number_of_characters specified is longer than the length of the string_expression, the whole string_expression is returned.

right

Extracts the right most portion of the string expression.

string_expression.right(number_of_characters)

If the number_of_characters specified is longer than the length of the string_expression, the whole string_expression is returned.

mid

Extracts a sub-string from the string expression.

string_expression.mid(start_index,number_of_characters)

The start_index is the offset from the beginning of the string_expression where the sub-string will be extracted.

If the number_of_characters specified is longer than the length of the string_expression-start_index, the whole string_expression to the right of start_index is returned.

number

Formats a numeric expression as a string.

“”.number(expression,format_character,format_precision)

The numeric expression is formatted the same way as a C style printf with the specified format_precision and format_character. The value of the string expression the function is attached to is not used.

Example:
     mystr := "".number(r.throttle,'f',5);
     

Built-in Functions that Returns Numeric Value

find

Searches the string expression haystack for the string expression needle.

find(haystack,needle)

Returns the index from the beginning of haystack where needle is located, or -1 of needle is not found.

int

Truncates the fractional portion of the expression, returning an integer number.

int(expression)

length

Calculates the length of the string_expression.

length(string_expression)

logenable

Toggle data logging for the RTDB item.

logenable(rtdb_ref , logical_expression)

When the logical_expression evaluates to true , logging is enabled, otherwise it is disabled.

ninputs

Returns the number of fields read by the previous read statement.

ninputs()

See read.

status

Returns the current script status.

status()

The status is set by all statements that generate a Pass or Fail condition. Negative values, defined in simerros.h, indicate a Fail; non-negative values, a Pass.

runtime

Returns the number of seconds elapsed since the beginning of the test execution.

runtime()

The number of seconds is rounded to the number of frames executed since the beginning.This function is non-blocking, I.e. it does not implicitly wait for a frame of execution.

Example:
     // The correct way to use runtime()
     while runtime() < 5.2
         waitframe
            ..
            ..
     end
     
value

Converts a string_expression into a numerical value.

value(string_expression)

If the string_expression contains illegal characters, a value of 0 is returned.

Built-in Numerical Functions

abs

Returns the absolute value of the expression.

abs(expression)

sqrt

Returns the square root of the expression.

sqrt(expression)

min

Returns the minimum of expression1 or expression2 .

min(expression1 , expression2)

max

Returns the maximum of expression1 or expression2 .

max(expression1 , expression2)

rand

Returns a random number between 0 and and the value of the expression.

rand(expression)

cos

Returns the cosine of the expression.

cos(expression)

cosh

Returns the hyperbolic cosine of the expression.

cosh(expression)

acos

Returns the arc cosine of the expression.

acos(expression)

acosh

Returns the hyperbolic arc cosine of the expression.

acosh(expression)

sin

Returns the sine of the expression.

sin(expression)

sinh

Returns the hyperbolic sine of the expression.

sinh(expression)

asin

Returns the arc sine of the expression.

asin(expression)

asinh

Returns the hyperbolic arc sine of the expression.

asinh(expression)

tan

Returns the tangent of the expression.

tan(expression)

tanh

Returns the hyperbolic tangent of the expression.

tanh(expression)

atan

Returns the arc tangent of the expression.

atan(expression)

atanh

Returns the hyperbolic arc tangent of the expression.

atanh(expression)

log

Returns the natural logarithm the expression.

log(expression)

log2

Returns the base 2 logarithm of the expression.

log2(expression)

log10

Returns the base 10 logarithm of the expression.

log10(expression)

exp

Returns the value of e (the base of natural logarithms) raised to the power of expression.

exp(expression)

exp2

Returns the value of 2 raised to the power of expression.

exp2(expression)

erf

Returns the error function of the expression.

erf(expression)

The erf function is defined as:

erfc

Returns the complementary error function of the expression. That is 1.0 - erf(expression)

erfc(expression)

Built-in Generic Functions

rtdb.snapshot

Take a snapshot of the RTDB loaded in memory.

rtdb.snapshot()

rtdb.formimport

Use the form to import values specified in the form into the RTDB.

rtdb.formimport(string_expression , expression)

string_expression specifies the name of the form to import. When expression is != 0, only the inputs items defined in the form are set. In general, it does not make sense to import output items into the RTDB as they would be immediately overwritten by the model(s) when computing their outputs.

rtdb.formcapture

Use the form to capture the values of the items specified in the form to s file.

rtdb.formcapture(string_expression1 , string_expression2, expression1 , expression2, expression3)

string_expression1 specifies the name of the form to import. string_expression2 specifies the name template for the capture file name.
expression1 specifies the format type for the capture file (0 == CSV, 1 == Initial Condition, 2 == RTForm , 3 == MAT file).
expression2 specifies the period in seconds when capturing multiple records to a CSV file .
expression3 specifies how many records to capture capturing multiple records to a CSV file .

Built-in Asynchronous I/O Functions

CAN ESD Functions

asyncio.CANId.ESD.fifotoscheduled

Switch the message from FIFO to scheduled transmission mode . If the message is already in scheduled mode, nothing happens and the call just returns with 0 error code. The previously used scheduled rate for the message can either be restored by passing -1 as the new transmission rate or set to the new value passed in the msRate argument. If the message is already in FIFO mode, nothing happens and the call just returns with 0 error code.

asyncio.CANId.ESD.fifotoscheduled( boardNum , netNum , canId , msRate )

Parameters:
boardNum The board number (starting at 1) where the CAN message is defined.
netNum the net number on which the message is defined.
canId The CAN id.
msRate The new transmit rate in milliseconds or -1 to restore the previously save rate. Be aware that if the message was initially setup as a FIFO/Queue message when

Returns 0 On success.
< 0 SCRIPT_NOTCANPOINT, SCRIPT_NOTCANOUTPUT, RTDB_POINTNOTFOUND.

asyncio.CANId.ESD.fifotxonchange

Set/reset the FIFO CAN id to transmit on change. When Tx on change is set, the CAN id is sent whenever its value changed. When Tx on change is reset, the CAN message is only by user request.

asyncio.CANId.ESD.fifotxonchange( boardNum , netNum , canId , txOnChange )

Parameters:
boardNum integer with the board number where the CAN Id is defined . The first board is 1.
netNum integer with the net number where the CAN Id is defined .
canId integer with the CAN Id to be sent .
txOnChange Boolean indicating whether to set or reset the Tx on change CAN id flag.

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND.

asyncio.CANId.ESD.getlastrxinterval

Returns the number of micro seconds elapsed since the specified CAN id was last received .

asyncio.CANId.ESD.getlastrxinterval( boardNum , netNum , canId )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
netNum The board net number number (0-3).
canId The CANid.

Returns The number of micro seconds if > 0.
< 0 RTDB_POINTNOTFOUND if the label cannot be found.

asyncio.CANId.ESD.getlastrxtime

Returns the number of micro seconds elapsed since the specified CAN id was last received .

asyncio.CANId.ESD.getlastrxtime( boardNum , netNum , canId )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
netNum The board net number number (0-3).
canId The CANid.

Returns The number of micro seconds if > 0.
< 0 RTDB_POINTNOTFOUND if the label cannot be found.

asyncio.CANId.ESD.getrxcount

Get the number of messages received for the selected CAN id.

asyncio.CANId.ESD.getrxcount( boardNum , netNum , canId )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
netNum integer with the net number where the message is defined .
canId The CAN id as defined in the RTDB configuration.

Returns >= 0 The number of message received. < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANId.ESD.gettxcount

Get the number of messages transmitted for the selected CAN id.

asyncio.CANId.ESD.gettxcount( boardNum , netNum , canId )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
netNum integer with the net number where the message is defined .
canId The CAN id as defined in the RTDB configuration.

Returns >= 0 The number of message transmitted. < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANId.ESD.gettxflags

Return the transmit rate of an CAN message by specifying the board number , net number and canId .

asyncio.CANId.ESD.gettxflags( boardNum , netNum , canId )

Parameters:
boardNum The board number . First board is 1.
netNum The net number.
canId The CAN id.

Returns The transmit flags as a combination of MSGIO_SCHED, MSGIO_FIFO, MSGIO_TXONCHANGE, MSGIO_PAUSED.
< 0 When an error occurred and the label could not be found.

asyncio.CANId.ESD.gettxrate

Return the transmit rate of a CAN message by specifying the board number , net number and canId .

asyncio.CANId.ESD.gettxrate( boardNum , netNum , canId )

Parameters:
boardNum The board number . First board is 1.
netNum The net number.
canId The CAN id.

Returns The transmit rate in milliseconds.
< 0 When an error occurred and the label could not be found.

asyncio.CANId.ESD.pause

Pause the selected CAN message. Sending of the CAN message can be resumed with a call to ccurAsyncIO_canResumeMsg.
The message must be defined as a scheduled/Sample message for this to work,

asyncio.CANId.ESD.pause( boardNum , netNum , canId )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
netNum integer with the net number where the message is defined .
canId The CAN id as defined in the RTDB configuration.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANId.ESD.resume

Resume sending the selected CAN message after the message has been paused with a call to ccurAsyncIO_canPauseMsg. The message must be defined as a schedule/Sample message for this to work.

asyncio.CANId.ESD.resume( boardNum , netNum , canId )

Parameters:
boardNum integer with the board number where the message is defined . The first board is 1.
netNum integer with the net number where the CAN id is defined .
canId The CAN id as defined in the RTDB configuration.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANId.ESD.scheduledtofifo

Switch the CAN message from scheduled transmission mode to FIFO/Queue mode. If the message is already in FIFO mode, nothing happens and the call just returns with 0 error code.

asyncio.CANId.ESD.scheduledtofifo( boardNum , netNum , canId )

Parameters:
boardNum The board number (starting at 1) where the CAN message is defined.
netNum the net number on which the message is defined.
canId The CAN id.

Returns 0 On success.
< 0 RTDB_POINTNOTFOUND if the message cannot be found.

asyncio.CANId.ESD.settxrate

Change the transmit rate of a CAN message by specifying the board number , net number and canId .

asyncio.CANId.ESD.settxrate( boardNum , netNum , canId , msRate )

Parameters:
boardNum The board number . First board is 1.
netNum The net number.
canId The CANid.
msRate The transmit rate in milliseconds.

Returns N/A

asyncio.CANId.ESD.txnow

Request that the value of label defined in FIFO queueing mode be sent now. FIFO mode labels are only transmitted upon user request.

asyncio.CANId.ESD.txnow( boardNum , netNum , canId )

Parameters:
boardNum integer with the board number where the CAN Id is defined . The first board is 1.
netNum integer with the net number where the CAN Id is defined .
canId integer with the CAN Id to be sent .

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANItem.fifotoscheduled

Switch the message where the point is mapped from FIFO to scheduled transmission mode . If the message is already in scheduled mode, nothing happens and the call just returns with 0 error code. The previously used scheduled rate for the message can either be restored by passing -1 as the new transmission rate or set to the new value passed in the msRate argument. configuring the RTDB, the message does NOT have an original scheduled rate and so the msRate must be supplied by the user the first time the call is used on the given pItem.

asyncio.CANItem.fifotoscheduled( rItem , msRate )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmission mode.
msRate The new transmit rate in milliseconds or -1 to restore the previously save rate. Be aware that if the message was initially setup as a FIFO/Queue message when

Returns 0 On success.
< 0 SCRIPT_NOTCANPOINT, SCRIPT_NOTCANOUTPUT, RTDB_POINTNOTFOUND.

asyncio.CANItem.fifotxonchange

Set/reset the FIFO CAN id where the point is mapped to transmit on change. When Tx on change is set, the label is sent whenever its value changed. When Tx on change is reset, the CAN message is only by user request.

asyncio.CANItem.fifotxonchange( rItem , txOnChange )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmission mode.
txOnChange Boolean indicating whether to set or reset the Tx on change CAN id flag.

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND.

asyncio.CANItem.getrxcount

Get the number of messages received for the CAN id associated with the RTDB item.

asyncio.CANItem.getrxcount( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want the count of message received .

Returns >= 0 The number of message received. < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANItem.gettxcount

Get the number of messages transmitted for the CAN id associated with the RTDB item.

asyncio.CANItem.gettxcount( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want the count of message transmitted .

Returns >= 0 The number of message transmitted. < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANItem.gettxflags

Return the transmit flags of the CAN message associated with the RTDB item. The RTDB item must be mapped to an CAN output message. If the item is mapped to more than one CAN output message, the TX flags for the first mapping is returned.

asyncio.CANItem.gettxflags( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want the transmit flags.

Returns The transmit flags as a combination of MSGIO_SCHED, MSGIO_FIFO,MSGIO_TXONCHANGE,MSGIO_PAUSED.
< 0 SCRIPT_NOTCANPOINT, SCRIPT_NOTCANOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.CANItem.gettxrate

Return the transmit rate of the CAN message associated with the RTDB item. The RTDB item must be mapped to an CAN output message. If the item is mapped to more than one CAN output message, the TX rate for the first mapping is returned.

asyncio.CANItem.gettxrate( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want the transmit rate.

Returns The TX rate in milliseconds.
< 0 SCRIPT_NOTCANPOINT, SCRIPT_NOTCANOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.CANItem.pause

Pause the CAN message onto which the specified RTDB item is mapped. Sending of message label can be resumed with a call to ccurAsyncIO_canResumeItemMsg.
The label must be defined as a schedule label for this to work.

asyncio.CANItem.pause( rItem )

Parameters:
rItem SWM reference to the RTDB item which is mapped to the label. If the point is not mapped to a CAN message label. This call returns an error.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.CANItem.resume

Resume sending the selected CAN message after the label has been paused with a call to ccurAsyncIO_canPauseItemCANId. The message where the point is mapped must be defined as a schedule/Sample message for this to work.

asyncio.CANItem.resume( rItem )

Parameters:
rItem SWM reference to the RTDB item which is mapped to the message. If the point is not mapped to a CAN message. This call returns an error.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND, SCRIPT_NOTCANOUTPUT if error.

asyncio.CANItem.scheduledtofifo

Switch the CAN message where the point is mapped from scheduled transmission mode to FIFO/Queue mode. If the message is already in FIFO mode, nothing happens and the call just returns with 0 error code.
The current scheduled rate for the message is saved so that it can be restored when the message is switched back to scheduled mode.

asyncio.CANItem.scheduledtofifo( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmission mode.

Returns 0 On success.
< 0 SCRIPT_NOTCANPOINT, SCRIPT_NOTCANOUTPUT, RTDB_POINTNOTFOUND.

asyncio.CANItem.settxrate

Change the transmit rate of the CAN message associated with the RTDB item. The RTDB item must be mapped to an CAN output message.

asyncio.CANItem.settxrate( rItem , msRate )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmit rate. Be aware that this will not change the default value for this variable in the RTDB.
msRate The transmit rate in milliseconds.

Returns 0 On success.
< 0 SCRIPT_NOTCANPOINT, SCRIPT_NOTCANOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.CANItem.txnow

Request that the value of CAN Id defined in FIFO queueing mode be sent now. If the item specified is mapped to multiple CAN Id's , all of the them will be transmitted. FIFO mode CAN Id with IOFL_TXONCHANGE flag are only transmitted upon user request.

asyncio.CANItem.txnow( rItem )

Parameters:
rItem SWM reference to the RTDB item mapped to the label we want to transmit.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

ARINC DDC A429 Functions

asyncio.ARINCItem.fifotoscheduled

Switch the label where the point is mapped from FIFO to scheduled transmission mode . If the label is already in scheduled mode, nothing happens and the call just returns with 0 error code. The previously used scheduled rate for the label can either be restored by passing -1 as the new transmission rate or set to the new value passed in the msRate argument. configuring the RTDB, the label does NOT have an original scheduled rate and so the msRate must be supplied by the user the first time the call is used on the given pItem.

asyncio.ARINCItem.fifotoscheduled( rItem , msRate )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmission mode.
msRate The new transmit rate in milliseconds or -1 to restore the previously save rate. Be aware that if the label was initially setup as a FIFO label when

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, CSCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.fifotxonchange

Set/reset transmit on change state on the FIFO label where the point is mapped. When Tx on change is set, the label is sent whenever its value changes. When Tx on change is reset, the label is only sent by user request.

asyncio.ARINCItem.fifotxonchange( rItem , txOnChange )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmission mode.
txOnChange Boolean indicating whether to set or reset the Tx on change label flag.

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND.

asyncio.ARINCItem.getrxcount

Return the number of times the ARINC 429 label associated with the RTDB item was received. The RTDB item must be mapped to an ARINC 429 output label. If the item is mapped to more than one output label, the TX rate for the first mapping is returned.

asyncio.ARINCItem.getrxcount( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want to get the transmit rate.

Returns The number of times the label was received.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.gettxcount

Return the number of times the ARINC 429 label associated with the RTDB item was sent. The RTDB item must be mapped to an ARINC 429 output label. If the item is mapped to more than one output label, the TX rate for the first mapping is returned.

asyncio.ARINCItem.gettxcount( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want to get the transmit rate.

Returns The number of times the label was sent.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.gettxflags

Return the transmit flags of the ARINC 429 label associated with the RTDB item. The RTDB item must be mapped to an ARINC 429 output label. If the item is mapped to more than one output label, the TX flags for the first mapping is returned.

asyncio.ARINCItem.gettxflags( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want to get the transmit flags.

Returns The transmit flags as a combination of MSGIO_SCHED, MSGIO_FIFO, MSGIO_TXONCHANGE, MSGIO_PAUSED.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.gettxrate

Return the transmit rate of the ARINC 429 label associated with the RTDB item. The RTDB item must be mapped to an ARINC 429 output label. If the item is mapped to more than one output label, the TX rate for the first mapping is returned.

asyncio.ARINCItem.gettxrate( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want to get the transmit rate.

Returns The transmit rate in milliseconds.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.pause

Pause the label mapped to the specified RTDB item. Sending of the label can be resumed with a call to ccurAsyncIO_arinc429ResumeItemLabel.
The label must be defined as a schedule label for this to work.

asyncio.ARINCItem.pause( rItem )

Parameters:
rItem SWM reference to the RTDB item which is mapped to the label. If the point is not mapped to an ARINC429 label. This call returns an error.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCItem.resume

Resume sending the selected label after the label has been paused with a call to ccurAsyncIO_arinc429PauseItemLabel. The label must be defined as a schedule label for this to work.

asyncio.ARINCItem.resume( rItem )

Parameters:
rItem SWM reference to the RTDB item which is mapped to the label. If the point is not mapped to an ARINC429 label. This call returns an error.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCItem.scheduledtofifo

Switch the ARINC 429 label where the point is mapped from scheduled transmission mode to FIFO mode. If the label is already in FIFO mode, nothing happens and the call just returns with 0 error code.
The current scheduled rate for the label is saved so that it can be restored when the label is switched back to scheduled mode.

asyncio.ARINCItem.scheduledtofifo( rItem )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmission mode.

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, CSCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.settxrate

Change the transmit rate of the ARINC 429 label associated with the RTDB item. The RTDB item must be mapped to an ARINC 429 output label.

asyncio.ARINCItem.settxrate( rItem , msRate )

Parameters:
rItem SWM reference to the RTDB item for which we want to change the transmit rate. Be aware that this will not change the default value for this variable in the RTDB.
msRate The transmit rate in milliseconds.

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, SCRIPT_BADARINCTXRATE.

asyncio.ARINCItem.txnow

Request that the value of label defined in FIFO queueing mode be sent now. If the item specified is mapped to multiple ARINC label , all of the them will be transmitted. FIFO mode labels with IOFL_TXONCHANGE are only transmitted upon user request.

asyncio.ARINCItem.txnow( rItem )

Parameters:
rItem SWM reference to the RTDB item mapped to the label we want to transmit.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCLabel.A429.fifotoscheduled

Switch the given label on the board type and number from FIFO to scheduled transmission mode . If the label is already in scheduled mode, nothing happens and the call just returns with 0 error code. The previously used scheduled rate for the label can either be restored by passing -1 as the new transmission rate or set to the new value passed in the msRate argument. configuring the RTDB, the label does NOT have an original scheduled rate and so the msRate must be supplied by the user the first time the call is used on the given pItem.

asyncio.ARINCLabel.A429.fifotoscheduled( boardNum , channelNum , labelNum , msRate )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
channelNum The channel number (0-15).
labelNum The label number.
msRate The new transmit rate in milliseconds or -1 to restore the previously save rate. Be aware that if the label was initially setup as a FIFO label when

Returns 0 On success.
< 0 RTDB_POINTNOTFOUND .

asyncio.ARINCLabel.A429.fifotxonchange

Set/reset transmit on change state on the FIFO label where the point is mapped. When Tx on change is set, the label is sent whenever its value changes.

asyncio.ARINCLabel.A429.fifotxonchange( boardNum , channelNum , labelNum , txOnChange )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
channelNum The channel number (0-15).
labelNum The label number.
txOnChange : 1 to set tx on change flag, 0 to reset the tx on change flag.

Returns 0 On success.
< 0 RTDB_POINTNOTFOUND if the label cannot be found.

asyncio.ARINCLabel.A429.getlastrxinterval

Returns the number of micro seconds elapsed since the specified label point was last received .

asyncio.ARINCLabel.A429.getlastrxinterval( boardNum , channelNum , labelNum )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
channelNum The channel number (0-15).
labelNum The label number.

Returns The number of micro seconds if > 0.
< 0 RTDB_POINTNOTFOUND if the label cannot be found.

asyncio.ARINCLabel.A429.getlastrxtime

Returns the number of micro seconds elapsed since the specified label point was last received .

asyncio.ARINCLabel.A429.getlastrxtime( boardNum , channelNum , labelNum )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
channelNum The channel number (0-15).
labelNum The label number.

Returns The number of micro seconds if > 0.
< 0 RTDB_POINTNOTFOUND if the label cannot be found.

asyncio.ARINCLabel.A429.getrxcount

Get the number of messages received for the selected ARINC label .

asyncio.ARINCLabel.A429.getrxcount( boardNum , channelNum , labelNum )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
channelNum integer with the channel number.
labelNum The ARINC label number.

Returns >= 0 The number of message received. < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCLabel.A429.gettxcount

Get the number of messages transmitted for the selected ARINC label .

asyncio.ARINCLabel.A429.gettxcount( boardNum , channelNum , labelNum )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
channelNum integer with the channel number.
labelNum The ARINC label number.

Returns >= 0 The number of message transmitted. < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCLabel.A429.gettxflags

Return the transmit flags of an ARINC 429 label by specifying the board number , channel and label where the label is defined.

asyncio.ARINCLabel.A429.gettxflags( boardNum , channelNum , labelNum )

Parameters:
boardNum The board number . First board is 1.
channelNum The channel number where the label is sent.
labelNum The ARINC label for which to change the schedule rate.

Returns The transmit flags as a combination of MSGIO_SCHED, MSGIO_FIFO, MSGIO_TXONCHANGE, MSGIO_PAUSED.
< 0 When an error occurred and the label could not be found.

asyncio.ARINCLabel.A429.gettxrate

Return the transmit rate of an ARINC 429 label by specifying the board number , channel and label where the label is defined.

asyncio.ARINCLabel.A429.gettxrate( boardNum , channelNum , labelNum )

Parameters:
boardNum The board number . First board is 1.
channelNum The channel number where the label is sent.
labelNum The ARINC label for which to change the schedule rate.

Returns The transmit rate in milliseconds.
< 0 When an error occurred and the label could not be found.

asyncio.ARINCLabel.A429.pause

Pause the selected ARINC 429 label. Sending of the label can be resumed with a call to ccurAsyncIO_arinc429ResumeLabel.
The label must be defined as a scheduled label for this to work,

asyncio.ARINCLabel.A429.pause( boardNum , channelNum , labelNum )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
channelNum integer with the channel number where the label is defined .
labelNum integer with the label number to resume.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCLabel.A429.resume

Resume sending the selected label after the label has been paused with a call to ccurAsyncIO_arinc429PauseLabel. The label must be defined as a schedule label for this to work.

asyncio.ARINCLabel.A429.resume( boardNum , channelNum , labelNum )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
channelNum integer with the channel number where the label is defined .
labelNum integer with the label number to resume.

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.

asyncio.ARINCLabel.A429.scheduledtofifo

Switch the ARINC 429 label where the point is mapped from scheduled transmission mode to FIFO mode. If the label is already in FIFO mode, nothing happens and the call just returns with 0 error code.
The current scheduled rate for the label is saved so that it can be restored when the label is switched back to scheduled mode.

asyncio.ARINCLabel.A429.scheduledtofifo( boardNum , channelNum , labelNum )

Parameters:
boardNum The board number (first board is 0) where the label is defined.
channelNum The channel number (0-15).
labelNum The label number.

Returns 0 On success.
< 0 SCRIPT_NOTARINCPOINT, SCRIPT_NOTARINCOUTPUT, RTDB_POINTNOTFOUND, CSCRIPT_BADARINCTXRATE.

asyncio.ARINCLabel.A429.settxrate

Change the transmit rate of an ARINC 429 label by specifying the board number , channel and label where the label is defined.

asyncio.ARINCLabel.A429.settxrate( boardNum , channelNum , labelNum , msRate )

Parameters:
boardNum The board number . First board is 1.
channelNum The channel number where the label is sent.
labelNum The ARINC label for which to change the schedule rate.
msRate The transmit rate in milliseconds.

Returns < 0 If the label could not be found

asyncio.ARINCLabel.A429.txnow

Request that the value of label defined in FIFO queueing mode be sent now. FIFO mode labels are only transmitted upon user request.

asyncio.ARINCLabel.A429.txnow( boardNum , channelNum , labelNum )

Parameters:
boardNum integer with the board number where the label is defined . The first board is 1.
channelNum integer with the channel number where the label is defined .
labelNum integer with the label number to be sent .

Returns 0 on Success < 0 RTDB_POINTNOTFOUND if error.