Advertisement
Guest User

EVE PI extractor calculation code

a guest
Aug 7th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.01 KB | None | 0 0
  1.         List<float> CalculateExtractorValues()
  2.         {
  3.             //Corresponding ingame view: http://i.imgur.com/2LWLj2w.png
  4.             //Graph of this code: http://i.imgur.com/6VsmWCX.png
  5.             int sec = 1;
  6.             List<float> values = new List<float>();
  7.             int installTime = 0;
  8.             int expiryTime = 171000; //1d 23h 30m; from API expiryTime-installTime
  9.             int cycleTime = 30*60; //30 minutes, value from API * 60
  10.             int quantityPerCycle = 6965; //Value from API
  11.             int numIterations = (expiryTime-installTime)/(cycleTime);
  12.  
  13.             float decayFactor = 0.012f; //Dogma attribute 1683 for this pin typeID - using defaults from dgmAttributeTypes
  14.             float noiseFactor = 0.8f; //Dogma attribute 1687 for this pin typeID - using defaults from dgmAttributeTypes
  15.  
  16.  
  17.             float barWidth = (float)cycleTime / sec / 900.0f;
  18.             const float f1 = 1f / 12;
  19.             const float f2 = 1f / 5;
  20.             const float f3 = 1f / 2;
  21.  
  22.             for (int i = 0; i < numIterations; i++)
  23.             {
  24.                 //timeDiff equals currentTime because installTime is zero. installTime has no effect on the results as long as total time remains constant.
  25.                 int timeDiff = (i + 1)*cycleTime;
  26.  
  27.                 int cycleNum = Math.Max((timeDiff + sec)/cycleTime - 1, 0);
  28.  
  29.                 float t = (cycleNum + 0.5f)*barWidth;
  30.  
  31.                 float decayValue = quantityPerCycle/(1 + t * decayFactor);
  32.  
  33.                 double phaseShift = Math.Pow(quantityPerCycle, 0.7f);
  34.  
  35.                 double sinA = Math.Cos(phaseShift + t*f1);
  36.                 double sinB = Math.Cos(phaseShift/2 + t*f2);
  37.                 double sinC = Math.Cos(t*f3);
  38.  
  39.                 double sinStuff = (sinA + sinB + sinC)/3;
  40.                 sinStuff = Math.Max(sinStuff, 0);
  41.  
  42.                 double barHeight = decayValue*(1 + noiseFactor*sinStuff);
  43.  
  44.                 values.Add((float) (barWidth*barHeight));
  45.             }
  46.             return values;
  47.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement