The motor model uses two resistances: motor resistance Rm and series resistance Rs. These are used to compute time constants and current contstants for generating waveforms for the Hbridge ON phase and OFF phases.
tau_ON = L/(Rm + Rs)
tau_OFF = L/(Rm)
Also the steady state current constants are affected by resistances:
i_ss_ON = (V_battery – V_bemf)/(Rm +Rs)
i_ss_OFF = -(V_diode + Vbemf)/Rm
These constants basically assume that the PTC resistances are incorporated into Rs during the ON phase and negligible for the OFF phase. Typically, Rs that best fits test data is .3 ohms according to Jpearman. The Rm is 1.5 ohms for a 393 and 2.5 for a 269 motor.
Incorporating the PTC requires an understanding of the Vex power distribution schematic shown below:(Click to expand)
The two PTC resistances involved are the Cortex Rptc_c and the motor PTC resistance Rptcm. They affect the controller voltage and the time constants of the H-bridge.
Voltage Drop: Rptc_c causes a voltage drop between V_battery measuring point and the controller. The voltage drop is Rptc_c*i_1_5 where i_1_5 is the sum of the current draws from ports 1-5 on the cortex. These currents have been assumed to be the average currents from each of the motors in the PTC monitor software. This however is very conservative since the current draw from the battery is zero for a motor during the OFF phase of the PWM controller cycle. For example, when the motor current of a 393 is at its safe current of .9 amps, the ON phase current is about 0.33 amps or 37% of i_m.
The current model computes the average current per PWM cycle as
i_avg = i_ss_ON*duty_ON + i_ss_OFF*duty_OFF
where i_ss_ON*duty_ON is the average current over a PWM cycle caused by the ON PWM pulse. This should be used in the computation of the cortex currents rather than the total motor current i_avg.
Vc = V_battery – Rptc_c*i_1_5
should be used as the input voltage to the current model rather than V_battery which we are using now.
Rptc_c for the HR16-400 is only 18 mohms. Typically the maximum current for a cortex bank is from 3 motors at stall or 4.8*3 = 14.4 amps. This can lead to a voltage drop of .26 volts. One might argue that Rptc_c effects can be ignored.
Time Constants: By inspection from the figure we can see that the series resistances in the controller-motor loop in series with the motor resistance Rm are slightly different for the ON and OFF phases.
R_s_ON = Rptcm + 2*Rwire + 2*Rfet.
R_s_OFF = Rptcm + 2*Rwire + Rfet. (it has one less FET in its path)
The time constants are :
tau_OFF = L/(Rm + R_s_OFF)
tau_ON = L/(Rm + R_s_ON)
Rwire is the wire resistance down stream of the controller. The upstream wire resistance is assumed negligible. 1 foot of wire is assumed for each power and ground leg and at 10 mohms per ft, Rwire = 10 mohms.
Rfet is the ON source-drain resistance of the MOSFET. This is about 20 mohms for both the high and low side MOSFETs.
Rptcm is the motor PTC reference resistance at 25 deg C. For the 393 Rptcm = 140 mohms and for the 269 Rptcm = 110 mohms.
Plugging in to the above formulas for a 393 motor gives
R_s_OFF = 140 + 20 + 40 = 200 mohms (.2 ohms)
R_s_ON = 140 + 20 + 20 = 180 mohms (.18 ohms)
Since there is only 20 mohms difference and these are added to Rm which is 1500 mohms I would recommend using one time constant:
tau = tau_ON = tau_OFF = L/(Rm + R_s) where R_s = 200 mohms.
Using a similar argument for the 269 we would have R_s = 170 mohms
The current constants are modified similar to the time constants:
i_ss_ON = (V_c – V_bemf)/(Rm +Rs_on) …. using V_c rather than V_battery
i_ss_OFF = -(V_diode + Vbemf)/(Rm + Rs_off)
We can also use the approximation Rs_on = Rs_off = Rs as we did for the time constants.
Having said all this , the differences discussed may or may not be noticible in the results and I wouldn’t be too uncomfortable keeping things the way they are since much of the testing done by Jpearman has shown adequate results with the present model.