Module simwbClient

Module simwbClient


SIMulation Workbench PYToolkit Client API.

This module provides a complete configuration and control interface to a 
SIMulation Workbench (SimWB) real-time host system.  The host may be the
same system as the one running the script, or remotely connected via a
standard network connection.

Module usage is best seen by example:
    import simwbPath
    import simwbClient

    simwbClient.connect("localhost")
    simwbClient.login("username","password")

    (reply,rtdbs) = simwbClient.rtdbGetList()
    if reply > 0:
        print rtdbs
    else:
        print "rtdbGetList error: %s" % simwbClient.strerror(reply)

    simwbClient.logout()
    simwbClient.disconnect()

First we connect to the real-time host (using the network name, or "localhost"
if the script is run on the same machine).  We then log in to SimWB.  At this point
configuration and control of SimWB is possible via any of the procedures defined
below.  In our example, a list of available RTDB's is fetched and printed.

All procedure documentation is avialable via the standard python techniques, i.e.
pydoc and help().

There is a companion module, simwbConstants, that is used to define internal
SimWB constant values.  This module is automatically imported by simwbClient,
and is unlikely to be explicitely useful to the user.

Copyright (c) Concurrent Real-Time

Classes
  RTDB
The RTDB class encapsulates all the available information on the items in a running test's RTDB.
  RTDBItem
The RTDBItem class contains all the information known about a particular RTDB item.
Functions
 
Log_Debug(txt='', enabled=False)
Output a cfgsrv.log-compliant debug message to stderr when 'enabled' is True.
 
Log_Error(txt='')
Output a cfgsrv.log-compliant error message to stderr.
 
Log_Fatal(txt='terminated', callback=None)
Output a cfgsrv.log-compliant error message to stderr and exit (with return code 1).
 
Log_Info(txt='')
Output a cfgsrv.log-compliant informational message to stderr.
 
Log_Warn(txt='')
Output a cfgsrv.log-compliant warning message to stderr.
 
adamsDelete(name)
Delete the named Adams model.
 
adamsInstall(adamsPath, rtdb, newRTDB=False, group=None, cpus='2', interface=None, rebuild=False, params=False, opts='', win64=False)
Install an MSC Software Adams model in SimWB.
 
adamsParse(adamsPath)
Return the model information contained within an MSC Software Adams model file.
 
addAsamGenerator(pointName, asamFile)
Attach an ASAM wave form generator to an RTDB point.
 
addGenerator(pointName, endConditionType, sigtype, freq, ampl, phase, offset, duty, noise, duration)
Attach a wave form generator to a RTDB point value for a specified duration.
 
addGroup(group)
Add a group to the SimWB user group list.
 
appendGenerator(first, second)
Append a signal generator to a previous one.
 
archiveTest(testid, name=None, source=True, sessiondata=True, description=None, group=None, project='default')
Create an archive of test 'testid'.
 
clientHMICommand(clientIp, command)
Send a command to a remote HMI run-time client.
 
clientIP()
Request the client IP address as known to the SimWB server.
 
connect(hostName='localhost')
Connect to the configuration server running on the host system given by 'hostName'.
 
connectRefresh()
Connect to the config server refresh port .
 
createDirectory(dirName)
Create the specified directory.
 
createRefreshThread(callbacks)
Create the refresh thread to receive asynchronous update messages from cfgsrv.
 
createSampleScript(name, lang='C', group='default')
Create a sample test script with the name specified.
 
createSampleUserModel(name, group='default', options='')
Create a sample user model script with the name specified.
 
dbDelete(dbName)
Delete the specified RTDB.
 
dbGetList()
See rtdbGetList().
 
dbInfo()
Get the RTDB meta information.
 
dbItemDelete(name)
Delete an RTDB item.
 
dbItemPut(att, save=False)
Update RTDB items.
 
dbLoad(dbName)
Load the RTDB.
 
dbNew()
Initialize your RTDB in the configuration server.
 
dbSave(dbName, desc='', group='default')
Save the RTDB ccurently loaded by the configuration server (cfgsrv) under the name dbName, with group 'group', and with the description in desc.
 
dbUnload()
See dbNew()
 
deleteGroup(group)
Delete a group from the SimWB user group list.
 
disconnect()
Disconnect from the configuration server running on the real-time host.
 
downloadArchive(name)
Download the archive file specified by 'name'.
 
dupeResource(resType, dupeType, currname, destproject, destname)
Duplicate the SimWB resource specified by 'resType' from the 'currname' in the current project to the 'destname' in the 'destproject'.
 
envFileDelete(file)
Delete the environment file.
 
envFileGetList()
Get a list of all the environment files defined in the real-time host.
 
extractArchive(name, toProject=None, toGroup=None)
Extract a previously archived test (archived as 'name') to the project specified by 'toProject', and make it belong to group 'toGroup'.
 
fmuDelete(name)
Delete the named FMU model.
 
fmuInstall(fmuPath, rtdb, newRTDB=False, group=None, cpus='2', interface=None, rebuild=False, params=False, opts='', win64=False, drivesim=False)
Install an FMU model in SimWB.
 
fmuParse(fmuPath)
Return the model information contained within an FMU model file.
 
formCapture(testid, name, period=1.0, runcount=1, nametemplate='$formname_$seqnum')
Capture (record) the data specified in form 'name' in test 'testid'.
 
formCaptureList(testid)
Retrieve a list of captures taken for test 'testid'.
 
formGet(testid, name)
Retrieve the form from test 'testid' named 'name'.
 
formGetCapture(testid, name, dest=None)
Retrieve the capture data from test 'testid' named 'name' and store into file 'dest'.
 
formImport(testid, name, inputsOnly=True)
Import (inject or write) the values specified in form 'name' in test 'testid'.
 
formList(testid)
Retrieve a list of forms defined for test 'testid'.
 
formRemove(testid, name)
Removes the form 'name' in test 'testid'.
 
formSet(testid, name, items, description=None)
Store form 'name' into the test 'testid'.
 
getAppLog(name, localFile)
Get the application log file specified by 'name' and store it in 'localFile'.
 
getAppLogLines(name)
Get the application log file specified by 'name'.
 
getAppLogList()
Get a list of all the application log files on the system.
 
getCcursimConf(local=False)
Get the de-commented contents of /etc/ccursim.conf from either the 'local' file system, or the connected-to host.
 
getEnvVariables(file)
Get all the environment variables defined in the given file.
 
