public function lamConSoc(ConnectorSoc $conSoc) { $base = $this->getConSocTypeValue($conSoc->getConnectorType()); $qual = $conSoc->getQuality(); if ($qual == "MIL-SPEC") { $piQ = 0.3; } else { $piQ = 1; } $sEnv = $conSoc->getEnvironment(); /*$stmt = $this->doctrine->getManager() ->getConnection() ->prepare('SELECT e.* FROM Environment e WHERE e.ID_Section = 152'); $stmt->execute(); $env = $stmt->fetchAll(); $piE = $env[0][$sEnv];*/ $piE = $this->systemService->getPiE(152, $sEnv); $q = 0.39; $n = $conSoc->getActivePins(); $piP = exp(pow(($n - 1) / 10, $q)); $lambda = $base * $piP * $piQ * $piE * pow(10, -6); return $lambda; }
/** * @Route("/newConSoc", name="newConSoc") * @Template() */ public function newConSocAction() { $post = $this->get('request')->request; $id = $post->get('id'); $formData = $post->get('formData'); $objF = json_decode($formData); $obj = $objF->connectorSocForm; $conSoc = new ConnectorSoc(); $conSoc->setParams($obj); $service = $this->get('ikaros_connectorService'); $lambda = $service->lamConSoc($conSoc); $serviceParts = $this->get('ikaros_partService'); $e = $serviceParts->setLams($lambda, $conSoc, $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' => $conSoc->getLabel(), 'Lam' => $conSoc->getLam(), 'ConnectorType' => $conSoc->getConnectorType(), 'Quality' => $conSoc->getQuality(), 'CasePart' => $conSoc->getCasePart(), 'Type' => $conSoc->getType(), 'ActivePins' => $conSoc->getActivePins(), 'Environment' => $conSoc->getEnvironment(), 'idP' => $conSoc->getIDPart())), 200, array('Content-Type' => 'application/json; charset=utf-8')); }