How to simulate a square wave current control on a BLDC motor

Goodmorning,

as the title of this question states I would like to know how to simulate a BLDC motor with a square wave current using PLECS,
TI Launchpad F28069M, the TI DRV8305EVM inverter and the BLDC QBL42018-100 motor from Trimac.

I see on https://www.plexim.com/sites/default/files/demo_models_categorized/rtbox/launchpad_interface_demo.pdf that what I’m trying to do is possible
but this example is for RT-Box which I don’t have and can’t use.

My aim is to use the Hall signals as a position sensor so that a square wave current control would be possible. Same signals, as the example above states, are inputs for the duty cycle calculation.
Are there specific examples for this?

I get the theoretical basis about square wave commutation and the PWM chopping related to it, but I’m struggling translating this into PLECS:
the PWM modules from the library don’t have a “Chopper” window like Symulink has, so I find quite difficult creating the PWM Chopping by using a C-Script.

Is it possible to create such control using PLECS blocks from library with proper manipulation of the signals or is it required to use ad-hoc blocks which library doesn’t have?

Attached you can find the file I’m working on where the Hall signals are imported via digital inputs and are later manipulated via a C-script to calculate which sector is
at the moment.
Duty cycles are still calculated form a current loop in the bottom side of the file where current are read by an ADC and then transformed into DQ quantities.

Hoping I’ve been clear enough, I wish someone will answer me.
Thanks in advance,

Alberto

sqrWAVE_hall.zip (11.6 KB)

Contacted the requestor directly to discuss this question.

  • Manu