-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mathematical Operation in Vspec #738
Comments
I am not sure if I fully understand the context of the issue. We do not have |
Hi @erikbosch, That is correct. I'm exploring the possibility of implementing mathematical operations on two standard signals to obtain their values when using the 'getValue' function on a third signal. I've attached the current selected signal below. My question is whether we can perform mathematical operations on two standard signals within the 'math' field of another third signal.
|
That would be doable, it seems quite similar to what the Eclipse Kuksa project is doing when providing metadata fro CAN/DBC to VSS mapping, see https://github.com/eclipse-kuksa/kuksa-can-provider/blob/main/mapping/README.md. But VSS/VSS-tools only help you with bringing the info to your target output format. Eclipse Kuksa for instance use vspec2json.py to convert the VSS catalog with the extra info given by an overlay. Then it traverse JSON itself and do what it does. The possibility to express that a signal is derived from other signals and express how is mentioned as a useful feature now and then, but so far there have not been initiatives to standardize any specification format, or to create any helper features in vss-tools to validate/evaluate given info. |
Although including that information in VSS is possible, I haven't seen a strong interest in doing so. The main reason is that such information can be part of the queries that are served by an API. Another (simpler) example is issue #690 , where the intention was to model a property multiple times to have in the specification placeholders referring to different units. Such things can be handled in the API directly. If having a formal specification of such derived in formation is interesting for you, then you might like the proposal to adopt the GraphQL schema language as the main language for VSS. Your example could look like: # Query definition
type Query {
timeToCompleteCharging(
stateOfChargeCurrent: Float! # parameter x
chargeRate: Float! # parameter y
): Float
} # Resolver function (that implements the logic)
const resolvers = {
Query: {
timeToCompleteCharging: (_, { stateOfChargeCurrent, chargeRate }) => {
return (72 * (1 - stateOfChargeCurrent)) / ((chargeRate * 120) / 1000);
},
},
// Other resolvers, if any
}; |
MoM:
|
Regarding the specification for Vehicle.Timeincurrentrip, could you please clarify if it's possible to utilize the variables x and y defined in the parameters section to perform a mathematical operation in the transform block to calculate the value of Time in current trip? If so, what specific mathematical operation should be applied using these variables?
I'm currently exploring the possibility of performing mathematical operations on two signals under a signal math transform. Specifically, I'd like to calculate the average time in the current trip by subtracting the start and stop times. Could you please provide guidance on how I can achieve this within the signal math transform?
The text was updated successfully, but these errors were encountered: