frmEntradasDetecta.frm
18.5 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
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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmEntradasDetecta
Caption = "Entradas para o Detecta"
ClientHeight = 4950
ClientLeft = 5475
ClientTop = 5400
ClientWidth = 7635
LinkTopic = "Form1"
ScaleHeight = 4950
ScaleWidth = 7635
Begin VB.Frame Frame4
Height = 4185
Left = 15
TabIndex = 36
Top = 4770
Visible = 0 'False
Width = 7605
Begin VB.Label Label4
Caption = "4"
Height = 405
Left = 240
TabIndex = 37
Top = 390
Width = 495
End
End
Begin MSComDlg.CommonDialog cdl
Left = 1170
Top = 4230
_ExtentX = 847
_ExtentY = 847
_Version = 393216
FileName = "C:\detecta.dat"
Filter = ".dat"
InitDir = "C:\"
End
Begin VB.Frame Frame3
Height = 4185
Left = 0
TabIndex = 17
Top = 0
Visible = 0 'False
Width = 7605
Begin VB.CommandButton cmPreencher
Caption = "Preencher Grade com dados externos"
Height = 375
Left = 120
TabIndex = 51
Top = 120
Width = 5295
End
Begin MSFlexGridLib.MSFlexGrid fgVazoesNos
Height = 3675
Left = 90
TabIndex = 46
Top = 480
Width = 7485
_ExtentX = 13203
_ExtentY = 6482
_Version = 393216
WordWrap = -1 'True
AllowUserResizing= 1
End
End
Begin VB.Frame Frame2
Height = 4185
Left = 0
TabIndex = 16
Top = 0
Visible = 0 'False
Width = 7605
Begin VB.Frame Frame12
Height = 2595
Left = 3120
TabIndex = 47
Top = 240
Width = 1695
Begin VB.ComboBox cbIntervalosCalc
Height = 315
ItemData = "frmEntradasDetecta.frx":0000
Left = 270
List = "frmEntradasDetecta.frx":004C
Style = 2 'Dropdown List
TabIndex = 50
Top = 1260
Width = 1185
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "Intervalos de Tempo para Cálculo"
Height = 705
Left = 270
TabIndex = 49
Top = 270
Width = 1125
End
End
Begin VB.Frame Frame11
Height = 3825
Left = 4920
TabIndex = 41
Top = 240
Width = 2565
Begin VB.ListBox ListIntervalos
Height = 2310
ItemData = "frmEntradasDetecta.frx":00A7
Left = 150
List = "frmEntradasDetecta.frx":00A9
Style = 1 'Checkbox
TabIndex = 44
Top = 870
Width = 2325
End
Begin VB.TextBox txtBombas
Height = 350
Left = 900
TabIndex = 42
Top = 3300
Width = 1000
End
Begin VB.Label Label15
Alignment = 2 'Center
Caption = "Intervalos de Tempo em Que a Bomba Funcionará"
Height = 825
Left = 570
TabIndex = 48
Top = 210
Width = 1485
End
Begin VB.Label Label14
Caption = "Bombas"
Height = 225
Left = 150
TabIndex = 43
Top = 3360
Width = 675
End
End
Begin VB.Frame Frame10
Height = 855
Left = 180
TabIndex = 38
Top = 240
Width = 2685
Begin VB.TextBox txtValvulas
Height = 350
Left = 120
TabIndex = 39
Top = 270
Width = 1000
End
Begin VB.Label Label2
Caption = "Válvulas"
Height = 225
Left = 1290
TabIndex = 40
Top = 360
Width = 765
End
End
Begin VB.Frame Frame9
Caption = "Tubos com Vazamento"
Height = 2775
Left = 180
TabIndex = 34
Top = 1200
Width = 2685
Begin VB.ListBox listLeft
Height = 2310
ItemData = "frmEntradasDetecta.frx":00AB
Left = 120
List = "frmEntradasDetecta.frx":00AD
Style = 1 'Checkbox
TabIndex = 35
Top = 270
Width = 2445
End
End
Begin VB.Label Label16
Caption = "Intervalos para Cálculo"
Height = 225
Left = 5640
TabIndex = 45
Top = 570
Width = 1905
End
End
Begin VB.CommandButton cmdFinish
Caption = "Calcular"
Height = 375
Left = 6420
TabIndex = 15
Top = 4410
Width = 1155
End
Begin VB.CommandButton cmdNext
Caption = "Próximo >"
Enabled = 0 'False
Height = 375
Left = 5130
TabIndex = 13
Top = 4410
Width = 1155
End
Begin VB.CommandButton cmdBack
Caption = "< Anterior"
Enabled = 0 'False
Height = 375
Left = 3840
TabIndex = 12
Top = 4410
Width = 1155
End
Begin VB.CommandButton cmdCancel
Caption = "Cancelar"
Height = 375
Left = 2550
TabIndex = 11
Top = 4410
Width = 1155
End
Begin VB.Frame Frame1
Height = 4185
Left = 10
TabIndex = 14
Top = 0
Width = 7605
Begin VB.CommandButton cmdFile
Height = 345
Left = 7110
TabIndex = 32
ToolTipText = "Selecione arquivo destino"
Top = 3690
Visible = 0 'False
Width = 315
End
Begin VB.TextBox txtFile
Height = 315
Left = 4140
TabIndex = 31
Top = 3660
Visible = 0 'False
Width = 2805
End
Begin VB.Frame Frame8
Caption = "Regime a ser calculado"
Height = 1005
Left = 210
TabIndex = 30
Top = 2970
Width = 3045
Begin VB.OptionButton optExtensivo
Caption = "Permanente e Extensivo"
Height = 285
Left = 300
TabIndex = 5
Top = 630
Width = 2565
End
Begin VB.OptionButton optPermanente
Caption = "Permanente"
Height = 255
Left = 300
TabIndex = 4
Top = 270
Value = -1 'True
Width = 1155
End
End
Begin VB.Frame Frame7
Caption = "Insira as informações sobre o fluido"
Height = 1335
Left = 3420
TabIndex = 25
Top = 2220
Width = 4005
Begin VB.TextBox txtMassaEspeficac
Height = 350
Left = 270
TabIndex = 10
Top = 810
Width = 1000
End
Begin VB.TextBox txtViscosidade
Height = 350
Left = 240
TabIndex = 9
Top = 300
Width = 1000
End
Begin VB.Label Label10
Caption = "Massa Específica (kg/m3)"
Height = 285
Left = 1440
TabIndex = 27
Top = 843
Width = 2415
End
Begin VB.Label Label9
Caption = "Viscosidade Cinematica (m2/s)"
Height = 285
Left = 1470
TabIndex = 26
Top = 333
Width = 2235
End
End
Begin VB.Frame Frame6
Caption = "Insira as informações gerais p/ calculo"
Height = 1845
Left = 3420
TabIndex = 23
Top = 240
Width = 4035
Begin VB.TextBox txtPressaoMin
Height = 350
Left = 210
TabIndex = 7
Top = 810
Width = 1000
End
Begin VB.TextBox txtPressaoMax
Height = 350
Left = 210
TabIndex = 8
Top = 1320
Width = 1000
End
Begin VB.TextBox txtVazaoInicial
Height = 350
Left = 210
TabIndex = 6
Top = 330
Width = 1000
End
Begin VB.Label Label12
Caption = "Pressão Máxima Admitida na Rede"
Height = 315
Left = 1350
TabIndex = 29
Top = 1338
Width = 2475
End
Begin VB.Label Label11
Caption = "Pressão Mínima Admitida na Rede"
Height = 285
Left = 1350
TabIndex = 28
Top = 843
Width = 2625
End
Begin VB.Label Label8
Caption = "Vazão Inicial (adotada) (m3/s)"
Height = 315
Left = 1350
TabIndex = 24
Top = 348
Width = 2295
End
End
Begin VB.Frame Frame5
Caption = "A rede selecionada para cálculo possui:"
Height = 2625
Left = 150
TabIndex = 18
Top = 240
Width = 3105
Begin VB.TextBox txtNos
Height = 350
Left = 180
TabIndex = 0
Top = 420
Width = 1000
End
Begin VB.TextBox txtTubos
Height = 350
Left = 180
TabIndex = 1
Top = 950
Width = 1000
End
Begin VB.TextBox txtReservatorio
Height = 350
Left = 180
TabIndex = 3
Top = 2010
Width = 1000
End
Begin VB.TextBox txtNosVazao
Height = 350
Left = 180
TabIndex = 2
Top = 1480
Width = 1000
End
Begin VB.Label Label1
Caption = "Nós"
Height = 285
Left = 1380
TabIndex = 22
Top = 453
Width = 915
End
Begin VB.Label Label5
Caption = "Tubos"
Height = 225
Left = 1380
TabIndex = 21
Top = 1013
Width = 795
End
Begin VB.Label Label6
Caption = "Nós com vazão de entrada ou saída"
Height = 435
Left = 1380
TabIndex = 20
Top = 1438
Width = 1605
End
Begin VB.Label Label7
Caption = "Reservatorio"
Height = 315
Left = 1380
TabIndex = 19
Top = 2028
Width = 1275
End
End
Begin VB.Label Label13
Caption = "Destino:"
Height = 255
Left = 3420
TabIndex = 33
Top = 3690
Visible = 0 'False
Width = 675
End
End
End
Attribute VB_Name = "frmEntradasDetecta"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim frameAtivo As Integer
Public ok As Boolean
Private Sub cbIntervalosCalc_Click()
Dim intervalos, i As Integer
Dim hora As String
intervalos = cbIntervalosCalc.Text
ListIntervalos.Clear
For i = 0 To intervalos - 1
hora = InputBox("Informe o horário correspondente a o período " & i + 1)
ListIntervalos.AddItem (i + 1 & "-" & hora & " hs")
Next i
End Sub
Private Sub cmdBack_Click()
Select Case frameAtivo
Case 4
frameAtivo = 3
Frame4.Visible = False
Frame3.Visible = True
cmdBack.Enabled = True
cmdNext.Enabled = True
cmdFinish.Enabled = False
Case 3
frameAtivo = 2
Frame3.Visible = False
Frame2.Visible = True
cmdBack.Enabled = True
cmdNext.Enabled = True
cmdFinish.Enabled = False
Case 2
frameAtivo = 1
Frame2.Visible = False
Frame1.Visible = True
cmdBack.Enabled = False
cmdNext.Enabled = True
cmdFinish.Enabled = False
End Select
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdFile_Click()
Cdl.Filter = "Detecta (*.dat)|*.dat"
Cdl.ShowOpen
If Cdl.FileName <> "" Then
txtFile.Text = Cdl.FileName
End If
End Sub
Private Sub cmdFinish_Click()
ok = True
Me.Hide
End Sub
Private Sub cmdNext_Click()
Select Case frameAtivo
Case 1
frameAtivo = 2
Frame1.Visible = False
Frame2.Visible = True
cmdBack.Enabled = True
cmdNext.Enabled = True
cmdFinish.Enabled = False
Case 2
frameAtivo = 3
Frame2.Visible = False
Frame3.Visible = True
cmdBack.Enabled = True
cmdNext.Enabled = False
cmdFinish.Enabled = True
Dim i As Integer
If Me.cbIntervalosCalc.Text = "" Then
fgVazoesNos.Cols = 2
fgVazoesNos.TextMatrix(0, 0) = "Nós/Intervalo"
fgVazoesNos.TextMatrix(0, 1) = "1"
Else
fgVazoesNos.Cols = cbIntervalosCalc.Text + 1
fgVazoesNos.TextMatrix(0, 0) = "Nós/Intervalo"
For i = 1 To fgVazoesNos.Cols - 1
fgVazoesNos.TextMatrix(0, i) = i
Next i
End If
Case 3
frameAtivo = 4
Frame3.Visible = False
Frame4.Visible = True
cmdBack.Enabled = True
cmdNext.Enabled = False
cmdFinish.Enabled = True
End Select
End Sub
Private Sub cmPreencher_Click()
Dim nomeArq As String
Cdl.Filter = "Detecta (*.dat)|*.dat"
Cdl.ShowOpen
If Cdl.FileName <> "" Then
nomeArq = Cdl.FileName
End If
nomeArq = App.path & "\dadosExt.dat"
Dim arqrede, linha As String
arqrede = FreeFile
Open nomeArq For Input As arqrede
conteudo = Input(LOF(arqrede), arqrede)
Close #arqrede
linhas = Split(conteudo, vbCrLf)
preencher
'showResults
'linha = linhas(UBound(linhas) - 1)
End Sub
Private Sub fgVazoesNos_KeyDown(KeyCode As Integer, Shift As Integer)
With fgVazoesNos
Select Case KeyCode
Case vbKeyDelete
.TextMatrix(.Row, .Col) = ""
End Select
End With
End Sub
Private Sub fgVazoesNos_KeyPress(KeyAscii As Integer)
With fgVazoesNos
Select Case KeyAscii
Case vbKeyBack
If .TextMatrix(.Row, .Col) <> "" Then
.TextMatrix(.Row, .Col) = Left(.TextMatrix(.Row, .Col), Len(.TextMatrix(.Row, .Col)) - 1)
End If
Case Else
.TextMatrix(.Row, .Col) = .TextMatrix(.Row, .Col) & Chr(KeyAscii)
End Select
End With
End Sub
Private Sub Form_Load()
ok = False
frameAtivo = 1
'cbIntervalosCalc.ListIndex = 1
End Sub
Private Sub optExtensivo_Click()
opcao
End Sub
Private Sub optPermanente_Click()
opcao
End Sub
Sub opcao()
If optPermanente.value = True Then
cmdBack.Enabled = False
cmdNext.Enabled = False
cmdFinish.Enabled = True
Else
cmdBack.Enabled = False
cmdNext.Enabled = True
cmdFinish.Enabled = False
End If
End Sub
Public Sub preencher()
Dim i, j, pal As Integer
Dim palavras
For i = 0 To UBound(linhas)
palavras = Split(linhas(i), " ")
pal = 0
For j = 0 To UBound(palavras)
If palavras(j) <> "" Then
Me.fgVazoesNos.TextMatrix(pal + 1, i + 1) = palavras(j)
pal = pal + 1
End If
Next j
Next i
End Sub