apply_rules

PWMControl.apply_rules() None

It applies all the rules in order to get a valid pwm value to set to the powertrain’s motor.

It loops over listed rules and applies all of them:

  • if a single rule returns a valid pwm, then this value is set as powertrain’s motor pwm,

  • if more than a single rule returns a valid pwm, then it raises a ValueError, since multiple rules are valid at the same time and it is not possible to identify which pwm value to use,

  • if no rule returns a valid pwm, then it sets powertrain’s motor pwm to 1.

Before settings the pwm, its value is saturated in order to be within -1 and 1.

Raises

ValueError

If two different rules are applicable at the same time. Only a single applicable rule is allowed to a specific simulation time.