常见问题

Need technical support?

How can I get the maximum value of a User Accessible Quantity (UAQ) for the whole simulation?

Question

How can I get the maximum value of a User Accessible Quantity (UAQ) for the whole simulation?

Solution

In the maneuver commands, you can use the RealTimeExpressions function max().

The max-function returns the maximum value of the given arguments.
The best way to get a maximum value of one quantity for the whole simulation is the following approach. Add the following commands in the Global Maneuver commands:

first() ? Qu::max_speed = 0
max_speed = max(Car.v,max_speed)

The variable "max_speed" is there to save the maximum value.
Then each simulation cycle we compare the current speed "Car.v" with the maximum value.
Which of both is bigger is saved as the new maximum speed.

You can check this screenshot to see how the values change:

Need technical support?
  • Date: 01.08.2023
  • Product: CarMaker
  • Version: 12.0
  • Component: RT Expressions
  • Language: English

Tags

RealTime Expressions
Maneuver Commands
User Accessible Quantities