blockDetectCommutationIntBEMFext

Detects sensorless when commutation is required by back EMF integration - extended method

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

TypeNameDefaultDescription
Modelica.SIunits.DurationDelayCommutation (from DetectCommutationPartial)5e-005Delay commutation
RealminEMF (from DetectCommutationPartial)0.5Minimum EMF for good speed
BooleansampleHitrueSample when PWM signal is high when true
BooleansampleLotrueSample when PWM signal is low when true
BooleansampleAlltrueUse all samples
Integerdropnoisysamples1Drop samples with switching noise
Integerbufsize10Size of buffer
Realperiod_adc1e-6
Modelica.SIunits.TimeTs_ADC1e-6Sample rate of ADC
Realvdivider3.6/13.6Voltage divider of phase voltage
IntegerNREG10Number of samples for a valid regression
BooleanmodeSlopetrueTrue for slope detection mode; false for ZeroCrossing only

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.RealInput[3]bridgeState (from DetectCommutationPartial)
Modelica.Blocks.Interfaces.RealInput[3]v (from DetectCommutationPartial)Voltage per phase
Modelica.Blocks.Interfaces.RealInputv_dc (from DetectCommutationPartial)dc link voltage
Modelica.Blocks.Interfaces.BooleanInputsenseBEMF (from DetectCommutationPartial)BEMF sensing active
Modelica.Blocks.Interfaces.BooleanOutputy (from DetectCommutationPartial)Commutate when true
Modelica.Blocks.Interfaces.BooleanOutputspeedOK (from DetectCommutationPartial)Sufficient EMF for good commutation
Modelica.Blocks.Interfaces.RealInputKV (from DetectCommutationPartial)Voltage constant
Interfaces.PwmControlBusConnectorInpwmControlBusConnectorIn (from DetectCommutationPartial)

Components

TypeNameDefaultDescription
Integer[3]bridgeStateInt (from DetectCommutationPartial)
IntegersenseBridgeID (from DetectCommutationPartial)
RealsenseBridgeSign (from DetectCommutationPartial)
Integerv_dc_intADC value of dc link voltage
Integerk_cb_ADCIncrements at each the ADC callback
Integersumxcomputes sum of x (time-axis)
Integersumx2computes sum of x**2
Integersumxycomputes sum of x * y
Integersumycomputes sum of y
Integersumy2computes sum of y**2
Integern_regnumber of elements in list
Integer[NREG]yregCircular buffer for y
Integer[NREG]xregCircular buffer for x
Integerk_sampleSample in the present commutation cycle
Integerpwm_dutyCycle_int
Integerpwm_period_intPWM period relating to period_adc
Integerk_pwm_periodIndicates if the pwm sample ocurred at pwm-on
BooleantakesampleHiIs true when high sample will be evaluated
BooleantakesampleLoIs true when low sample will be evaluated
Integerk_zcSample when the zero crossing occurs
IntegerKV_intInteger equivalent of KV
Realduration_zc2comm_intDuration from zero crossing to next commutation
Realm_regSlope
Realb_regy-intercept
Realtime_blockstartTime when last block started
Realtime_nextblockTime when next block (commutation) will occur
Realtime_last_zcTime of last zero crossing (when modeSlope=false)
RealmaxBEMFMax EMF in this cycle
Realv_senseSensed voltage at the open motor pin, referenced to v_dc/2
Sensors.ADCs.AdcSingleBufferedIntegeradcSingleBufferedInteger
Modelica.Electrical.Analog.Basic.Groundground
Modelica.Electrical.Analog.Sources.SignalVoltagesignalVoltage