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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
| [<?php
//session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Tracé de lignes</title>
<script src='OSC.js'></script>
</head>
<body>
<script>
$immat='ARCUS T'
// $immat=<?php echo $_SESSION['immatAeronef']; ?>;
$MMA=800
$MENP=530
$MEP=217
$MMXWB=185
$mMaxBallastSupp=11
$QcarbMax=15.9
$MasseMaxBag=2
$Cr=290
// $MVE=504
$MVE=<?php echo $_SESSION['MVE']; ?>;
$X0=540
$Ca=75
$Cr=290
$Lpil=1468
$Lpass=308
$Lwb=-17
$LBallastSupp=5292
$Lcarb=492
$Lbg=200
$_SESSION_Mp=90
$_SESSION_Mpass=80
$_SESSION_Qcarb=15
$_SESSION_MwbQ=10
$_SESSION_Mwb=100
$largeurImagecreate=1300
$hauteurImagecreate=800
$OrigineMasse=10*(Math.round(($MVE/10),0))-50
$EtendueMasse=10*((Math.round((($MMA-$MVE)/10),0))+10)
$EchMasse=$hauteurImagecreate/$EtendueMasse
$OrigineMoment=0
$EtendueMoment=1.4*(Math.round(($MMA*1.25*$Cr/10000),0)*10000)
$EchMoment=$largeurImagecreate/$EtendueMoment
</script>
<canvas id='moncanvas' width='1300' height='800'></canvas>
<script>
canvas = O('moncanvas')
context = canvas.getContext('2d')
S(canvas).background = 'lightblue'
context.fillStyle = 'red'
context.font = 'normal 20px Arial'
context.strokeStyle = 'black'
context.textBaseline = 'top'
context.lineWidth = 1
//Fonctions calcul:
//Étendue des masses:
function etmasse($MMA,$MVE)
{
return 10*((Math.round((($MMA-$MVE)/10),0))+10)
}
//Origine des masses:
function orimasse($MVE)
{
return 10*(Math.round(($MVE/10),0))-50
}
//Origine des moments: (=0)
//Fonction ligne:
function traceLigne($Ax,$Ay,$Bx,$By)
{
context.beginPath()
context.moveTo( $Ax,$Ay)
context.lineTo( $Bx,$By)
context.stroke()
context.closePath()
return
}
//Axe origine gauche:
traceLigne(0,0,0,$hauteurImagecreate)
//Marquage unique axe des masses vertical:
context.strokeText('M (Kg)',30, $hauteurImagecreate-50)
//Bordure droite:
traceLigne($largeurImagecreate,0,$largeurImagecreate,$hauteurImagecreate)
//Marquage unique axe origine supérieur:
context.strokeText('MMT (mm x Kg)',$largeurImagecreate-150,520-orimasse(504))
//Graduation verticale des masses:
$graduvert=0
while($graduvert<=etmasse(800,504))
{
traceLigne(0,$graduvert*$EchMasse,$largeurImagecreate,$graduvert*$EchMasse)
context.strokeText((orimasse(504)+$graduvert),20,20+$graduvert*$EchMasse)
$graduvert=$graduvert+100
}
//Graduation horizontale des moments:
$graduhoriz=0
while($graduhoriz<=$largeurImagecreate)
{
traceLigne($graduhoriz,0,$graduhoriz,$hauteurImagecreate)
context.strokeText($graduhoriz,20+$graduhoriz,5)
$graduhoriz=$graduhoriz+100
}
//Immatriculation:
context.strokeStyle = 'red'
context.strokeText('',$MVE*$X0*$EchMoment-35,($MVE-orimasse(504))*$EchMasse-30)
context.strokeText($immat,600,40)
context.strokeStyle = 'black'
//Point MVE,X0:
context.strokeStyle = 'red'
context.fillRect($MVE*$X0*$EchMoment-7,($MVE-orimasse(504))*$EchMasse-7,14,14)
context.strokeText('MVE.X0',$MVE*$X0*$EchMoment-40,($MVE-orimasse(504))*$EchMasse-50)
context.strokeStyle = 'black'
//Tracé du réseau Ca/Cr:
$C=$Ca
$deltaC=($Cr-$Ca)/10
while($C<=$Cr)
{
$Ax=($C*$MVE-0)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($C*$MMA-0)*$EchMoment
$By=($MMA-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
$C=$C+$deltaC
}
//Renforcement des bordures du réseau:
//limites av:
context.strokeStyle = 'red'
context.lineWidth = 3
$Ax=($Ca*$MVE-0)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($Ca*$MMA-0)*$EchMoment
$By=($MMA-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
//limites arr:
$Ax=($Cr*$MVE-0)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($Cr*$MMA-0)*$EchMoment
$By=($MMA-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
//limites supérieure:
$Ax=($Ca*$MVE-0)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($Cr*$MVE-0)*$EchMoment
$By=($MVE-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
//limite inférieure:
$Ax=($Ca*$MMA-0)*$EchMoment
$Ay=($MMA-orimasse(504))*$EchMasse
$Bx=($Cr*$MMA-0)*$EchMoment
$By=($MMA-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.strokeStyle = 'black'
context.lineWidth = 1
//Graduation du réseau Ca/Cr:
$C=$Ca
$deltaC=($Cr-$Ca)/10
$pct=0
while($C<=$Cr)
{
$x=($C*$MMA-0)*$EchMoment
$y=($MMA-orimasse(504))*$EchMasse
context.strokeText($pct,$x-5,$y)
$C=$C+$deltaC;
$pct=$pct+10;
}
//Ligne MVE:
context.lineWidth = 2
$Ax=0
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=$largeurImagecreate
$By=($MVE-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeText('MVE='+$MVE+' kg',10,$By-20)
//Ligne MMA:
context.lineWidth = 2
$Ax=0
$Ay=($MMA-orimasse(504))*$EchMasse
$Bx=$largeurImagecreate
$By=($MMA-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeText('MMA='+$MMA+' kg',10,$By-20)
//Ligne MENP + MEP:
context.lineWidth = 3
$Ax=0
$Ay=($MENP+$MEP-orimasse(504))*$EchMasse
$Bx=$largeurImagecreate
$By=($MENP+$MEP-orimasse(504))*$EchMasse
context.strokeStyle = 'Orange'
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeStyle = 'Black'
context.strokeText('LIMITE ENP='+($MENP+$MEP)+' kg',10,$By-20)
//Vecteur moment water-ballasts d'ailes 0 à $MMXWB:
context.lineWidth = 3
context.strokeStyle = 'Green'
$Qwba=$MMXWB
$Ax=($X0*$MVE)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($X0*$MVE+$Qwba*$Lwb-$OrigineMoment)*$EchMoment
$By=($MVE+$Qwba-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeStyle = 'Black'
context.strokeText('WB Ailes < '+$MMXWB+' L',$Bx-60,$By)
//Vecteur moment water-ballasts de queue 0 à $mMaxBallastSupp:
context.lineWidth = 3
context.strokeStyle = 'Green'
$Qwbq=$mMaxBallastSupp
$Ax=($X0*$MVE)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($X0*$MVE+$Qwbq*$LBallastSupp-$OrigineMoment)*$EchMoment
$By=($MVE+$Qwbq-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeStyle = 'Black'
context.strokeText('WB Queue < '+$mMaxBallastSupp+' L',$Bx-60,$By)
//Vecteur moment réservoir carburant 0 à $QcarbMax:
context.lineWidth = 3
context.strokeStyle = 'Green'
$Qcarb=$QcarbMax
$Ax=($X0*$MVE)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($X0*$MVE+0.72*$Qcarb*$Lcarb-$OrigineMoment)*$EchMoment
$By=($MVE+0.72*$Qcarb-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeStyle = 'Black'
context.strokeText('Q Carb < '+$QcarbMax+' L',$Bx-60,$By)
//Vecteur moment bagages 0 à $MasseMaxBag:
context.lineWidth = 3
context.strokeStyle = 'Green'
$Mbg=$MasseMaxBag
$Ax=($X0*$MVE)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($X0*$MVE+$Mbg*$Lbg-$OrigineMoment)*$EchMoment
$By=($MVE+$Mbg-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.lineWidth = 1
context.strokeStyle = 'Black'
context.strokeText('M Bag < '+$MasseMaxBag+' Kg',$Bx,$By-30)
//Tracé vecteur moment pilote 70 kg + passager 0 kg:
$Ax=($X0*$MVE)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-70*$Lpil-0*$Lpass-0)*$EchMoment
$By=($MVE+70+0-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
//Réseau vecteurs moment pilote 70 à 110 kg + passager 0 à 110 kg:
$Mpass=0;
while ($Mpass<=110)
{
$Ax=($X0*$MVE-70*$Lpil-$Mpass*$Lpass-0)*$EchMoment
$Ay=($MVE+70+$Mpass-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-110*$Lpil-$Mpass*$Lpass-0)*$EchMoment
$By=($MVE+110+$Mpass-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
$Mpass=$Mpass+10
}
//Tracé des iso-masse pilote:
$Mpil=70;
while ($Mpil<=110)
{
$Ax=($X0*$MVE-$Mpil*$Lpil-0*$Lpass-0)*$EchMoment
$Ay=($MVE+$Mpil+0-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-$Mpil*$Lpil-110*$Lpass-0)*$EchMoment
$By=($MVE+$Mpil+110-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
$Mpil=$Mpil+10
}
//Marquage des iso-masse équipage AV:
$Mpil=70;
while ($Mpil<=110)
{
$Bx=($X0*$MVE-$Mpil*$Lpil-0*$Lpass-0)*$EchMoment
$By=($MVE+$Mpil-orimasse(504))*$EchMasse
context.strokeText($Mpil,$Bx-10,$By-30)
$Mpil=$Mpil+10
}
//Marquage unique vecteur équipage AV:
$Bx=($X0*$MVE-100*$Lpil-0*$Lpass-0)*$EchMoment;
$By=($MVE+100-orimasse(504))*$EchMasse;
context.strokeText('Equipage AV (Kg)',$Bx-40,$By-90)
//Marquage des iso-masse équipage ARR:
$Mpil=70
$Mpass=0
while ($Mpass<=110)
{
$Bx=($X0*$MVE-$Mpil*$Lpil-$Mpass*$Lpass-0)*$EchMoment
$By=($MVE+$Mpil+$Mpass-orimasse(504))*$EchMasse
context.strokeText($Mpass,$Bx+15,$By-10)
$Mpass=$Mpass+20
}
//Marquage unique vecteur équipage ARR:
$Bx=($X0*$MVE-70*$Lpil-50*$Lpass-0)*$EchMoment
$By=($MVE+70+50-orimasse(504))*$EchMasse
context.strokeText('Equipage ARR (Kg)',$Bx+40,$By-10)
//Positionnement du CdG:
// Premier segment (masse pilote):
$Ax=($X0*$MVE-0)*$EchMoment
$Ay=($MVE-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-$Lpil*$_SESSION_Mp-0)*$EchMoment
$By=($MVE+$_SESSION_Mp-orimasse(504))*$EchMasse
context.lineWidth = 3
context.strokeStyle = 'red'
traceLigne($Ax,$Ay,$Bx,$By)
context.fillRect($Bx-7,$By-7,14,14)
context.strokeText('1',$Bx-20,$By-20)
// Deuxième segment (masse passager):
$Ax=($X0*$MVE-$Lpil*$_SESSION_Mp-0)*$EchMoment
$Ay=($MVE+$_SESSION_Mp-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass-0)*$EchMoment
$By=($MVE+$_SESSION_Mp+$_SESSION_Mpass-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.fillRect($Bx-7,$By-7,14,14)
context.strokeText('2',$Bx-20,$By-20)
// Troisième segment (masse carburant):
$Ax=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass-0)*$EchMoment
$Ay=($MVE+$_SESSION_Mp+$_SESSION_Mpass-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass+$Lcarb*0.72*$_SESSION_Qcarb-0)*$EchMoment
$By=($MVE+$_SESSION_Mp+$_SESSION_Mpass+0.72*$_SESSION_Qcarb-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.fillRect($Bx-7,$By-7,14,14)
context.strokeText('3',$Bx+10,$By-20)
// Quatrième segment (masse wbq):
$Ax=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass+$Lcarb*0.72*$_SESSION_Qcarb-0)*$EchMoment
$Ay=($MVE+$_SESSION_Mp+$_SESSION_Mpass+0.72*$_SESSION_Qcarb-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass+$Lcarb*0.72*$_SESSION_Qcarb+$LBallastSupp*$_SESSION_MwbQ-0)*$EchMoment
$By=($MVE+$_SESSION_Mp+$_SESSION_Mpass+0.72*$_SESSION_Qcarb+$_SESSION_MwbQ-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.fillRect($Bx-7,$By-7,14,14)
context.strokeText('4',$Bx+10,$By-20)
// Cinquième segment (masse wba):
$Mwb=80
$Ax=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass+$Lcarb*0.72*$_SESSION_Qcarb+$LBallastSupp*$_SESSION_MwbQ-0)*$EchMoment
$Ay=($MVE+$_SESSION_Mp+$_SESSION_Mpass+0.72*$_SESSION_Qcarb+$_SESSION_MwbQ-orimasse(504))*$EchMasse
$Bx=($X0*$MVE-$Lpil*$_SESSION_Mp-$Lpass*$_SESSION_Mpass+$Lcarb*0.72*$_SESSION_Qcarb+$Lwb*$_SESSION_Mwb+$LBallastSupp*$_SESSION_MwbQ-0)*$EchMoment
$By=($MVE+$_SESSION_Mp+$_SESSION_Mpass+0.72*$_SESSION_Qcarb+$_SESSION_Mwb+$_SESSION_MwbQ-orimasse(504))*$EchMasse
traceLigne($Ax,$Ay,$Bx,$By)
context.fillRect($Bx-7,$By-7,14,14)
context.strokeText('5',$Bx+10,$By-20)
//Calculs:
document.write('EtendueMasses= '+etmasse(800,504)+' / ')
document.write('OrigineMasses= '+orimasse(504)+' / ')
document.write('MVE= '+$MVE)
document.write(' / ' +'MVExX0= '+$MVE*$X0+ ' / ')
document.write('Echelle Masse= '+$EchMasse+ '/ ')
document.write('Echelle Moment= '+(Math.round(100000*$EchMoment,5))/100000)
abscisse=Math.round($MVE*$X0*$EchMoment,0)
ordonnee=Math.round(($MVE*$EchMasse-orimasse(504)),0)
document.write(' / Abscisse MVE= '+abscisse+' /')
document.write('Ordonnee MVE= '+ordonnee)
// window.location.href = 'animationAbaqueCEV.php'
</script>
</body>
</html> |
Partager