Ejemplo n.º 1
0
 /**
  * @Route("/newMicrocircuit", name="newMicrocircuit")
  * @Template()
  */
 public function newMicrocircuitAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->microcircuitForm;
     $micro = new Microcircuit();
     $micro->setParams($obj);
     $serviceMicro = $this->get('ikaros_microcircuitService');
     $lambda = $serviceMicro->calculateLam($micro, $id);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $micro, $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' => $micro->getLabel(), 'Lam' => $micro->getLam(), 'Type' => $micro->getType(), 'CasePart' => $micro->getCasePart(), 'Application' => $micro->getApplication(), 'Description' => $micro->getDescription(), 'Quality' => $micro->getQuality(), 'Environment' => $micro->getEnvironment(), 'PinCount' => $micro->getPinCount(), 'GateCount' => $micro->getGateCount(), 'ProductionYears' => $micro->getProductionYears(), 'TempDissipation' => $micro->getTempDissipation(), 'Technology' => $micro->getTechnology(), 'TempPassive' => $micro->getTempPassive(), 'PackageType' => $micro->getPackageType(), 'idP' => $micro->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }
 public function calculateLam(Microcircuit $micro, $pcbID)
 {
     $sEnv = $micro->getEnvironment();
     $piE = $this->systemService->getPiE(510, $sEnv);
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $temp = $micro->getTempPassive() + $micro->getTempDissipation() + $system->getTemp();
     $micro->setTemp($temp);
     $packageType = $this->getPackageTypeID($micro->getPackageType());
     $pinCnt = $micro->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;
     }
     $description = $micro->getDescription();
     $app = $micro->getApplication();
     $gateCnt = $micro->getGateCount();
     if ($description == "Bipolar") {
         if ($app == "Digital") {
             if ($gateCnt <= 100) {
                 $c1 = 0.0025;
             } else {
                 if ($gateCnt <= 1000) {
                     $c1 = 0.005;
                 } else {
                     if ($gateCnt <= 3000) {
                         $c1 = 0.01;
                     } else {
                         if ($gateCnt <= 10000) {
                             $c1 = 0.02;
                         } else {
                             if ($gateCnt <= 30000) {
                                 $c1 = 0.04;
                             } else {
                                 $c1 = 0.08;
                             }
                         }
                     }
                 }
             }
         } else {
             if ($app == "Linear") {
                 if ($gateCnt <= 100) {
                     $c1 = 0.01;
                 } else {
                     if ($gateCnt <= 300) {
                         $c1 = 0.02;
                     } else {
                         if ($gateCnt <= 1000) {
                             $c1 = 0.04;
                         } else {
                             $c1 = 0.06;
                         }
                     }
                 }
             } else {
                 if ($gateCnt <= 200) {
                     $c1 = 0.01;
                 } else {
                     if ($gateCnt <= 1000) {
                         $c1 = 0.021;
                     } else {
                         $c1 = 0.042;
                     }
                 }
             }
         }
     } else {
         if ($app == "Digital") {
             if ($gateCnt <= 100) {
                 $c1 = 0.01;
             } else {
                 if ($gateCnt <= 1000) {
                     $c1 = 0.02;
                 } else {
                     if ($gateCnt <= 3000) {
                         $c1 = 0.04;
                     } else {
                         if ($gateCnt <= 10000) {
                             $c1 = 0.08;
                         } else {
                             if ($gateCnt <= 30000) {
                                 $c1 = 0.16;
                             } else {
                                 $c1 = 0.29;
                             }
                         }
                     }
                 }
             }
         } else {
             if ($app == "Linear") {
                 if ($gateCnt <= 100) {
                     $c1 = 0.01;
                 } else {
                     if ($gateCnt <= 300) {
                         $c1 = 0.02;
                     } else {
                         if ($gateCnt <= 1000) {
                             $c1 = 0.04;
                         } else {
                             $c1 = 0.06;
                         }
                     }
                 }
             } else {
                 if ($gateCnt <= 500) {
                     $c1 = 0.00085;
                 } else {
                     if ($gateCnt <= 1000) {
                         $c1 = 0.0017;
                     } else {
                         if ($gateCnt < 5000) {
                             $c1 = 0.0034;
                         } else {
                             $c1 = 0.0068;
                         }
                     }
                 }
             }
         }
     }
     $piQ = $this->getQualityValue($micro->getQuality());
     $technology = $this->getTechnology($micro->getTechnology());
     $category = $technology['Category'];
     $ea = $technology['Value'];
     if ($category == 1) {
         $piT = 0.1 * exp(-$ea / (8.617000000000001 * pow(10, -5)) * (1 / ($temp + 273) - 1 / 298));
     } else {
         $piT = 0.1 * exp(-$ea / (8.617000000000001 * pow(10, -5)) * (1 / ($temp + 273) - 1 / 423));
     }
     $years = $micro->getProductionYears();
     $piL = 0.01 * exp(5.35 - 0.35 * $years);
     $lambda = ($c1 * $piT + $c2 * $piE) * $piQ * $piL * pow(10, -6);
     return $lambda;
 }