Ejemplo n.º 1
0
 public function calculateLam(Memory $memory, $pcbID)
 {
     $sEnv = $memory->getEnvironment();
     $piE = $this->systemService->getPiE(510, $sEnv);
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $temp = $memory->getTempPassive() + $memory->getTempDissipation() + $system->getTemp();
     $memory->setTemp($temp);
     $packageType = $this->getPackageTypeID($memory->getPackageType());
     $pinCnt = $memory->getPinCount();
     switch ($packageType) {
         case 1:
             $c2 = 2.8 * pow(10, -4) * pow($pinCnt, 1.08);
             break;
         case 2:
             $c2 = 9 * pow(10, -5) * pow($pinCnt, 1.51);
             break;
         case 3:
             $c2 = 3 * pow(10, -5) * pow($pinCnt, 1.82);
             break;
         case 4:
             $c2 = 3 * pow(10, -5) * pow($pinCnt, 2.01);
             break;
         case 5:
             $c2 = 3.6 * pow(10, -4) * pow($pinCnt, 1.08);
             break;
     }
     $piQ = $this->getQualityValue($memory->getQuality());
     $description = $memory->getDescription();
     $memoryType = $memory->getMemoryType();
     $memSize = $memory->getMemorySize();
     if ($memSize <= 16) {
         $range = 1;
     } else {
         if ($memSize <= 64) {
             $range = 2;
         } else {
             if ($memSize <= 256) {
                 $range = 3;
             } else {
                 $range = 4;
             }
         }
     }
     $c1 = $this->getTypeValue($description, $memoryType, $range);
     $oxid = $memory->getEepromOxid();
     $cyclesCnt = $memory->getCyclesCount();
     if ($memoryType == "EEPROM") {
         //spocitat cyc
         $piEcc = $this->getEccValue($memory->getECC());
         if ($oxid == "Flotox") {
             $a2 = 0;
             $b2 = 0;
             $b1 = pow($memSize * 1024 / 16000, 0.5) * exp(-0.15 / (8.617000000000001 * pow(10, -5)) * (1 / ($temp + 273) - 1 / 333));
             $a1 = 6.817 * pow(10, -6) * $cyclesCnt;
         } else {
             if ($cyclesCnt < 300000) {
                 $a2 = 0;
             } else {
                 if ($cyclesCnt < 400000) {
                     $a2 = 1.1;
                 } else {
                     $a2 = 2.3;
                 }
             }
             //zadano v tis.
             $b2 = pow($memSize * 1024 / 64000, 0.25) * exp(0.1 / (8.617000000000001 * pow(10, -5)) * (1 / ($temp + 273) - 1 / 303));
             $b1 = pow($memSize * 1024 / 64000, 0.25) * exp(-0.12 / (8.617000000000001 * pow(10, -5)) * (1 / ($temp + 273) - 1 / 303));
             if ($cyclesCnt <= 100) {
                 $a1 = 0.0097;
             } else {
                 if ($cyclesCnt <= 200) {
                     $a1 = 0.014;
                 } else {
                     if ($cyclesCnt <= 500) {
                         $a1 = 0.023;
                     } else {
                         if ($cyclesCnt <= 1000) {
                             $a1 = 0.033;
                         } else {
                             if ($cyclesCnt <= 3000) {
                                 $a1 = 0.061;
                             } else {
                                 if ($cyclesCnt <= 7000) {
                                     $a1 = 0.14;
                                 } else {
                                     $a1 = 0.3;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $cyc = ($a1 * $b1 + $a2 * $b2 / $piQ) / $piEcc;
     } else {
         $cyc = 0;
     }
     //defaultne Memories
     $piT = 0.1 * exp(-0.6 / (8.617000000000001 * pow(10, -5)) * (1 / ($temp + 273) - 1 / 298));
     $years = $memory->getProductionYears();
     $piL = 0.01 * exp(5.35 - 0.35 * $years);
     $lambda = ($c1 * $piT + $c2 * $piE + $cyc) * $piQ * $piL * pow(10, -6);
     return $lambda;
 }
Ejemplo n.º 2
0
 /**
  * @Route("/newMemory", name="newMemory")
  * @Template()
  */
 public function newMemoryAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->memoryForm;
     $memory = new Memory();
     $memory->setParams($obj);
     $serviceMemory = $this->get('ikaros_memoryService');
     $lambda = $serviceMemory->calculateLam($memory, $id);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $memory, $id);
     if ($e != "") {
         return new Response(json_encode(array('e' => $e)), 400, array('Content-Type' => 'application/json; charset=utf-8'));
     }
     return new Response(json_encode(array('Label' => $memory->getLabel(), 'Lam' => $memory->getLam(), 'Type' => $memory->getType(), 'CasePart' => $memory->getCasePart(), 'MemoryType' => $memory->getMemoryType(), 'Description' => $memory->getDescription(), 'Quality' => $memory->getQuality(), 'Environment' => $memory->getEnvironment(), 'PinCount' => $memory->getPinCount(), 'CyclesCount' => $memory->getCyclesCount(), 'ProductionYears' => $memory->getProductionYears(), 'TempDissipation' => $memory->getTempDissipation(), 'TempPassive' => $memory->getTempPassive(), 'PackageType' => $memory->getPackageType(), 'ECC' => $memory->getECC(), 'EepromOxid' => $memory->getEepromOxid(), 'MemorySize' => $memory->getMemorySize(), 'idP' => $memory->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }