public function calculateLam(InductiveDev $inductive, $pcbID) { $sEnv = $inductive->getEnvironment(); $piE = $this->systemService->getPiE(111, $sEnv); $pcb = $this->pcbService->getItem($pcbID); $system = $this->systemService->getItem($pcb->getSystemID()); $temp = $inductive->getTempPassive() + $inductive->getTempDissipation() + $system->getTemp(); $inductive->setTemp($temp); $surface = $inductive->getSurface(); $weight = $inductive->getWeight(); $powerLoss = $inductive->getPowerLoss(); if ($surface) { $deltaT = 125 * $powerLoss / ($surface / 6.452); } else { if ($weight) { $deltaT = 11.5 * $powerLoss / pow($weight * 2.2046, 0.6766); } else { $deltaT = 35; } } $ths = $temp + 1.1 * $deltaT; $piT = exp(-0.11 / (8.617000000000001 * pow(10, -5)) * (1 / ($ths + 273) - 1 / 298)); $type = $inductive->getDevType(); $desc = $inductive->getDescription(); $base = $this->getDescValue($type, $desc); $qual = $inductive->getQuality(); $piQ = $this->getQualityValue($qual); $lambda = $base * $piT * $piQ * $piE * pow(10, -6); return $lambda; }
/** * @Route("/newInductive", name="newInductive") * @Template() */ public function newInductiveAction() { $post = $this->get('request')->request; $id = $post->get('id'); $formData = $post->get('formData'); $objF = json_decode($formData); $obj = $objF->inductiveForm; $inductive = new InductiveDev(); $inductive->setParams($obj); $serviceInductive = $this->get('ikaros_inductiveService'); $lambda = $serviceInductive->calculateLam($inductive, $id); $serviceParts = $this->get('ikaros_partService'); $e = $serviceParts->setLams($lambda, $inductive, $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' => $inductive->getLabel(), 'Lam' => $inductive->getLam(), 'Type' => $inductive->getType(), 'CasePart' => $inductive->getCasePart(), 'DevType' => $inductive->getDevType(), 'Description' => $inductive->getDescription(), 'Quality' => $inductive->getQuality(), 'Environment' => $inductive->getEnvironment(), 'PowerLoss' => $inductive->getPowerLoss(), 'Weight' => $inductive->getWeight(), 'Surface' => $inductive->getSurface(), 'TempDissipation' => $inductive->getTempDissipation(), 'TempPassive' => $inductive->getTempPassive(), 'idP' => $inductive->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8')); }