- Custom Development
Important: this note covers the original I2t protection. If you programmed your Regulate before September 2018 that's what you have. After September 2018 we released an improved version (I²t current limit: Programmable Fuse (v2.0)). The foundation is the same, but handy new features have been added.
FlexSEA-Execute and FlexSEA-Battery/Regulate have an optional I²t protection. This piece of code allows the user to select limits for average and peak currents (of a certain duration). It is essentially a programmable fuse that can be used to protect the circuits, but also the robot that used FlexSEA.
The Matlab/Octave script below allows users to generate the proper constants for the C code. The example uses 5A average, and a peak of 30A for no longer than 2.5s.
% I2t current limit: user % JFDuval, Dephy, Inc. 06/14/2017 % Note: use this file to get your #define values. i2t_1.m can be used to test % your values with different profiles. clc; close all; clear all; format short eng % Period, i2t_compute() call: dt = 100e-3; %Every 100ms disp('Program these values in i2t-current-limit.h:') disp('============================================') % The algorithm uses 8-bit values: we need to scale down the maximum current % accordingly. It uses real units (mA). Ex.: ±30000mA sensor => % 30000/256 = 117 => shift 7 (div by 128). 30A will give us 234 I2C_SCALE_DOWN_SHIFT = 7 % Closest bitshift available SCALE = 128; % (Octave only, avoids bitwise operations) % Maximum average current you want to support: maxAvgCurrent = 5000; %mA I2T_LEAK = (maxAvgCurrent / SCALE)^2 % Maximum current you want to support, and duration: currentLimit = 30000; %mA currentLimitTime = 2.5; %s I2T_LIMIT = (currentLimitTime / dt) * ((currentLimit/SCALE)^2 - I2T_LEAK) %At what fraction of the max to you want a warning? (0-1) warn = 0.8; I2T_WARNING = warn * I2T_LIMIT % Plotting: CURR = maxAvgCurrent:1000:30000; tmp = (CURR./SCALE).^2; time = (I2T_LIMIT * dt) ./ ( tmp - I2T_LEAK ); figure() plot(CURR, time) title('Time before reaching the I2t limit') xlabel('Current (mA)') ylabel('Time (s)') disp('Time at 6A:') CURR = 6000; tmp = (CURR./SCALE).^2; time = (I2T_LIMIT * dt) ./ ( tmp - I2T_LEAK )
The script will output constants, and a plot:
Program these values in i2t-current-limit.h: ============================================ I2C_SCALE_DOWN_SHIFT = 7.0000e+000 I2T_LEAK = 1.5259e+003 I2T_LIMIT = 1.3351e+006 I2T_WARNING = 1.0681e+006 Time at 6A: time = 198.8636e+000
The examples below are based on a Pocket board with a ±5A sensor, 1.5A continuous and 5A 500ms limit.
Program these values in i2t-current-limit.h: ============================================ I2C_SCALE_DOWN_SHIFT = 5.0000e+000 I2T_LEAK = 2.1973e+003 I2T_LIMIT = 111.0840e+003 I2T_WARNING = 88.8672e+003 Time at 1.6A: time = 36.6935e+000
2.5A continuous, 15A for 1s, non-linearity at 22.5A:
I2C_SHIFT = 7.0000e+000 (7) I2T_LEAK = 381.4697e+000 (381) I2T_LIMIT = 133.5144e+003 (133514) I2T_NON_LINEAR_THRESHOLD = 175.7812e+000 (176) Time at given current (mA): CURR = 25.0000e+003 time = 353.5354e-003 timeNL = 87.7193e-003
10A continuous, 15A for 1s, non-linearity at 20A:
I2C_SHIFT = 7.0000e+000 (7) I2T_LEAK = 6.1035e+003 (6104) I2T_LIMIT = 76.2939e+003 (76294) I2T_NON_LINEAR_THRESHOLD = 156.2500e+000 (156) Time at given current (mA): CURR = 25.0000e+003 time = 238.0952e-003 timeNL = 22.6244e-003