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
| Private Sub TraceDiagUQ(k%, N1$, N2$, L2%, N3$, L4%, N4$)
'trace 1 graphique
'N1 = NBUALT
'N2 = NBPTS
'L2 = LAlt
'N3 = NBURES
'L4 = Lres
'N4 = NBPTSSUP
Dim bloc1$, bloc2$, bloc3$, A$, B$
Dim L1%, L3%, L5%
Dim XYlegend$, Xunit$, Yunit$, Titre$
' Modification version 003-C 23/08/2005
Dim fso As Scripting.FileSystemObject
Dim MyFile As TextStream
Dim ligne As Double
MargeFile = App.path & "\parametres.conf"
' Fin modification version 003-C 23/08/2005
ColHeader = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", _
"AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ", _
"BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BL", "BM", "BN", "BO", "BP", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BX", "BY", "BZ", _
"CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CI", "CJ", "CK", "CL", "CM", "CN", "CO", "CP", "CQ", "CR", "CS", "CT", "CU", "CV", "CW", "CX", "CY", "CZ", _
"DA", "DB", "DC", "DD", "DE", "DF", "DG", "DH", "DI", "DJ", "DK", "DL", "DM", "DN", "DO", "DP", "DQ", "DR", "DS", "DT", "DU", "DV", "DW", "DX", "DY", "DZ", _
"EA", "EB", "EC", "ED", "EE", "EF", "EG", "EH", "EI", "EJ", "EK", "EL", "EM", "EN", "EO", "EP", "EQ", "ER", "ES", "ET", "EU", "EV", "EW", "EX", "EY", "EZ", _
"FA", "FB", "FC", "FD", "FE", "FF", "FG", "FH", "FI", "FJ", "FK", "FL", "FM", "FN", "FO", "FP", "FQ", "FR", "FS", "FT", "FU", "FV", "FW", "FX", "FY", "FZ", _
"GA", "GB", "GC", "GD", "GE", "GF", "GG", "GH", "GI", "GJ", "GK", "GL", "GM", "GN", "GO", "GP", "GQ", "GR", "GS", "GT", "GU", "GV", "GW", "GX", "GY", "GZ", _
"HA", "HB", "HC", "HD", "HE", "HF", "HG", "HH", "HI", "HJ", "HK", "HL", "HM", "HN", "HO", "HP", "HQ", "HR", "HS", "HT", "HU", "HV", "HW", "HX", "HY", "HZ", _
"IA", "IB", "IC", "ID", "IE", "IF", "IG", "IH", "II", "IJ", "IK", "IL", "IM", "IN", "IO", "IP", "IQ", "IR", "IS", "IT", "IU", "IV", "IW", "IX", "IY", "IZ")
A = ColHeader((k - 1) * 3)
B = ColHeader((k - 1) * 3 + 1)
L1 = N1 * (N2 + 1) - 1 + 2 * (N1 + 1) 'fin bloc
bloc1 = A & "1:" & A & L1 & ";" & B & "1:" & B & L1
L3 = L2 + 3 * N3 - 2
bloc2 = A & L2 & ":" & A & L3 & ";" & B & L2 & ":" & B & L3
If N4 = 0 Then
L5 = L4
Else
L5 = L4 + N4
End If
bloc3 = A & L4 & ":" & A & L5 & ";" & B & L4 & ":" & B & L5
'Modifications 003-D
If DeltaQ(k) >= 1 Then
Nbre_decimal_Q = "0"
Else
If DeltaQ(k) >= 0.1 Then
Nbre_decimal_Q = "0.0"
Else
Nbre_decimal_Q = "0.00"
End If
End If
If DeltaU(k) >= 1 Then
Nbre_decimal_U = "0"
Else
If DeltaU(k) >= 0.1 Then
Nbre_decimal_U = "0.0"
Else
Nbre_decimal_U = "0.00"
End If
End If
If ILANG = "1" Then
Xlegend = "Tension réseau HT"
Ylegend = "Puissance réactive réseau HT"
Titre = "Diagramme Puissance réactive réseau HT / tension réseau HT" & Chr$(10) & _
"avec une puissance active de " & PALT(k) & " MW"
Else
Ylegend = "HV network Reactive power"
Xlegend = "HV network Voltage"
Titre = "HV network reactive power / HV network voltage chart" & Chr$(10) & _
"at " & PALT(k) & " MW generator active power"
End If
If (IPRESENT = "3" Or IPRESENT = "1") Then
Yunit = "(Mvar)"
Xunit = "(kV)"
Else
Yunit = "(Q/Pmax)"
Xunit = "(kV)"
End If
'fin de modification 003-D
' pour le titre
Charts.Add after:=Sheets(Sheets.Count)
ActiveChart.ChartArea.AutoScaleFont = False
'ActiveWindow.Zoom = 100 'ne marche pas avec win2k et winXP
With ActiveChart
.Location Where:=xlLocationAsNewSheet, Name:=Str$(k) 'nom du graphique=son numéro
.ChartType = xlXYScatter
.PlotArea.Interior.ColorIndex = xlNone 'à revoir
.Legend.Position = xlLegendPositionRight
.SetSourceData Source:=Sheets("caduq").Range(bloc1), PlotBy:=xlColumns
.SeriesCollection.Add Source:=Worksheets("caduq").Range(bloc2) 'PlotBy:=xlColumns
.SeriesCollection(2).Border.LineStyle = xlDashDot
.SeriesCollection(2).Border.Weight = xlThin
.HasTitle = True
.ChartTitle.Characters.Text = UCase(Titre)
.ChartTitle.Characters.Font.Size = 12
.ChartTitle.Left = 290
.ChartTitle.Top = 10
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = UCase(Xlegend) & " " & Xunit 'XLEGEND
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = UCase(Ylegend) & " " & Yunit 'Ylegend
End With
With ActiveChart.SeriesCollection(1)
.Border.ColorIndex = 3
.MarkerStyle = xlNone
End With
With ActiveChart.SeriesCollection(2)
.Border.ColorIndex = 5
.MarkerStyle = xlNone
End With
If N4 > 0 Then
ActiveChart.SeriesCollection.Add Source:=Worksheets("caduq").Range(bloc3)
With ActiveChart.SeriesCollection(3)
.Border.ColorIndex = 10
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = 10
.MarkerStyle = xlNone
End With
' Modification 003-C
If N66(k) < 0 Then
With ActiveChart.SeriesCollection(3)
.Border.ColorIndex = 10
.MarkerBackgroundColorIndex = xlNone
.MarkerForegroundColorIndex = 10
.MarkerStyle = xlStar
.MarkerSize = 8
' .ApplyDataLabels Type:= _
' xlDataLabelsShowLabel, AutoText:=True, LegendKey:=False
End With
ActiveChart.SeriesCollection(3).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
End If
End If
With ActiveChart.Axes(xlValue)
'.TickLabels.NumberFormat = "0"
.TickLabels.NumberFormat = Nbre_decimal_Q
.MinimumScale = Qmin(k)
.MaximumScale = Qmax(k)
.MajorUnit = DeltaQ(k)
.HasMajorGridlines = True
.MajorGridlines.Border.ColorIndex = 15
.MajorGridlines.Border.Weight = xlThin
.AxisTitle.Orientation = xlUpward 'xlVertical 'xlHorizontal
'.AxisTitle.Left = 9 '25
'.AxisTitle.Top = 120 '40
'.AxisTitle.VtFont.Size = 100
' Modification version 003-C 02-08-2005
'On change l'épaisseur de l'axe principal des Y
.Border.Weight = xlMedium
' Fin modification version 003-C 02-08-2005
End With
'Axe X = U
With ActiveChart.Axes(xlCategory)
'TickLabels.NumberFormat = "0.00"
.TickLabels.NumberFormat = Nbre_decimal_U
.TickLabelPosition = xlLow
.MinimumScale = Umin(k)
.MaximumScale = Umax(k)
.MajorUnit = DeltaU(k)
.HasMajorGridlines = True
.MajorGridlines.Border.ColorIndex = 15
.MajorGridlines.Border.Weight = xlThin
.AxisTitle.Orientation = xlHorizontal
' Modification version 003-C 02-08-2005
'On change l'épaisseur de l'axe principal des X
.Border.Weight = xlMedium
' Fin modification version 003-C 02-08-2005
End With
'AQ
With ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, 5, 22, 12)
.TextFrame.Characters.Text = "AQ#" & ICOMAQ
.TextFrame.HorizontalAlignment = xlLeft
.TextFrame.VerticalAlignment = xlTop
.TextFrame.Characters.Font.Size = 8
.TextFrame.AutoSize = True
.Name = "numéro AQ"
End With
With ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 30, 10, 260, 30)
.TextFrame.Characters.Text = AFFNOM
.TextFrame.HorizontalAlignment = xlLeft 'modif 003-C xlCenter -> xlLeft
.TextFrame.VerticalAlignment = xlCenter
.TextFrame.Characters.Font.FontStyle = "Gras italique"
.TextFrame.Characters.Font.Size = 14 'modif 003-C/D 20 -> 16 ->12 -> 14
' .TextFrame.Characters.Text = AFFNOM
End With
ActiveChart.ChartArea.Border.LineStyle = xlAutomatic
ActiveChart.Legend.Delete
With ActiveSheet.PageSetup
.LeftMargin = Application.CentimetersToPoints(Marge_gauche)
.RightMargin = Application.CentimetersToPoints(Marge_droite)
.TopMargin = Application.CentimetersToPoints(Marge_haut)
.BottomMargin = Application.CentimetersToPoints(Marge_bas)
.HeaderMargin = Application.CentimetersToPoints(Marge_tete)
.FooterMargin = Application.CentimetersToPoints(Marge_pied)
End With
End Sub |
Partager