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
| Sub Bouton2_Cliquer()
'Outil et onglets utilisés
Dim OUT As Workbook
Dim VMR As Worksheet
Dim MTA As Worksheet
Dim MTR As Worksheet
Dim ACC As Worksheet
Dim AVM As Worksheet
'Toutes les données utiles à la marche-type
Dim Pk As Single 'Pk à l'instant T
Dim Pkt As Single 'Pk test
Dim Pkw As Single 'Pk test 2
Dim Pkmax As Single
'Dim T As String 'Variable temporelle
Dim V As Single 'Vitesse à l'instant T
Dim Vi As Single 'Vitesse à l'instant T créée pour les tests
Dim Vmax As Single 'Vitesse maximale due à l'infrastructure
'Dim VmaxMR As Single 'Vitesse maximale du matériel roulant
Dim V1 As Single 'Vitesse pallier du matériel roulant pour calculer l'accélération
Dim Vt As Single 'Vitesse test
Dim Vw As Single 'Vitesse test 2
Dim a As Single 'Accélération
Dim a1 As Single 'Accélération pallier
Dim amax As Single 'Accélération maximale
Dim dmax As Single 'Décélération maximale du matériel roulant
'Pas et cellule variable
Dim k As Single 'Pas de temps
Dim b As Long 'Cellule
Dim c As Long 'Cellule suivant
Dim i As Long
Dim j As Long
Dim m As Long
Dim n As Long
'Initialisation des onglets utilisés
Set OUT = ThisWorkbook
Set VMR = OUT.Worksheets("Validation matériel roulant")
Set MTA = OUT.Worksheets("Marche type sens aller")
'Set MTR = OUT.Worksheets("Marche type sens retour")
Set ACC = OUT.Worksheets("ACCUEIL")
Set AVM = OUT.Worksheets("Aperçu Vmax")
k = MTA.Cells("3", "K").Value
Pk = ACC.Cells("16", "G").Value
Pkmax = ACC.Cells("18", "G").Value
amax = VMR.Cells("4", "B").Value
'VmaxMR = VMR.Cells("6", "B").Value
dmax = VMR.Cells("7", "B").Value
Pkw = Pk
V = 0
Vw = V
V1 = VMR.Cells("5", "B").Value
j = 5
i = 6
m = 9
n = 10
MTA.Cells(m, "C") = V
MTA.Cells(m, "B") = Pk
Do Until Pk >= Pkmax
Do While AVM.Cells(i, "H").Value <= Pk
i = i + 1
j = j + 1
Loop
Vmax = AVM.Cells(j, "I").Value / 3.6
Pkt = AVM.Cells(i, "H").Value
Vt = AVM.Cells(i, "I").Value / 3.6
Do Until V <= Vt
Vw = Vw + k * d
Pkw = Pkw + k * Vw
Loop
If Pkw >= Pkt Then
a = dmax
V = V + k * a
Pk = Pk + k * V
MTA.Cells(m, "E").Value = a
MTA.Cells(n, "C").Value = V
MTA.Cells(n, "B").Value = Pk
Else
If V = Vmax Then
a = 0
V = V + k * a
Pk = Pk + k * V
MTA.Cells(m, "E").Value = a
MTA.Cells(n, "C").Value = V
MTA.Cells(n, "B").Value = Pk
Else
If V < V1 Then
a = amax
V = V + k * a
Pk = Pk + k * V
MTA.Cells(m, "E").Value = a
MTA.Cells(n, "C").Value = V
MTA.Cells(n, "B").Value = Pk
Else
a = (amax / (Vmax - V1)) * (Vmax - V)
V = V + k * a
Pk = Pk + k * V
MTA.Cells(m, "E").Value = a
MTA.Cells(n, "C").Value = V
MTA.Cells(n, "B").Value = Pk
End If
End If
End If
m = m + 1
n = n + 1
Loop
End Sub |
Partager