Hi David,
Sorry for delay - i just sow your replay here. Please use @ to mention me - this way i'll get an email from the system - otherwise it goes to bulk where is harder to sort it out.
1. In respect with available demos for the PMSM with encoder/resolver position feedback we do not have such Simulink models yet. In fact i asked my co-workers and we do not have no such model for any other platforms - this is something i need to address in the near future.
2. The PMSM is quite different than BLDC. Starting from BLDC you will need to modify the PWM configuration to allow all 3 phases on, then you will need to initialize and read the resolver/encoder to get the position and finally you need to change the control loops to work in the DQ reference system. This can be easy done with the AMMCLIB Simulink blocks.
3. If you have parts of the code already written in the C or ASM you can call such code from the Simulink model.
Please have a look of these links to see how to interconnect custom code with Simulink models:
- https://community.nxp.com/message/910444?commentID=910444#comment-910444
- https://community.nxp.com/message/900776?commentID=900776#comment-900776
- https://community.nxp.com/thread/449904#comment-901737
4. Assuming you know the Motor Control theory behind the PMSM - I would start with:
- i. read the position sensor and compute the speed/position. You can do this without applying voltage to the motor.
- ii. create a simple open loop model to drive the motor in V/f. This will give you the opportunity to test the power stage/PWM
- iii. create the current closed loop system: using the V/f to spin the motor - use the ADC to read the phase currents and AMMCLIB ABC2ab and ab2dq transformations (Park/Clarke) to get the torque and flux quantities.
- iv. only after iii, is up and running i would go further and close the outer loop (speed/position) and tune the controllers.
- v. implement various functionalities like protections/signaling/etc.
If you have some experience with Motors/Drives and Model Based Design that should take you about 3-4 weeks to complete all 5 stages.
Best regards,
Daniel