Module: saturationSingleActuator

Executive Summary

The saturationSingleActuator module applies optional saturation limits to a scalar actuator command. The module reads a SingleActuatorMsgPayload input message containing a scalar command \(u\). When saturation is enabled, the command is clamped between a user-defined minimum and maximum value,

\[u_{\text{out}} = \mathrm{clip}(u, u_{\min}, u_{\max})\]

When saturation is disabled, the input command is passed through unchanged.

Message Connection Description

The following table lists the module input and output messages.

Module I/O Messages

Msg Variable Name

Msg Type

Description

actuatorInMsg

SingleActuatorMsgPayload

Input scalar actuator command

actuatorOutMsg

SingleActuatorMsgPayload

Output saturated or pass-through actuator command

Module Functions

This module performs the following functions:

  • Reads the incoming scalar actuator command

  • Applies optional minimum and maximum saturation limits

  • Writes the resulting scalar actuator command to the output message

Module Assumptions and Limitations

  • Saturation behavior is enabled or disabled via a configuration flag

  • Minimum and maximum limits are independent and user-configurable

  • No rate limits, deadbands, or actuator dynamics are modeled

Test Description and Success Criteria

The unit test for this module is defined in test_saturationSingleActuator. The test applies a set of commands spanning values below, within, and above the configured limits. The test passes if the output command matches the expected clamped value when saturation is enabled, and exactly matches the input when saturation is disabled, within numerical tolerance.


class SaturationSingleActuator : public SysModel
#include <saturationSingleActuator.h>

Module that optionally saturates a scalar actuator command.

Public Functions

inline SaturationSingleActuator()

Constructor.

~SaturationSingleActuator() = default

Destructor.

void UpdateState(uint64_t currentSimNanos) override

Read input, apply optional saturation, and write output.

void setSaturationEnabled(bool enabled)

Enable or disable saturation.

Parameters:

enabled – True enables saturation, false passes commands through unchanged.

void setMinInput(double minInput)

Set minimum allowed actuator command.

Parameters:

minInput – Minimum command value.

void setMaxInput(double maxInput)

Set maximum allowed actuator command.

Parameters:

maxInput – Maximum command value.

Public Members

ReadFunctor<SingleActuatorMsgPayload> actuatorInMsg

Input actuator command.

Message<SingleActuatorMsgPayload> actuatorOutMsg

Output actuator command.

BSKLogger bskLogger

BSK logging.

Private Functions

double applySaturation(double inputValue) const

Apply saturation to an input value if enabled.

Parameters:

inputValue – Raw actuator command.

Returns:

Saturated or pass-through command.

Private Members

bool saturationEnabled = true

Flag enabling saturation.

double minInput = -std::numeric_limits<double>::infinity()

Minimum allowed command.

double maxInput = std::numeric_limits<double>::infinity()

Maximum allowed command.