Jump to main content

##

# 3.3.2 mcFocI_FieldOrientedControlEnable

## C

    /* Enable Field Oriented Control (FOC) module */
    void  mcFocI_FieldOrientedControlEnable( tmcFocI_ModuleData_s * const pParameters )

## Summary

Enable Field Oriented Control (FOC) module

## Description

This function enables the field-oriented control (FOC) module by linking the state variables and initializing the module if necessary. It checks the FOC initialization state, initialize the module if not initialized, and then enable the following control modules using state variables and sets the enable flag:

- Open Loop Start-Up Module: Enables the open loop start-up module using `mcSupI_OpenLoopStartupEnable`.
- Reference Control Module: Enables the reference control module using `mcRefI_ReferenceControlEnable`.
- Position Control Module: Enables the position control module using `mcPosI_PositionControlInit` in position control mode.
- Speed Control Module: Enables the speed control module using `mcSpeI_SpeedControlEnable`.
- Torque Control Module: Enables the torque control module using `mcTorI_TorqueControlEnable`.
- Flux Control Module: Enables the flux control module using `mcFlxI_FluxControlEnable`.
- Flux Weakening Module: Enables the flux weakening module using `mcFlxI_FluxWeakeningEnable` if field weakening is enabled.
- MTPA Module: Enables the Maximum Torque Per Ampere (MTPA) module using `mcFlxI_MTPAEnable` if MTPA is enabled.
- Rotor Position Estimation Module: Enables the rotor position estimation module using `mcRpeI_RotorPositionEstimEnable` for sensor-less FOC operation.
- PWM Module: Enables the Pulse Width Modulation (PWM) module using `mcPwmI_PulseWidthModulationEnable`.

## Precondition

None.

## Parameters

Param | Description
--- | ---
pParameters | A pointer to the module data structure, which contains the parameters and state variables for the FOC module.

## Returns

None

## Example

    // Define the FOC module data structure
    tmcFocI_ModuleData_s focModuleData;

    // Enable the FOC module
    mcFocI_FieldOrientedControlEnable(&focModuleData);

## Remarks

None.