blockDetectCommutationIntBEMFext
Extends from DetectCommutationPartial (I/O ports for commutation detection algorithm).
Information
This block determines the time when the next commutation has to occur by detecting the zero crossing and (if enabled) the slope of the voltage of the open motor phase. The back-EMF is sampled with an ADC. The ADC callback is executed each time its buffer is (half-) full, i.e. when ...cbStart .... The ADC buffer is then evaluated by for f in 1:bufsize loop... Depending on the selected PWM method, it may be required to evaluate only the samples during t_on or t_off. Furthermore some potentially noisy samples that are close to PWM switching events can be droped by adjusting the dropnoisysamples parameter. All good samples are stored in a circular buffer of the size NREG where yreg[NREG] are the sampled values and xreg[NREG] are their respective indexes. The voltage zero crossing is determined by applying a linear fit to all good values in the buffer. The index of the calculated zero crossing (from the beginning of the ADC measurement) is k_zc. This is not neccessarily the index of a valid sample. The time of the next commutation event time_nextblock is either calculated by evaluation of the voltage slope (if modeSlope) or the duration of the last voltage zero crossing. Note that the second method will work robustly with the most motors while the first method potentialy provides better dynamic response / acceleration while it may cause trouble with motors with an "ugly" back EMF shape.
TODO:
1. Investigate the spike that occurs single leg mode as in Test.Commutation.IntBEMF3.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.SIunits.Duration | DelayCommutation (from DetectCommutationPartial) | 5e-005 | Delay commutation |
| Real | minEMF (from DetectCommutationPartial) | 0.5 | Minimum EMF for good speed |
| Boolean | sampleHi | true | Sample when PWM signal is high when true |
| Boolean | sampleLo | true | Sample when PWM signal is low when true |
| Boolean | sampleAll | true | Use all samples |
| Integer | dropnoisysamples | 1 | Drop samples with switching noise |
| Integer | bufsize | 10 | Size of buffer |
| Real | period_adc | 1e-6 | |
| Modelica.SIunits.Time | Ts_ADC | 1e-6 | Sample rate of ADC |
| Real | vdivider | 3.6/13.6 | Voltage divider of phase voltage |
| Integer | NREG | 10 | Number of samples for a valid regression |
| Boolean | modeSlope | true | True for slope detection mode; false for ZeroCrossing only |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.RealInput[3] | bridgeState (from DetectCommutationPartial) | ||
| Modelica.Blocks.Interfaces.RealInput[3] | v (from DetectCommutationPartial) | Voltage per phase | |
| Modelica.Blocks.Interfaces.RealInput | v_dc (from DetectCommutationPartial) | dc link voltage | |
| Modelica.Blocks.Interfaces.BooleanInput | senseBEMF (from DetectCommutationPartial) | BEMF sensing active | |
| Modelica.Blocks.Interfaces.BooleanOutput | y (from DetectCommutationPartial) | Commutate when true | |
| Modelica.Blocks.Interfaces.BooleanOutput | speedOK (from DetectCommutationPartial) | Sufficient EMF for good commutation | |
| Modelica.Blocks.Interfaces.RealInput | KV (from DetectCommutationPartial) | Voltage constant | |
| Interfaces.PwmControlBusConnectorIn | pwmControlBusConnectorIn (from DetectCommutationPartial) |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Integer[3] | bridgeStateInt (from DetectCommutationPartial) | ||
| Integer | senseBridgeID (from DetectCommutationPartial) | ||
| Real | senseBridgeSign (from DetectCommutationPartial) | ||
| Integer | v_dc_int | ADC value of dc link voltage | |
| Integer | k_cb_ADC | Increments at each the ADC callback | |
| Integer | sumx | computes sum of x (time-axis) | |
| Integer | sumx2 | computes sum of x**2 | |
| Integer | sumxy | computes sum of x * y | |
| Integer | sumy | computes sum of y | |
| Integer | sumy2 | computes sum of y**2 | |
| Integer | n_reg | number of elements in list | |
| Integer[NREG] | yreg | Circular buffer for y | |
| Integer[NREG] | xreg | Circular buffer for x | |
| Integer | k_sample | Sample in the present commutation cycle | |
| Integer | pwm_dutyCycle_int | ||
| Integer | pwm_period_int | PWM period relating to period_adc | |
| Integer | k_pwm_period | Indicates if the pwm sample ocurred at pwm-on | |
| Boolean | takesampleHi | Is true when high sample will be evaluated | |
| Boolean | takesampleLo | Is true when low sample will be evaluated | |
| Integer | k_zc | Sample when the zero crossing occurs | |
| Integer | KV_int | Integer equivalent of KV | |
| Real | duration_zc2comm_int | Duration from zero crossing to next commutation | |
| Real | m_reg | Slope | |
| Real | b_reg | y-intercept | |
| Real | time_blockstart | Time when last block started | |
| Real | time_nextblock | Time when next block (commutation) will occur | |
| Real | time_last_zc | Time of last zero crossing (when modeSlope=false) | |
| Real | maxBEMF | Max EMF in this cycle | |
| Real | v_sense | Sensed voltage at the open motor pin, referenced to v_dc/2 | |
| Sensors.ADCs.AdcSingleBufferedInteger | adcSingleBufferedInteger | ||
| Modelica.Electrical.Analog.Basic.Ground | ground | ||
| Modelica.Electrical.Analog.Sources.SignalVoltage | signalVoltage |