public function calculateLam(TransistorBiLF $transistor, $pcbID)
 {
     $sEnv = $transistor->getEnvironment();
     $piE = $this->systemService->getPiE(63, $sEnv);
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $temp = $transistor->getTempPassive() + $transistor->getTempDissipation() + $system->getTemp();
     $transistor->setTemp($temp);
     $piT = exp(-2114 * (1 / ($temp + 273) - 1 / 298));
     $base = 0.00074;
     $app = $transistor->getApplication();
     if ($app == "Switching") {
         $piA = 0.7;
     } else {
         $piA = 1.5;
     }
     $piQ = $this->getQualityValue($transistor->getQuality());
     $power = $transistor->getPowerRated();
     if ($power <= 0.1) {
         $piR = 0.43;
     } else {
         $piR = pow($power, 0.37);
     }
     $vs = $transistor->getVoltageCE() / $transistor->getVoltageCEO();
     $piS = 0.45 * exp(3.1 * $vs);
     $lambda = $base * $piT * $piA * $piR * $piS * $piQ * $piE * pow(10, -6);
     return $lambda;
 }
 /**
  * @Route("/newTransistorBiLF", name="newTransistorBiLF")
  * @Template()
  */
 public function newTransistorBiLFAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->transistorBiLFForm;
     $transistor = new TransistorBiLF();
     $transistor->setParams($obj);
     $serviceTransistor = $this->get('ikaros_transistorBiLFService');
     $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(), 'VoltageCE' => $transistor->getVoltageCE(), 'VoltageCEO' => $transistor->getVoltageCEO(), 'TempDissipation' => $transistor->getTempDissipation(), 'TempPassive' => $transistor->getTempPassive(), 'idP' => $transistor->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }