Exemplo n.º 1
0
 public function calculateLam(Optoelectronics $opto, $pcbID)
 {
     $sEnv = $opto->getEnvironment();
     $piE = $this->systemService->getPiE(611, $sEnv);
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $temp = $opto->getPassiveTemp() + $opto->getDPTemp() + $system->getTemp();
     $opto->setTemp($temp);
     $piT = exp(-2790 * (1 / ($temp + 273) - 1 / 298));
     $base = $this->getApplicationValue($opto->getApplication());
     $piQ = $this->getQualityValue($opto->getQuality());
     $lambda = $base * $piT * $piQ * $piE * pow(10, -6);
     return $lambda;
 }
 /**
  * @Route("/newOpto", name="newOpto")
  * @Template()
  */
 public function newOptoAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->optoForm;
     $opto = new Optoelectronics();
     $opto->setParams($obj);
     $serviceOpto = $this->get('ikaros_optoService');
     $lambda = $serviceOpto->calculateLam($opto, $id);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $opto, $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' => $opto->getLabel(), 'Lam' => $opto->getLam(), 'DPTemp' => $opto->getDPTemp(), 'PassiveTemp' => $opto->getPassiveTemp(), 'Application' => $opto->getApplication(), 'Quality' => $opto->getQuality(), 'Environment' => $opto->getEnvironment(), 'idP' => $opto->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }