Sample function

float uz_SpeedControl_sample(uz_SpeedControl_t *self, float omega_m_rad_per_sec, float n_ref_rpm)

Calculates reference torque.

Parameters
  • self – pointer to uz_SpeedControl_t object

  • omega_m_rad_per_sec – mechanical rotational speed in rad/s

  • n_ref_rpm – reference speed in 1/min

Returns

reference torque in Nm

Example

Listing 107 Example function call to calculate the SpeedControl output. SpeedControl-Instance via init-function
1int main(void) {
2   float omega_m_rad_per_sec = 1.5f;
3   float n_ref_rpm = 500.0f;
4   float torque_out = uz_SpeedControl_sample(SC_instance, omega_m_rad_per_sec, n_ref_rpm);
5}

Description

Warning

The sample function has to be called with the same sample time as specified in the samplingTime_sec member of the configuration struct.

Calculates the reference speed into angular frequency and calculates the latest sample of the n-PI-Controller. Output is a reference torque. Furthermore, an external clamping signal can be set via a dedicated set function.