public function calculateLam(TransistorFetLF $transistor, $pcbID)
 {
     $sEnv = $transistor->getEnvironment();
     $piE = $this->systemService->getPiE(64, $sEnv);
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $temp = $transistor->getTempPassive() + $transistor->getTempDissipation() + $system->getTemp();
     $transistor->setTemp($temp);
     $piT = exp(-1925 * (1 / ($temp + 273) - 1 / 298));
     $tech = $transistor->getTechnology();
     if ($tech == "JFET") {
         $base = 0.0045;
     } else {
         $base = 0.012;
     }
     $app = $transistor->getApplication();
     $power = $transistor->getPowerRated();
     if ($app == "Linear Amplification") {
         $piA = 1.5;
     } else {
         if ($app == "Small Signal Switching") {
             $piA = 0.7;
         } else {
             if ($power < 2) {
                 $piA = 1.5;
             } else {
                 if ($power < 5) {
                     $piA = 2;
                 } else {
                     if ($power < 50) {
                         $piA = 4;
                     } else {
                         if ($power < 250) {
                             $piA = 8;
                         } else {
                             $piA = 10;
                         }
                     }
                 }
             }
         }
     }
     $piQ = $this->getQualityValue($transistor->getQuality());
     $lambda = $base * $piT * $piA * $piQ * $piE * pow(10, -6);
     return $lambda;
 }
 /**
  * @Route("/newTransistorFetLF", name="newTransistorFetLF")
  * @Template()
  */
 public function newTransistorFetLFAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->transistorFetLFForm;
     $transistor = new TransistorFetLF();
     $transistor->setParams($obj);
     $serviceTransistor = $this->get('ikaros_transistorFetLFService');
     $lambda = $serviceTransistor->calculateLam($transistor, $id);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $transistor, $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' => $transistor->getLabel(), 'Lam' => $transistor->getLam(), 'Type' => $transistor->getType(), 'CasePart' => $transistor->getCasePart(), 'Application' => $transistor->getApplication(), 'Quality' => $transistor->getQuality(), 'Environment' => $transistor->getEnvironment(), 'PowerRated' => $transistor->getPowerRated(), 'Technology' => $transistor->getTechnology(), 'TempDissipation' => $transistor->getTempDissipation(), 'TempPassive' => $transistor->getTempPassive(), 'idP' => $transistor->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }