protected function calculateTrajectory() { // sprawdzić czy: // 1. jest pole zawierające trajektorię? // 2. czy klasa zawiera taką metodę? //jeśli tak to liczymy pozostałe parametry i wyznaczamy trajektorię // $step = 10; if (!empty($this->record['azimuth'])) { $azimut = $this->record['azimuth']; } else { $azimut = 0; } $algoritm = new TrajectoryAlgoritm(); $this->trajectory = new TrajectoryVariant(); if ($this->record['wellTrajectory'] == 'J1') { $this->sectionNumber = 2; } if ($this->record['wellTrajectory'] == 'J2') { $this->sectionNumber = 3; } if ($this->record['wellTrajectory'] == 'J3') { $this->sectionNumber = 5; } if ($this->record['wellTrajectory'] == 'S1') { $this->sectionNumber = 3; } if ($this->record['wellTrajectory'] == 'S2') { $this->sectionNumber = 4; } if ($this->record['wellTrajectory'] == 'S3') { $this->sectionNumber = 4; } if ($this->record['wellTrajectory'] == 'S4') { $this->sectionNumber = 5; } if ($this->record['wellTrajectory'] == 'catenary') { $this->sectionNumber = 3; } if (method_exists($this->trajectory, $this->record['wellTrajectoryVariant'])) { if ($this->record['wellType'] == '2d') { $trajectoryMethod = $this->record['wellTrajectoryVariant']; $methodParameters = array(); $parameters = explode("_", $this->record['wellTrajectoryVariant']); array_shift($parameters); foreach ($parameters as $parameter) { $methodParameters[$parameter] = $this->record[$parameter]; } $this->trajectoryParams = call_user_func_array(array($this->trajectory, $trajectoryMethod), $methodParameters); if (!empty($this->trajectoryParams['error'])) { $this->errorMessageContainer = new CoreFormValidationMessageContainer(); $this->errorMessageContainer->addMessage('parametrError'); return 0; } $this->trajectoryTable = $algoritm->calculateCoordinates($this->sectionNumber, $this->trajectoryParams['A'], $this->trajectoryParams['H'], $this->trajectoryParams['L'], $this->trajectoryParams['alfa'], $this->trajectoryParams['delta'], $this->trajectoryParams['DLS'], $this->trajectoryParams['R'], $azimut, $step); $firstElements = array_values($this->trajectoryTable); $firstElement = $firstElements[0]; if ($this->record['vsection'] !== null) { $angleParametr = $this->record['vsection']; } else { $angleParametr = $algoritm->calculateVsAngle($this->trajectoryTable[1], $this->trajectoryTable[count($this->trajectoryTable)]); } foreach ($this->trajectoryTable as $key => $trajectoryTableElement) { $this->trajectoryTable[$key]['alfa'] = rad2deg($trajectoryTableElement['alfa']); $this->trajectoryTable[$key]['beta'] = rad2deg($trajectoryTableElement['beta']); } $algoritm->calculateVerticalSection($this->trajectoryTable, $angleParametr); /*foreach($this->trajectoryTable as $key => $trajectoryTableElement){ $this->trajectoryTable[$key]['alfa'] = rad2deg($trajectoryTableElement['alfa']); $this->trajectoryTable[$key]['beta'] = rad2deg($trajectoryTableElement['beta']); }*/ for ($i = 1; $i <= $this->sectionNumber; $i++) { $this->trajectoryParams['alfa'][$i] = rad2deg($this->trajectoryParams['alfa'][$i]); $this->trajectoryParams['delta'][$i] = rad2deg($this->trajectoryParams['delta'][$i]); } if (!empty($this->trajectoryTable)) { $xmax = 0; $ymax = 0; $zmax = 0; $mdmax = 0; $tmpArr = array(); $section = null; foreach ($this->trajectoryTable as $element) { if ($xmax < $element['X']) { $xmax = $element['X']; } if ($ymax < $element['Y']) { $ymax = $element['Y']; } if ($zmax < $element['Z']) { $zmax = $element['Z']; } if ($mdmax < $element['MD']) { $mdmax = $element['MD']; } //print_r($element); $this->trajectoryTable[$key]['X'] = $this->trajectoryTable[$key]['X'] + floatval($this->record['tvectorX']); $this->trajectoryTable[$key]['Y'] = $this->trajectoryTable[$key]['Y'] + floatval($this->record['tvectorY']); $this->trajectoryTable[$key]['Z'] = $this->trajectoryTable[$key]['Z'] + floatval($this->record['tvectorZ']); $tmpArr['x'] = 1 * ($element['X'] + floatval($this->record['tvectorX'])); $tmpArr['y'] = -1 * ($element['Y'] + floatval($this->record['tvectorY'])); $tmpArr['z'] = 1 * ($element['Z'] + floatval($this->record['tvectorZ'])); $tmpArr['md'] = -1 * $element['MD']; $this->trajectory3DRender[1][] = $tmpArr; if ($section == null) { $section = $element['section']; $this->startingPoint = $tmpArr; } if ($element['section'] == 'PP') { $this->trajectoryHaracteristicPoints[count($this->trajectory3DRender[1]) - 1] = $tmpArr; } elseif ($element['section'] != $section) { $this->trajectoryHaracteristicPoints[count($this->trajectory3DRender[1]) - 1] = $tmpArr; } $section = $element['section']; } $this->trajectory3DRenderParam[1]['xMax'] = 1 * $xmax; $this->trajectory3DRenderParam[1]['yMax'] = -1 * $ymax; $this->trajectory3DRenderParam[1]['zMax'] = 1 * $zmax; $this->trajectory3DRenderParam[1]['mdMax'] = -1 * $mdmax; } } } if ($this->record['wellType'] == '3d') { // get points from DAO $well3dDAO = new Well3DPointDAO(); $this->points3d = $well3dDAO->getWellPointsByWellId($this->record['id']); // print_r("Input points X[m], Y[m], Z[m], LP[m], alfa[st], beta[st] \n"); foreach ($this->points3d as $point) { $MX[$point['number']] = $point['X']; $MY[$point['number']] = $point['Y']; $MZ[$point['number']] = $point['Z']; $MLP[$point['number']] = $point['LP']; $Malfa[$point['number']] = $point['alfa']; $Mbeta[$point['number']] = $point['beta']; // print_r( $point['X']." ".$point['Y']." ".$point['Z']." ".$point['LP']." ".$point['alfa']." ".$point['beta']."\n"); } $np = count($this->points3d); //$step = 50; if ($this->record['well3DTrajectory'] == 'POCZ' || empty($this->record['well3DTrajectory'])) { if ($np > 0) { $this->trajectoryTable = $algoritm->r3pocz($np, $MX, $MY, $MZ, $MLP, $Malfa, $Mbeta, $step); $this->defaultVsection = $algoritm->calculateVsAngle($this->trajectoryTable[1], $this->trajectoryTable[count($this->trajectoryTable)]); } } else { if ($np > 0) { $this->trajectoryTable = $algoritm->r3konc($np, $MX, $MY, $MZ, $MLP, $Malfa, $Mbeta, $step); $this->defaultVsection = $algoritm->calculateVsAngle($this->trajectoryTable[1], $this->trajectoryTable[count($this->trajectoryTable)]); } } //print_r($this->record); //print_r($this->trajectoryTable); // count in algoritm if (!empty($this->trajectoryTable)) { $xmax = 0; $ymax = 0; $zmax = 0; $mdmax = 0; $tmpArr = array(); $section = null; foreach ($this->trajectoryTable as $key => $element) { //print_r($element['X']); //print_r("MD ". $element['MD'] ." ". $element['X'] ."\n\t"); if ($xmax < $element['X']) { $xmax = $element['X']; } if ($ymax < $element['Y']) { $ymax = $element['Y']; } if ($zmax < $element['Z']) { $zmax = $element['Z']; } if ($mdmax < $element['MD']) { $mdmax = $element['MD']; } //print_r($element); $this->trajectoryTable[$key]['X'] = $this->trajectoryTable[$key]['X'] + floatval($this->record['tvectorX']); $this->trajectoryTable[$key]['Y'] = $this->trajectoryTable[$key]['Y'] + floatval($this->record['tvectorY']); $this->trajectoryTable[$key]['Z'] = $this->trajectoryTable[$key]['Z'] + floatval($this->record['tvectorZ']); $tmpArr['x'] = $element['X'] + floatval($this->record['tvectorX']); $tmpArr['y'] = $element['Y'] + floatval($this->record['tvectorY']); $tmpArr['z'] = -($element['Z'] + floatval($this->record['tvectorZ'])); $tmpArr['md'] = -1 * $element['MD']; $this->trajectory3DRender[1][] = $tmpArr; if ($section == null) { $section = $element['section']; $this->startingPoint = $tmpArr; } if ($element['section'] == 'PP') { $this->trajectoryHaracteristicPoints[count($this->trajectory3DRender[1]) - 1] = $tmpArr; } elseif ($element['section'] != $section) { $this->trajectoryHaracteristicPoints[count($this->trajectory3DRender[1]) - 1] = $tmpArr; } $section = $element['section']; } $this->trajectory3DRenderParam[1]['xMax'] = 1 * $xmax; $this->trajectory3DRenderParam[1]['yMax'] = -1 * $ymax; $this->trajectory3DRenderParam[1]['zMax'] = 1 * $zmax; $this->trajectory3DRenderParam[1]['mdMax'] = -1 * $mdmax; $this->trajectory3DRenderParam[1]['color'] = $this->record['color']; } // } }
public function calculateTrajectory($wellId, $step, $azimut) { $wellDAO = new WellDAO(); $this->record = $wellDAO->getRecordById($wellId); $algoritm = new TrajectoryAlgoritm(); $this->trajectory = new TrajectoryVariant(); if ($this->record['wellTrajectory'] == 'J1') { $this->sectionNumber = 2; } if ($this->record['wellTrajectory'] == 'J2') { $this->sectionNumber = 3; } if ($this->record['wellTrajectory'] == 'J3') { $this->sectionNumber = 5; } if ($this->record['wellTrajectory'] == 'S1') { $this->sectionNumber = 3; } if ($this->record['wellTrajectory'] == 'S2') { $this->sectionNumber = 4; } if ($this->record['wellTrajectory'] == 'S3') { $this->sectionNumber = 4; } if ($this->record['wellTrajectory'] == 'S4') { $this->sectionNumber = 5; } if (method_exists($this->trajectory, $this->record['wellTrajectoryVariant'])) { if ($this->record['wellType'] == '2d') { $trajectoryMethod = $this->record['wellTrajectoryVariant']; $methodParameters = array(); $parameters = explode("_", $this->record['wellTrajectoryVariant']); array_shift($parameters); //print_r($parameters); foreach ($parameters as $parameter) { $methodParameters[$parameter] = $this->record[$parameter]; } //print_r($methodParameters); //print_r($trajectoryMethod); $this->trajectoryParams = call_user_func_array(array($this->trajectory, $trajectoryMethod), $methodParameters); if (!empty($this->trajectoryParams['error'])) { // $this->errorMessageContainer = new CoreFormValidationMessageContainer(); // $this->errorMessageContainer->addMessage('parametrError'); return 0; } //$this->trajectory->$trajectoryMethod(extract($methodParameters)); $this->trajectoryTable = $algoritm->calculateCoordinates($this->sectionNumber, $this->trajectoryParams['A'], $this->trajectoryParams['H'], $this->trajectoryParams['L'], $this->trajectoryParams['alfa'], $this->trajectoryParams['delta'], $this->trajectoryParams['DLS'], $this->trajectoryParams['R'], $azimut, $step); $firstElements = array_values($this->trajectoryTable); $firstElement = $firstElements[0]; //print_r($firstElement); if ($this->record['vsection'] !== null) { $angleParametr = $this->record['vsection']; } else { $angleParametr = $algoritm->calculateVsAngle($this->trajectoryTable[1], $this->trajectoryTable[count($this->trajectoryTable)]); } $algoritm->calculateVerticalSection($this->trajectoryTable, $angleParametr); /*foreach($this->trajectoryTable as $key => $telement){ //print_r($telement); $kx = $telement['Y'] - $firstElement['Y']; $ky = $telement['X'] - $firstElement['X']; $dept = sqrt(pow($kx,2) + pow($ky,2)); if ($ky==0){ $angle = 0; } else $angle = rad2deg(atan(abs($kx/$ky))); if (($kx=0) && ($ky=0)){ $angle = 0; } if (($kx>=0)&&($ky>0)) $angle = $angle; if (($kx>0) && ($ky==0)) $angle = rad2deg(pi()/2); if (($kx>=0) && ($ky<0)) $angle = rad2deg(pi()) - $angle; if (($kx<=0) && ($ky<0)) $angle = rad2deg(pi()) + $angle; if (($kx<0) && ($ky==0)) $angle = rad2deg(3*pi()/2); if (($kx<=0) && ($ky>0)) $angle = rad2deg(2*pi()) - $angle; $this->trajectoryTable[$key]['CL_DEP'] = $dept; $this->trajectoryTable[$key]['CL_Angle'] = $angle; //$this->trajectoryTable[$key]['VS_Displacment'] = $dept*cos(deg2rad($angle-vs_angle)); }*/ //print_r($this->trajectoryTable); foreach ($this->trajectoryTable as $key => $trajectoryTableElement) { $this->trajectoryTable[$key]['alfa'] = rad2deg($trajectoryTableElement['alfa']); $this->trajectoryTable[$key]['beta'] = rad2deg($trajectoryTableElement['beta']); } for ($i = 1; $i <= $this->sectionNumber; $i++) { $this->trajectoryParams['alfa'][$i] = rad2deg($this->trajectoryParams['alfa'][$i]); $this->trajectoryParams['delta'][$i] = rad2deg($this->trajectoryParams['delta'][$i]); } if (!empty($this->trajectoryTable)) { $xmax = 0; $ymax = 0; $zmax = 0; $mdmax = 0; $tmpArr = array(); $this->trajectory3DRender = null; foreach ($this->trajectoryTable as $element) { if ($xmax < $element['X']) { $xmax = $element['X']; } if ($ymax < $element['Y']) { $ymax = $element['Y']; } if ($zmax < $element['Z']) { $zmax = $element['Z']; } if ($mdmax < $element['MD']) { $mdmax = $element['MD']; } //print_r($element); $this->trajectoryTable[$key]['X'] = $this->trajectoryTable[$key]['X'] + floatval($this->record['tvectorX']); $this->trajectoryTable[$key]['Y'] = $this->trajectoryTable[$key]['Y'] + floatval($this->record['tvectorY']); $this->trajectoryTable[$key]['Z'] = $this->trajectoryTable[$key]['Z'] + floatval($this->record['tvectorZ']); $tmpArr['x'] = 1 * ($element['X'] + floatval($this->record['tvectorX'])); $tmpArr['y'] = 1 * ($element['Y'] + floatval($this->record['tvectorY'])); $tmpArr['z'] = -1 * ($element['Z'] + floatval($this->record['tvectorZ'])); $tmpArr['md'] = -1 * $element['MD']; $this->trajectory3DRender[] = $tmpArr; } $this->trajectory3DRenderParam['render'] = $this->trajectory3DRender; $this->trajectory3DRenderParam['trayectory'] = $this->trajectoryTable; $this->trajectory3DRenderParam['xMax'] = 1 * $xmax; $this->trajectory3DRenderParam['yMax'] = 1 * $ymax; $this->trajectory3DRenderParam['zMax'] = -1 * $zmax; $this->trajectory3DRenderParam['mdMax'] = -1 * $mdmax; $this->trajectory3DRenderParam['color'] = $this->record['color']; $this->trajectory3DRenderParam['wellName'] = $this->record['wellName']; } //print_r($this->trajectoryTable); } } if ($this->record['wellType'] == '3d') { // get points from DAO $well3dDAO = new Well3DPointDAO(); $this->points3d = $well3dDAO->getWellPointsByWellId($this->record['id']); // print_r("Input points X[m], Y[m], Z[m], LP[m], alfa[st], beta[st] \n"); foreach ($this->points3d as $point) { $MX[$point['number']] = $point['X']; $MY[$point['number']] = $point['Y']; $MZ[$point['number']] = $point['Z']; $MLP[$point['number']] = $point['LP']; $Malfa[$point['number']] = $point['alfa']; $Mbeta[$point['number']] = $point['beta']; // print_r( $point['X']." ".$point['Y']." ".$point['Z']." ".$point['LP']." ".$point['alfa']." ".$point['beta']."\n"); } $np = count($this->points3d); //$step = 50; if ($this->record['well3DTrajectory'] == 'POCZ' || empty($this->record['well3DTrajectory'])) { if ($np > 0) { $this->trajectoryTable = $algoritm->r3pocz($np, $MX, $MY, $MZ, $MLP, $Malfa, $Mbeta, $step, $this->record['vsection']); } } else { if ($np > 0) { $this->trajectoryTable = $algoritm->r3konc($np, $MX, $MY, $MZ, $MLP, $Malfa, $Mbeta, $step, $this->record['vsection']); } } //print_r($this->record); //print_r($this->trajectoryTable); // count in algoritm if (!empty($this->trajectoryTable)) { $xmax = 0; $ymax = 0; $zmax = 0; $mdmax = 0; $tmpArr = array(); $this->trajectory3DRender = null; foreach ($this->trajectoryTable as $key => $element) { //print_r($element['X']); //print_r("MD ". $element['MD'] ." ". $element['X'] ."\n\t"); if ($xmax < $element['X']) { $xmax = $element['X']; } if ($ymax < $element['Y']) { $ymax = $element['Y']; } if ($zmax < $element['Z']) { $zmax = $element['Z']; } if ($mdmax < $element['MD']) { $mdmax = $element['MD']; } //print_r($element); $this->trajectoryTable[$key]['X'] = $this->trajectoryTable[$key]['X'] + floatval($this->record['tvectorX']); $this->trajectoryTable[$key]['Y'] = $this->trajectoryTable[$key]['Y'] + floatval($this->record['tvectorY']); $this->trajectoryTable[$key]['Z'] = $this->trajectoryTable[$key]['Z'] + floatval($this->record['tvectorZ']); $tmpArr['x'] = $element['X'] + floatval($this->record['tvectorX']); $tmpArr['y'] = -($element['Y'] + floatval($this->record['tvectorY'])); $tmpArr['z'] = -($element['Z'] + floatval($this->record['tvectorZ'])); $tmpArr['md'] = -1 * $element['MD']; $this->trajectory3DRender[] = $tmpArr; } $this->trajectory3DRenderParam['render'] = $this->trajectory3DRender; //$this->trajectory3DRenderParam['trajectory'] = $this->trajectoryTable; $this->trajectory3DRenderParam['xMax'] = 1 * $xmax; $this->trajectory3DRenderParam['yMax'] = 1 * $ymax; $this->trajectory3DRenderParam['zMax'] = -1 * $zmax; $this->trajectory3DRenderParam['mdMax'] = -1 * $mdmax; $this->trajectory3DRenderParam['color'] = $this->record['color']; $this->trajectory3DRenderParam['wellName'] = $this->record['wellName']; } } //print_r($this->trajectory3DRenderParam); return $this->trajectory3DRenderParam; }
public function prepareData() { parent::prepareData(); $this->initForm(); $this->createFormFields(); $this->setFieldValuesFromRequest(); $request = CoreServices::get('request'); $this->A = $this->form->getField('A')->getValue(); $this->H = $this->form->getField('H')->getValue(); $this->L1 = $this->form->getField('L1')->getValue(); $this->DLS = $this->form->getField('DLS')->getValue(); $this->DLS2 = $this->form->getField('DLS2')->getValue(); $this->alfa2 = $this->form->getField('alfa2')->getValue(); $this->L3 = $this->form->getField('L3')->getValue(); $this->Azimuth = $this->form->getField('Azimuth')->getValue(); $this->targetInclination = $this->form->getField('targetInclination')->getValue(); $this->targetAzimuth = $this->form->getField('targetAzimuth')->getValue(); $this->TR = $this->form->getField('TR')->getValue(); $this->TL = $this->form->getField('TL')->getValue(); $this->BR = $this->form->getField('BR')->getValue(); $this->BL = $this->form->getField('BL')->getValue(); $this->SR = $this->form->getField('SR')->getValue(); $this->ST = $this->form->getField('ST')->getValue(); $this->SM = $this->form->getField('SM')->getValue(); $this->NOS = $this->form->getField('NOS')->getValue(); $this->DeltaX = $this->form->getField('DeltaX')->getValue(); $this->DeltaY = $this->form->getField('DeltaY')->getValue(); $this->Variant = $this->form->getField('Variant')->getValue(); $this->Name = $this->form->getField('Name')->getValue(); $this->siteId = $this->form->getField('SiteId')->getValue(); if (empty($this->Name)) { $this->Name = "Pads"; } if (empty($this->Variant)) { throw new Exception("No Trajectory Variant"); } $wellDAO = new WellDAO(); $well3dpointDAO = new Well3DPointDAO(); $well = $wellDAO->getRecordTemplate(); $well['A'] = $this->A; $well['H'] = $this->H; $well['L1'] = $this->L1; $well['DLS'] = $this->DLS; $well['DLS2'] = $this->DLS2; $well['alfa2'] = $this->alfa2; $well['L3'] = $this->L3; $well['wellName'] = $this->Name . " W0"; $well['siteId'] = $this->siteId; $well['wellType'] = '2d'; $well['wellTrajectory'] = "J2"; $well['wellTrajectoryVariant'] = $this->Variant; $wellDAO->save($well); $this->trajectory = new TrajectoryVariant(); $algoritm = new TrajectoryAlgoritm(); $trajectoryMethod = $this->Variant; $methodParameters = array(); $parameters = explode("_", $this->Variant); array_shift($parameters); foreach ($parameters as $parameter) { $methodParameters[$parameter] = $well[$parameter]; } $this->trajectoryParams = call_user_func_array(array($this->trajectory, $trajectoryMethod), $methodParameters); if (!empty($this->trajectoryParams['error'])) { //$this->errorMessageContainer = new CoreFormValidationMessageContainer(); //$this->errorMessageContainer->addMessage('parametrError'); return 0; //!!!!! } //print_r($this->trajectoryParams); $sectionNumber = 3; $step = 10; $azimut = 0; $this->trajectoryTable = $algoritm->calculateCoordinates($sectionNumber, $this->trajectoryParams['A'], $this->trajectoryParams['H'], $this->trajectoryParams['L'], $this->trajectoryParams['alfa'], $this->trajectoryParams['delta'], $this->trajectoryParams['DLS'], $this->trajectoryParams['R'], $azimut, $step); //print_r($this->trajectoryTable); $firstElements = array_values($this->trajectoryTable); $firstElement = $firstElements[0]; $trayectoryTableLenght = count($this->trajectoryTable); $section = $firstElement['section']; $hpoints[] = $firstElement; $counter = 1; foreach ($this->trajectoryTable as $point) { if ($point['section'] == 'PP' || $section != $point['section'] && $section != 'PP' || $counter == $trayectoryTableLenght) { $section = $point['section']; $hpoints[] = $point; } $counter++; } //print_r($hpoints); if ($this->TR == 'true') { // In loop create // 1. well 3d with R3Konc // 2. calulate points W, HP, TP // 3. save well & points if ($this->NOS > 0) { for ($i = 1; $i <= $this->NOS; $i++) { $padWell = $wellDAO->getRecordTemplate(); $padWell['wellName'] = $this->Name . "_W" . $i . "R"; $padWell['wellType'] = '3d'; $padWell['well3DTrajectory'] = "KONC"; $padWell['siteId'] = $this->siteId; $wellDAO->save($padWell); $srSum = $i * $this->SR; $stSum = $i * $this->ST; $BOPX = $firstElement['X'] + $srSum * cos($this->Azimuth * Pi() / 180) + $this->DeltaX; $BOPY = $firstElement['Y'] - $srSum * sin($this->Azimuth * Pi() / 180) + $this->DeltaY; $HPX = $hpoints[2]['X'] + $stSum * cos($this->Azimuth * Pi() / 180) + $this->DeltaX; $HPY = $hpoints[2]['Y'] - $srSum * sin($this->Azimuth * Pi() / 180) + $this->DeltaY; $TPX = $hpoints[3]['X'] + $stSum * cos($this->Azimuth * Pi() / 180) + $this->DeltaX; $TPY = $hpoints[3]['Y'] - $srSum * sin($this->Azimuth * Pi() / 180) + $this->DeltaY; $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 1; $well3dpoint['X'] = $BOPX; $well3dpoint['Y'] = $BOPY; $well3dpoint['Z'] = 0; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 2; $well3dpoint['X'] = $HPX; $well3dpoint['Y'] = $HPY; $well3dpoint['Z'] = $hpoints[2]['Z']; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 3; $well3dpoint['X'] = $TPX; $well3dpoint['Y'] = $TPY; $well3dpoint['Z'] = $hpoints[3]['Z']; $well3dpoint['alfa'] = $this->targetInclination; $well3dpoint['beta'] = $this->targetAzimuth; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); } } } if ($this->TL == 'true') { if ($this->NOS > 0) { for ($i = 1; $i <= $this->NOS; $i++) { $padWell = $wellDAO->getRecordTemplate(); $padWell['wellName'] = $this->Name . "_W" . $i . "L"; $padWell['wellType'] = '3d'; $padWell['well3DTrajectory'] = "KONC"; $padWell['siteId'] = $this->siteId; $wellDAO->save($padWell); $srSum = $i * $this->SR; $stSum = $i * $this->ST; $BOPX = $firstElement['X'] - $srSum * cos($this->Azimuth * Pi() / 180) + $this->DeltaX; $BOPY = $firstElement['Y'] + $srSum * sin($this->Azimuth * Pi() / 180) + $this->DeltaY; $HPX = $hpoints[2]['X'] - $stSum * cos($this->Azimuth * Pi() / 180) + $this->DeltaX; $HPY = $hpoints[2]['Y'] + $srSum * sin($this->Azimuth * Pi() / 180) + $this->DeltaY; $TPX = $hpoints[3]['X'] - $stSum * cos($this->Azimuth * Pi() / 180) + $this->DeltaX; $TPY = $hpoints[3]['Y'] + $srSum * sin($this->Azimuth * Pi() / 180) + $this->DeltaY; $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 1; $well3dpoint['X'] = $BOPX; $well3dpoint['Y'] = $BOPY; $well3dpoint['Z'] = 0; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 2; $well3dpoint['X'] = $HPX; $well3dpoint['Y'] = $HPY; $well3dpoint['Z'] = $hpoints[2]['Z']; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 3; $well3dpoint['X'] = $TPX; $well3dpoint['Y'] = $TPY; $well3dpoint['Z'] = $hpoints[3]['Z']; $well3dpoint['alfa'] = $this->targetInclination; $well3dpoint['beta'] = $this->targetAzimuth; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); } } } if ($this->BR == 'true') { if ($this->NOS > 0) { for ($i = 1; $i <= $this->NOS; $i++) { $this->Azimuth = $this->Azimuth + 180; $padWell = $wellDAO->getRecordTemplate(); $padWell['wellName'] = $this->Name . "_W" . $i . "MR"; $padWell['wellType'] = '3d'; $padWell['well3DTrajectory'] = "KONC"; $padWell['siteId'] = $this->siteId; $wellDAO->save($padWell); $srSum = $i * $this->SR; $stSum = $i * $this->ST; $DeltaX = $this->DeltaX + $this->SM * sin($this->Azimuth * pi() / 180); $DeltaY = $this->DeltaY + $this->SM * sin($this->Azimuth * pi() / 180); $BOPX = $firstElement['X'] + $srSum * cos($this->Azimuth * Pi() / 180) + $DeltaX; $BOPY = $firstElement['Y'] - $srSum * sin($this->Azimuth * Pi() / 180) + $DeltaY; $HPX = $hpoints[2]['X'] + $stSum * cos($this->Azimuth * Pi() / 180) + $DeltaX; $HPY = $hpoints[2]['Y'] - $srSum * sin($this->Azimuth * Pi() / 180) + $DeltaY; $TPX = $hpoints[3]['X'] + $stSum * cos($this->Azimuth * Pi() / 180) + $DeltaX; $TPY = $hpoints[3]['Y'] - $srSum * sin($this->Azimuth * Pi() / 180) + $DeltaY; $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 1; $well3dpoint['X'] = $BOPX; $well3dpoint['Y'] = $BOPY; $well3dpoint['Z'] = 0; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 2; $well3dpoint['X'] = $HPX; $well3dpoint['Y'] = $HPY; $well3dpoint['Z'] = $hpoints[2]['Z']; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 3; $well3dpoint['X'] = $TPX; $well3dpoint['Y'] = $TPY; $well3dpoint['Z'] = $hpoints[3]['Z']; $well3dpoint['alfa'] = $this->targetInclination; $well3dpoint['beta'] = $this->targetAzimuth; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); } } } if ($this->BL == 'true') { if ($this->NOS > 0) { for ($i = 1; $i <= $this->NOS; $i++) { $this->Azimuth = $this->Azimuth + 180; $padWell = $wellDAO->getRecordTemplate(); $padWell['wellName'] = $this->Name . "_W" . $i . "ML"; $padWell['wellType'] = '3d'; $padWell['well3DTrajectory'] = "KONC"; $padWell['siteId'] = $this->siteId; $wellDAO->save($padWell); $srSum = $i * $this->SR; $stSum = $i * $this->ST; $DeltaX = $this->DeltaX + $this->SM * sin($this->Azimuth * pi() / 180); $DeltaY = $this->DeltaY + $this->SM * sin($this->Azimuth * pi() / 180); $BOPX = $firstElement['X'] - $srSum * cos($this->Azimuth * Pi() / 180) + $DeltaX; $BOPY = $firstElement['Y'] + $srSum * sin($this->Azimuth * Pi() / 180) + $DeltaY; $HPX = $hpoints[2]['X'] - $stSum * cos($this->Azimuth * Pi() / 180) + $DeltaX; $HPY = $hpoints[2]['Y'] + $srSum * sin($this->Azimuth * Pi() / 180) + $DeltaY; $TPX = $hpoints[3]['X'] - $stSum * cos($this->Azimuth * Pi() / 180) + $DeltaX; $TPY = $hpoints[3]['Y'] + $srSum * sin($this->Azimuth * Pi() / 180) + $DeltaY; $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 1; $well3dpoint['X'] = $BOPX; $well3dpoint['Y'] = $BOPY; $well3dpoint['Z'] = 0; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 2; $well3dpoint['X'] = $HPX; $well3dpoint['Y'] = $HPY; $well3dpoint['Z'] = $hpoints[2]['Z']; $well3dpoint['alfa'] = 0; $well3dpoint['beta'] = 0; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); $well3dpoint = $well3dpointDAO->getRecordTemplate(); $well3dpoint['wellId'] = $padWell['id']; $well3dpoint['number'] = 3; $well3dpoint['X'] = $TPX; $well3dpoint['Y'] = $TPY; $well3dpoint['Z'] = $hpoints[3]['Z']; $well3dpoint['alfa'] = $this->targetInclination; $well3dpoint['beta'] = $this->targetAzimuth; $well3dpoint['LP'] = 0; $well3dpointDAO->save($well3dpoint); } } } // +add slot to DB // +calculate trajectory // +get points 0, HP, TP // calculate additional trajectories points // create }