i defined a sysvar as a string in CANalyzer to use it with a panel.
Then in a CAPL a would like to get the value of this variable and save the name,i tried as i usually do in CAPL with the numbers so:
write("%s",#namespace::name_of_variable)
But i got an error saying tha the '#' should be used only for integer or float variables. How can i get the value of this string and save it in a local variable to reused it in a CAPL?
Thanks in advice.
The CAPL function you are looking for is sysGetVariableString
Usage is as follows:
char value[100]; //has to be big enough to hold the value
sysGetVariableString(sysvar::namespace::name_of_variable, value, elcount(value));
Related
If I create new project and I call this string predefined function or extern variables all works fine. But when I continuously modified or did some operation with those string function or variables then those functions are not working properly and shows some junk characters at the UART output.
It may because of the memory issue. please check the buzzer size if it is string array, make sure if are you using string then at end of the buzzer put the null ('\0') terminate.
If you are modifying variable in different process or function , please try to use "volatile " key word for the update.
Thank you.
Ketan
The Problem: An agent has a parameter that refers to an object (lets say an INode). I want to get and use the name of that INode as plain text without writing a function that maps INodes to their names. If currentLocation (which has a value of Node12) is the parameter, in a snippet, it looks like:
agent.currentLocation
Is there a name property of Parameters or other Objects that i can reference and it returns a String (just the text "Node12" in this case)? I have tried all kinds of references with parameter.name, getValue, etc, to no avail.
For INodes you can use myNode.getName(), as you can for every object in Java.
However, you cannot get the name of parameters, variables, etc. And you shouldn't do that, it is considered bad practice :-)
I have a string that stores a signal name extracted from an excel file.
I want to dynamically assign the name of the signal using the string, if I have many such signals.
For example, if I have a signal called 'speed' in my dbc file, and I have a string that stores 'speed', I need to set the value of signal 'speed' as 100.
variable
{
message BCM BCM;
char signal[100]= "speed";
}
on message *
{
$signal= 100;
}
The error I get is:
Error: Identifier 'signal' does not have a signal type.
Is there a workaround to this problem, such that I can convert the string into a signal name by some means?
You are mixing the variable formats like this. The only object on which you can use $ is dbSignal type. What you would need is a function like getSignal(dbSignal name);, but with char[] parameter.
Sadly, Vector did not implement such workaround, leaving you the only option to pass your signal strings by testcase parameters (if you are using XML Test nodes).
Since, I presume you have too many, I suggest you write a script in another scripting language constructing the text of the .can file itself, filling the place of dbsignals with the strings from the excel, then use the .can file for testing/simulation.
I am using Steam to attempt to build a prediction service using a python preprocessing script. When python passes the cleaned data to the prediction service in the
variable:value var2:value2 var3:value3
format (as seen in the Spam Detection Example) I get a
ERROR PredictPythonServlet - Failed to parse
error from the service. When I look at the PredictPythonServlet.java file it seems to only use the strMapToRowData function which assumes every value in the input string is a number:
for (String p : pairs) {
String[] a = p.split(":");
String term = a[0];
double value = Float.parseFloat(a[1]);
row.put(term, value);
}
Are character values not allowed to be sent in this format? If so is there a way to get the PredictPythonServlet file to use the csvToRowData function that is defined but never used? I'd like to not have to use One-Hot encoding for my models so being able to pass the actual character string representation would be ideal.
Additionally, I passed the numeric representation found in the model pojo file for the categorical variables and received the error:
hex.genmodel.easy.exception.PredictUnknownTypeException: Unexpected object type java.lang.Double for categorical column home_team
So it looks like the service expects a character string but I can't figure out how to pass it along to the actual model. Any help would be greatly appreciated!
The prediction service is using EasyPredictModelWrapper and it can only use what the underlying model uses. Here it's not clear what model you use, but most use numerical float values. In the for loop code snippet you can see that the number has to be float.
I am getting a run time error '6' Over Flow in vb 6
The "Overflow" error means that you are trying to put a number into a variable (or property etc), and the data type of the variable doesn't allow numbers that large.
Make sure that numbers used in calculations that are coerced into integers do not have results larger than integers.
What is the type of the data in the database?
My guess is that ADO returns it as either a String or a Decimal, and Decimal values only "fit into" a Variant in VB6.
VB6 has no syntax for a Decimal literal, however you can use something like:
CDec(111010114289#)
... inline, or declare a Const as in:
Private Const BigVal As Currency = 111010114289#
I you have to put a large number in a small variable, like C, check Remove integer bound check in project properties (if you are not compiling as PCode)