so i made this input view which input some data, and then some services to process the data, these services are being called from the controller, the problem is when i try to call this particular function SUPMPFunc($index, $loop, $length)
the controller seems to be not passing the arguments to the service
this is the too few arguments error
controller :
<?php
class supmpController extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function Store(Request $request)
{
$medInput = new MedInput();
$deviceId = $medInput->MedInput();
$toolsInput = new ToolsInput();
$toolsRes = $toolsInput->ToolsInput(request("toolsIndex"));
$toolsfunctionInput = new ToolsFunctionInput();
$functionality = $toolsfunctionInput->ToolsFunctionInput(request("checkIndex"));
$temperature = new TempFunc();
$humidity = new HumidFUnc();
$condition = array(
$temperature->TempFunc(),
$humidity->HumidFUnc(),
);
$electricity = new Electricityinput();
$elInput = $electricity->ElectricityInput(request("electricIndex"));
$index = request("tablesupmpindex");
$loop = request("loopVal");
$length = request("supmpLength");
$SUPMP = new SUPMPFunc();
$result = $SUPMP->SUPMPFunc($index, $loop, $length);
$analysis = new AnalysisFunc();
$texttoShow = $analysis->AnalysisFunc();
$data = array (
array($deviceId, $texttoShow, $toolsRes, request("loopVal")), //0
$condition, //1
$functionality,//2
$elInput, //3
$result[0], //4
$result[1], //5
$result[2], //6
$result[3], //7
$result[4], //8
$result[5], //9
$result[6], //10
);
return view('laporan', ['data' => $data]);
}
}
service :
<?php
class SUPMPFunc
{
public function SUPMPFunc($index, $loop, $length)
{
$Avg = new AvgFunc();
$TINV = new TINVFunc();
$round = new RoundFunc();
$stdev = new StdevFunc();
$budget = new BudgetFunc();
$drift = new DriftFunc();
$driftres = $drift->Drift1895040();
$medInput = new MedInput();
$deviceId = $medInput->MedInput();
$resolution = $deviceId[6];
///////////////////////////////////////////////////////////////////////////////
// everything below is related to calibration value
$settingsArray = [];
$valueArray = [];
for($i = 0; $i <= $length; $i++)
{
array_push($settingsArray, request("table".$index."setVal".$i));
}
$A1 = request('inVal_A-1');
$B1 = request('inVal_B-1');
$C1 = request('inVal_C-1');
$D1 = request('inVal_D-1');
$E1 = request('inVal_E-1');
$F1 = request('inVal_F-1');
$G1 = request('inVal_G-1');
$A2 = request('inVal_A-2');
$B2 = request('inVal_B-2');
$C2 = request('inVal_C-2');
$D2 = request('inVal_D-2');
$E2 = request('inVal_E-2');
$F2 = request('inVal_F-2');
$G2 = request('inVal_G-2');
$A3 = request('inVal_A-3');
$B3 = request('inVal_B-3');
$C3 = request('inVal_C-3');
$D3 = request('inVal_D-3');
$E3 = request('inVal_E-3');
$F3 = request('inVal_F-3');
$G3 = request('inVal_G-3');
$A4 = request('inVal_A-4');
$B4 = request('inVal_B-4');
$C4 = request('inVal_C-4');
$D4 = request('inVal_D-4');
$E4 = request('inVal_E-4');
$F4 = request('inVal_F-4');
$G4 = request('inVal_G-4');
$A5 = request('inVal_A-5');
$B5 = request('inVal_B-5');
$C5 = request('inVal_C-5');
$D5 = request('inVal_D-5');
$E5 = request('inVal_E-5');
$F5 = request('inVal_F-5');
$G5 = request('inVal_G-5');
$A6 = request('inVal_A-6');
$B6 = request('inVal_B-6');
$C6 = request('inVal_C-6');
$D6 = request('inVal_D-6');
$E6 = request('inVal_E-6');
$F6 = request('inVal_F-6');
$G6 = request('inVal_G-6');
$A7 = request('inVal_A-7');
$B7 = request('inVal_B-7');
$C7 = request('inVal_C-7');
$D7 = request('inVal_D-7');
$E7 = request('inVal_E-7');
$F7 = request('inVal_F-7');
$G7 = request('inVal_G-7');
$Aval = array(-$A1, -$A2, -$A3, -$A4, -$A5, -$A6, -$A7);
$Bval = array(-$B1, -$B2, -$B3, -$B4, -$B5, -$B6, -$B7);
$Dval = array(-$D1, -$D2, -$D3, -$D4, -$D5, -$D6, -$D7);
$Fval = array(-$F1, -$F2, -$F3, -$F4, -$F5, -$F6, -$F7);
$Cval = array(-$C1, -$C2, -$C3, -$C4, -$C5, -$C6, -$C7);
$Eval = array(-$E1, -$E2, -$E3, -$E4, -$E5, -$E6, -$E7);
$Gval = array(-$G1, -$G2, -$G3, -$G4, -$G5, -$G6, -$G7);
$koreksiStd = array(
array(0.0, 0.6, 0.7, 1.0, 0.9, 1.4, 1.3), //koreksistdUp
array(0.0, 0.7, 0.8, 1.1, 1.1, 1.7, 1.7), //koreksi tdDn
array(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5), //Usertifikat up
array(0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5) //Usertifikat dn
);
$usertifikat = 0.5;
for($i = 0; $i < count($koreksiStd[0]); $i++ )
{
$Bval[$i] = $Bval[$i] + $koreksiStd[0][$i];
$Dval[$i] = $Dval[$i] + $koreksiStd[0][$i];
$Fval[$i] = $Fval[$i] + $koreksiStd[0][$i];
}
for($j = 0; $j < count($koreksiStd[1]); $j++ )
{
$Cval[$j] = $Cval[$j] + $koreksiStd[1][$j];
$Eval[$j] = $Eval[$j] + $koreksiStd[1][$j];
$Gval[$j] = $Gval[$j] + $koreksiStd[1][$j];
}
$valVi = 2;
$valVi2 = 50;
$valVi3 = 50;
$dividerD = 2 / sqrt(3);
$dividerA = 2 / sqrt(6);
$valURes = $resolution / $dividerA;
$stdSertifikat = [];
$UstdSertifikat = [];
$hysterisis = [];
for($i = 0; $i < count($koreksiStd[2]); $i++)
{
$stdSertifikat[$i] = $koreksiStd[2][$i];
array_push($UstdSertifikat, $stdSertifikat[$i] / 2);
}
for($i = 0; $i < count($Aval); $i++)
{
array_push($hysterisis, abs((($Cval[$i] - $Bval[$i])) +
($Eval[$i] - $Dval[$i]) +
($Gval[$i] - $Fval[$i])) / 3
);
}
$upAvg = [];
$dnAvg = [];
$upKoreksi = [];
$dnKoreksi = [];
$upStdev = [];
$dnStdev = [];
$upURepeat = [];
$dnURepeat = [];
$zeroErr = [];
$zeroErrU = [];
for($i = 0; $i < count($koreksiStd[0]); $i++)
{
$array = array(
$Bval[$i], $Dval[$i], $Fval[$i]
);
array_push($upAvg, $round->Roundto($Avg->Average($array), 1));
}
for($i = 0; $i < count($koreksiStd[0]); $i++)
{
$array = array(
$Cval[$i], $Eval[$i], $Gval[$i]
);
array_push($dnAvg, $round->Roundto($Avg->Average($array), 1));
}
for($i = 0; $i < count($Aval); $i++)
{
array_push($upKoreksi, $round->Roundto(($upAvg[$i] - $Aval[$i]), 1));
}
for($i = 0; $i < count($Aval); $i++)
{
array_push($dnKoreksi, $round->Roundto(($dnAvg[$i] - $Aval[$i]), 1));
}
for($i = 0; $i < count($Aval); $i++)
{
$array = array(
$Bval[$i], $Dval[$i], $Fval[$i]
);
array_push($upStdev, $stdev->Stdev($array));
}
for($i = 0; $i < count($Aval); $i++)
{
$array = array(
$Cval[$i], $Eval[$i], $Gval[$i]
);
array_push($dnStdev, $stdev->Stdev($array));
}
for($i = 0; $i < count($Aval); $i++)
{
array_push($upURepeat, $upStdev[$i] / (2 * sqrt(3)));
}
for($i = 0; $i < count($Aval); $i++)
{
array_push($dnURepeat, $dnStdev[$i] / (2 * sqrt(3)));
}
for($i = 0; $i < count($Aval); $i++)
{
array_push($zeroErr, max(abs($Cval[$i] - $Bval[$i]),
abs($Eval[$i] - $Dval[$i]),
abs($Gval[$i] - $Fval[$i])
));
}
//this one has the same value as u hysterisis column
for($i = 0; $i < count($Aval); $i++)
{
array_push($zeroErrU, $zeroErr[$i] / (2 * (pow(3, 0.5))));
}
$KANval = 7.5;
$UPbudgetua = [];
$UPbudgetRes = [];
$UPjumlahuicipow = [];
$UPjumlahuicivi = [];
$UPketidakpastianGab = [];
$UPkebebasanEff = [];
$UPfaktorCakup = [];
$UPketidakpastianBen = [];
$UPfinalRes = [];
for($i = 0; $i < 7; $i++)
{
array_push($UPbudgetua, $upStdev[$i], $zeroErr[$i], $resolution, 0, $stdSertifikat[$i], $hysterisis[$i], ((0.1 * $driftres[0][$i]) / 2));
$UPbudgetRes[$i] = $budget->Budget($UPbudgetua);
$UPjumlahuicipow[$i] = $round->Roundto(array_sum($UPbudgetRes[$i][6]), 3);
$UPjumlahuicivi[$i] = $round->Roundto(array_sum($UPbudgetRes[$i][7]), 3);
$UPketidakpastianGab[$i] = $round->Roundto(sqrt($UPjumlahuicipow[$i]), 3);
$UPkebebasanEff[$i] = $round->Roundto((pow($UPketidakpastianGab[$i], 4) / $UPjumlahuicivi[$i]), 3);
$UPfaktorCakup[$i] = $round->Roundto($TINV->TINV(0.05, $UPkebebasanEff[$i]), 3);
$UPketidakpastianBen[$i] = $round->Roundto($UPketidakpastianGab[$i] * $UPfaktorCakup[$i], 3);
if($UPketidakpastianBen[$i] <= $KANval)
{
$UPfinalRes[$i] = $KANval;
}
else
{
$UPfinalRes[$i] = $round->Roundto($UPketidakpastianBen[$i], 1);
}
array_splice($UPbudgetua, 0, count($UPbudgetua));
}
$DNbudgetua = [];
$DNbudgetRes = [];
$DNjumlahuicipow = [];
$DNjumlahuicivi = [];
$DNketidakpastianGab = [];
$DNkebebasanEff = [];
$DNfaktorCakup = [];
$DNketidakpastianBen = [];
$DNfinalRes = [];
for($i = 0; $i < 7; $i++)
{
array_push($DNbudgetua, $dnStdev[$i], $zeroErr[$i], $resolution, 0, $stdSertifikat[$i], $hysterisis[$i], ((0.1 * $driftres[0][$i]) / 2));
$DNbudgetRes[$i] = $budget->Budget($DNbudgetua);
$DNjumlahuicipow[$i] = $round->Roundto(array_sum($DNbudgetRes[$i][6]), 3);
$DNjumlahuicivi[$i] = $round->Roundto(array_sum($DNbudgetRes[$i][7]), 3);
$DNketidakpastianGab[$i] = $round->Roundto( sqrt($DNjumlahuicipow[$i]), 3);
$DNkebebasanEff[$i] = $round->Roundto((pow($DNketidakpastianGab[$i], 4) / $DNjumlahuicivi[$i]), 3);
// $DNfaktorCakDN[$i] = $round->Roundto($round->TINV(0.05, $DNkebebasanEff[$i]), 3);
$DNfaktorCakup[$i] = $round->Roundto($TINV->TINV(0.05, $DNkebebasanEff[$i]), 3);
$DNketidakpastianBen[$i] = $round->Roundto($DNketidakpastianGab[$i] * $DNfaktorCakup[$i], 3);
if($DNketidakpastianBen[$i] <= $KANval)
{
$DNfinalRes[$i] = $KANval;
}
else
{
$DNfinalRes[$i] = $round->Roundto($DNketidakpastianBen[$i], 1);
}
array_splice($DNbudgetua, 0, count($DNbudgetua));
}
$result = array(
$Aval,
$upAvg,
$dnAvg,
$upKoreksi,
$dnKoreksi,
$UPfinalRes,
$DNfinalRes,
$length,
);
return $result;
}
}
Aucun commentaire:
Enregistrer un commentaire