public function lamConGen(ConnectorGen $conGen, $pcbID)
 {
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $conGen->setTemp($system->getTemp() + $conGen->getPassiveTemp());
     $base = $this->getConGenTypeValue($conGen->getConnectorType());
     $prumerI = $conGen->getCurrentContact();
     $popis = $conGen->getConnectorType();
     $contactCnt = $conGen->getContactCnt();
     if ($popis == "RF Coaxial") {
         $deltaT = 5;
     } else {
         if ($popis == "RF Coaxial (High Power)") {
             $deltaT = 50;
         } else {
             if ($contactCnt <= 12) {
                 $deltaT = 0.1 * $prumerI ^ 1.85;
             } else {
                 if ($contactCnt >= 13 && $contactCnt <= 16) {
                     $deltaT = 0.274 * pow($prumerI, 1.85);
                 } else {
                     if ($contactCnt >= 17 && $contactCnt <= 18) {
                         $deltaT = 0.429 * pow($prumerI, 1.85);
                     } else {
                         if ($contactCnt >= 19 && $contactCnt <= 20) {
                             $deltaT = 0.64 * pow($prumerI, 1.85);
                         } else {
                             if ($contactCnt >= 21 && $contactCnt <= 22) {
                                 $deltaT = 0.989 * pow($prumerI, 1.85);
                             } else {
                                 if ($contactCnt >= 23 && $contactCnt <= 24) {
                                     $deltaT = 1.345 * pow($prumerI, 1.85);
                                 } else {
                                     if ($contactCnt >= 25 && $contactCnt <= 28) {
                                         $deltaT = 2.286 * pow($prumerI, 1.85);
                                     } else {
                                         if ($contactCnt >= 29 && $contactCnt <= 31) {
                                             $deltaT = 2.856 * pow($prumerI, 1.85);
                                         } else {
                                             if ($contactCnt >= 32) {
                                                 $deltaT = 3.256 * pow($prumerI, 1.85);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $teplota = $conGen->getTemp() + $deltaT;
     $piT = exp(-0.14 / (8.617000000000001 * pow(10, -5)) * (1 / ($teplota + 273) - 1 / 298));
     $spoj = $conGen->getMatingFactor();
     if ($spoj <= 0.05) {
         $piK = 1;
     } else {
         if ($spoj > 0.05 && $spoj <= 0.5) {
             $piK = 1.5;
         } else {
             if ($spoj > 0.5 && $spoj <= 5) {
                 $piK = 2;
             } else {
                 if ($spoj > 5 && $spoj <= 50) {
                     $piK = 3;
                 } else {
                     $piK = 4;
                 }
             }
         }
     }
     $qual = $conGen->getQuality();
     if ($qual == "MIL-SPEC") {
         $piQ = 1;
     } else {
         $piQ = 2;
     }
     $sEnv = $conGen->getEnvironment();
     $piE = $this->systemService->getPiE(151, $sEnv);
     $lambda = $base * $piT * $piK * $piQ * $piE * pow(10, -6);
     return $lambda;
 }
 /**
  * @Route("/newConGen", name="newConGen")
  * @Template()
  */
 public function newConGenAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->connectorGenForm;
     $conGen = new ConnectorGen();
     $conGen->setParams($obj);
     $service = $this->get('ikaros_connectorService');
     $lambda = $service->lamConGen($conGen, $id);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $conGen, $id);
     //$service = $this->get('ikaros_connectorService');
     //$e = $service->setLamsConGen($conGen, $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' => $conGen->getLabel(), 'Lam' => $conGen->getLam(), 'ConnectorType' => $conGen->getConnectorType(), 'Quality' => $conGen->getQuality(), 'Environment' => $conGen->getEnvironment(), 'MatingFactor' => $conGen->getMatingFactor(), 'ContactCnt' => $conGen->getContactCnt(), 'PassiveTemp' => $conGen->getPassiveTemp(), 'CurrentContact' => $conGen->getCurrentContact(), 'idP' => $conGen->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }