| ||||||||||||||||||||||||||||||||||
rsRsiAddConfigVarAdd a configuration variable to the .rsi file. Adds the variable specified by the ’name’ parameter as a new configuration variable. If that variable was already a configuration variable, then rsRsiAddConfigVar behaves the same as rsRsiSetConfigVarType. For a description of the syntax of types in .rsi files, see Section 5.3.2 in the Reactis User’s guide. Syntaxint rsRsiAddConfigVar ( RsiFile *hRsi, const char *name, const char *type, ); Parameters
Return Value
Example Code The following code could be used to add a configuration variable named “InitialSpeed”. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { rsRsiAddConfigVar(rsi, "InitialSpeed", "double{10.0, 30.0, 40.0}"); rsRsiSave(rsi, "cruise.rsi"); rsRsiClose(rsi); } rsRsiRemoveConfigVarRemove configuration variable from .rsi file. Syntaxint rsRsiRemoveConfigVar ( RsiFile * h, const char *Name); Parameters
Return Value
Example Code The following code could be used to remove an existing configuration variable. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { rsRsiRemoveConfigVar(rsi, "InitialSpeed"); rsRsiSave(rsi, "cruise.rsi"); rsRsiClose(rsi); } rsRsiGetNumConfigVarsNumber of configuration variables in an .rsi file. Return the number of configuration variables currently set in the .rsi file. Syntaxint rsRsiGetNumConfigVars (RsiFile *h); Parameters
Return ValueReturns the number of configuration variables in the .rsi file specified by the h parameter or -1 if an error occurred. In that case, you may call rsGetLastError to retrieve the error message string. Example Code The following code could be used to get the quantity of configuration variables already assigned from the cruise.rsi file. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { int num_cvs; num_cvs = rsRsiGetNumConfigVars(rsi); rsRsiClose(rsi); } rsRsiGetConfigVarNameReturn name of a configuration variable with the given index. Return the name of a configuration variable. Syntaxint rsRsiGetConfigVarName ( RsiFile *h, int index, char *buffer, int bufferSize ); Parameters
Return Value
Example Code The following code could be used to get the names of the variables already assigned as configuration variables from the cruise.rsi file. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { int cvn_index; int num_cvs; char buffer[100]; num_cvs = rsRsiGetNumConfigVars(rsi); for ( cvn_index = 0; cvn_index < num_cvs; cvn_index++ ) { rsRsiGetConfigVarName(rsi, cvn_index, buffer, bufferSize); printf("Configuration variable %u has name %s\n", cvn_index, buffer); } rsRsiClose(rsi); } rsRsiGetConfigVarTypeReturn the type of a configuration variable. Return the data type of a configuration variable in the .rsi file. For a description of the syntax of types in .rsi files, see Section 5.3.2 in the Reactis User's Guide. Syntaxint rsRsiGetConfigVarType ( RsiFile *h, const char *name, char *buffer, int bufferSize ); Parameters
Return Value
Example Code The following code could be used to get the type of the named configuration variable from the cruise.rsi file. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { char buffer[100]; rsRsiGetConfigVarType(rsi, "InitialSpeed", buffer, 100); printf("Type of InitialSpeed: %s\n", buffer); rsRsiClose(rsi); } rsRsiSetConfigVarTypeSet the type of a configuration variable. Set the data type of a configuration variable in the .rsi file. For a description of the syntax of types in .rsi files see Section 5.3.2 . Syntaxint rsRsiSetConfigVarType (RsiFile *h, const char *Name, char *Type); Parameters
Return Value
Example Code The following code could be used to set the type of an existing configuration variable. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { rsRsiSetConfigVarType(rsi, "InitialSpeed", "double{10.0, 30.0, 40.0}"); rsRsiSave(rsi, "cruise.rsi"); rsRsiClose(rsi); } rsRsiGetNumPotentialConfigVarsNumber of workspace vars that could be configuration vars. Return the number of workspace variables defined by the model that can be used as configuration variables. Syntaxint rsRsiGetNumPotentialConfigVars (RsiFile *h); Parameters
Return ValueReturns the number of potential configuration variables or -1 if an error occurred. In that case, you may call rsGetLastError to retrieve the error message string. Example Code The following code could be used to get the quantity and also the names of the variables available for assignment as configuration variables. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { int pcvn_index; int num_pcvs; char buffer[100]; num_pcvs = rsRsiGetNumPotentialConfigVars(rsi); for ( pcvn_index = 0; pcvn_index < num_pcvs; pcvn_index++ ) { rsRsiGetPotentialConfigVarName(rsi, pcvn_index, buffer, bufferSize); printf("Potential Configuration variable %u has name %s\n", pcvn_index, buffer); } rsRsiClose(rsi); } rsRsiGetPotentialConfigVarNameRetrieve name of potential configuration variable. Return the name of a configuration variable. Syntaxint rsRsiGetPotentialConfigVarName ( RsiFile *h, int index, char *buffer, int bufferSize ); Parameters
Return Value
Example Code The following code could be used to get the names of the variables available for assignment as configuration variables. RsRsiFile *rsi = rsRsiOpen(h, "cruise.rsi", "cruise.slx"); if ( rsi ) { int pcvn_index; int num_pcvs; char buffer[100]; num_pcvs = rsRsiGetNumPotentialConfigVars(rsi); for ( pcvn_index = 0; pcvn_index < num_pcvs; pcvn_index++ ) { rsRsiGetPotentialConfigVarName(rsi, pcvn_index, buffer, bufferSize); printf("Potential Configuration variable %u has name %s\n", pcvn_index, buffer); } rsRsiClose(rsi); } rsRsiAddConfigVarSetAdd a new configuration variable set to the .rsi file. Adds a new configuration set to the .rsi file. If the copyFrom parameter is NULL, then no constraints will be set initially for variables in the new configuration set, otherwise the constraints will be copied from the corresponding variables in the configuration set named by the copyFrom parameter. Syntaxint rsRsiAddConfigVarSet ( RsiFile *hRsi, const char *name, const char *copyFrom, ); Parameters
Return Value
rsRsiRemoveConfigVarSetDelete a configuration variable set from .rsi file. Remove a configuration variable set from the .rsi file. Syntaxint rsRsiRemoveConfigVarSet (RsiFile * h, const char *Name); Parameters
Return Value
rsRsiGetNumConfigVarSetsNumber of configuration variable sets in an .rsi file. Return the number of configuration variable sets currently set in the .rsi file. Syntaxint rsRsiGetNumConfigVarSets (RsiFile *h); Parameters
Return Value Returns the number of configuration variable sets in the .rsi file
specified by the h parameter or -1 if an error occurred. In
that case, you may call rsGetLastError to retrieve the error message
string.
rsRsiGetConfigVarSetEnabledGet enabled/disabled status of a configuration variable set. Query the enabled/disabled status of a configuration set in the .rsi file. Syntaxint rsRsiGetConfigVarSetEnabled ( RsiFile *h, const char *name ); Parameters
Return Value
rsRsiSetConfigVarSetEnabledSet enabled/disabled status of a configuration variable set. Set the enabled/disabled status of a configuration variable set in the .rsi file. Syntaxint rsRsiSetConfigVarSetEnabled (RsiFile *h, const char *Name, int Enable ); Parameters
Return Value
rsRsiGetActiveConfigVarSetReturn name of currently active configuration variable set. Return the name of the currently active configuration variable set. Calls to rsRsiSetConfigVarType and rsRsiGetConfigVarType to modify and return the setting for the configuration variable in the currently active set. Syntaxint rsRsiGetActiveConfigVarSet (RsiFile *h, char *buffer, int bufferSize ); Parameters
Return Value
rsRsiSetActiveConfigVarSetSets the active configuration variable set. Change the currently active configuration variable set. Calls to rsRsiSetConfigVarType and rsRsiGetConfigVarType to modify and return the setting for the configuration variable in the currently active set. Syntaxint rsRsiSetActiveConfigVarSet (RsiFile *h, const char *Name); Parameters
Return Value
rsRsiGetConfigVarSetNameReturn name of a configuration variable set with the given index. Return the name of a configuration variable set. Syntaxint rsRsiGetConfigVarSetName ( RsiFile *h, int index, char *buffer, int bufferSize ); Parameters
Return Value
| ||||||||||||||||||||||||||||||||||