getFile(remoteFile, localFile)
Get the file specified by 'remoteFile' of the projects directory (i.e.
 
getFileLines(remoteFile)
Get the file specified by 'remoteFile'.
 
getFrameRate()
Get the frame rate in Hz of the running test.
 
getGeneratorInfo(genNum)
Get Info about the generator whose number is genNum (this may be a list).
 
getGroupList()
List all SimWB user groups.
 
getIOMappingRecords()
Get the I/O mapping records defined in the currently loaded RTDB.
 
getIOMappingRecordsDisk(RTDBname)
Get the I/O mapping records defined for an RTDB.
 
getInitConditions(testid, name='.default')
Get the initial conditions set 'name' for test 'testid'.
 
getItemValues(names)
Get CVT values, alternate values and real-time flags for a list of RTDB items specified in 'names'.
 
getItems()
Get the items defined in the currently loaded RTDB.
 
getItemsDisk(RTDBname)
Get the items defined in the named RTDB.
 
getItemsRTDB()
Get the items currently loaded in the in-memory Real-Time Data Base (RTDB).
 
getLicenseInfo()
Get the SimWB license information for the connect server.
 
getLoggingSet(testid, name)
Get the data logging settings for the test 'testid' with initial conditions data set called 'name' (e.g.
 
getNumberOfCpus()
Get the number of CPUs on the SIMulation Workbench server.
 
getParameterValues()
Get CVT values and types for all the items defined as parameters in the currently running RTDB.
 
getRuntimeRTDBName()
Get the name of the currently running test's RTDB, in the form of ['dbname=%s'].
 
getSignalFaults(rtdb)
Returns the contents of the signalfaults.db file for the specified RTDB.
 
getTarget(envvar='SIMWB_TARGET', host='localhost', userpass='admin/nimda', project='<default>', test='', session='', cpu=0, debug=0, logfile='Concurrent.log')
Get SimWB target information.
 
getTestState(dictionary=False)
Get the state of the real-time system.
 
getUname()
Retrieve information about the SimWB host machine.
 
getUserBoardList()
Get the a list of user-define I/O boards.
 
getUserHardwareRecord(boardID)
Get the user I/O mapping records defined for the user device named 'boardID'.
 
getVersion(format='string')
Get the SIMulation Workbench version number from the configuration server.
 
hexAtoD(st)
This module is provided as a means to convert ASCII C99 '%a' format doubles.
 
hexDtoA(f)
This module is provided as a means to convert doubles to ASCII C99 '%a' format.
 
initConditionList(testid)
Get the initial conditions list.
 
lastReply()
The SimWB server reply consists of status code and associated text.
 
lockAsamPlatform(state)
Lock the ASAM platform target.
 
logRefreshStart()
Start the log refresh data.
 
logRefreshStop()
Stop the log refresh data.
 
login(userName=None, password=None)
Login to the real-time host with the given user name and password.
 
logout()
Logout from the real-time host where the user is currently running.
 
makeASAMsrv(name, cpu=0, debug=0)
Build the ASAMsrv process, and run it as 'name'.
 
mergeRTDB(sourceRTDB, destinationRTDB, sourceProject='<default>', destinationProject='<default>')
Merge an RTDB into another RTDB.
 
message(text, source='python', severity='INFO')
Send a message to the logger.
 
modelParametersSignals(name)
Get the model parameters and signals.
 
pauseDLogger()
Pause the data logger.
 
programGetList()
Get a list of all the programs defined in the real-time host.
 
projectCopyResource(source, destination, typ, resourceName)
This function has been DEPRECATED.
 
projectCreate(projectName, groupName='default')
Create a new project on the RT-host.
 
projectDelete(projectName)
Delete a project root on the RT-host.
 
projectDupeResource(operation, typ, sourceProject, sourceName, destProject, destName)
Duplicate a SimWB resource by either making a copy of the resource or creating a link to it.
 
projectGetList()
Get a list of all the projects root on the real-time host.
 
projectGetSelected()
Get the selected project on the real-time host.
 
projectSelect(projectName='<default>')
Select the project to be the new project root on the RT-host.
 
projectWhich(directory=None)
This routine is designed to be run on the SimWB server.
 
putAsamFile(localFile, remoteFile=None, compress=True)
Send the file specified by 'localFile' and store it in 'remoteFile' in the ASAM directory that is relative to the current project.
 
putEnvVariables(file, envvars)
Save all the environment variables to the given file.
 
putFile(localFile, remoteDir='/', remoteFile=None, compress=False)
Send the file specified by 'localFile' and store it in 'remoteFile' in the 'remoteDir' of the projects directory (i.e.
 
putFileLines(lines, remoteDir='/', remoteFile='putFileLines')
Send the list of 'lines' and store it in 'remoteFile' in the 'remoteDir' of the projects directory (i.e.
 
putIOMappingRecords(recs)
Put the I/O mapping records defined in recs into the currently loaded RTDB.
 
rampRate(pointName, duration, rate, initCondition, initialValue)
Ramp up/down a RTDB point value at a given rate and for a specified duration.
 
rampToValue(pointName, endValue, rate, initCondition, initialValue)
Ramp up/down a RTDB point value until it reaches the given endValue.
 
readXMLTarget(fileName)
Read and parse the XML 'fileName' for SimWB ASAM target configuration information.
 
refreshPort(port)
This call has been deprecated and replaced by connectRefresh()
 
removeAllGenerators()
Stop and remove all signal generators.
 
removeGenerator(genNum)
Stop and remove the signal generator whose number is genNum (this may be a list).
 
renameModelRTDB(modelname, rtdbname)
Modify the RTDB used by model 'modelname' to be 'rtdbname' (in the currently selected project).
 
renameResource(resType, oldname, newname)
Modify the SimWB resource specified by 'resType' from the 'oldname' to the 'newname' (in the currently selected project).
 
resetProcessStat()
Reset the SimWB scheduler runtime statistics.
 
resumeDLogger()
Resume the data logger.
 
retrieveArchiveList()
Return a list of archives that are in your group(s).
 
rtdbGetList()
Get a list of all the real-time databases (RTDB) defined in the real-time host.
 
schedRefreshStart()
Start the scheduler refresh data.
 
schedRefreshStop()
Stop the scheduler refresh data.
 
schedulerPause()
Pause the scheduler.
 
schedulerResume()
Resume the scheduler.
 
schedulerStep(nSteps)
Step the scheduler through nSteps.
 
sessionAutoStart(testId, sessionId='', initConditions='.default', fixedStep=0, description='', noDataLogging=0, envFile=None, schedType=0, fbsKey=3331, fbsDevice='rtc0', maxInitTime=None, maxInitScriptTime=5, maxIOShutdownTime=10, maxOverrunTime=0, userParm=None, etigate=None, userLogging=False, timeout=None)
Create a new test session and start running it immediately.
 
sessionCreate(testId, sessionId, description, initConditions='.default', fixedStep=0, runFrames=0, maxOverruns=20, maxConsecutiveOverruns=10, noDataLogging=0, envFile=None, schedType=0, fbsKey=3331, fbsDevice='rtc0', maxInitTime=None, maxInitScriptTime=5, maxIOShutdownTime=10, endSnapshot=0, noDirectIO=0, circLoggerLock=0, asynciousec=20, schedstats=0, maxOverrunTime=0, int5565='0:1', disableio=None, userParm=None, etigate=None, userLogging=False)
Create a test session under test 'testId', and where 'sessionId' is the name of the new session.
 
sessionDelete(testId, sessionId)
Delete the specified test session.
 
sessionStart(testId, sessionId, timeout=None)
Start running the test and session specified.
 
sessionStop(reason=-102, timeout=None)
Stop the test that is currently running.
 
setCPUShielding(mask=0)
Set the CPU shielding for the specified CPUs.
 
setDebugLevel(task, level=0)
Set the specified SimWB task's debug level.
 
setInitConditions(nsNames, nsItems, testid, name, description='', default=0, oldName=None)
Set the initial conditions set 'name' for test 'testid'.
 
setItemRTFlags(varName, flags)
Set the real-time flags for the item 'varName'.
 
setItemValue(variable, value, rowIndex=None, columnIndex=None, isRaw=False, itemsRTDB=None)
Set the value of RTDB item 'variable' to 'value' (for non-string items.
 
setLoggingSet(testid, name, items)
Set the data logging settings for the test 'testid' with initial conditions data set called 'name' (e.g.
 
setSignalFaults(defines, rtdb)
Store the signal fault definitions in the 'defines' dictionary into the signalfaults.db file for the specified rtdb.
 
setStringItemValue(varName, value)
Set the value of RTDB string item 'varName'.
 
signalAsamSrv(name, kind='mantrigger')
The ASAMsrv task 'name' can be signaled to perform certain actions, defined by the 'kind' of signal sent.
 
simpackGetProperties()
Get SIMPACK run-time properties.
 
simwbVersion(format='string')
This is an alias for getVersion().
 
snapshotConfig(testID, fileNameTemplate='$testname_$sessionname', itemNameRegex='.*', snapshotFormat=0, pointTypeMask=-1)
Define the test snapshot configuration for future snapshots using the snapshotTake() call.
 
snapshotFetch(testId, name, dest=None)
Retrieve the snapshot data from test 'testid' session 'sessionId' named 'name' and store into file 'dest'.
 
snapshotList(testId, sessionId)
Get a list of the snapshots available from test 'testId' and session 'sessionID'.
 
snapshotTake()
Take an RTDB snapshot of the currently running test.
 
startAllGenerators()
Start all the signal generators that have been defined so far.
 
startGenerator(genNum)
Start the signal generator whose number is genNum (this may be a list).
 
stderrRefreshStart(callback, discoCallback=None)
Notify cfgsrv to start sending its stderr messages.
 
stderrRefreshStop()
Tell cfgsrv to stop sending its stderr messages.
 
stopAllGenerators()
Stop all the signal generators that have been defined so far.
 
stopCircularLogger()
Stop the circular logger.
 
stopGenerator(genNum)
Stop the signal generator whose number is genNum (this may be a list).
 
strerror(code)
Return a string representation of the message text associated with the SimWB integer error 'code'.
 
testCreate(testid, dbname, description='', group=None, fixedstep=None, scriptname=None, initscript=None, rtwname=None, userpgmname=None, simpackpgmname=None, fmupgmname=None, adamspgmname=None, snapshotfiletemplate=None, snapshotnamemask=None, snapshotformat=None, snapshotmask=None, datalogging=True, schedstats=False, maxoverruns=20, maxconsecutiveoverruns=10, pythonpgmname=None)
Create a SimWB test comprised of the following components: testid the name of the test description a string description of the test group the SimWB group ownership of the model.
 
testDelete(testid)
Delete test 'testid' in the current project.
 
testGetList(maxTests=None)
Get a list of tests and their descriptions/details.
 
testGetModelInputs(testId)
Get the intra-model data exchange connections for the specified test.
 
testGetSession(testId, sessionId)
Get the properties of the testId and sessionId combination.
 
testGetSessions(testId, maxSessions=100)
Get the properties of the test sessions defined under testId up to a maximum of maxSessions
 
testInfoRefreshStart()
Start the scheduler refresh of test info.
 
testInfoRefreshStop()
Stop the scheduler refresh of test info.
 
testRemakeModels(name)
Rebuilds all models associated with test 'name' in the current project.
 
toolkitBuild()
Return the PYToolkit build string.
 
toolkitVersion(format='string')
Return the PYToolkit version number.
 
updateAdd(name, typ)
Add an item to the binary refresh stream.
 
updateRemove(name)
Remove an item(s) from the binary refresh stream.
 
updateValueAdd(name)
Add an item(s) to the ASCII refresh stream.
 
updateValueRemove(name)
Remove an item(s) from the ASCII refresh stream.
 
uploadArchive(name, toName=None)
Upload an archive 'name' (which was previously downloaded) to the server and name it 'toName' on the server (default for 'toName' is 'name').
 
userAdd(user, password, priv=2, group='default')
Add a SimWB user account.
 
userList()
List all SimWB users.
 
userProgramMake(name, script=False)
Build a script or user model named 'name' (in the current project).
 
vigradeInstallStatus()
Returns a tuple (integer,boolean), where the integer is the return code from the configuration server and the boolean indicates whether or not VI-grade is installed on the server.
 
vigradeVarList()
Returns a tuple (integer,dictionary), where the integer is the return code from the configuration server and the dictionary describes VI-grade variables for this project.
 
writeXMLTarget(conf, fileName)
Write the SimWB ASAM target configuration dictionary 'conf' (containing the configuration information defined in getTarget()) as XML into the file 'fileName'.
Variables
  PYTHON2 is True when running Python 2.x
  PYTHON3 is True when running Python 3.x
  PYTHON_VERSION is an integer 3-tuple of the running Python version
  __package__ = None
  causalityToString = {0: 'Parameter', 1: 'Input', 2: 'Output', ...
  cvtTypeToString = {1: 'char', 2: 'uchar', 3: 'int', 4: 'uint',...
  isConnected = False
  isLoggedin = False
  loginGUITimeoutSec = 5
  stringToBoardId = {'12AO16': 2, '16AO16': 2, '16AO16:Wave': 31...
  stringToCVTType = {'char': 1, 'double': 8, 'float': 5, 'int': ...
  stringToPointType = {'AI': 17, 'AIO': 49, 'AO': 33, 'DI': 18, ...
  stringToRawType = {'bit': 13, 'char': 1, 'double': 8, 'float':...
  varTypeToCVTType = {0: 8, 1: 3, 2: 2, 3: 10, 4: 3}
  varTypeToString = {0: 'Real', 1: 'Integer', 2: 'Boolean', 3: '...
  variabilityToString = {0: 'Constant', 1: 'Fixed', 2: 'Tunable'...
Function Details

Log_Fatal(txt='terminated', callback=None)

 

Output a cfgsrv.log-compliant error message to stderr and exit (with return code 1). When specified, the 'callback' routine is executed at the beginning of the routine.

adamsDelete(name)

 

Delete the named Adams model. This is the model name as defined within the model,
NOT the file name of the model. This call always succeeds.

Returns an integer code with the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

adamsInstall(adamsPath, rtdb, newRTDB=False, group=None, cpus='2', interface=None, rebuild=False, params=False, opts='', win64=False)

 

Install an MSC Software Adams model in SimWB.

These models are a variant of FMU models.

The Adams model file specified in 'adamsPath' will be sent to SimWB for processing
into an executable model that can be incorporated into a SimWB test. The only
mandatory arguments are the path to the Adams file 'adamsPath' and the name of the
RTDB 'rtdb' that will be interfaced to the model.

Additional optional arguments modify the build and installation of the model:
    newRTDB     set to True if you want a brand new RTDB, False is this is
                an existing RTDB (this will be verified).
    group       the SimWB group ownership of the model. When unspecified the
                first login group will be used (must be one of your login groups).
    cpus        a list of CPUs the model will be allowed to run on. Multiple CPUs
                are delineated with ';' (e.g. '2;3;4').
    interface   the model interface dictionary returned from an adamsParse() call,
                and modified by the user (see adamsParse() for details on dictionary
                structure and allowed modifications).
    rebuild     set to True if you want to rebuild the model before installation,
                False otherwise.
    params      set to True if you want model parameters treated as inputs
                to the model. This results in RTDB locations defined for all model
                parameters (both Adams and FMU).
    opts        these are run-time model options for the SimWB scheduler. Best
                to ignore this unless you know what you're doing.
    win64       use a Windows dll model if available in the FMU.

The call returns an integer return code.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

adamsParse(adamsPath)

 

Return the model information contained within an MSC Software Adams model file.

These models are a variant of FMU models.

Sends the Adams model file located at 'adamsPath' to the SimWB server, which then
parses it to ensure validity and to extract interface information. The interface
information is in the form of a dictionary:

    { modelVarName1: { 'causality':int
                       'varType':int
                       'initval': string
                       'variability':int
                       'description':string
                       'rtdbname':string
                       'logging':bool
                       'adamsparam':bool
                     },
      modelVarName2: { 'causality':int
                       'varType':int
                       'initval': string
                       'variability':int
                       'description':string
                       'rtdbname':string
                       'logging':bool
                       'adamsparam':bool
                     },

                  ...etc...

      '__info__':    { 'description':string,
                       'modelName':string
                       'linux32':bool,
                       'linux64':bool,
                       'rthost32':bool,
                       'gentool':string,
                       'source':bool,
                       'version':int
                     }
    }

    The causality, varType and variability values may be interpreted by using
    the causalityToString, varTypeToString and variabilityToString dictionaries.
    A bool is an integer 0 (false) or 1 (true).

    The special '__info__' variable provides model-level information. Note that
    the model name as seen by SimWB corresponds to 'modelName'.

    The adamsparam boolean is used to distinguish between regular FMU parameters
    and Adams-specific parameters.

Parsing an Adams model before installing it (see adamsInstall()) is optional. By
default the adamsInstall() does it's own internal adamsParse() and uses that
information to update the specified RTDB. You can override some of this process
by manipulating the dictionary returned by adamsParse() and passing it into the
adamsInstall(). There are a few ways to modify this data:

    o  Remove a model variable. This either skips the update of that variable
       in an existing RTDB, or excludes the variable altogether in a new RTDB.
    o  Change the 'initval' for a variable. The new value will override the value
       from the model. **NOTE: this is a string!
    o  Change the default logging behavior for a variable (1=logged, 0=not logged).
       By default inputs and outputs are logged, anything else is not.
    o  ALL OTHER CHANGES WILL BE IGNORED.

The call returns a tuple (ret,dict) where 'ret' is the SimWB return code of the
parsing operation, and 'dict' is the interface information dictionary.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

addAsamGenerator(pointName, asamFile)

 

Attach an ASAM wave form generator to an RTDB point. 

Returns the signal generator number when > 0. The number must be used with the startGenerator
call to start the generator.
            
Arguments:
    pointName  The name of the RTDB item to assign value to.
    asamFile   The file name of the ASAM waveform.

NOTE:
    Generators will not effect variables with the OPR flag set.

The return code has the following meaning:
    > 0: the generator number on success.
    < 0: error (see simwbClient.strerror(code)).

addGenerator(pointName, endConditionType, sigtype, freq, ampl, phase, offset, duty, noise, duration)

 

Attach a wave form generator to a RTDB point value for a specified duration. 

Returns the signal generator number when > 0. The number must be used with the startGenerator
call to start the generator.

Arguments:
    pointName         The name of the RTDB item to assign value to.
    endConditionType  One of GEN_SIGGENEND_CALLBACK (terminates when the user supplied callback
                        returns True) or GEN_SIGGENEND_DURATION (terminate after the duration
                        specified elapses).
    sigtype           One of the predefined SigType i.e. SIG_TYPE_SINE, SIG_TYPE_SQUARE,
                        SIG_TYPE_TRIANGLE, SIG_TYPE_SAWTOOTH, SIG_TYPE_NOISE, but NOT
                        SIG_TYPE_RAMP which is reserved for ramp and cannot be used with this call.
    freq              The frequency in Hz for the signal generator.
    ampl              The amplitude in Engineering for the generator.
    phase             The phase in degree for the generator.
    offset            The offset in engineering units for the generator.
    duty              The duty cycle in % (0 to 100 %) for the generator.
    noise             Additional white noise component to add to the signal generator.
    duration          The duration in seconds to run the generator.

NOTE:
    Generators will not effect variables with the OPR flag set.

The return code has the following meaning:
    > 0: The generator number on success.
    < 0: error (see simwbClient.strerror(code)).

addGroup(group)

 

Add a group to the SimWB user group list.

'group' may be a single string group name, or a list of names.
Adding an existant group is allowed.

Returns an integer status:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

appendGenerator(first, second)

 

Append a signal generator to a previous one. When the first signal generator stops running
because it has run its course, the second one starts running.

Arguments:
    first   The number of the first signal generator.
    second  The number of the signal generator that is concatenated to the first one.

NOTE:
    Generators will not effect variables with the OPR flag set.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

archiveTest(testid, name=None, source=True, sessiondata=True, description=None, group=None, project='default')

 

Create an archive of test 'testid'.

The following optional arguments may be specified:
    name         the name of the archive, or use testid when unspecified
    source       when True, include all the test source files
    sessiondata  when True, include all recorded session data
    description  a string description added to the archive
    group        when the user is a member of multiple groups, the group
                   to be used can be specified here. When unspecified the
                   user's primary (first) group is used
    project      the project in which the test resides

NOTE: This can take a while - the routine will not return
      until the archive creation completes.

Returns a tuple (code,files), where code is:
  = 0 on success
  < 0 on error (see simwbClient.strerror(code))
and files is a list of directories and file names in the archive (empty on error).

clientHMICommand(clientIp, command)

 

 Send a command to a remote HMI run-time client.
     clientIP    The IP address where the target HMI is running.
                   This should be specified as "127.0.0.1" for instance,
                   and NOT a host name.
     command     The command to send. The command is a list of remote
                   HMI commands separated by '///'.

 The commands supported are:
     displayopen=displayname
     displayclose=displayname
     error=Error message text
     warning=Warning message text
     message=Plain message text

Example:
     displayopen=autotrans///displayclose=auto1///message=This is the message and you can embed \n to display a multi line\n message.

 Return: The return code from the configuration server.
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

clientIP()

 

Request the client IP address as known to the SimWB server.
Returns a tuple (iReply,IP) where the IP is a string in dot notation
(e.g. '192.168.1.12').

iReply has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

connect(hostName='localhost')

 

Connect to the configuration server running on the host system given by 'hostName'.
hostName is a string with the name of the real-time host.

When already connected this funtion simply returns 0.

The return code has the following meaning:
    0: success.
    not 0: error (see simwbClient.strerror(code)).

connectRefresh()

 

Connect to the config server refresh port .
This call is used in the background when you invoke the call to create the refresh thread.
The user should not use this call directly.

Return: 
    On success: The file object representing the socket that receives the refresh data, or
    None if a connection error occured.

createDirectory(dirName)

 

Create the specified directory.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

createRefreshThread(callbacks)

 

Create the refresh thread to receive asynchronous update messages from cfgsrv.

The thread will process the following messages:
    scheduler updates
    test info updates
    RTDB item value updates
    Log message updates
    Binary chart data updates

The 'callbacks' argument is a dictonary that specifies the respective call back
routines to call on each type of update notification:
    callback['testinfo_update'] = tInfoCB
    callback['sched_update'] = schedInfoCB
    callback['value_update'] = valueUpdateCB
    callback['chart_update'] = chartCB
    callback['logmsg_update'] = logMsgCB
    callback['disconnect'] = discoCB
Where each '*CB' is a python routine in the caller.

Each call back routine (except 'disconnect') is called with a single argument that
specifies the data received from the asynchronous update event. The argument can be
a dictionary (for testinfo_update, value_update and chart_updatea), a list of lines
(for sched_update) or a single ASCII line (for logmsg_update).

The 'disconnect' callback is invoked when the connection is lost. Realistically there
is not much you can do at that point (it most likely means the cfgsrv had restarted)
but gives you the opportunity to cleanly shut down (rather than hang).

testinfo_update: must be started with a call to simwbClient.testInfoRefreshStart()
     {'recording': 1, 'framelength': 10000, 'framerate': 100.0, 'overruns': 0,
      'running': 1, 'schedop': 0, 'schedstate': 0, 'test': 'autotrans/Ses_0146',
      'maxoverruns': 10, 'endsnapshot': 0, 'framecount': 0}

value_update: must be started with a call to simwbClient.updateValueAdd(RTDBItem_name)
     {'autotrans_demo.SWspeed_mph': {'rawvalue': 0.0, 'cvttype': 8,
                                     'value': 0.13281351327896118,
                                     'altvalue': 0.0, 'flags': 0,
                                     'pointtype': 8225}}
     * after 7.5 there will be a 'colmajor' (0 or 1) indicating column or row major storage.

logmsg_update: must be started with simwbClient.logRefreshStart()
     11/07 00:30:27.493 |INFO    |scheduler| Starting run, frame rate:100.00 Hz, frame length:10000 Usec, run until stopped

chart_update: must be started with a call to simwbClient.updateAdd(RTDBIem_name,type),
  where type is one of:
    'cvt' to receive CVT values only
    'both' to receive CVT and alternate values.
    'active' to receive either CVT of alternate value depending on the of the alternate for the particular sample

    {'elements': 1, 'name': 'autotrans_demo.SWeng_rpm', 'cvttype': 8, 'valuetype': '3', 
       'value': (2343.6695453597495, 2348.9173797305029, 2354.2075824505168, 2359.5253433570178, 2364.8582043541396), 
       'altvalue': (0.0, 0.0, 0.0, 0.0, 0.0), 
       'dimensions': '1', 'Length': 80, 'nvalues': 5, 'framecount': 81, 'nbuffers': 2}
    * after 7.5 there will be a 'colmajor' (0 or 1) indicating column or row major storage.

sched_update: must be started with a call to simwbClient.schedRefreshStart()
    The scheduler refresh data is made available here out of completeness. But since this data tends to
    be SimWB version dependent, we request that information relevent to deciphering should be made via
    email to support@concurrent-rt.com. Feel free to examine it yourself, but be aware that what you
    reverse-engineer now may break in a future release.

Returns 0 on success, 1 if the refresh thread does not start within 5 seconds.

createSampleScript(name, lang='C', group='default')

 

Create a sample test script with the name specified.
The test script will be created under the currently selected project, and
be in the language specified. Select from:
    'C'       the C language.
    'python'  python.
    'SWs'     the SimWB scripting language.
    'SWm'     the SimWB macro language.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

createSampleUserModel(name, group='default', options='')

 

Create a sample user model script with the name specified.
The user model  will be created under the currently selected project.
options is optional and is a list of additional parameters to specify when creating/running the model.
    example:
        options='rtdb=RTDBNAME,envfile=ENVFILE_NAME'
        rtdb = means that the sample programs will be created with direct RTDB CVT access via struct dereference like:
            float aa = CVTTable.aa
         envfile= to specify a specific environment variables file to load when starting the user program.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

dbDelete(dbName)

 

Delete the specified RTDB. 

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

dbInfo()

 

 Get the RTDB meta information.

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary with the following entries:
         'maxNumRTDBItems'     Max number of RTDB items allowed.
         'RTDBLoaded'          1 if an RTDB loaded, 0 if not.
         'dbFileName'          Name of the loaded RTDB.
         'dbDescription'       Description from the loaded RTDB.
         'numRTDBItemsDefined' Number of items in the loaded RTDB.

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

dbItemDelete(name)

 

Delete an RTDB item.  The 'name' is a single RTDB item name (string).

By default the item is only deleted in the currently loaded RTDB. After the final delete,
the RTDB should be saved via the dbSave() routine.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

dbItemPut(att, save=False)

 

Update RTDB items.  This is passed as a dictionary of names v. attribs, where attribs is
a dictionary of attributes to be updated.  These are assumed to already be encoded strings,
since not all attributes must be specified except one: pointtype.

By default the item is only updated in the currently loaded RTDB. After the final update
the RTDB should be saved via the dbSave() routine. By setting 'save' to True the RTDB will
be saved at the time of the update.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

dbLoad(dbName)

 

Load the RTDB. 

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

dbNew()

 

Initialize your RTDB in the configuration server. This will unload the currently
loaded RTDB. In essense the same as unloading your RTDB from the GUI.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

dbSave(dbName, desc='', group='default')

 

Save the RTDB ccurently loaded by the configuration server (cfgsrv) under the name dbName,
with group 'group', and with the description in desc.  If undefined the group will be 'default'
and the description will be empty.

NOTE: To create a new, empty RTDB just do a dbSave() without having done a dbLoad() (or
      after a dbNew()).

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

deleteGroup(group)

 

Delete a group from the SimWB user group list.

'group' may be a single string group name, or a list of names.
Deleting a nonexistant group is allowed.
Attempting to delete the 'default' group is ignored.

Returns an integer status:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

disconnect()

 

Disconnect from the configuration server running on the real-time host.

This routine always succeeds, and has no return value.

downloadArchive(name)

 

Download the archive file specified by 'name'.

This actually constitues three files:
    name.tar.gz         a gzip'd tar-ball of all the files
    .name.group         the group name that the test belongs to
    .name.description   the description added when the archive
                          was created

NOTE: This can take a while - the routine will not return
      until the files are transferred.

On success a 0 is returned. Anything else is an error
code (see simwbClient.strerror(code)).

dupeResource(resType, dupeType, currname, destproject, destname)

 

Duplicate the SimWB resource specified by 'resType' from the 'currname' in
the current project to the 'destname' in the 'destproject'. The 'dupeType'
determines whether the resource is copied (when 'dupeType' is 'copy') or if
a link back to the current resource is created (when 'dupeType' is 'link').
The 'resType' must be one of the following strings:
  RTDB
  Script
  ENV
  RTW
  FMU
  ADAMS
  SIMPACK
  UserModel
  SigGen

NOTE: These changes may require model rebuilds.

Return: The reply code from the configuration server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

envFileDelete(file)

 

Delete the environment file.

Return: The reply code from the configuration server.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

envFileGetList()

 

Get a list of all the environment files defined in the real-time host.

Return: A tuple (integer,list) with the return code from the configuration server and
        a list containing the names of the environment files.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

extractArchive(name, toProject=None, toGroup=None)

 

Extract a previously archived test (archived as 'name') to the project
specified by 'toProject', and make it belong to group 'toGroup'. When
unspecified 'toProject' is 'default' and 'toGroup' is the users primary
group (the user must be a member of any specified group).

Return is a tuple (code,statusList) where 'code' is the return status of
the command, and 'statusList' is a list of messages generated during the
extraction (this includes a list of file names along with various other
messages).

NOTE: This will create a test with the same name as the test when it was
      archived - you will overwrite a test if one with that name already
      exists in the project.

The return code has the following values:
    = 0 on success.
    < 0 on error (see simwbClient.strerror(code)).

fmuDelete(name)

 

Delete the named FMU model. This is the model name as defined within the FMU,
NOT the file name of the FMU. This call always succeeds.

Returns an integer code with the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

fmuInstall(fmuPath, rtdb, newRTDB=False, group=None, cpus='2', interface=None, rebuild=False, params=False, opts='', win64=False, drivesim=False)

 

Install an FMU model in SimWB.

The FMU model file specified in 'fmuPath' will be sent to SimWB for processing
into an executable model that can be incorporated into a SimWB test. The only
mandatory arguments are the path to the FMU file 'fmuPath' and the name of the
RTDB 'rtdb' that will be interfaced to the model.

Additional optional arguments modify the build and installation of the model:
    newRTDB     set to True if you want a brand new RTDB, False is this is
                an existing RTDB (this will be verified).
    group       the SimWB group ownership of the model. When unspecified the
                first login group will be used (must be one of your login groups).
    cpus        a list of CPUs the model will be allowed to run on. Multiple CPUs
                are delineated with ';' (e.g. '2;3;4').
    interface   the model interface dictionary returned from an fmuParse() call,
                and modified by the user (see fmuParse() for details on dictionary
                structure and allowed modifications).
    rebuild     set to True if you want to rebuild the FMU before installation,
                False otherwise.
    params      set to True if you want FMU model parameters treated as inputs
                to the model. This results in RTDB locations defined for all model
                parameters.
    opts        these are run-time model options for the SimWB scheduler. Best
                to ignore this unless you know what you're doing.
    win64       use a Windows dll model if available in the FMU.
    drivesim    build an executable that is integrated with VI-DriveSim.

The call returns an integer return code.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

fmuParse(fmuPath)

 

Return the model information contained within an FMU model file.

Sends the FMU model file located at 'fmuPath' to the SimWB server, which then
parses it to ensure validity and to extract interface information. The interface
information is in the form of a dictionary:

    { modelVarName1: { 'causality':int
                       'varType':int
                       'initval': string
                       'variability':int
                       'description':string
                       'rtdbname':string
                       'logging':bool
                     },
      modelVarName2: { 'causality':int
                       'varType':int
                       'initval': string
                       'variability':int
                       'description':string
                       'rtdbname':string
                       'logging':bool
                     },

                  ...etc...

      '__info__':    { 'description':string,
                       'modelName':string
                       'linux32':bool,
                       'linux64':bool,
                       'rthost32':bool,
                       'gentool':string,
                       'source':bool,
                       'version':int
                       'ompcores':int
                     }
    }

    The causality, varType and variability values may be interpreted by using
    the causalityToString, varTypeToString and variabilityToString dictionaries.
    A bool is an integer 0 (false) or 1 (true).

    The special '__info__' variable provides FMU-level information. Note that
    the FMU name as seen by SimWB corresponds to 'modelName'.

Parsing an FMU before installing it (see fmuInstall()) is optional. By default
the fmuInstall() does it's own internal fmuParse() and uses that information to
update the specified RTDB. You can override some of this process by manipulating
the dictionary returned by fmuParse() and passing it into the fmuInstall(). There
are a few ways to modify this data:

    o  Remove a model variable. This either skips the update of that variable
       in an existing RTDB, or excludes the variable altogether in a new RTDB.
    o  Change the 'initval' for a variable. The new value will override the value
       from the FMU. **NOTE: this is a string!
    o  Change the default logging behavior for a variable (1=logged, 0=not logged).
       By default inputs and outputs are logged, anything else is not.
    o  ALL OTHER CHANGES WILL BE IGNORED.

The call returns a tuple (ret,dict) where 'ret' is the SimWB return code of the
parsing operation, and 'dict' is the interface information dictionary.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formCapture(testid, name, period=1.0, runcount=1, nametemplate='$formname_$seqnum')

 

Capture (record) the data specified in form 'name' in test 'testid'. The data
will be captured 'runcount' times, every 'period' seconds (float) and whose name
is generated using the 'nametemplate'. The template may contain these tokens:
    $formname
    $testname
    $sessionname
    $framecount
    $date
    $time
    $seqnum

Returns a success/failure code from the server.

NOTE: A test MUST be running or an error is returned.

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formCaptureList(testid)

 

Retrieve a list of captures taken for test 'testid'.

Returns a tuple of (retcode, dict), where 'retcode' is the server return
code, and dict is a dictionary of dictionaries. The primary dictionary
keys are capture file names of the form session-name/file-name. The
secondary dictionary contains:
    Key         Value
    size     Integer file size in bytes
    modtime  String representing time of the capture (e.g. '2014/08/12 15:38:32')
For example:
    {'main/Form1.csv': {'modtime': '2016/01/22 12:28:46', 'size': 185},
     'debug/Testing.csv': {'modtime': '2016/01/22 12:34:19', 'size': 392}}

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formGet(testid, name)

 

Retrieve the form from test 'testid' named 'name'.

Returns a tuple of (retcode, dict), where 'retcode' is the server return
code, and dict is a dictionary of dictionaries. The primary dictionary
keys are parameter names (in the form of namespace/item-name). The namespace
will be one of:
    rtdbitems
    <model-name_N>/Signals
    <model-name_N>/Parameters

The secondary dictionary contains:
    Key         Value
    cvttype     String representation of CVT data type (e.g. 'double', 'int')
    pointtype   String representation of the point type (e.g. 'AO', 'DI') for
                  RTDB items, 'PARM' for model parameters, 'MDLSIGNAL' for
                  model signals, or 'SHRDPARM' for model shared parameters)
    dimensions  String representation of dimention (e.g. '2x5', '4')
    value       Scalar or list (depending on 'dimensions') of float values
    colmajor    0=row major, 1=column major (7.5 or later only).

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formGetCapture(testid, name, dest=None)

 

Retrieve the capture data from test 'testid' named 'name' and store into
file 'dest'. The 'name' should be one of those returned by the formCaptureList().
When dest is unspecified then the file is stored in the current directory.

NOTE: For example, if 'dest' is unspecified, and the 'name' is 'nolog/getstuff.0000.csv'
      the directory 'nolog' is created (if needed) and the file 'getstuff.0000.csv'
      is written to that directory.

The return code is the same as for getFile() (which is used to retrieve the file):
    > 0: size of file (in bytes) on success.
    < 0: error (see simwbClient.strerror(code)).

formImport(testid, name, inputsOnly=True)

 

Import (inject or write) the values specified in form 'name' in test 'testid'.
When 'inputsOnly' is True then only import items whos pointtype is an input
(e.g. AI, DI, etc). Returns a success/failure code from the server.

NOTE: A test MUST be running or an error is returned.

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formList(testid)

 

Retrieve a list of forms defined for test 'testid'.

Returns a tuple of (retcode, dict), where 'retcode' is the server return
code, and dict is a dictionary of dictionaries. The primary dictionary
keys are form names. The secondary dictionary contains:
    Key          Value
    description  String of descriptive text

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formRemove(testid, name)

 

Removes the form 'name' in test 'testid'.

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

formSet(testid, name, items, description=None)

 

Store form 'name' into the test 'testid'.

The 'items' dictionary looks exactly like that returned by formGet().
Only the 'name', 'cvttype' and 'pointtype' definitions are required. The
'dimensions' and 'value' are optional.

If 'description' is undefined then the current time in the form
'Wed Aug 13 06:56:11 2014' is used.

Returns the server return code.

retcode:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getAppLog(name, localFile)

 

Get the application log file specified by 'name' and store it in 'localFile'.

The return code has the following meaning:
    > 0: size of file (in bytes) on success.
    < 0: error (see simwbClient.strerror(code)).

getAppLogLines(name)

 

Get the application log file specified by 'name'.

Return: A tuple (integer,lines) with the return code from the configuration server and
        a list of 'lines' from the file.  The list is empty on error.

WARNING: Do NOT get very large log files!

The return code has the following meaning:
    >= 0: number of lines on success.
    < 0: error (see simwbClient.strerror(code)).

getAppLogList()

 

Get a list of all the application log files on the system.

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the name of the log file and its value is a
        dictionary with the following entries:
            'created'   The creation date of the program in seconds since the epoch.
            'modified'  The last modification date of the program in seconds since the epoch.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getCcursimConf(local=False)

 

Get the de-commented contents of /etc/ccursim.conf from either the 'local'
file system, or the connected-to host.

Return: A tuple (integer,dictionary) with the return code from the configuration
        server and a dictionary of strings that correspoint to the current SimWB
        configuration.  These are currently:
            projectsdir             scriptdir           mdldir
            asamdir                 rtwdir              rtwsourcedir
            usersourcedir           userexecdir         rtdbdir
            envdir                  waveformdir         testdir
            circularlogger_dir      circularlogger_maxfile
            circularlogger_filelength                   dlnetworkbuffers
            dlcpus                  installdir          guiicondir
            guifiledir              userguilibdir       dataloggerhost
            groupname               editorcommand       useriodir
            userhooksdir            guihooksdir         dlunbufferedio
            projarchivedir          pythondir
        As features are added to SimWB this list will likely grow.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getEnvVariables(file)

 

Get all the environment variables defined in the given file.

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary containing the environment variables in the format dict[var]=value

Arguments:
    file  The name of the file from which to load the variables.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getFile(remoteFile, localFile)

 

Get the file specified by 'remoteFile' of the projects directory (i.e. it is relative
to the projects directory) and store it in 'localFile'. Non-existing directories in
the 'localFile' path will be created.

The return code has the following meaning:
    >= 0: size of file (in bytes) on success.
    < 0: error (see simwbClient.strerror(code)).

getFileLines(remoteFile)

 

Get the file specified by 'remoteFile'.

Return: A tuple (integer,lines) with the return code from the configuration server and
        a list of 'lines' from the file.  The list is empty on error.

WARNING: Do NOT get very large files!  Getting binary files is unpredictable and should
         be avoided.

The return code has the following meaning:
    >= 0: number of lines on success.
    < 0: error (see simwbClient.strerror(code)).

getFrameRate()

 

Get the frame rate in Hz of the running test.

Return: A tuple (integer,float) with the return code from the configuration server and
        the frame rate in Hz.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getGeneratorInfo(genNum)

 

Get Info about the generator whose number is genNum (this may be a list).

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the name of the parameter and the corresponding value is:
            'varname'       The RTDB item name attached to the signal generator.
            'duration'      The duration in seconds the generator will run for.
            'framecount'    The current count of execution of the generator
            'endframecount' How many time the generator will run.
            'flags'         An hex mask specifying the status of the generator: flags & 1 when generator is running
            'type'          The generator type I.e simwbConstants.SIG_TYPE_SINE,etc.
When passed a list of generators then a list of tuples is returned.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getGroupList()

 

List all SimWB user groups.

Return: A tuple (iReply,groups), where 'groups' is a list of
        defined group names.

iReply is the return status:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getIOMappingRecords()

 

Get the I/O mapping records defined in the currently loaded RTDB.
The RTDB must have been loaded with a dbLoad command.

NOTE: This routine is intended for expert users only, and may be removed
      in a future PYToolkit release.

Return: A tuple (integer,dictionary) with the return code from the configuration
        server and a dictionary of keys and their associated values. This dictionary
        may contain, but is not limited to, the following:
        'boardid'     The board type this record described
        'boardnum'    The I/O board instance number (Board number start at 1).
        'type'        IN, OUT, etc.
        'channelnum'  The channel number on the specific board.
        'bitnum'      The bit number this item is mapped.
        'startbit'    The starting bit when the item is mapped to a number of bits. 
        'startbyte'   The starting byte within the message where the mapping starts.
        'numbits'     The number of bits in the mapping range that this item maps to.
        'ioflags'     Additional hexadecimal I/O flags used to define the mapping
                          (Only used by some devices such as CAN, AFDX and FLEXRAY).
        'labelnum'    Label number for ARINC 429 mapping.
        'canid'       CAN Id for CAN type mapping.
        'message'     The name of the message this item maps to. Used by AFDX and FLEXRAY.
        'controltype' Define the type of control for joystick mapping. (AXIS/BUTTON).
        'controlnum'  Define the control number for joystick mapping.
        'varname'     The name of the buffer variable where this RTDB item is mapped to.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getIOMappingRecordsDisk(RTDBname)

 

Get the I/O mapping records defined for an RTDB.  This can be a single name or a composite
of several names separated by '/' (for compatibility with composite run-time RTDBs).

NOTE: This routine is intended for expert users only, and may be removed
      in a future PYToolkit release.

Return: A tuple (integer,dictionary) with the return code from the configuration
        server and a dictionary of keys and their associated values. This dictionary
        may contain, but is not limited to, the following:
        'boardid'     The board type this record described
        'boardnum'    The I/O board instance number (Board number start at 1).
        'type'        IN, OUT, etc.
        'channelnum'  The channel number on the specific board.
        'bitnum'      The bit number this item is mapped.
        'startbit'    The starting bit when the item is mapped to a number of bits. 
        'startbyte'   The starting byte within the message where the mapping starts.
        'numbits'     The number of bits in the mapping range that this item maps to.
        'ioflags'     Additional hexadecimal I/O flags used to define the mapping
                          (Only used by some devices such as CAN, AFDX and FLEXRAY).
        'labelnum'    Label number for ARINC 429 mapping.
        'canid'       CAN Id for CAN type mapping.
        'message'     The name of the message this item maps to. Used by AFDX and FLEXRAY.
        'controltype' Define the type of control for joystick mapping. (AXIS/BUTTON).
        'controlnum'  Define the control number for joystick mapping.
        'varname'     The name of the buffer variable where this RTDB item is mapped to.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getInitConditions(testid, name='.default')

 

Get the initial conditions set 'name' for test 'testid'.

Return: A tuple (integer,nsNames,nsItems) with the return code from the configuration server,
        a list of namespaces, and a corresponding item list.  Each entry in the nsItems is a
        dictionary, where the keys are item names, and whose values are dictionaries of values
        and item meta information. The value and meta information are:
        'name'         The item name.
        'namespace'    The namespace this item belongs to.
        'pointtype'    The item point type as a string (e.g. 'AI', 'DO').
        'cvttype'      The item CVT type as a string (e.g. 'double', 'int').
        'numelements'  Number of elements in the item 1 for scalar).
        'dimensions'   Dimension of the item (eg. '1x1', '2x3x4', etc.).
        'value'        A value.  Scalars are returned as a single float and everything else
                        as a list.
        'rate'         The rate in EU/sec at which to ramp to the shut down value (when
                         specified).
        'colmajor'     0=row major, 1=column major (7.5 or later only).

        This is best seen through an example (from the sharedparams_demo test found in
        the Simulink project).

        The returned 'nsNames' is:
            ['Initial Values/ccur_shared_params_model1_1',
             'Initial Values/ccur_shared_params_model2_1',
             'Initial Values/ccur_shared_params_model3_1',
             'Initial Values',
             'Initial Values/rtdb_itemsIC',
             'Shutdown Values']

        The returned 'nsItems' is:
            Items in namespace[0] (Initial Values/ccur_shared_params_model1_1):
              Sine_Wave_1/Phase    {'cvtype': 'double', 'value': 0.0, ...
              Sine_Abs_Output/Out1/InitialOutput {'cvtype': 'double', 'value': 0.0, ...
              Sine_Wave_1/Bias     {'cvtype': 'double', 'value': 0.0, ...
              Sine_Wave_1/Frequency {'cvtype': 'double', 'value': 1.0, ...
              Sine_Wave_1/Amplitude {'cvtype': 'double', 'value': 2.0, ...

            Items in namespace[1] (Initial Values/ccur_shared_params_model2_1):
              Sine_Wave_2/Amplitude {'cvtype': 'double', 'value': 4.0, ...
              Sine_Wave_2/Phase    {'cvtype': 'double', 'value': 0.0, ...
              Sine_Wave_2/Frequency {'cvtype': 'double', 'value': 1.0, ...
              Sawtooth_Wave_1/Constant/Value {'cvtype': 'double', 'value': 2.0, ...
              Sine_Abs_Output/Out1/InitialOutput {'cvtype': 'double', 'value': 0.0, ...
              Sawtooth_Wave_1/rep_seq_y {'cvtype': 'double', 'value': [0.0, 2.0], ...
              Saw_Abs_Output/Out1/InitialOutput {'cvtype': 'double', 'value': 0.0, ...
              Sine_Wave_2/Bias     {'cvtype': 'double', 'value': 0.0, ...
              Sawtooth_Wave_1/Look-Up Table1/BreakpointsForDimension1 {'cvtype': 'double', 'value': [0.0, 2.0], ...

            Items in namespace[2] (Initial Values/ccur_shared_params_model3_1):
              Sawtooth_Wave_2/Look-Up Table1/BreakpointsForDimension1 {'cvtype': 'double', 'value': [0.0, 2.0], ...
              Saw_Abs_Output/Out1/InitialOutput {'cvtype': 'double', 'value': 0.0, ...
              Sawtooth_Wave_2/Constant/Value {'cvtype': 'double', 'value': 2.0, ...
              Sawtooth_Wave_2/rep_seq_y {'cvtype': 'double', 'value': [0.0, 4.0], ...

            Items in namespace[3] (Initial Values):
              sharedParams/sine_enable {'cvtype': 'uchar', 'value': 200.0, ...
              sharedParams/saw_enable {'cvtype': 'uchar', 'value': 100.0, ...

            Items in namespace[4] (Initial Values/rtdb_itemsIC):
              mdl2_saw_Out         {'cvtype': 'double', 'value': 0.0, ...
              mdl3_saw_Out         {'cvtype': 'double', 'value': 0.0, ...
              mdl1_sine_Out        {'cvtype': 'double', 'value': 0.0, ...
              mdl2_sine_Out        {'cvtype': 'double', 'value': 0.0, ...

            Items in namespace[5] (Shutdown Values):
              mdl2_saw_Out         {'cvtype': 'double', 'value': 0.0, ...
              mdl3_saw_Out         {'cvtype': 'double', 'value': 0.0, ...
              mdl1_sine_Out        {'cvtype': 'double', 'value': 0.0, ...
              mdl2_sine_Out        {'cvtype': 'double', 'value': 0.0, ...

        Namespace and item contents can vary from release to release, with the
        most likely change being the addition of new information. Every attempt
        is made to keep existing scripts backwards compatible.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

* NOTE  an error return reflects a server or internal API error. If a
        non-existant initial conditions 'name' is requested the nsNames
        will be [''] and nsItems will be [{}].

getItemValues(names)

 

 Get CVT values, alternate values and real-time flags for a list of RTDB items
 specified in 'names'. This can be a single name (as a string) or a list of
 names (as a list of strings).

 Return: A tuple (integer,dictionary) with the return code from the configuration
 server and a dictionary where the primary key is the name of the item and its
 value is a dictionary containing:
     'cvttype'   an integer with the item CVT type (NOT a string!)
     'value'     either a scalar float or a list of floats that is the value of the item
     'altvalue'  either a scalar float or a list of floats that is the alternate value of the item
     'rtflags'   integer with the real-time flags for the item
     'colmajor'  0=row major, 1=column major (7.5 or later only)

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
           The dictionary will contain the key 'ERROR' containing the error text.
 

getItems()

 

 Get the items defined in the currently loaded RTDB.
 The RTDB has been loaded with a dbLoad command.

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary where the primary key is the name of the item and its value is a dictionary 
         with the following entries:
         'A'             Engineering unit conversion constant where the raw item is converted to
                           EU according to the formula:
                           EU = A*Raw + B
         'B'             Engineering unit conversion constant. 
         'pointtype'     The item point type as a string (e.g. 'AI', 'DO').
         'cvttype'       The item CVT type as a string (e.g. 'double', 'int').
         'numelements'   Number of elements in the item 1 for scalar).
         'units'         Text with engineering units.
         'order'         Structured data ordering.
         'description'   Text with the item description.
         'metaflags'     Integer with the item meta flags.
         'eumaxvalue'    Maximum engineering units value allowed for the item.
         'euminvalue'    Minimum engineering units value allowed for the item.
         'eumsgperiod'   Number of seconds after which to repeat an 'out of range
                           engineering units value' message.
         'loggingperiod' How often to record this item (in milliseconds) when this item
                           is being recorded.
         'defaultvalue'  Scalar or list (depending on 'dimensions') of float values
         'mappingrecords' I/O device mapping records (separated with '/').

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

getItemsDisk(RTDBname)

 

 Get the items defined in the named RTDB. This can be a single name or a composite
 of several names separated by '/' (for compatibility with composite run-time RTDBs).

 Returns a tuple (integer,dictionary) with the return code from the configuration
 server and a dictionary where the primary key is the name of the item and its value
 is a dictionary with the following entries:
     'A'             Engineering unit conversion constant where the raw item is
                     converted to EU according to the formula:
                       EU = A*Raw + B
     'B'             Engineering unit conversion constant. 
     'pointtype'     The item point type as a string (e.g. 'AI', 'DO').
     'cvttype'       The item CVT type as a string (e.g. 'double', 'int').
     'numelements'   Number of elements in the item (1 for scalar).
     'units'         Text with engineering units.
     'description'   Text with the item description.
     'order'         Structured data ordering.
     'metaflags'     Integer with the item meta flags.
     'eumaxvalue'    Maximum engineering units value allowed for the item.
     'euminvalue'    Minimum engineering units value allowed for the item.
     'eumsgperiod'   Number of seconds after which to repeat an 'out of range
                       engineering units value' message.
     'loggingperiod' How often to record this item (in milliseconds) when this item
                       is being recorded.
     'defaultvalue'  Scalar or list (depending on 'dimensions') of float values
     'mappingrecords' I/O device mapping records (separated with '/').

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

getItemsRTDB()

 

Get the items currently loaded in the in-memory Real-Time Data Base (RTDB).

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the name of the item and its value is a dictionary 
        with the following entries:
        'A'             Engineering unit conversion constant where the raw item is converted to
                          EU according to the formula:
                          EU = A*Raw + B
        'B'             Engineering unit conversion constant. 
        'pointtype'     The item point type as a string (e.g. 'AI', 'DO').
        'cvttype'       The item CVT type as a string (e.g. 'double', 'int').
        'numelements'   Number of elements in the item (1 for scalar).
        'units'         Text with engineering units.
        'order'         Structured data ordering.
        'description'   Text with the item description.
        'metaflags'     Integer with the item meta flags.
        'eumaxvalue'    Maximum engineering units value allowed for the item.
        'euminvalue'    Minimum engineering units value allowed for the item.
        'eumsgperiod'   Number of seconds after which to repeat an 'out of range
                          engineering units value' message.
        'loggingperiod' How often to record this item (in milliseconds) when this item
                          is being recorded.
        'defaultvalue'  Scalar or list (depending on 'dimensions') of float values
        'dimensions'    When 'numelements' > 1 this is a text representation of the
                          dimensions (e.g. '6', '4x1', '1x8', '3x5', etc). For scalars
                          this key is not present.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getLicenseInfo()

 

Get the SimWB license information for the connect server.

Return: A tuple (integer,dictionary) with the return code from the configuration
        server and a dictionary of licensing information, e.g.:
            { 'licenseID':'simwb-f38f5e33@D_5a3d8',
              'licenser' :'Big Corporation'
              'licensee' :'John Doe'
              'licenses' :{'FIBEXIMPORT':{'count':'unlimited', 'expires':'2025-12-25 00:00:00'},
                           'SIMPACK'    :{'count':'1', 'expires':'2025-12-25 00:00:00'}
                           'PYTOOLKIT'  :{'count':'1', 'expires':'2025-12-25 00:00:00'}
                          }
            }
        On error this dictionary is empty. Otherwise, there should always be the
        'license*' keys, with at least two licenses.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getLoggingSet(testid, name)

 

 Get the data logging settings for the test 'testid' with initial conditions data
 set called 'name' (e.g. ('rtdemo1','.default', which is the same as ('rtdemo1',
 'Default-models-RTDB')).

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary where the primary key is the name of the item and its value is a dictionary 
         with the following entries:
         'metaflags'      The metaflags for this item.
         'pointtype'      The point type of this item.
         'loggingperiod'  How often to record this item (in milliseconds) when this item
                            is being recorded.

* NOTE that only items to be logged via the initial conditions settings are specified here.
       Those settings override the RTDB settings. But beware - just because an item is not here
       does not mean it is not logged. In that case it depends on the RTDB metaflags.

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

getNumberOfCpus()

 

Get the number of CPUs on the SIMulation Workbench server.

Return: A tuple (code,number).  The 'code' value is the command return code from the
configuration server, and 'number' is the number of CPUs.

The code value has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).  Number will be 0 on error.

getParameterValues()

 

 Get CVT values and types for all the items defined as parameters in the currently running RTDB.

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary where the primary key is the name of the parameter item and its value
         is a dictionary with:
             'cvttype'  an integer with the item CVT type (NOT a string!).
             'value'    either a scalar float or a list of floats that is the value of the item.
             'colmajor' 0=row major, 1=column major (7.5 or later only).
         
The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

getRuntimeRTDBName()

 

Get the name of the currently running test's RTDB, in the form of ['dbname=%s'].

The name may be a composite of serveral RTDBs depending on how the test models
were built (and their RTDBs generated). In this case the returned RTDB name will
be those of the composite elements delineated by '/' (e.g. rtdb1/rtdb2/rtdb3).

If no test is running the name of the RTDB from the last run test is returned.
In the case where no previous test was run (i.e. SimWB startup) then ['dbname=']
is returned.

Return: A tuple of (return code, ['dbname=%s']) where the return code is:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getSignalFaults(rtdb)

 

Returns the contents of the signalfaults.db file for the specified RTDB. A
tuple of (code,defines) is returned, where 'code' is the return code from
the server, and 'defines' is a dictionary, whose structure is identical to
the one specified in the setSignalFaults() routine (see that routine for
more information).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getTarget(envvar='SIMWB_TARGET', host='localhost', userpass='admin/nimda', project='<default>', test='', session='', cpu=0, debug=0, logfile='Concurrent.log')

 

Get SimWB target information.

Returns the tuple (integer,dict) of return code and target host
configuration dictionary.  The dictionary contains essential target
connection information for using the ASAM API.  Keys are:
    host
    username
    password
    project
    test
    session
    cpu
    debug
    logfile

The information is culled from the environment variable named in 'envvar'
It should be of the form 'HOST:USERNAME/PASSWORD:PROJECT:TEST:SESSION:CPU:DEBUG:LOGFILE'.
Defaults for each field can be passed into the routine if desired.

NOTE: When used with the ASAM package 'envvar' MUST be "SIMWB_TARGET".
      The 'cpu' and 'debug' fields only have meaning to ASAM capture tasks. 

NOTE: Trailing empty fields can be left off (e.g. 'sys1:joe/doe'), but
      skipped fields must be delineated (e.g. 'sys1::::session2').

NOTE: No field can contain a ':' as part of it's value. Because of this, the 'logfile'
      argument will be URL decoded so that it may contain colons. The user should
      insure all embedded colons are entered as %3A.

NOTE: USERNAME/PASSWORD are always defined as a pair.

NOTE: Special 'logfile' values of 'stdout', 'stderr' or 'null' will be interpreted
      as meaning 'send to stdout', 'send to stderr' or don't log at all, respectively.

Always returns success. The only possible error is too many fields, in
      which case the additional trailing fields are ignored.

getTestState(dictionary=False)

 

Get the state of the real-time system. I.e. whether it is currently
running a test and addition information about the running test.

Return: A tuple (int (return code), string (testId/sessionId),
                 int (frameCount), int(frameLength),
                 int (isRunning), int (schedOp) ,int(schedState),
                 int (isRecording))
        These are:
            The return code from the configuration for this command (see below).
            The testId/sessionId string of the test that is currently running.
            The frame count for the currently running test (legit only when isRunning > 0).
            The frame length (in microseconds) for the test that is currently running.
            isRunning:     == 0 if a test is not running (see simwbConstants.TEST_STAT_XXX
                                                      for specific state values).
            schedOp:       The scheduler operation currently in progress.
            schedState:    The scheduler state.
            isRecording: 0 if not recording, 1 if recording.

When 'dictionary' is True, results are returned as a tuple of
(integer-return-code, state-dictionary), with the state-dictionary having keys:
    'test'
    'framecount'
    'running'
    'framelength'
    'schedstate'
    'schedop'
    'recording'
Be aware that all key values will be strings!
Future releases may add to this list. Be sure to check for a key before referencing
it for backwards compatibility. Current new keys are:
    'overruns'      current number of overruns
    'maxoverruns'   maximum allowed overruns before test shutdown
    'project'       the project under which the currently running test exists

NOTE: If waiting for test stop, then wait until isRunning == 0.
      If waiting for test start, then wait until isRunning > 0 and frameCount > 0.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getUname()

 

Retrieve information about the SimWB host machine. These are:
    sysname       Operating system name (e.g., "Linux")
    nodename      Name within "some implementation-defined network"
                    (This may not be useful)
    release       OS release (e.g., "2.6.23.17-RedHawk-5.1.4-trace")
    version       OS version (e.g., "#1 SMP PREEMPT Mon Mar 29 10:53:25 EDT 2010")
    machine       Hardware identifier (e.g., "i686")

Returns a tuple (return code, dictionary), where the dictionary keys
are as shown above.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getUserBoardList()

 

Get the a list of user-define I/O boards.

Return: A tuple (integer,list) with the return code from the configuration
        server and list of board names as strings.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getUserHardwareRecord(boardID)

 

Get the user I/O mapping records defined for the user device named 'boardID'.

Return: A tuple (integer,dictionary) with the return code from the configuration
        server and a dictionary of keys and their associated values. Since the
        keys are user defined, all keys and values will be returned as strings.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

getVersion(format='string')

 

Get the SIMulation Workbench version number from the configuration server.  The 
'format' argument is either 'string' (default) or 'tuple'.  If anything other than
these are specified, 'string' is returned.

Return: A tuple (return,version).  The 'return' value is the command return code from the
configuration server, and 'version' is the version in the requested format.  So a string
might be '2.4-1', and the quivalent tuple being (2, 4, 1).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).  The version is '?.?' or ('?','?') on error.

hexAtoD(st)

 

This module is provided as a means to convert ASCII C99 '%a' format doubles. As of Python 2.6 this capability is a float method: float.fromhex(string) -> float, and is implemented as such.

Given a string in the C99 '%a' format ([-]0xH.HHHHpPP) it returns the equivalent double precision value.

hexDtoA(f)

 

This module is provided as a means to convert doubles to ASCII C99 '%a' format. As of Python 2.6 this capability is a float method: float.hex(double) -> string, and is implemented as such.

Given a double it returns a string in the C99 '%a' format ([-]0xH.HHHHpPP).

initConditionList(testid)

 

 Get the initial conditions list.

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary where the primary key is the name of the initial condition,
         with the following entries:
         'description' Text with the init condition description.
         'default'     1 if this is the default, 0 otherwise.

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

lastReply()

 

The SimWB server reply consists of status code and associated text. This code (typically negative on error) is always returned as the return status of the API command. The text is almost always the same as that returned by the strerror() function (with the status code as argument).

There are, however, times when this text might be useful. E.g. if the lockAsamPlatform fails because someone else has the lock, the host name of the lock holder will be in the text.

This routine will return that text.

lockAsamPlatform(state)

 

Lock the ASAM platform target. This is only done at the platform
level, so only one ASAM Platform object may be created at a time.
The lock is automatically taken on object creation, and released
when the object is deleted.

The 'state' is interpreted as an integer, with 1 being a lock
request and 0 being a free request. Other values return an error.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

logRefreshStart()

 

Start the log refresh data.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

logRefreshStop()

 

Stop the log refresh data.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

login(userName=None, password=None)

 

Login to the real-time host with the given user name and password.
The program must have connected to the real-time host previously with
the connect() call.

When 'userName' and 'password' are both None, and the python engine was built
with the tkinter module, then a small login GUI will be presented to the user.
If untouched, the GUI will timeout (see simwbClient.loginGUITimeoutSec) and
the login will fail. The 'userName' will be populated by the value returned
from getpass.getuser().

When 'password' is None (or not passed as an argument) the 'userName' is
expected to be of the form 'username/password' and will be split up and
used accordingly. This is for compatibility with the getTarget() function.

If the 'userName' is not in the form of 'username/password' it is assumed to
be only a username, and the GUI login is presented.

Return: A tuple (integer,integer,string) with the return code from the configuration server,
        the privilege level defined for the user, and the group(s) that user belongs to.
        There are four privileges defined for a user. From highest to lowest:
          administrator Can do anything.
                          (simwbConstants.USER_ADMIN)
          power         Like an administrator, but can not change other user privileges
                        (password, group, etc.) and can not create a user.
                          (simwbConstants.USER_POWER)
          operator      Can start/stop a test and modify RTDB values.
                          (simwbConstants.USER_OPERATOR)
          monitor       Can look at a running test, but can not modify RTDB values or
                        start/stop a test, and can not configure resources.
                          (simwbConstants.USER_MONITOR)
        Multiple group names are separated with a slash (e.g. 'group1/group2/group3').
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

logout()

 

Logout from the real-time host where the user is currently running.

This routine always succeeds, and has no return value.

makeASAMsrv(name, cpu=0, debug=0)

 

Build the ASAMsrv process, and run it as 'name'.  The name is the only required
arguments.
    name      The name that the ASAMsrv task will be run under.
    cpu       The cpu on which to run the ASAMsrv process (0 by default).
    debug     An integer debug level passed into the ASAMsrv process.

Return: A tuple (iReply,port), where iReply is the command return status, and port
    is the port to connect on the server to receive status messages. On error the
    port is 0. iReply will be:
        > 0: success.
        < 0: error (see simwbClient.strerror(code)).

mergeRTDB(sourceRTDB, destinationRTDB, sourceProject='<default>', destinationProject='<default>')

 

Merge an RTDB into another RTDB.

Merge the named RTDB from the source project into the named RTDB in
the destination project.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

message(text, source='python', severity='INFO')

 

Send a message to the logger.

These messages always originate with the cfgsrv task, but the text is
pre-pended with the 'source' string that you pass.
The severity is one of:
  INFO      informational message (default)
  WARNING   warning message (might be ignorable)
  ERROR     error (might be critical)
  CRITICAL  the test should be stopped
  USER      generic user message
  DEBUG     used for debug
  VERBOSE   used for verbose
The text and source are URL encoded before sending to the server.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

modelParametersSignals(name)

 

 Get the model parameters and signals.

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary where the primary key is the name of the item and its value is a dictionary 
         with the following entries:
         'name'         The item name.
         'pointtype'    The item point type as a string ('PARM', 'MDLSIGNAL', 'SHRDPARM').
         'cvttype'      The item CVT type as a string (e.g. 'double', 'int').
         'numelements'  Number of elements in the item 1 for scalar).
         'dimensions'   Dimension of the item (eg. '1x1', '2x3x4', etc.).
         'value'        A value.  Scalars are returned as a single float and everything else
                         as a list.
         'colmajor'     0=row major, 1=column major (7.5 or later only).

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

pauseDLogger()

 

Pause the data logger. This is only effective when a test is running. It
will suspend data recording until resume with a call to resumeDLogger

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

programGetList()

 

 Get a list of all the programs defined in the real-time host.

 Return: A tuple (integer,dictionary) with the return code from the configuration server and
         a dictionary where the primary key is  one of the following entries:
         'script'       User scripts
         'userprogram'  User defined programs
         'rtw'          for Simulink/RTW type programs
         'simpack'      for SIMPACK models
         'fmu'          for FMU models
         'adams'        for ADAMS models
         'carmaker'     for CarMaker models
         'python'       for Python programs

         Under each of the previous keys, a prorgam is defined by a dicionary whose main key is
         the program name and with the following possible elements:
             'description'  Text with a description of the program.
             'createdate'   The creation date of the program in seconds since the epoch.
             'fixedstep'    The fixed step size (microseconds) at which the program should run.
             'group'        User group that this program belongs to.
             'modelfile'    model file name (when appropriate).
             'cpus'         model run-time CPU list (e.g. '1;2;3').
         As features are added to SimWB this list will likely grow.

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

projectCopyResource(source, destination, typ, resourceName)

 

This function has been DEPRECATED. Please use projectDupeResource().

projectCreate(projectName, groupName='default')

 

Create a new project on the RT-host.

The 'projectName' is always releative to <default> (the top-level project). For example, if you
want to create project 'foo/bar' you must first create 'foo' and then create 'foo/bar' (assuming
'foo' does not exist). Creating an existing project is not an error and does not effect the
existing project.

Return: The reply code from the configuration server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

projectDelete(projectName)

 

Delete a project root on the RT-host.

Return: The reply code from the configuration server.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

projectDupeResource(operation, typ, sourceProject, sourceName, destProject, destName)

 

Duplicate a SimWB resource by either making a copy of the resource or
creating a link to it. This is controlled by the 'operation' argument:
    'copy'
    'link'

The resource, specified by the 'sourceProject' and 'sourceName' will be
copied/linked to a new 'destProject' and 'destName'. The destination
project will be created if it does not exist. If sourceProject is None
the currently selected project will be used.

The 'typ' of the resource is one of the following:
    'RTDB'
    'Script'
    'RTW'
    'FMU'
    'SIMPACK'
    'UserModel'
    'SigGen'
    'ENV'

Return: The reply code from the configuration server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

projectGetList()

 

Get a list of all the projects root on the real-time host.

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the name of the project and its value is a
        dictionary with the following entry:
            'group'  Text with the group name the project belongs to.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

projectGetSelected()

 

Get the selected project on the real-time host.

Return: A tuple (integer,string) with the return code from the configuration server and
        a string which is the name of the selected project.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

projectSelect(projectName='<default>')

 

Select the project to be the new project root on the RT-host. All
operations on the cfgsrv will be from this newly selected project root.

* NOTE subprojects are elemited with a '/' character. E.g. to select
       the pre-installed Hardware-Tests AO16 project use the name
       'Hardware-Tests/AO16'.

Return: The reply code from the configuration server.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

projectWhich(directory=None)

 

This routine is designed to be run on the SimWB server.

There may be times when a script needs to know the name of the project from which it is being executed.

It will return the project name that contains the specified 'directory', or of the current working directory (as returned by os.getcwd()) when unspecified.

Returns a tuple of (code,projname), where 'code' is 1 on success (and 'projname' contains the project name) or -1 on error (and 'projname' will contain an error message). The default project will return (1,'<default>'). All other projects are reported as, e.g. 'one', 'one/two', 'one/two/three', etc., and are suitable for use in the projectSelect() routine.

putAsamFile(localFile, remoteFile=None, compress=True)

 

Send the file specified by 'localFile' and store it in 'remoteFile' in the ASAM
directory that is relative to the current project.  If unspecified remoteFile
will be the basename of localFile.

When 'compress' is True, the file is compressed before sending and
decompressed by the server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

putEnvVariables(file, envvars)

 

Save all the environment variables to the given file.

Return: The return code from the configuration server.

Arguments:
    file     The name of the file to save the variables.
    envvars  Dictionary with environment variables in the form envvars[variable]=value

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

putFile(localFile, remoteDir='/', remoteFile=None, compress=False)

 

Send the file specified by 'localFile' and store it in 'remoteFile' in the 'remoteDir'
of the projects directory (i.e. it is relative to the projects directory).
If unspecified, remoteDir will be /, and remoteFile will be the basename of localFile.

When 'compress' is True, the file is compressed before sending and
decompressed by the server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

putFileLines(lines, remoteDir='/', remoteFile='putFileLines')

 

Send the list of 'lines' and store it in 'remoteFile' in the 'remoteDir'
of the projects directory (i.e. it is relative to the projects directory).
If unspecified, remoteDir will be /, and remoteFile will be 'putFileLines'.

Unlike putFile() there is no 'compress' option, so do not send large
amounts of data using this function.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

putIOMappingRecords(recs)

 

Put the I/O mapping records defined in recs into the currently loaded RTDB.
The RTDB must have been loaded with a dbLoad command.

recs: A dictionary where the primary key is the name of the item and its value is a dictionary 
      with the following required entries:
        'boardid'    The board type this record described
        'boardnum'   The I/O board instance number (Board number start at 1).
        'type'       IN, OUT, etc.
      Any other entries are optional and board-specific.  They are assumed to all be strings,
      and that anything that needs to be URL encoded already is.

NOTE: This is a convenience routine made available for expert users with an in-depth
      knowledge of SimWB.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

rampRate(pointName, duration, rate, initCondition, initialValue)

 

Ramp up/down a RTDB point value at a given rate and for a specified duration.

Returns the signal generator number when > 0. The number must be used with the startGenerator
call to start the generator.

Arguments:
    pointName      The name of the RTDB item to assign value to.
    duration       The duration in seconds to run the generator.
    rate           The rate in Units/Seconds at which to ramp the value of the item up or down.
    initCondition  The initial value type for the ramp.  GEN_SIGGENINIT_DB  or GEN_SIGGENINIT_USER .
    initialValue   This is the initial value for the point when initCondition is GEN_SIGGENINIT_USER.

NOTE:
    Generators will not effect variables with the OPR flag set.

The return code has the following meaning:
    > 0: the generator number on success.
    < 0: error (see simwbClient.strerror(code)).

rampToValue(pointName, endValue, rate, initCondition, initialValue)

 

Ramp up/down a RTDB point value  until it reaches the given endValue.

Returns the signal generator number when > 0. The number must be used with the startGenerator
call to start the generator.

Arguments:
    pointName      The name of the RTDB item to assign value to.
    endValue       The target end value.
    rate           The rate in Units/Seconds at which to ramp the value of the item up or down.
    initCondition  The initial value type for the ramp.  GEN_SIGGENINIT_DB  or GEN_SIGGENINIT_USER .
    initialValue   This is the initial value for the point when initCondition is GEN_SIGGENINIT_USER.

NOTE:
    Generators will not effect variables with the OPR flag set.

The return code has the following meaning:
    > 0: the generator number on success.
    < 0: error (see simwbClient.strerror(code)).

readXMLTarget(fileName)

 

Read and parse the XML 'fileName' for SimWB ASAM target
configuration information.

Returns a tuple of (integer,dict), where the integer is
the return code and the dict is the target configuration
dictionary (see getTarget() for key details).

If the return code is non-zero, the config dictionary
contains the same default values as defined by the
getTarget() routine.

Return:
    0: success.
    < 0: error (see simwbClient.strerror(code)).

removeAllGenerators()

 

Stop and remove all signal generators.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

removeGenerator(genNum)

 

Stop and remove the signal generator whose number is genNum (this may be a list).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

renameModelRTDB(modelname, rtdbname)

 

Modify the RTDB used by model 'modelname' to be 'rtdbname' (in the
currently selected project). The 'rtdbname' must already exist.

NOTE: After the change the model must be recompiled.

Return: The reply code from the configuration server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

renameResource(resType, oldname, newname)

 

Modify the SimWB resource specified by 'resType' from the 'oldname' to
the 'newname' (in the currently selected project). The 'resType' must be
one of the following (string):
  RTDB
  Script
  RTW
  Test
  FMU
  ADAMS
  SIMPACK
  UserModel
  SigGen

NOTE: These changes will likely require model rebuilds.

Return: The reply code from the configuration server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

resetProcessStat()

 

Reset the SimWB scheduler runtime statistics.

Return is always a success valued integer.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

resumeDLogger()

 

Resume the data logger. This is only effective while a test is running.
It will resume data recording when suspended by a call to pauseDLogger

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

retrieveArchiveList()

 

Return a list of archives that are in your group(s).
This is returned as a tuple of (code,dict), where the dict has
primary keys being the archive name, and whos value is a dictionary
with the following keys:
    createdate      a date of the form 'Fri Nov  6 16:03:40 2015'
    description     the description entered at the time of creation
    project         the project the test was located in
    test            the test ID name
    size            the size of the archive file (bytes)
    groupfsize      the size of the group file (bytes)
    despfsize       the size of the description file (bytes)

The code is:
  = 0 on success
  < 0 on error (see simwbClient.strerror(code))
The dict will empty on error.

rtdbGetList()

 

Get a list of all the real-time databases (RTDB) defined in the real-time host.

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the name of the RTDB and its value is a
        dictionary with the following entries:
            'description'  Text with a description of the program.
            'createdate'   The creation date of the program in seconds since the epoch.
        
The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

schedRefreshStart()

 

Start the scheduler refresh data.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

schedRefreshStop()

 

Stop the scheduler refresh data.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

schedulerPause()

 

Pause the scheduler. 
This call only has effect when a test is running.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

schedulerResume()

 

Resume the scheduler. 
This call only has effect when a test is running.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

schedulerStep(nSteps)

 

Step the scheduler through nSteps. 
This call only has effect when a test is running.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

sessionAutoStart(testId, sessionId='', initConditions='.default', fixedStep=0, description='', noDataLogging=0, envFile=None, schedType=0, fbsKey=3331, fbsDevice='rtc0', maxInitTime=None, maxInitScriptTime=5, maxIOShutdownTime=10, maxOverrunTime=0, userParm=None, etigate=None, userLogging=False, timeout=None)

 

Create a new test session and start running it immediately.

The default name for the new session is Ses_%04d where the sessions are numbered sequentially.
The default initial conditions set is .default where the value of the model parameters are those
defined when creating the Simulink models and the RTDB items take their default values defined 
when creating the database.
    sessionId       Run this session instead of creating a new one. This is functionally
                    the same as sessionStart(testId, sessionId), but gives the caller the
                    ability to select new parameters for initial conditions, logging, etc.,
                    i.e. to override the default session parameters.
    initConditions  Name of the initial conditions set to use (default .default).
    fixedStep       Defaults to the one specified when initially creating the test.
    description     Default to creation data if not specified.
    noDataLogging   Default to logging the data to the data logger.
    envFile         Specifies the environment variable file to load before starting the test run.
    schedType       simwbConstants.SCHEDTYPE_DEFAULT to use the default FBS scheduler.
                      Otherwise one of the SCHEDTYPE_xxx
    fbsKey          The FBS key to create for this scheduler.
    fbsDevice       The RCIM device to use as a timing source for this scheduler.
    maxInitTime     Maximum time to wait for test initialization to complete (sec).
                      Default is 30s, with 0s indicating "wait forever".
    maxInitScriptTime
                    Maximum time to wait for an initialization script to complete (sec).
                      Default is 5s (there is no "wait forever" value).
    maxIOShutdownTime
                    Maximum time to allow for shutodwn values to be sent (sec).
    maxOverrunTime  Maximum % of cycle past end-of-cycle before declaring an overrun (%).
    userLogging     When True then connect to additional loggers as defined in the
                      SimWB /etc/ccursim.conf file.
    userParm        A user-defined string that is made available to applications via
                    the ccurRTDB_getSessionUserParm() call.
    etigate         An ETI number (edge-triggered interrupt, 0-12) that is used to pause
                    the session after the init cycles and prior to resuming the session.
                    The session blocks until the ETI is "on".

This is an asynchronous operation and returns as soon as SimWB acknowledges the request.

When a timeout is specified (in seconds) this function will begin polling (via
the getTestState() function every 0.1 seconds) until the test is running.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

sessionCreate(testId, sessionId, description, initConditions='.default', fixedStep=0, runFrames=0, maxOverruns=20, maxConsecutiveOverruns=10, noDataLogging=0, envFile=None, schedType=0, fbsKey=3331, fbsDevice='rtc0', maxInitTime=None, maxInitScriptTime=5, maxIOShutdownTime=10, endSnapshot=0, noDirectIO=0, circLoggerLock=0, asynciousec=20, schedstats=0, maxOverrunTime=0, int5565='0:1', disableio=None, userParm=None, etigate=None, userLogging=False)

 

Create a test session under test 'testId', and where 'sessionId' is the name of the new session.
The default initial conditions set is .default where the value of the model parameters are those
defined when creating the Simulink models and the RTDB items take their default valued defined 
when creating the database.
runFrames               Defines the number of frames to run the test for. The default (0) means
                          indefinitely until stopped by the user or a user script.
fixedStep               Defaults to the one specified when initially creating the test.
maxOverruns
maxConsecutiveOverruns  Define the total  number of frame overruns and maximum number of
                          consecutive overruns allowed before the test is aborted.
noDataLogging           Set to 1 not to log any data to the data logger.
envFile                 The environment variable file to load when running this test session.
schedType               simwbConstants.SCHEDTYPE_DEFAULT to use the default FBS scheduler.
                          Otherwise one of the SCHEDTYPE_xxx
fbsKey                  The FBS key to create for this scheduler.
fbsDevice               The RCIM device to use as a timing source for this scheduler.
maxInitTime             Maximum time to wait for test initialization to complete (sec).
                          Default is 30s, with 0s indicating "wait forever".
maxInitScriptTime       Maximum time to wait for an initialization script to complete (sec).
                          Default is 5s (there is no "wait forever" value).
maxIOShutdownTime       Maximum time to allow for shutodwn values to be sent (sec).
endSnapshot             Set to 1 to produce an RTDB snapshot at test end.
noDirectIO              Do not use direct I/O when logging.
schedstats              Set to 1 to include scheduler statistics in logged data.
asynciousec             Amount of time (usec) allowed for scheduler to set asynchronous input
                          data (device inputs, operator inputs, etc.) into the RTDB.
circLoggerLock          Set the circular logging lock behavior. Should be one of the
                          simwbConstants.CIRCLOGGER_xxx values. See the documentation on
                          test sessions for more information.
maxOverrunTime          Maximum % of cycle past end-of-cycle before declaring an overrun (%).
int5565                 When schedType is simwbConstants.SCHEDTYPE_5565INTR this will be the
                        5565 'board:interrupt' used for timing (board 0+, interrupt range 1-4)
disableio               When present, this is a string of the form 'bn1:bname1;bn2:bname2;...'
                        where bnX is the board number and bnameX is the board name. I/O to these
                        boards will be disabled when this session is run. The bnX must be 0+,
                        and bnameX must be a key in the simwbClient.stringToBoardId dictionary.
userLogging             When True then connect to additional loggers as defined in the
                          SimWB /etc/ccursim.conf file.
userParm                A user-defined string that is made available to applications via
                        the ccurRTDB_getSessionUserParm() call.
etigate                 An ETI number (edge-triggered interrupt, 0-12) that is used to pause
                        the session after the init cycles and prior to resuming the session.
                        The session blocks until the ETI is "on".

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

sessionDelete(testId, sessionId)

 

Delete the specified test session.
This routine always succeeds.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

sessionStart(testId, sessionId, timeout=None)

 

Start running the test and session specified.

This is an asynchronous operation and returns as soon as SimWB acknowledges the request.

When a timeout is specified (in seconds) this function will begin polling (via
the getTestState() function every 0.1 seconds) until the test is running.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

sessionStop(reason=-102, timeout=None)

 

Stop the test that is currently running.

The 'reason' must be an integer termination code (SCHED_xxx)
defined in the simwbConstants module.

This is an asynchronous operation and returns as soon as SimWB acknowledges the request.

When a timeout is specified (in seconds) SimWB will begin polling (via
the getTestState() function every 0.1 seconds) until the test is stopped.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setCPUShielding(mask=0)

 

Set the CPU shielding for the specified CPUs.

Each bit in the mask corresonds to a CPU (bit 0 = CPU 0, bit 1 = CPU 1, etc).
A set bit shields that CPU from interrupts, processes and local timer interrupts.
A clear bit unshields that CPU.

The only bits examined are those corresponding to existing CPUs. Newer releases of
SimWB will further filter the CPUs that you can shield by examining the contents
of $SIMWB_ROOT/etc/cpuallowed.txt.  CPU 0 (bit 0) is never shielded.

Internally abs(int(mask)) is used. Passing negative values will cause confusion.

Return: An integer return code.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setDebugLevel(task, level=0)

 

Set the specified SimWB task's debug level.

Task is the exact SimWB task name as a string.  Level is an integer 0
or larger.  By default, a level of 0 disables debugging for the task.
Typically larger levels output more debug information.

Returns an integer return code.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setInitConditions(nsNames, nsItems, testid, name, description='', default=0, oldName=None)

 

 Set the initial conditions set 'name' for test 'testid'.

 Inputs: nsNames      The list of namespace names.
         nsItems      The list of initial condition items.
         name         The name of the initial conditions set. Use ".default" to set
                      whatever the current default is.
         description  A string description - your choice.
         default      Set to 1 to make this the default initial conditions set, 0 otherwise.

         oldName      This should only be set when new initial conditions are to be
                      created from an existing one. In this case 'name' is the new name
                      and 'oldName' is the old one (the old one MUST exist).

         * NOTE   the nsNames and nsItems lists are exactly like those returned from the
                  getInitConditions() function (See this API call for more details). The
                  intention is that in order to modify or set initial conditions, one first
                  does a getInitConditions() call which will return nsNames and nsItems. The
                  user them modifies these variables (e.g. changes an RTDB item initial
                  value) and passes them back into the setInitConditions() call to set
                  them.

The return code has the following meaning:
     > 0: success.
     < 0: error (see simwbClient.strerror(code)).
 

setItemRTFlags(varName, flags)

 

Set the real-time flags for the item 'varName'. 'flags' is an integer
bit mask representing the states of the flags. These are defined
in simwbConstants as RTDBFL_*. See the SimWB docs for more details.

Setting 'flags' to 0 will reset (turn off) all flags.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setItemValue(variable, value, rowIndex=None, columnIndex=None, isRaw=False, itemsRTDB=None)

 

Set the value of RTDB item 'variable' to 'value' (for non-string items. Use
setStringItemValue() with string items).

(1) When the item is a scalar, either a scalar or single element list is
acceptable as the 'value' ('rowIndex' and 'columnIndex' are ignored).

(2) When the item is non-scalar and both 'rowIndex' and 'columnIndex' are
set then the scalar located at [rowIndex,columnIndex] is updated.

(3) When the item is non-scalar and 'rowIndex' and 'columnIndex' are unset,
then the entire item is updated and the 'value' must have the same number of
elements as the item.

When the item is non-scalar and only one of 'rowIndex' or 'columnIndex' is
set then the other is treated as set to zero and processed like (2) above.

Raw data values may be written to by setting the 'raw' flag to True.

Since size of the item is required, this function will either query for RTDB
item information (via the getItemsRTDB() call) or the user can make the call
and pass the returned dictionary in as the 'itemsRTDB' argument. This is the
desired approach for efficiency, as this query will add considerable overhead
to this call.

The operator entry real-time flag for the item is set when using this function.
Values are only set when a test is running since the item is updated during the 
asynchronous input time slice within the scheduler.

NOTE: As of PYToolkit 7.6 it is possible to set multiple values in one shot.
      Do this by making 'variable' a list of names, and 'value' a list of
      corresponding values. If you wish to specify 'rowIndex', 'columnIndex'
      or 'isRaw' for the corresponding variable then these must also be lists
      that are of the same length as 'variable'.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setLoggingSet(testid, name, items)

 

Set the data logging settings for the test 'testid' with initial conditions data
set called 'name' (e.g. ('rtdemo1','.default', which is the same as ('rtdemo1',
'Default-models-RTDB')) to correspond to the entries in the 'items' dictionary.

The 'items' dictionary has a primary key of the name of the item and its value
is a dictionary with the following entries:
        'metaflags'      The metaflags for this item.
        'pointtype'      The point type of this item.
        'loggingperiod'  How often to record this item (in milliseconds) when this item
                           is being recorded.

* NOTE These items are the same as those obtained from the getLoggingSet().  See the NOTE
      for that command.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setSignalFaults(defines, rtdb)

 

Store the signal fault definitions in the 'defines' dictionary into the signalfaults.db file
for the specified rtdb. The dictionary has the following form:
    { 'signalname1': { 'device':DEVICE, FAULT:'<rtdb DO item for this fault',
                                        FAULT:'<rtdb DO item for this fault',
                                        ... }
    }

DEVICE is the SimWB device name (e.g. 'CP-FISC_1', 'CP-UEGO_2', 'CP-RES_3').
FAULT is one of 'GND', 'PWR' or 'OPEN'. In the case of the 'CP-FISC' device, the
FAULT may also be 'C2C'. More than one fault may be defined for a signal.

* NOTE the RTDB must currently be loaded.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

setStringItemValue(varName, value)

 

Set the value of RTDB string item 'varName'. value is the string value.
The value is URL encoded before sending it to the server so that non-ASCII,
binary data can be loaded into the string.

The operator entry real-time flag for the item is set when using this function.
The values is only set when a test is running since the item is updated during the 
input cycle of the test by the asynchronous input process.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

signalAsamSrv(name, kind='mantrigger')

 

The ASAMsrv task 'name' can be signaled to perform certain actions,
defined by the 'kind' of signal sent.

Currently these are either 'mantrigger', to manually trigger a start or
stop condition, 'fetch', to initiate the storage of data from the
time of the last fetch signal (or the start condition, whichever is
most recent) up to the time of the signal arrival, or 'abort' to abort
the server (no results produced).

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

simpackGetProperties()

 

Get SIMPACK run-time properties. This is a dictionary with keys:
    installdir      root directory for the active SIMPACK installation
    home            HOME directory to be used when invoking SIMPACK tasks

These are returned as a tuple of (return code int, properties dict).

NOTE: If installdir has never been set, then the string
        'Set The Location of your SIMPACK installation directory'
      will be retuned and home will be empty.

The return code has the following meaning:
    > 0: success
    < 0: error (see simwbClient.strerror(code))

snapshotConfig(testID, fileNameTemplate='$testname_$sessionname', itemNameRegex='.*', snapshotFormat=0, pointTypeMask=-1)

 

Define the test snapshot configuration for future snapshots using the
snapshotTake() call.

Arguments to this call are:
testID                  name of the test (the only required argument)
fileNameTemplate        for CSV, MAT and INITCOND snapshots, then user defined
                          (special symbols $testname and $sessionname)
                        for RTFORM snapshots, this is the existing form name
itemNameRegex           regular expression selecting item names ('' = '.*' = all)
snapshotFormat          one of simwbConstants.CAPTURE_CSV, .CAPTURE_INITCOND,
                          .CAPTURE_RTFORM or .CAPTURE_MAT
pointTypeMaks           mask of simwbConstants.SNAPSHOT_PARAMETERS, .SNAPSHOT_SIGNALS,
                          .SNAPSHOT_RTDBIn or .SNAPSHOT_RTDBOut (-1 = all)

Returns an integer with the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

snapshotFetch(testId, name, dest=None)

 

Retrieve the snapshot data from test 'testid' session 'sessionId' named 'name' and
store into file 'dest'. The 'name' should be one of those returned by the snapshotList().
When dest is unspecified then the file is stored in the current directory.

The return code is the same as for getFile() (which is used to retrieve the file):
    > 0: size of file (in bytes) on success.
    < 0: error (see simwbClient.strerror(code)).

snapshotList(testId, sessionId)

 

Get a list of the snapshots available from test 'testId' and session 'sessionID'.

Returns a tuple of (status, dict) where 'status' is the command success
code, and 'dict' will be:
    { 'fileName1.typ': {'modtime': '2015/06/02 09:16:33', 'size': 1566},
      'fileName2.typ': {'modtime': '2015/06/02 11:52:54', 'size': 1560},
      ...
    }
The filename type will be that selected for the snapshot (.mat or .csv).

The status has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

snapshotTake()

 

Take an RTDB snapshot of the currently running test.
Taking a snapshot of an 'unconfigured' test results in a snapshot identical to
having called snapshotConfig() with all default arguments.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

startAllGenerators()

 

Start all the signal generators that have been defined so far.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

startGenerator(genNum)

 

Start the signal generator whose number is genNum (this may be a list).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

stderrRefreshStart(callback, discoCallback=None)

 

Notify cfgsrv to start sending its stderr messages. 'callback' should be a python
routine in the main program that will receive the messages, of the form:
    def CB(line):
        # process string 'line'

The 'discoCallback' is invoked on detection of a disconnect from the server. It
is called without arguments, and gives you the opportunity to set a flag, etc.,
for a cleaner shutdown.

Returns 0 on success, 1 if the refresh thread does not start within 5 seconds.

stopAllGenerators()

 

Stop all the signal generators that have been defined so far.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

stopCircularLogger()

 

Stop the circular logger. Once stopped, the circular data logger cannot be resumed. 
This call only has effect when a test is running.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

stopGenerator(genNum)

 

Stop the signal generator whose number is genNum (this may be a list).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

strerror(code)

 

Return a string representation of the message text associated with the SimWB integer error 'code'. If 'code' is not an SimWB error code, then it is assume to be an errno value, and the message text for that is returned.

NOTE: multi-line message text is seperated with a newline (\n) character.

testCreate(testid, dbname, description='', group=None, fixedstep=None, scriptname=None, initscript=None, rtwname=None, userpgmname=None, simpackpgmname=None, fmupgmname=None, adamspgmname=None, snapshotfiletemplate=None, snapshotnamemask=None, snapshotformat=None, snapshotmask=None, datalogging=True, schedstats=False, maxoverruns=20, maxconsecutiveoverruns=10, pythonpgmname=None)

 

Create a SimWB test comprised of the following components:
    testid               the name of the test
    description          a string description of the test
    group                the SimWB group ownership of the model. When unspecified the
                         first login group will be used (must be one of your login groups).
    dbname               the name of the RTDB for this test (see NOTE)
           -- optional --
    fixedstep            the step size in microseconds
                         (default is pulled from RTW models, or 10000 when no RTW model)
    scriptname           name of the test script
    initscript    _      name of the init script
    rtwname        |
    userpgmname    |
    simpackpgmname |==>  name(s) of model(s) (multiple names separated by '/')
    fmupgmname     |     each model must have 9 or 10 properties using the format 'keyword=value' and separated by ',':
    adamspgmname   |       modelname:cpu=,freqdiv=,runatcount=[,runatcycle=],startorder=,endorder=,priority=,schedulingpolicy=,asyncexecchain=,options=/
    pythonpgmname _|         e.g. modelA:cpu=4,freqdiv=1,runatcount=0,startorder=1,endorder=2,priority=97,schedulingpolicy=fifo,asyncexecchain=,options=/
                           examples can be found in property files in an existing test
                           (see NOTE on legacy support)
    snapshotfiletemplate string representing the snapshot filename template composed
                         of any valid file name character, plus:
                             $testname
                             $sessionname
                             $framecount
                             $date
                             $time
                             $seqnum
                         (as of this release the default is $testname_$sessionname)
    snapshotnamemask     a regular expression string used to matched the names in
                         the 'snapshotmask' grouping of items
    snapshotformat       one of:
                           simwbConstatants.CAPTURE_CSV       (default)
                           simwbConstatants.CAPTURE_INITCOND
                           simwbConstatants.CAPTURE_RTFORM
                           simwbConstatants.CAPTURE_MAT
    snapshotmask         a mask of one or more of:
                           simwbConstatants.SNAPSHOT_PARAMETERS
                           simwbConstatants.SNAPSHOT_SIGNALS
                           simwbConstatants.SNAPSHOT_RTDBIn
                           simwbConstatants.SNAPSHOT_RTDBOut
    datalogging          True to enable data logging, False to disable it
    schedstats           Create scheduling stats in the RTDB
    maxoverruns          Total maximum allowed overruns before shutodwn
    maxconsecutiveoverruns  Maximum allowed consecutive overruns before shutodwn

NOTE: A running test's RTDB may actually be a composite of RTDBs from the various
      models which are run as part of the test. When defining a test only one of
      these RTDBs need to be specified. So, for example, if this test has model1
      using 'rtdb1' and model2 using 'rtdb2', then either 'rtdb1' or 'rtdb2' can
      be specified for the 'dbname'.

      Legacy support for task properties is still supported. In this case there are
      only 7 properties separated by ':':
        cpu:freqdiv:runatcount:startorder:endorder:priority:schedulingpolicy

      This function is NOT comprehensive. For example, there is no way to set
      execution order of tasks. It is strongly recommended that you examine the
      created test via the Control Center to insure correctness.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testDelete(testid)

 

Delete test 'testid' in the current project.

Returns an integer return code with the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testGetList(maxTests=None)

 

Get a list of tests and their descriptions/details.

Be aware that returned results will only be for the current project, and whose
group are in your set of groups.

At most 'maxTests' (an integer) tests will be returned when defined. By default
all tests are returned.

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the test Id of the test and its value is a
        dictionary with the following entries:
            'description'  Text with a description of the program.
            'createdate'   The creation date of the program in seconds since the epoch.
            'scriptname'   The name of the script program assigned to the test.
            'dbname'       The RTDB for this test (see NOTE).
            'fixedstep'    Test cycle time in microseconds.
            'initscript'   Optional initialization script name.
            'snapshotfiletemplate'  Template for the snapshot file name.
            'snapshotformat'  Format of the template (MAT, init, etc).
            'snapshotmask'  Mask of the snapshot.
            'snapshotnamemask'  Mask of the snapshot file.

            The contents of these are dictionaries of dictionaries:
            'userpgmname'     Optional user program names
            'rtwname'         Optional Simulink model names
            'simpackpgmname'  Optional SIMPACK model names
            'fmupgmname'      Optional FMU model names
            'adamspgmname'    Optional Adams model names
            'carmakerpgmname' Optional CarMaker model names
            'pythonpgmname'   Optional Python model names
            'asyncpgmname'    Optional asynchronous model names
            The dictionary keys are task names, with value keys of:
                'cpu'              Eligible CPU's to run this task (list).
                'freqdivider'      Cycle frequency divider (decimation).
                'runatcount'       When equal to 1, interpret 'freqdivider' as a
                                     multiplier (i.e. run that many times per cycle).
                'runatcycle'       When freqdivider is non-zero, this is the cycle
                                     between 0 and freqdivider-1 at which to execute.
                'startorder'       - Internally used -
                'endorder'         - Internally used -
                'priority'         Task scheduler priority.
                'schedulingpolicy' Task scheduler policy.
                'options'          Optional program command line options
                'asyncexecchain'   - Internally used -
                'asynctype'        - Internally used -

NOTE: A running test's RTDB may actually be a composite of RTDBs from the various
      models which are run as part of the test. When defining a test only one of
      these RTDBs need be selected, and it is this one which is returned.

NOTE: The exact keys returned in the program dictionaries depends on which version
      of SimWB created the test. Some keys were added in later versions, and may
      not appear in tests created by earlier versions.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testGetModelInputs(testId)

 

Get the intra-model data exchange connections for the specified test.

Return: A tuple (integer,dictionary) with the return code from the configuration
        server and a dictionary of the data exchange connections.  The dictionary
        is structured in the following way.

        The outer, or primary, dictionary keys are all models in the test. Their
        key values are also dictionaries, with each dictionary entry being a
        pair of RTDB variables, such that 'abc':'xyz' corresponds to the assignment
        abc = xyz.

        As an example, assume there are two instances of a plant model, and one
        controller model. Each plant has a 'control' input and a 'reference' output.
        The controller has two reference inputs and two control outputs. So the
        plant takes the control input, produces a reference, passes it to the
        controller, which produces a new control value for the plant. So the
        controller is communicating with both plants (known to it as "a" and "b").

        {
            'plant_1':
                {
                    'plant_1.control':'controller_1.control_a',
                }
            'plant_2':
                {
                    'plant_2.control':'controller_1.control_b',
                }
            'controller_1':
                {
                    'controller_1.reference_a':'plant_1.reference',
                    'controller_1.reference_b':'plant_2.reference',
                }
        }

        Notice that the model names are followed by their "instance" number, just
        as they appear when you define the test.

        Data exchange connections are always defined from the input side of the
        exchange, so will be shown as belonging to the model that requires that
        input.

NOTE: On error, or when there are no model inputs defined, the returned dictionary
      is empty ({}).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testGetSession(testId, sessionId)

 

Get the properties of the testId and sessionId combination. 

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary with the following entries:
        'description'     Text with the session description.
        'createdate'      The creation date of the session in number of seconds since the epoch.
        'fixedstep'       The fixed step size (in micro seconds) at which the session should run.
        'initconditions'  The name of the initial conditions set for this session.
        'defaultIC'       Set to 1 when the initconditions is specified as '.default'.
        'runFrames'       The number of frames to run the test for. The default (0) means
                            indefinitely until stopped by the user or a user script.
        'starttime'       Time when the sesssion run started as a tuple with seconds since
                            epcoch and micro seconds within the current second.
        'stoptime'        Time when the sesssion run stopped as a tuple with seconds since
                            epcoch and micro seconds within the current second.
        'status'          The termination status of the test run. One of the scheduler
                            completion code SCHED_xxx defined in the simwbConstants module.
        'testoverruns'    Number of overruns that occured during the test run.
        'maxoverruns'     Maximum number of  overruns that are allowed during a test run
                            before the test is stopped.
        'maxconsecutiveoverruns'
                          Maximum number of consecutive overruns that are allowed
                            during a test run before the test is stopped.
        'noDataLogging'   Whether to log the data when running this test session.
        'envfile'         The environment file to load when running this session.
        'nodirectio'      If logging is using direct I/O.
        'maxinittime'     Maximum time to wait for initialization complete (sec).
        'maxinitscripttime'
                          Maximum time to wait for initialization script to complete (sec).
        'schedtype'       The scheduler type to be used when running this test matching
                            one of the SCHEDTYPE_xxx defined in the simwbConstants module.
        'endsnapshot'     Set to 1 when an RTDB snapshot is to be produced at test end.
        'schedstats'      Set to 1 when scheduling stats are enabled.
        'swsstat'         The termination status of a SimWB test script.
        'userparm'        A user-defined string that is made available to applications via
                          the ccurRTDB_getSessionUserParm() call.
        'userLogging'     Set to 1 when additional loggers are being used.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testGetSessions(testId, maxSessions=100)

 

Get the properties of the test sessions defined under testId up to a maximum of maxSessions

Return: A tuple (integer,dictionary) with the return code from the configuration server and
        a dictionary where the primary key is the name of the session and its value is a
        dictionary with the following entries:
        'description'     Text with the session description.
        'createdate'      The creation date of the session in number of seconds since the epoch.
        'initconditions'  The name of the initial conditions set to use when running the session.
        'fixedstep'       The fixed step size (in micro seconds) at which the session should run.
        'runFrames'       The number of frames to run the test for. The default (0) means
                            indefinitely until stopped by the user or a user script.
        'starttime '      Time when the sesssion run started as a tuple with seconds since
                            epcoch and micro seconds within the current second.
        'stoptime '       Time when the sesssion run stopped as a tuple with seconds since
                            epcoch and micro seconds within the current second.
        'status'          The termination status of the test run. One of the scheduler
                            completion code SCHED_xxx defined in the simwbConstants module.
        'testoverruns'    Number of overruns that occured during the test run.
        'maxoverruns'     Maximum number of overruns that are allowed during a test run
                            before the test is stopped.
        'maxconsecutiveoverruns'
                          Maximum number of consecutive overruns that are allowed
                            during a test run before the test is stopped.
        'nodatalogging'   Whether to log the data when running this test session.
        'nodirectio'      The Direct I/O setting of this session.
        'envfile'         The environment file to load when running this session.
        'maxinittime'     Maximum time to wait for test initialization to complete (sec).
        'maxinitscripttime'
                          Maximum time to wait for initialization script to complete (sec).
        'maxioshutdowntime'
                          Maximum time to allow for shutodwn values to be sent (sec).
        'endSnapshot'     Set to 1 when an RTDB snapshot is to be produced at test end.
        'maxoverruntime'  Maximum % of cycle past end-of-cycle before declaring an overrun (%).
        'userLogging'     Set to 1 when additional loggers are being used.
        'userparm'        A user-defined string that is made available to applications via
                          the ccurRTDB_getSessionUserParm() call.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testInfoRefreshStart()

 

Start the scheduler refresh of test info.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testInfoRefreshStop()

 

Stop the scheduler refresh of test info.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

testRemakeModels(name)

 

Rebuilds all models associated with test 'name' in the current project.

A tuple of (return code, output) is returned where 'return code' is the command
completion status, and 'output' is a list of strings produced by the make process.

The return code has the following meaning:
    = 0: success.
    > 0: make error (see the 'output').
    < 0: command error (see simwbClient.strerror(code)).

toolkitBuild()

 

Return the PYToolkit build string. This is at a minimum a string of the form
'YYYYMMDD-HHMMSS'. There could be additional text separated by at least one
space.

Return: A tuple (return,string).  The 'return' value is a success code for the command,
and 'string' is the build string.

The return code has the following meaning:
    = 0: success.
    < 0: error (see simwbClient.strerror(code)).  The build string is '' on error.

toolkitVersion(format='string')

 

Return the PYToolkit version number.  The 'format' argument is either 'string' (default)
or 'tuple'.  If anything other than these are specified, 'string' is returned.

Return: A tuple (return,version).  The 'return' value is a success code for the command,
and 'version' is the version in the requested format.  So a string might be '2.4-1',
and the quivalent tuple being (2, 4, 1).

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).  The version is '?.?-?' or ('?','?','?') on error.

updateAdd(name, typ)

 

Add an item to the binary refresh stream.
    Name of item to add.
    Typ must be one of 'cvt' or 'both' (where 'both' means both CVT and ALT values).

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

updateRemove(name)

 

Remove an item(s) from the binary refresh stream.
    Name of item(s) (comma seperated) to remove.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

updateValueAdd(name)

 

Add an item(s) to the ASCII refresh stream.
    Name of item(s) (comma seperated) to add.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

updateValueRemove(name)

 

Remove an item(s) from the ASCII refresh stream.
    Name of item(s) (comma seperated) to remove.

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

uploadArchive(name, toName=None)

 

Upload an archive 'name' (which was previously downloaded) to the server
and name it 'toName' on the server (default for 'toName' is 'name').

The archive takes the form of three files:
    name.tar.gz
    .name.group
    .name.description

The name argument can include a path specification if desired (but should
not have any extension).

NOTE: This can take a while - the routine will not return
      until the files are transferred.

On success a 0 is returned. Anything else is an error
code (see simwbClient.strerror(code)).

userAdd(user, password, priv=2, group='default')

 

Add a SimWB user account.

    'user'      The user name
    'password'  The clear-text password
    'priv'      The account privilege, should be one of:
                  simwbConstants.USER_ADMIN
                  simwbConstants.USER_MONITOR (default)
                  simwbConstants.USER_OPERATOR
                  simwbConstants.USER_POWER
    'group'     The group the user is to belong to ('default' by default)
                  Mulitple groups should be separated by a '/'.
                    E.g., 'one/two/three'

Return: The return code from the configuration server.
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

userList()

 

List all SimWB users.

Return: A tuple (iReply,users), where 'users' is a list of
        strings of the form 'user:password:priv:group'.

        Priv will be a string, whose integer value corresponds to:
            simwbConstants.USER_ADMIN
            simwbConstants.USER_MONITOR
            simwbConstants.USER_OPERATOR
            simwbConstants.USER_POWER

        If more than one group they will be of the form 'group1/group2'.

iReply is the return status:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

userProgramMake(name, script=False)

 

Build a script or user model named 'name' (in the current project). By default a
user model is built. Setting 'script' to True will build a script.

A tuple of (return code, output) is returned where 'return code' is the command
completion status, and 'output' is a list of strings produced by the make process.

The return code has the following meaning:
    = 0: success.
    > 0: make error (see the 'output').
    < 0: command error (see simwbClient.strerror(code)).

vigradeInstallStatus()

 

Returns a tuple (integer,boolean), where the integer is the return code from the
configuration server and the boolean indicates whether or not VI-grade is installed
on the server.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

vigradeVarList()

 

Returns a tuple (integer,dictionary), where the integer is the return code from the
configuration server and the dictionary describes VI-grade variables for this project.

The dictionary structure is (for example):
    {
        'VI_CarRealTime.Outputs.UserSensor.Road_Material.front_left_tire': { 'feature':'GraphSim', 'required':'true' },
        'VI_CarRealTime.Outputs.Wheel.Global_Omega_X.L1': { 'feature':'WorldSim', 'required':'false' },
        'VI_CarRealTime.Outputs.Vehicle.Body_Fixed_Alpha_X': { 'feature':'BassShaker', 'required':'true' },
        'VI_CarRealTime.Outputs.Vehicle.CM_Body_Fixed_Vx': { 'feature':'MotionCueing', 'required':'true' },
        'VI_CarRealTime.Outputs.Steering_System.DriveSim_Steering_Feedback': { 'feature':'StopManager', 'required':'true' },
        'VI_CarRealTime.Outputs.fuel_consumption.instantaneous': { 'feature':'SCANeRStudio', 'required':'true' },
        ...
    }
On error the dictionary will be empty.

The return code has the following meaning:
    > 0: success.
    < 0: error (see simwbClient.strerror(code)).

writeXMLTarget(conf, fileName)

 

Write the SimWB ASAM target configuration dictionary 'conf'
(containing the configuration information defined in
getTarget()) as XML into the file 'fileName'.

Return:
    0: success.
    < 0: error (see simwbClient.strerror(code)).


Variables Details

causalityToString

Value:
{0: 'Parameter', 1: 'Input', 2: 'Output', 3: 'Local'}

cvtTypeToString

Value:
{1: 'char',
 2: 'uchar',
 3: 'int',
 4: 'uint',
 5: 'float',
 6: 'short',
 7: 'ushort',
 8: 'double',
...

stringToBoardId

Value:
{'12AO16': 2,
 '16AO16': 2,
 '16AO16:Wave': 31,
 'ADLINK:7230': 63,
 'ADLINK:7256': 27,
 'ADLINK:7296': 64,
 'AFDX': 6,
 'AI64LL': 26,
...

stringToCVTType

Value:
{'char': 1,
 'double': 8,
 'float': 5,
 'int': 3,
 'llong': 9,
 'short': 6,
 'string': 10,
 'uchar': 2,
...

stringToPointType

Value:
{'AI': 17,
 'AIO': 49,
 'AO': 33,
 'DI': 18,
 'DIO': 50,
 'DO': 34,
 'MDLSIGNAL': 45,
 'PARM': 25,
...

stringToRawType

Value:
{'bit': 13,
 'char': 1,
 'double': 8,
 'float': 5,
 'int': 3,
 'llong': 9,
 'packed': 12,
 'short': 6,
...

varTypeToString

Value:
{0: 'Real', 1: 'Integer', 2: 'Boolean', 3: 'String', 4: 'Enum'}

variabilityToString

Value:
{0: 'Constant',
 1: 'Fixed',
 2: 'Tunable',
 3: 'Discrete',
 4: 'Continuous'}