Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor Regen Rate #805

Closed
ghost opened this issue Nov 9, 2016 · 9 comments
Closed

Capacitor Regen Rate #805

ghost opened this issue Nov 9, 2016 · 9 comments
Labels
discussion This is mostly a discussion thread

Comments

@ghost
Copy link

ghost commented Nov 9, 2016

This issue is just for visibility.
At the request of @Ebag333 I'm doing some research into capacitor regen.

Dust Puppys research (listed here http://wiki.eveuniversity.org/Capacitor_Recharge_Rate#Dust_Puppy.27s_Calculations ) is accurate. The constant is 5.0.

@Ebag333
Copy link
Contributor

Ebag333 commented Nov 9, 2016

Shield uses the same formula and constant as capacitor.

@blitzmann
Copy link
Collaborator

@ccplarrikin thanks for looking into this

@Ebag333 To confirm, we're using the same formula in pyfa, correct?

@Ebag333
Copy link
Contributor

Ebag333 commented Nov 9, 2016

Looking into it now. We use the right constant at least. :)

@Ebag333
Copy link
Contributor

Ebag333 commented Nov 9, 2016

So we currently seem to use this formula:

tau = self.capacitorRecharge / 5.0
cap = ((1.0+(sqrt(cap/capCapacity)-1.0)*exp((t_last-t_now)/tau))**2)*capCapacity

This is the correct formula:
Regen formula

If we rewrite what we use to be closer to the format of the actual formula, we get:
C1 = Cmax*[1.0+(sqrt(C0/Cmax)-1.0)*exp((t0-t1)/tau)]**2

So capacitor looks pretty good for our simulation. (Or at least, any problems with it do not rest with the formula used).

Walking through the section of code in question, I can see (what I believe to be) a problem.
t_last and t_now seem to be always 0 when the formula is calculated. That means we're always doing exp(0), which always equals 1.

It's because of:
t_now, duration, capNeed, shot, clipSize = activation
Every time we hit this, t_now gets reset to 0. So this is likely a problem.

Going further through the simulation, we have:
t_now += 10000 # include reload time
This isn't so much a wrong number as it is assuming that everything that has a clip has 10 second reload time. Not necessarily true (though I'll admit I don't know any modules offhand that this differs on).

@Ebag333
Copy link
Contributor

Ebag333 commented Nov 9, 2016

Okay, for regen.

Here's the formula we use (basically the same for both cap and shield):

        capacity = self.ship.getModifiedItemAttr("capacitorCapacity")
        rechargeRate = self.ship.getModifiedItemAttr("rechargeRate") / 1000.0
        return 10 / rechargeRate * sqrt(percent) * (1 - sqrt(percent)) * capacity

Couple problems off the bat with this.

One, we assume that percent is 25%. This isn't actually true.

Used this bit of code to spit out the amount you'd get for one tick at each percent:

from math import sqrt, exp

MaximumAmount = 4653.6525
tau = 60771.9922442 / 5.0
percent = 0

while percent < 100:
    StartingAmount = MaximumAmount*(percent/100)
    EndingAmount = ((1.0+(sqrt(StartingAmount/MaximumAmount)-1.0)*exp((0-1000)/tau))**2)*MaximumAmount
    print(str(percent) + "% " + str(EndingAmount-StartingAmount))
    percent += 1

(Capacitor Amount and Time are from a regenGu fit.)

So with a Vengeance fit I have, the max amount added is at 24%. Tried a regenGu fit, that has a max amount at 23%. It can probably go the other way (above 25%) with the right numbers, didn't find any off hand. Is it terribly far off? No, even with the extreme regenGu it looks like it's off by about .4 GJ/s (at 25%, it's only .1 GJ/s away from the actual max at 23%).

Since it's pretty trivial to figure out what percentage the max cap regen is, there's no reason why we shouldn't do that.

As for the formula used, I don't see any reason why we shouldn't be using the actual regen formula. What we're using today is a fair amount different, and clearly it's giving out incorrect (though close) numbers.

@Ebag333
Copy link
Contributor

Ebag333 commented Nov 9, 2016

@blitzmann What I'd like to do is to break both shield and cap out into their own stand alone module. Couple advantages to this.

  1. Reuse of a simple function call rather than copy/pasta of code between functions.
  2. Can use for new Pyfa service as well as old Pyfa
  3. I'm already doing this (and mostly already done). :P

It's being done under my own repo, but if you'd like to open another repo under the pyfa-org umbrella I can move it there. Would like to get that setup before I publish to PyPi.

@Ebag333
Copy link
Contributor

Ebag333 commented Nov 10, 2016

Testing this a bit.

Fit used:

[Vengeance, Heavy Tackle]

Small Ancillary Armor Repairer
Reactive Armor Hardener

5MN Quad LiF Restrained Microwarpdrive
J5b Enduring Warp Scrambler
X5 Enduring Stasis Webifier

Small Energy Nosferatu II

Small Auxiliary Nano Pump II

Everything on except the MWD. No paste, no heat, no implants/drugs/etc. All V char.

Pyfa says:
https://puu.sh/sd1Ub/9cef01943a.png

Using the simulation I wrote, we get:
Cap stable at 41.07%
Peak regen at 24% at 8.887 GJ/s

Here's the block of code I used to populate the simulation and cap regen matrix:

from simulations.capacitor import Capacitor
from formulas.formulas import Formulas

module_list = []

capacitor_amount = 375
capacitor_recharge = 105468.75

module_list.append(
    {
        'Amount': 10,
        'CycleTime': 2500,
        'Charges': False,
        'ReloadTime': False,
    }
) # Small T2 Nos

module_list.append(
    {
        'Amount': -1.5,
        'CycleTime': 5000,
        'Charges': False,
        'ReloadTime': False,
    }
) # J5b Enduring Warp Scrambler

module_list.append(
    {
        'Amount': -1.5,
        'CycleTime': 5000,
        'Charges': False,
        'ReloadTime': False,
    }
) # X5 Enduring Statis Webifier

module_list.append(
    {
        'Amount': -40,
        'CycleTime': 4500,
        'Charges': False,
        'ReloadTime': False,
    }
) # Small Ancilliary Armor Repairer

module_list.append(
    {
        'Amount': -10.5,
        'CycleTime': 5000,
        'Charges': False,
        'ReloadTime': False,
    }
) # Reactive Armor Hardener

return_value = Capacitor.CapacitorTimeSimulator(module_list, capacitor_amount, capacitor_recharge)
return_matrix = Formulas.capacitor_shield_regen_matrix(capacitor_amount, capacitor_recharge)
pass

You can use the repo at: https://github.com/Ebag333/EVESimulator2001

@blitzmann
Copy link
Collaborator

Haven't had time to properly review much of this. However, @OISumeko could you perhaps take a peak at the discussion here?

@blitzmann blitzmann added the discussion This is mostly a discussion thread label Nov 30, 2016
@blitzmann
Copy link
Collaborator

trying to clean up issues that aren't really issues, so closing this. Thanks for the discussion everyone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This is mostly a discussion thread
Projects
None yet
Development

No branches or pull requests

2 participants