/**
  * @Route("/newDiodeLF", name="newDiodeLF")
  * @Template()
  */
 public function newDiodeLFAction()
 {
     $post = $this->get('request')->request;
     $id = $post->get('id');
     $formData = $post->get('formData');
     $objF = json_decode($formData);
     $obj = $objF->diodeLFForm;
     $diode = new DiodeLF();
     $diode->setParams($obj);
     $serviceDiode = $this->get('ikaros_diodeService');
     $lambda = $serviceDiode->calculateLam($diode, $id);
     $serviceParts = $this->get('ikaros_partService');
     $e = $serviceParts->setLams($lambda, $diode, $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' => $diode->getLabel(), 'Lam' => $diode->getLam(), 'VoltageRated' => $diode->getVoltageRated(), 'VoltageApplied' => $diode->getVoltageApplied(), 'DPTemp' => $diode->getDPTemp(), 'PassiveTemp' => $diode->getPassiveTemp(), 'Application' => $diode->getApplication(), 'ContactConstruction' => $serviceDiode->getContactConstructionDesc($diode->getContactConstruction()), 'Quality' => $diode->getQuality(), 'Environment' => $diode->getEnvironment(), 'idP' => $diode->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8'));
 }
예제 #2
0
 public function calculateLam(DiodeLF $diode, $pcbID)
 {
     $sEnv = $diode->getEnvironment();
     $piE = $this->systemService->getPiE(61, $sEnv);
     $pcb = $this->pcbService->getItem($pcbID);
     $system = $this->systemService->getItem($pcb->getSystemID());
     $temp = $diode->getPassiveTemp() + $diode->getDPTemp() + $system->getTemp();
     $diode->setTemp($temp);
     $app = $this->getApplication($diode->getApplication());
     $base = $app['Value'];
     if ($app['Description'] == "Power Rectifier with High Voltage Stacks") {
         $base /= $temp;
     }
     $tempCategory = $app['tempCategory'];
     $stressCategory = $app['stressCategory'];
     if ($tempCategory == 1) {
         $piT = exp(-3091 * (1 / ($temp + 273) - 1 / 298));
     } else {
         $piT = exp(-1925 * (1 / ($temp + 273) - 1 / 298));
     }
     $stressRatio = $diode->getVoltageApplied() / $diode->getVoltageRated();
     if ($stressCategory == 2) {
         if ($stressRatio <= 0.3) {
             $piS = 0.054;
         } else {
             $piS = pow($stressRatio, 0.43);
         }
     } else {
         $piS = 1.0;
     }
     $piC = $this->getContactConstructionValue($diode->getContactConstruction());
     $quality = $this->getQuallity($diode->getQuality());
     $piQ = $quality['Value'];
     $lambda = $base * $piT * $piS * $piC * $piQ * $piE * pow(10, -6);
     return $lambda;
 }