MV Active Time/Time Progress Battle System Logic

Ok, so I've recently come to the conclusion I'm going to have to write my own ATB/TPB system. This is mostly because I use LeTBS (LeCode's Tactical Battle System), which obviously makes all the available plugins incompatible. I've tried posting on Classifieds, but to no avail. The way I see it is, all the turn phases and unit turn code are already set up. I just need to replace LeTBS's default turn order formula. This is what's already there:
JavaScript:
BattleManagerTBS.determineTurnOrderSimple = function () {
    var array = [];
    this._turnOrder = [];
    this._activeIndex = 0;

    this.allPlayableEntities().forEach(function (entity) {
        array.push(entity);
    });
    array = array.sort(function (a, b) {
        return eval(Lecode.S_TBS.turnOrderSortMethod);
    });

    this._turnOrder = array;
    this._turnOrderVisual.set(this._turnOrder);
};
...where Lecode.S_TBS.turnOrderSortMethod is: b._battler.luk - a._battler.luk
Thus, I need to apply the ATB/TPB logic on the ._turnOrder array.

So let's say we have 4 units in a battle; 2 actors & 2 enemies. They have the following SPEED (Luck):
  • Actor1: 20
  • Actor2: 12
  • Enemy1: 10
  • Enemy2: 18
Therefore, Actor1's turn should come twice as often as Enemy1. And for every 2 turns by Actor2, Enemy2 would get 3. How would we do the math for this?

Edit: It looks like ._activeIndex is what I need to manipulate. The default code simply has the index start at 0 (aka the fastest unit, which is the 1st in the array) and then increments from there, cycling back to 0 when it hits a value equal to the number of battlers.
JavaScript:
BattleManagerTBS.nextTurn = function () {
    do {
        this._activeIndex++;
        if (this._activeIndex >= this._turnOrder.length) {
            this._activeIndex = 0;
            this.onTurnOrderEnd();
        }
    } while (this.activeEntity()._dead);
    if (this.activeEntity().isTurnHidden()) {
        this.nextTurn();
        return;
    }
    this._turnOrderVisual.updateOnNextTurn(this._turnOrder, this._activeIndex);
    this.startTurn();
};

So I'm thinking...I need to have each unit start counting/incrementing a value equal to the unit's Speed ÷ the fastest unit's Speed. Whenever it crosses a whole number/integer, that'll be a turn. Or an action rather...a "turn" would occur once the # of actions equals the # of battlers, which is 4 in this example's case.

Edit2: I found these very informative threads!

Original thread: https://forums.rpgmakerweb.com/threads/active-time-time-progress-battle-system-logic.141688/