SimuArgsMgr.php
5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
/**
* @class SimuArgsMgr
* @version
*
*/
class SimuArgsMgr {
protected $paramID;
protected $dataProducteur;
protected $dom;
protected $simulatedRegion;
function __construct() {
}
/*****************************************************************
* PUBLIC FUNCTIONS
*****************************************************************/
public function init($paramID){
$this->paramID = $paramID;
if ((strncmp($this->paramID, "impex___", 8) === 0) || (strncmp($this->paramID, "spase___", 8) === 0)){
$this->getDataProducteur();
$this->dom = new DomDocument("1.0");
$this->dom->load(USERWSDIR.'RemoteParams.xml');
if ($this->dataProducteur == 'FMI_GUMICS')
$this->simulatedRegion = 'Earth.Magnetosphere';
else
$this->getSimulatedRegion();
}
}
protected function getDataProducteur(){
if (strncmp($this->paramID, "impex___", 8) === 0)
$par = str_replace ("impex___", "", $this->paramID);
elseif (strncmp($this->paramID, "spase___", 8) === 0)
$par = str_replace ("spase___IMPEX_NumericalOutput_", "", $this->paramID);
// TODO tests
$tmp = explode( '_', $par);
if ($tmp[0] == 'FMI')
$this->dataProducteur = $tmp[0].'_'.$tmp[1];
else
$this->dataProducteur = $tmp[0];
}
protected function getSimulatedRegion(){
$param = $this->dom->getElementById(trim($this->paramID));
$parentID = $param->getAttribute('parentID');
$dataSet = $this->dom->getElementById($parentID);
$this->simulatedRegion = $dataSet->getAttribute('SimulatedRegion');
}
protected function getMissionsBySimuRegion(){
$missions = simplexml_load_file(missionXml);
$missionsVal = array();
foreach($missions->Local->MissionID as $mission){
if (stripos ($mission['targets'], trim($this->simulatedRegion)) !== false ){
if ( !isset($mission['group']) || (isset($mission['group']) && $mission['group'] != 'TEST')) {
$multypMissions = array();
if ($mission['missions'] != '')
$multypMissions = explode(';',$mission['missions']);
else
$multypMissions[0] = (string)$mission;
$missionsVal = array_merge($missionsVal,$multypMissions);
}
}
}
sort($missionsVal);
return $missionsVal;
}
public function makeSimuArgs(){
if ($this->dataProducteur != 'CCMC'){
$missions = $this->getMissionsBySimuRegion();
if (count($missions) == 1)
$grp[] = array("group" => "Satellite", "args" => array("value" => $missions[0]));
elseif (count($missions) > 1){
foreach ($missions as $mission){
$miss[] = array ("arg" => $mission, "value" => $mission);
}
$grp[] = array("group" => "Satellite", "args" => $miss);
}
switch ($this->dataProducteur){
case 'LATMOS':
$grp[] = array("group" => "ClockAngle", "args" => array("value" => "0"));
break;
case 'SINP':
if ($this->simulatedRegion == 'Mercury.Magnetosphere'){
$grp[] = array("group" => "BD", "args" => array("value" => "-196.0"));
$grp[] = array("group" => "Flux", "args" => array("value" => "131.0"));
$grp[] = array("group" => "Rss", "args" => array("value" => "1.35"));
$grp[] = array("group" => "R2", "args" => array("value" => "1.32"));
$grp[] = array("group" => "DZ", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0"));
}
elseif ($this->simulatedRegion == 'Saturn.Magnetosphere'){
$grp[] = array("group" => "BDC", "args" => array("value" => "3.0"));
$grp[] = array("group" => "BT", "args" => array("value" => "7.0"));
$grp[] = array("group" => "Rss", "args" => array("value" => "22.0"));
$grp[] = array("group" => "RD1", "args" => array("value" => "15.0"));
$grp[] = array("group" => "RD2", "args" => array("value" => "6.5"));
$grp[] = array("group" => "R2", "args" => array("value" => "18.0"));
$grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0"));
}
elseif ($this->simulatedRegion == 'Jupiter.Magnetosphere'){
$grp[] = array("group" => "BDC", "args" => array("value" => "3.0"));
$grp[] = array("group" => "BT", "args" => array("value" => "7.0"));
$grp[] = array("group" => "Rss", "args" => array("value" => "22.0"));
$grp[] = array("group" => "RD1", "args" => array("value" => "15.0"));
$grp[] = array("group" => "RD2", "args" => array("value" => "6.5"));
$grp[] = array("group" => "R2", "args" => array("value" => "18.0"));
$grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0"));
$grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0"));
}
break;
case 'LESIA':
break;
}
return $grp;
}
return;
}
}
?>