0% found this document useful (0 votes)
88 views102 pages

Frmdog - 1 Option Explicit

This form is titled "frmInicial" and contains labels and buttons including a label displaying the version ("Beta 1.1/55 - Diciembre 1.998") and a button to exit the form and enable another form ("frmMain"). The form has a frame containing these elements with no scrollbars and is not resizable by the user.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views102 pages

Frmdog - 1 Option Explicit

This form is titled "frmInicial" and contains labels and buttons including a label displaying the version ("Beta 1.1/55 - Diciembre 1.998") and a button to exit the form and enable another form ("frmMain"). The form has a frame containing these elements with no scrollbars and is not resizable by the user.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 102

frmDOG - 1

Option Explicit
frmDOG - 1

VERSION 5.00
Begin VB.Form frmDOG
BorderStyle = 3 'Fixed Dialog
ClientHeight = 375
ClientLeft = 5250
ClientTop = 4245
ClientWidth = 1095
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 375
ScaleWidth = 1095
ShowInTaskbar = 0 'False
Begin VB.Label Label1
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "D.O.G."
BeginProperty Font
Name = "Bookman Old Style"
Size = 9.75
Charset = 0
Weight = 600
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 0
Top = 0
Width = 1095
End
End
frmGrafica - 1

VERSION 5.00
Object = "{02B5E320-7292-11CF-93D5-0020AF99504A}#1.0#0"; "MSCHART.OCX"
Begin VB.Form frmGrafica
Caption = "Gráfica de ..."
ClientHeight = 4905
ClientLeft = 315
ClientTop = 930
ClientWidth = 5745
Icon = (Icono)
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 5745
Begin MSChartLib.MSChart MSChart1
Height = 4695
Left = 120
TabIndex = 0
Top = 120
Width = 5535
End
End
frmGridValida - 1

Dim fEntrada As String, fT As String

Private Sub Anadir_Click()


End Sub

Private Sub Command1_Click()

End Sub

Private Sub Elimina_Click()

On Error GoTo NoPuedo


If MSFlexGrid1.Rows = 1 Then GoTo NoPuedo
MSFlexGrid1.RemoveItem MSFlexGrid1.Rows
Exit Sub

NoPuedo:
gMsg = "No se puede eliminar esta fila"
gTitulo = "IMPOSIBLE"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo

End Sub

Private Sub Form_Load()

fT = Chr(9)

With MSFlexGrid1
.Clear
.FixedRows = 1
.FixedCols = 1
.Row = 1
.col = 1
.Rows = 1
.Cols = 3
.CellAlignment = flexAlignCenterCenter
End With
'Cabecera
fEntrada = " Punto " & fT & " x " & fT & " z "

MSFlexGrid1.FormatString = fEntrada
End Sub

Private Sub Salir_Click()

Unload frmGridValida

End Sub

Private Sub Text1_GotFocus()

With Text1
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text2_GotFocus()

With Text2
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub UnoMas_Click()

If Text1.Text <> " " And Text2.Text <> " " Then
fEntrada = Str(MSFlexGrid1.Rows) & fT & Text1.Text & _
fT & Text2.Text
MSFlexGrid1.AddItem fEntrada
frmGridValida - 2

MSFlexGrid1.Refresh
End If
Text1.Text = " "
Text2.Text = " "
Text1.SetFocus

End Sub
frmGridValida - 1

VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmGridValida
Caption = "Form1"
ClientHeight = 3225
ClientLeft = 4875
ClientTop = 930
ClientWidth = 6225
LinkTopic = "Form1"
ScaleHeight = 3225
ScaleWidth = 6225
Begin VB.Frame Frame2
Caption = "Editar punto "
Height = 975
Left = 3360
TabIndex = 9
Top = 1320
Width = 2775
Begin VB.TextBox Text4
Height = 285
Left = 360
TabIndex = 13
Text = "Text4"
Top = 600
Width = 975
End
Begin VB.TextBox Text3
Height = 285
Left = 360
TabIndex = 12
Text = "Text3"
Top = 240
Width = 975
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "y: "
Height = 195
Left = 120
TabIndex = 11
Top = 600
Width = 165
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "x: "
Height = 195
Left = 120
TabIndex = 10
Top = 240
Width = 165
End
End
Begin VB.CommandButton Elimina
Caption = "&Eliminar"
Height = 255
Left = 3360
TabIndex = 8
ToolTipText = "Elimina el último punto"
Top = 2400
Width = 1095
End
Begin VB.Frame Frame1
Caption = "Añadir punto "
Height = 1095
Left = 3360
TabIndex = 5
Top = 120
Width = 2775
Begin VB.CommandButton UnoMas
Caption = "&Añadir"
Height = 255
Left = 1560
TabIndex = 3
frmGridValida - 2

ToolTipText = "Añade el punto indicado"


Top = 240
Width = 1095
End
Begin VB.TextBox Text2
Height = 285
Left = 360
TabIndex = 1
Top = 600
Width = 975
End
Begin VB.TextBox Text1
Height = 285
Left = 360
TabIndex = 0
Top = 240
Width = 975
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "z: "
Height = 195
Left = 120
TabIndex = 7
Top = 600
Width = 165
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "x: "
Height = 195
Left = 120
TabIndex = 6
Top = 240
Width = 165
End
End
Begin VB.CommandButton Salir
Caption = "&Salir"
Height = 375
Left = 3360
TabIndex = 4
Top = 2760
Width = 1095
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3015
Left = 120
TabIndex = 2
Top = 120
Width = 3135
_ExtentX = 5530
_ExtentY = 5318
_Version = 327680
Cols = 3
End
End
frmInicial - 1

Option Explicit

Private Sub Picture1_Click()

End Sub

Private Sub Label5_Click()

gMsg = "Beta 1.0 - Verano 1.998" & Chr(10) & _


"Beta 1.1 - Diciembre 1.998"
gTitulo = "VERSIONES"
MsgBox gMsg, vbOKOnly + vbInformation, gTitulo

End Sub

Private Sub Salir_Click()

Screen.MousePointer = 11
frmMain.Enabled = True
Unload frmInicial
Screen.MousePointer = 0

End Sub
frmInicial - 1

VERSION 5.00
Begin VB.Form frmInicial
ClientHeight = 2505
ClientLeft = 2265
ClientTop = 2955
ClientWidth = 7695
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 2505
ScaleWidth = 7695
Begin VB.Frame Frame1
Height = 2415
Left = 120
TabIndex = 0
Top = 0
Width = 7455
Begin VB.CommandButton Salir
Caption = "&Salir"
Height = 375
Left = 6240
TabIndex = 6
Top = 1920
Visible = 0 'False
Width = 1095
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "Beta 1.1/55 - Diciembre 1.998"
Height = 195
Left = 840
TabIndex = 5
Top = 2160
Width = 2145
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "Versión: "
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 120
TabIndex = 4
Top = 2160
Width = 765
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "José María Medina Villaverde"
BeginProperty Font
Name = "Arial Narrow"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 225
Left = 3120
TabIndex = 3
Top = 1920
Width = 1995
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
frmInicial - 2

Caption = "Generalización del modelo de Battjes y Janssen (1.978)"


BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 390
Left = 3840
TabIndex = 2
Top = 1440
Width = 2715
WordWrap = -1 'True
End
Begin VB.Label Label1
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "DINÁMICA DEL PERFIL DE PLAYA - 2"
BeginProperty Font
Name = "Bookman Old Style"
Size = 18
Charset = 0
Weight = 600
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 975
Left = 3120
TabIndex = 1
Top = 240
Width = 4215
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 1860
Left = 120
Picture = (Mapa de bits)
Stretch = -1 'True
Top = 240
Width = 2865
End
End
End
frmMain - 1

Option Explicit

Dim mTopNode As Node


Private mThisControl As Control
Dim mTopNodeResultados As Node

Dim mCab As DatosGrd, mDat() As Single

Private Sub A_Grapher_Click()

Dim f As Integer, file As String, X As Single, _


fila As Integer

On Error GoTo Salgamos


With CommonDialog1
.filename = "perfil.dat"
.CancelError = True
.DialogTitle = "Crear archivo ASCI"
.Filter = "Perfil GRAPHER (*.dat)|*.dat|Archivos DPP (*.pro)|*.pro|Todos los archivos
(*.*)|*.*"
.Action = 2
file = .filename
End With

'A ver si existe el archivo


On Error GoTo NoExiste
k = FileLen(file)
Call Existe(file)
If gResponse = 7 Then Exit Sub

Seguir:
Screen.MousePointer = 11
f = FreeFile
fila = Val(Label10.Caption)
Open file For Output As #f
If Right(file, 3) = "pro" Then Print #f, Fich.Columnas
For j = 1 To Fich.Columnas
X = gDx * (j - 1)
Print #f, Str(X); " ,"; Str(gZ(fila, j))
Next j
Close #f
GoTo Salgamos

NoExiste:
Resume Seguir
Salgamos:
Screen.MousePointer = 0

End Sub

Private Sub Command1_Click()

Dim f As Integer, k As Long, _


file As String

Screen.MousePointer = 11
file = Label4.Caption
On Error GoTo NoFile
k = FileLen(file) 'Para ver si existe el archivo
On Error GoTo 0
Call TipoGrd(file)

Picture1.Cls
Select Case Fich.Clase
Case Is = "DSAA"
Call leeASCI(file)
Case Is = "DSBB"
Call LeeBinario(file)
End Select
Playa_Cilindrica.Enabled = True
A_Grapher.Enabled = True
Screen.MousePointer = 0
Exit Sub
frmMain - 2

NoFile:
Screen.MousePointer = 0
Call NoHay

End Sub

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Lee el archivo batimétrico para dibujo")

End Sub

Private Sub Command2_Click()

Frame12.Enabled = True

Call NameFile
frmGridValida.Show

End Sub

Private Sub Check1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

gAntes = Check1.Value

End Sub

Private Sub Check1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Check1.Value = gAntes

End Sub

Private Sub Check2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

gAntes = Check2.Value

End Sub

Private Sub Check2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Check2.Value = gAntes

End Sub

Private Sub Check3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

gAntes = Check3.Value

End Sub

Private Sub Check3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Check3.Value = gAntes

End Sub

Private Sub Check4_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

gAntes = Check4.Value

End Sub

Private Sub Check4_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Check4.Value = gAntes

End Sub

Private Sub Dibujo_Click()

Dim f As Integer, fila As Integer, _


X As Single
frmMain - 3

Screen.MousePointer = 11
Call Inicializa_Picture1
fila = Val(Label10.Caption)

If fila = 0 Then
Dibujo.Enabled = False
Playa_Cilindrica.Enabled = False
Exit Sub
End If

f = FreeFile

Picture1.Cls

Open "dibujo.tmp" For Output As #f


For j = 1 To Fich.Columnas
X = gDx * (j - 1)
Print #f, Str(X); " ,"; Str(gZ(fila, j))
Next j
Close #f

Call perfil(fila, "frmMain", " ")


Screen.MousePointer = 0

End Sub

Private Sub Dibujo_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Dibuja el gráfico actual")

End Sub

Sub Enable_todo()

mnuModel.Enabled = True

Toolbar2.Buttons(1).Enabled = True
Toolbar2.Buttons(2).Enabled = True

End Sub
Sub Disable_todo()

mnuModel.Enabled = False
mnuResults.Enabled = False
Toolbar2.Buttons(1).Enabled = False
Toolbar2.Buttons(2).Enabled = False
Toolbar3.Buttons(1).Enabled = False
Check1.Value = 0
Check2.Value = 0
Check3.Value = 0
ProgressBar1.Value = ProgressBar1.min

End Sub
Private Sub Info()

Select Case Check4.Value


Case Is = 1
Frame10.Visible = True
Frame9.Visible = True
Frame8.Visible = True
Frame7.Visible = True
Frame6.Visible = True
Frame5.Visible = True

Case Else
Frame10.Visible = False
Frame9.Visible = False
Frame8.Visible = False
Frame7.Visible = False
Frame6.Visible = False
Frame5.Visible = False

End Select
frmMain - 4

End Sub
Private Sub PillaFoco()

frmMain.Refresh

End Sub

Private Sub Form_GotFocus()

Call PillaFoco

End Sub

Private Sub Form_Load()

Dim Inicio As Single, Final As Single, _


Elapsed As Single

Dim clmX As ColumnHeader


Inicio = Timer
frmInicial.Show
frmInicial.Refresh
TreeView2.ImageList = ImageList1
PopulateTreeViewDatos

StatusBar1.Panels.Add
StatusBar1.Panels.Add
StatusBar1.Panels.Add
StatusBar1.Panels(1).AutoSize = sbrContents
StatusBar1.Panels(2).AutoSize = sbrContents
StatusBar1.Panels(4).AutoSize = sbrContents
StatusBar1.Panels(1).Alignment = sbrCenter
StatusBar1.Panels(2).Text = "No hay proyecto abierto"
StatusBar1.Panels(3).Visible = False

Text7.Text = Date & " - " & Time

Do Until Elapsed > 4


Final = Timer
Elapsed = Final - Inicio
Loop
Call Descarga

End Sub

Private Sub PopulateTreeViewDatos()

Dim X As Integer, Cat As String

Set mTopNode = TreeView2.Nodes.Add(, , , "proyecto", 8, 9)

Set Bati = TreeView2.Nodes.Add(mTopNode, tvwChild, , "Batimetría", 1, 1)


Set Olas = TreeView2.Nodes.Add(mTopNode, tvwChild, , "Oleaje", 6, 6)
Set Calibra = TreeView2.Nodes.Add(mTopNode, tvwChild, , "Calibración", 5, 5)
TreeView2.Nodes(1).Expanded = True

End Sub
Private Sub RemoveResultados()

On Error GoTo Salir


TreeView1.Nodes.Remove 1

Salir:

End Sub
Private Sub PopulateTreeViewResultados()

Dim X As Integer, Cat As String

Set mTopNodeResultados = TreeView1.Nodes.Add(, , , "Resultados", 1, 2)

Set Perfil_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, gProyectoNP.Batimetria,


"Perfil", 18, 2)
frmMain - 5

Set Hm_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Hm.grd", "Altura de ola máx


ima", 4, 2)
Set Hrms_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Hrms.grd", "Altura de ola
Hrms", 5, 2)
Set L_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Londa.grd", "Longitud de ond
a", 11, 2)
Set Q_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Qb.grd", "Fracción de olas r
otas", 6, 2)
Set Cg_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "CGrupo.grd", "Celeridad de
grupo", 16, 2)
Set S_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, , "Tensor de radiación", 8, 2
)
Set SXX_R = TreeView1.Nodes.Add(S_R, tvwChild, "Sxx.grd", "Sxx", 9, 2)
Set SXY_R = TreeView1.Nodes.Add(S_R, tvwChild, "Sxy.grd", "Sxy", 9, 2)
Set SYY_R = TreeView1.Nodes.Add(S_R, tvwChild, "Syy.grd", "Syy", 9, 2)
Set E_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "E.grd", "Energía", 15, 2)
Set Px_R = TreeView1.Nodes.Add(E_R, tvwChild, "Px.grd", "Flujo transversal de energía", 9
, 2)
Set Py_R = TreeView1.Nodes.Add(E_R, tvwChild, "Py.grd", "Flujo longitudinal de energía",
9, 2)
Set D_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, , "Disipación de energía", 3,
2)
Set DR_R = TreeView1.Nodes.Add(D_R, tvwChild, "Db.grd", "Por rotura de oleaje", 9, 2)
Set DF_R = TreeView1.Nodes.Add(D_R, tvwChild, "Df.grd", "Por fricción con el fondo", 9, 2
)
Set Fw_R = TreeView1.Nodes.Add(DF_R, tvwChild, "Fw.grd", "Parámetro de fricción con el fo
ndo", 9, 2)
Set Ur = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Ursell.grd", "Parámetro de Ur
sell", 10, 2)
Set SU = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Setup.grd", "Set-up", 13, 2)
Set Uorb_R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, "Uorb.grd", "Velocidad orb
ital", 17, 2)
Set R = TreeView1.Nodes.Add(mTopNodeResultados, tvwChild, , "Términos impulsores", 14, 2)
Set Rx_R = TreeView1.Nodes.Add(R, tvwChild, "Rx.grd", "Rx", 9, 2)
Set Ry_R = TreeView1.Nodes.Add(R, tvwChild, "Ry.grd", "Ry", 9, 2)

TreeView1.Nodes(1).Expanded = True
TreeView1.Nodes(6).Expanded = False
TreeView1.Nodes(10).Expanded = False

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call NoXY
Call Ayuda(" ")

End Sub

Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call NoXY

End Sub

Private Sub Frame1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbRightButton Then


Set mThisControl = Frame1
PopupMenu mnuHelp
End If
Set mThisControl = Nothing

End Sub

Private Sub Frame3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call NoXY
Call Ayuda("Información sobre el proyecto")

End Sub

Private Sub Label4_Change()


frmMain - 6

Command1.Caption = "&Leer " & Label4.Caption


ProgressBar2.Value = ProgressBar2.min

End Sub

Private Sub Label7_Click()

Text7.Text = Date & " - " & Time

End Sub

Private Sub mnuEditEliminaActual_Click()


Dim nodo As Integer

On Error GoTo Salir


nodo = TreeView2.SelectedItem.Index

If TreeView2.SelectedItem.Key <> "" Then


TreeView2.Nodes.Remove nodo
TreeView2.Nodes(1).Text = "proyecto"
End If

Call LimpiaTexto1
Call RemoveResultados
Call NoProyectoStatus
Call Disable_todo

Salir:
End Sub

Private Sub mnuEditEliminaTodos_Click()

For i = TreeView2.Nodes.Count To 1 Step -1


If TreeView2.Nodes(i).Key <> "" Then
TreeView2.Nodes.Remove i
End If
Next i
TreeView2.Nodes(1).Text = "proyecto"
Call LimpiaTexto1
Call RemoveResultados
Call NoProyectoStatus
Call Disable_todo

End Sub

Private Sub mnuFileCrearCalibracion_Click()


Screen.MousePointer = 11
frmParametros.Show
frmMain.Enabled = False
Screen.MousePointer = 0
End Sub

Private Sub mnuFileCrearOleaje_Click()

Screen.MousePointer = 11
frmOlas.Show
frmMain.Enabled = False
Screen.MousePointer = 0

End Sub

Private Sub mnuFileEliminarResutados_Click()

Dim f As Integer, a As String, num As Integer, _


max As Integer

'Asegurar que se desea eliminar los archivos de resultados


gMsg = "No podrá recuperarlos" & Chr(10) & "¿Está seguro?"
gTitulo = "ELIMINAR RESULTADOS"
gResponse = MsgBox(gMsg, vbQuestion + vbYesNo + vbDefaultButton1, gTitulo)
If gResponse = 7 Then Exit Sub
frmMain - 7

max = 21
Call Inicializa_Picture1
Call LaSonda_Inicio("ELIMINANDO ARCHIVOS", max, 0)

f = FreeFile
On Error GoTo NoLista
Open "listaResult.dat" For Input As #f
Do While Not EOF(f)
num = num + 1
Input #f, a
Call Elimina(a, num)
Loop
Close #f
Call Elimina("listaResult.dat", max)

Fin:
Call LaSonda_Final
Exit Sub

NoLista:
gMsg = "No hay lista de resultados" & Chr(10) & _
"No se pueden eliminar los archivos"
gTitulo = "FALTAN DATOS"
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo
Resume Fin

End Sub

Private Sub mnuFileExportarResultados_Click()

Dim file As String, Ficheros As Integer, _


f As Integer, canal As Integer, _
File1 As String

Ficheros = 14
On Error GoTo Salida
With CommonDialog1
.CancelError = True
.DialogTitle = "Exportar archivo de resultados"
.Filter = "Resultados (*.res)|*.res|Todos los archivos (*.*)|*.*"
.Action = 1
file = .filename
File1 = .FileTitle
End With
On Error GoTo NoExiste
k = FileLen(file)
On Error GoTo 0
kk:
If gResponse = 7 Then Exit Sub
sigue:
Kill (file)
Call LaSonda_Inicio("GRABANDO ARCHIVO DE RESULTADOS", Ficheros, 0)
canal = FreeFile
Open file For Binary As #canal
f = FreeFile
On Error GoTo NoFile
frmMain.ProgressBar1.Value = 1
k = FileLen("Londa.grd")
Call LeerBin("Londa.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 2
k = FileLen("Cgrupo.grd")
Call LeerBin("Cgrupo.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 3
k = FileLen("Hm.grd")
Call LeerBin("Hm.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 4
k = FileLen("Hrms.grd")
Call LeerBin("Hrms.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 5
frmMain - 8

k = FileLen("Qb.grd")
Call LeerBin("Qb.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 6
k = FileLen("Uorb.grd")
Call LeerBin("Uorb.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 7
k = FileLen("Df.grd")
Call LeerBin("Df.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 8
k = FileLen("Db.grd")
Call LeerBin("Db.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 9
k = FileLen("E.grd")
Call LeerBin("E.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 10
k = FileLen("Sxx.grd")
Call LeerBin("Sxx.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 11
k = FileLen("Sxy.grd")
Call LeerBin("Sxy.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 12
k = FileLen("Syy.grd")
Call LeerBin("Syy.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 13
k = FileLen("Ursell.grd")
Call LeerBin("Ursell.grd")
Call WriteBin(file, canal)
frmMain.ProgressBar1.Value = 14
On Error GoTo 0

Call LaSonda_Final
Unload frmSonda
Exit Sub

NoExiste:
gTitulo = "¡¡ATENCIÓN!!"
gMsg = "El archivo " & File1 & " existe" & Chr(10) & _
"¿Sobreescribo?"
gResponse = MsgBox(gMsg, vbQuestion + vbYesNo + vbDefaultButton1, gTitulo)
Resume kk

NoFile:
gTitulo = "ERROR DE LECTURA"
gMsg = "No existe un archivo"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo
Salida:

End Sub
Sub WriteBin(file As String, canal As Integer)

Put #canal, , "DSBB"


Put #canal, , mCab.Columnas
Put #canal, , mCab.filas
Put #canal, , mCab.MinX
Put #canal, , mCab.MaxX
Put #canal, , mCab.MinY
Put #canal, , mCab.MaxY
Put #canal, , mCab.Minz
Put #canal, , mCab.MaxZ
For i = 1 To mCab.filas
For j = 1 To mCab.Columnas
Put #canal, , mDat(i, j)
Next j
Next i
frmMain - 9

End Sub
Sub LeerBin(file As String)

Dim f As Integer
f = FreeFile

Open file For Binary As #f


Get #f, , mCab.Clase
Get #f, , mCab.Columnas
Get #f, , mCab.filas
Get #f, , mCab.MinX
Get #f, , mCab.MaxX
Get #f, , mCab.MinY
Get #f, , mCab.MaxY
Get #f, , mCab.Minz
Get #f, , mCab.MaxZ

ReDim mDat(1 To mCab.filas, 1 To mCab.Columnas) As Single


For i = 1 To mCab.filas
For j = 1 To mCab.Columnas
Get #f, , mDat(i, j)
Next j
Next i
Close #f
End Sub
Private Sub mnuFileOpenAbrir_Click()

Dim f As Integer, file As String, filedat As String, st As String, _


largo As Integer, lon As Integer, a As String

Call mnuEditEliminaTodos_Click
On Error GoTo SalirOpen
If gProyectoLista = "" Then
With CommonDialog1
.CancelError = True
.DialogTitle = "Importar archivo de proyecto"
.Filter = "Proyecto (*.dpp)|*.dpp"
.Action = 1
frmMain.Refresh
gProyecto.Nombre = .filename
gProyectoNP.Nombre = .FileTitle
Call mnuEditEliminaTodos_Click
TreeView2.Nodes(1).Text = .FileTitle
End With
End If
frmMain.Refresh
TreeView2.Refresh

f = FreeFile
Open gProyecto.Nombre For Input As #f
Input #f, gProyecto.Batimetria
Input #f, gProyecto.Oleaje
Input #f, gProyecto.Calibracion
Close #1
i = 0
Do While a <> "\"
a = Mid(gProyecto.Batimetria, Len(gProyecto.Batimetria) - i, 1)
i = i + 1
Loop
gProyectoNP.Batimetria = Right(gProyecto.Batimetria, i - 1)
TreeView2.Nodes.Add Bati, tvwChild, "B", gProyecto.Batimetria, 7, 7
TreeView2.Nodes.Add Olas, tvwChild, "C", gProyecto.Oleaje, 7, 7
TreeView2.Nodes.Add Calibra, tvwChild, "D", gProyecto.Calibracion, 7, 7
For i = 1 To 4
TreeView2.Nodes(i).Expanded = True
Next i

TreeView2.Refresh

'Barra de estado
StatusBar1.Panels(2).Text = "Proyecto abierto"
StatusBar1.Panels(3).Visible = True
StatusBar1.Panels(3).AutoSize = sbrContents
frmMain - 10

StatusBar1.Panels(3).Text = gProyectoNP.Nombre

Call Herramientas
Call Enable_todo

file = gProyecto.Nombre
largo = Len(file) - 3
filedat = Left(file, largo) + ".txt"
f = FreeFile
On Error GoTo nodat
Open filedat For Input As #f
Input #f, st
Text8.Text = st
Input #f, st
Text7.Text = st
Input #f, st
Text6.Text = st
Input #f, st
Text5.Text = st
Close #f
Exit Sub

Text8.SetFocus

nodat:
Close #f
Frame2.Caption = "No hay datos"
Exit Sub

SalirOpen:
End Sub
Private Sub LimpiaTexto1()

Text8.Text = ""
Text7.Text = ""
Text6.Text = ""
Text5.Text = ""
Frame2.Caption = "Datos del proyecto"
StatusBar1.Panels(2).Text = "No hay proyecto abierto"
StatusBar1.Panels(3).Visible = False
Picture1.Cls

Label4.Caption = ""
Label5.Caption = ""
Label6.Caption = ""
Label10.Caption = ""
Label15.Caption = ""
Label16.Caption = ""
Label17.Caption = ""
Label18.Caption = ""
Label26.Caption = ""
Dibujo.Enabled = False
MSChart1.Visible = False
Playa_Cilindrica.Enabled = False
A_Grapher.Enabled = False
VScroll1.min = 0
VScroll1.max = 0
frmMain.ProgressBar2.Value = 1

End Sub

Private Sub mnuFileOpenExportar_Click()

Dim f As Integer, file As String, filedat As String, _


FileNombre As String

If TreeView2.Nodes(1).Text = "Proyecto" Then


gMsg = "No hay proyecto completo" & Chr(10)
gMsg = gMsg & "Seleccione el componente que falta" & Chr(10)
gMsg = gMsg & "y de nombre al proyecto"
gTitulo = "PROYECTO INCOMPLETO"
frmMain - 11

MsgBox gMsg, vbInformation + vbOKOnly + vbDefaultButton1, gTitulo


Exit Sub
Else
On Error GoTo sale
With CommonDialog1
.filename = TreeView2.Nodes(1).Text
.CancelError = True
.DialogTitle = "Exportar archivo de proyecto"
.Filter = "Proyecto (*.dpp)|*.dpp"
.Action = 2
End With
f = FreeFile
file = CommonDialog1.filename
FileNombre = CommonDialog1.FileTitle

If Right(file, 3) <> "dpp" And Right(file, 3) <> "DPP" Then file = file + ".dpp"
filedat = Left(file, (Len(file) - 3)) + ".txt"

On Error GoTo NoExiste


k = FileLen(file)
Call Existe(file)
If gResponse = 7 Then Exit Sub

sigue:
FileNombre = Left(FileNombre, Len(FileNombre) - 4)
TreeView2.Nodes(1).Text = FileNombre
TreeView2.Refresh

Open file For Output As #f


For i = 5 To 7
Print #f, TreeView2.Nodes(i).Text
Next i
Close #f

f = FreeFile
Open filedat For Output As #f
Print #f, Text8.Text
Print #f, Text7.Text
Print #f, Text6.Text
Print #f, Text5.Text
Close #f
End If
GoTo sale

NoExiste:
Resume sigue
sale:
End Sub

Private Sub mnuFileOpenImportar_Click()

Dim codigo As Single


On Error GoTo SalirImport
With CommonDialog1
.CancelError = True
.DialogTitle = "Importar archivo de datos"
.Filter = "Batimetría (*.grd)|*.grd|Oleaje (*.ola)|*.ola|Calibración (*.cal)|*.cal"
.Action = 1
End With
On Error GoTo Captura2
gZonaError = "Importar dato"
Select Case Right(CommonDialog1.filename, 3)
Case Is = "grd", "GRD"
gProyecto.Batimetria = CommonDialog1.filename
gProyectoNP.Batimetria = CommonDialog1.FileTitle
TreeView2.Nodes.Add Bati, tvwChild, "B", gProyecto.Batimetria, 7, 7
TreeView2.Refresh
Call Herramientas
Case Is = "ola", "OLA"
gProyecto.Oleaje = CommonDialog1.filename
gProyectoNP.Oleaje = CommonDialog1.FileTitle
TreeView2.Nodes.Add Olas, tvwChild, "C", gProyecto.Oleaje, 7, 7
Case Is = "cal", "CAL"
gProyecto.Calibracion = CommonDialog1.filename
frmMain - 12

gProyectoNP.Calibracion = CommonDialog1.FileTitle
TreeView2.Nodes.Add Calibra, tvwChild, "D", gProyecto.Calibracion, 7, 7
End Select
On Error GoTo 0
For i = 1 To 4
TreeView2.Nodes(i).Expanded = True
Next i
GoTo SalirImport

Captura2:
codigo = Err.Number
gZonaError = "Importando dato"
Call errores(codigo)

SalirImport:
Screen.MousePointer = 0
End Sub

Private Sub mnuFileOpenNuevo_Click()

Call mnuEditEliminaTodos_Click
Call Disable_todo

End Sub
Sub NoProyectoStatus()

StatusBar1.Panels(2).Text = "No hay proyecto"


StatusBar1.Panels(3).Visible = False
StatusBar1.Panels(3).AutoSize = sbrContents
StatusBar1.Panels(3).Text = ""

End Sub

Private Sub mnuFileOpenResultados_Click()

Call NoImplementado

End Sub

Private Sub mnuFileOpenSalir_Click()

Dim Inicio As Single, Final As Single, _


Elap As Single

gMsg = "¿Desea salir del programa?"


gTitulo = "SALIDA"
gResponse = MsgBox(gMsg, vbQuestion + vbYesNo + vbDefaultButton1, gTitulo)
If gResponse = 7 Then Exit Sub
Close
Screen.MousePointer = 0
frmMain.Visible = False
frmDOG.Show
frmDOG.Refresh
Inicio = Timer
Do While Elap < 0.5
Final = Timer
Elap = Final - Inicio
Loop
Unload frmDOG
End

End Sub

Private Sub mnuPerfilesUniformidad_Click()

frmUniform.Show

End Sub

Private Sub mnuResults_Click()

frmResultados.Show

End Sub
frmMain - 13

Private Sub mnuVerInfo_Click()

If mnuVerInfo.Checked = True Then


mnuVerInfo.Checked = False
Check4.Value = 0
Else
mnuVerInfo.Checked = True
Check4.Value = 1
End If

Call Info

End Sub

Private Sub MSChart2_ChartSelected(MouseFlags As Integer, Cancel As Integer)

frmGrafica.MSChart1 = gChart2
frmGrafica.Caption = "Gráfica de Hrms"
frmGrafica.Show

End Sub

Private Sub MSChart3_ChartSelected(MouseFlags As Integer, Cancel As Integer)

frmGrafica.MSChart1 = gChart3
frmGrafica.Caption = "Perfil (Fila 1)"
frmGrafica.Show

End Sub

Private Sub MSChart4_ChartSelected(MouseFlags As Integer, Cancel As Integer)

frmGrafica.MSChart1 = gChart4
frmGrafica.Caption = "Gráfica de Qb"
frmGrafica.Show

End Sub

Private Sub Text2_GotFocus()

With Text2
.SelLength = Len(.Text)
.SelStart = 0
End With
Call NameFile

End Sub
Private Sub NameFile()

gFileVal = Text2.Text
If Right(gFileVal, 4) <> ".val" Then gFileVal = gFileVal & ".val"
frmGridValida.Caption = gFileVal

End Sub
Private Sub Text2_LostFocus()

If Text2.Text = " " Then


gMsg = "No ha dado nombre al archivo de puntos"
gTitulo = "ERROR"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo
Text2.SetFocus
Exit Sub
End If
Call NameFile

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)


Select Case Button.Key
Case Is = "Abrir"
Call mnuFileOpenAbrir_Click
Case Is = "Oleaje"
Call mnuFileCrearOleaje_Click
frmMain - 14

Case Is = "Calibracion"
Call mnuFileCrearCalibracion_Click
Case Is = "Impresoras"
'CommonDialog1.ShowPrinter
CommonDialog1.Action = 5
Case Is = "Salir"
Call mnuFileOpenSalir_Click
End Select
Label1.Caption = Button
End Sub

Private Sub mnuHelp1Acercade_Click()

Screen.MousePointer = 11
frmInicial.Show
frmInicial.Salir.Visible = True
frmMain.Enabled = False
Screen.MousePointer = 0
End Sub

Private Sub mnuHelpQuees_Click()

mThisControl.ShowWhatsThis

End Sub

Private Sub mnuModel_Click()

'Rutina de control que utiliza las subrutinas contenidas en los _


módulos 3, 4 y 5

'Chequeo de los datos previo a la modelización

gTitulo = "ERROR EN LOS DATOS"


If Right(gProyecto.Batimetria, 3) <> "grd" And _
Right(gProyecto.Batimetria, 3) <> "GRD" Then
gMsg = "El archivo" & Chr(10) & _
gProyecto.Batimetria & Chr(10) & _
"no es batimétrico. " & Chr(10) & Chr(10) & _
"No se puede seguir adelante"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo
Exit Sub
End If

If Right(gProyecto.Oleaje, 3) <> "ola" And _


Right(gProyecto.Oleaje, 3) <> "OLA" Then
gMsg = "El archivo" & Chr(10) & _
gProyecto.Oleaje & Chr(10) & _
"no es de oleaje. " & Chr(10) & Chr(10) & _
"No se puede seguir adelante"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo
Exit Sub
End If

If Right(gProyecto.Calibracion, 3) <> "cal" And _


Right(gProyecto.Calibracion, 3) <> "CAL" Then
gMsg = "El archivo" & Chr(10) & _
gProyecto.Calibracion & Chr(10) & _
"no es de calibración. " & Chr(10) & Chr(10) & _
"No se puede seguir adelante"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo
Exit Sub
End If

'Se procede a modelizar

Frame8.Caption = gProyectoNP.Nombre
Frame10.Caption = gProyectoNP.Nombre

Dim Inicio As Single, Final As Single, _


Elapsed As Single

Dim file As String, fileList As Integer, _


fNo As Integer, fLo As Integer, _
frmMain - 15

fCg As Integer, fOb As Integer, _


fHm As Integer, FQb As Integer, _
fUorb As Integer, fDf As Integer, _
fDb As Integer, fE As Integer, _
fPx As Integer, fPy As Integer, _
fHrms As Integer, fSxx As Integer, _
fSxy As Integer, fSyy As Integer, _
fUr As Integer, fSU As Integer, _
fRx As Integer, fRy As Integer, _
fFw As Integer

Dim file_k As String, file_L As String, _


file_CG As String, file_OB As String, _
file_Hm As String, file_Qb As String, _
file_Uorb As String, file_Df As String, _
file_Db As String, file_E As String, _
file_Px As String, file_Py As String, _
file_Hrms As String, file_Sxx As String, _
file_Sxy As String, file_Syy As String, _
file_Ur As String, file_SU As String, _
file_Rx As String, file_Ry As String, _
file_fw As String

Dim MaxNO As Double, MinNO As Double, _


MaxL As Double, MinL As Double, _
MaxCG As Double, MinCG As Double, _
MaxOB As Double, MinOB As Double, _
MaxHm As Double, MinHm As Double, _
MaxQb As Double, MinQb As Double, _
MaxUorb As Double, MinUorb As Double, _
MaxDb As Double, MinDb As Double, _
MaxDf As Double, MinDf As Double, _
MaxE As Double, MinE As Double, _
MaxPx As Double, MinPx As Double, _
MaxPy As Double, MinPy As Double, _
MaxHrms As Double, MinHrms As Double, _
MaxSxx As Double, MinSxx As Double, _
MaxSxy As Double, MinSxy As Double, _
MaxSyy As Double, MinSyy As Double, _
MaxUr As Double, MinUr As Double, _
MaxSU As Double, MinSU As Double, _
MaxRx As Double, MinRx As Double, _
MaxRy As Double, MinRy As Double, _
MaxFw As Double, MinFw As Double

Dim f As Integer

Inicio = Timer

'INICIALIZAR VALORES EXTREMOS


MaxNO = -1E+32: MinNO = -MaxNO
MaxL = MaxNO: MinL = MinNO
MaxOB = MaxNO: MinOB = MinNO
MaxHm = MaxNO: MinHm = MinNO
MaxQb = MaxNO: MinQb = MinNO
MaxUorb = MaxNO: MinUorb = MinNO
MaxDb = MaxNO: MinDb = MinNO
MaxDf = MaxNO: MinDf = MinNO
MaxE = MaxNO: MinE = MinNO
MaxPx = MaxNO: MinPx = MinNO
MaxPy = MaxNO: MinPy = MinNO
MaxHrms = MaxNO: MinHrms = MinNO
MaxSxx = MaxNO: MinSxx = MinNO
MaxSxy = MaxNO: MinSxy = MinNO
MaxSyy = MaxNO: MinSyy = MinNO
MaxUr = MaxNO: MinUr = MinNO
MaxSU = MaxNO: MinSU = MinNO
MaxRx = MaxNO: MinRx = MinNO
MaxRy = MaxNO: MinRy = MinNO
MaxFw = MaxNO: MinFw = MinNO

Call Ayuda("Modelizando según Battjes y Janssen (1.978)")


StatusBar1.Refresh
frmMain - 16

ReDim gChart(1 To 6, 1 To 2) As Variant


MSChart2.Visible = False
MSChart3.Visible = False
MSChart4.Visible = False

'LECTURA DE DATOS
gModela = 1
Call RemoveResultados
Call Inicializa_Picture1
Picture1.Cls
' On Error GoTo Salida
gProyecto.Batimetria = TreeView2.Nodes(5)
file = gProyecto.Batimetria
f = FreeFile
Call LaSonda_Inicio("LECTURA DE DATOS", Fich.filas, 0)
Open file For Binary As #f
Get #f, , Fich.Clase
Close #f
If Fich.Clase = "DSAA" Then Call leeASCI(file) Else LeeBinario (file)
Call Dimensionar(Fich.filas, Fich.Columnas)
Call Datos_Iniciales
Call LeeCalibra(gProyecto.Calibracion)
Call LaSonda_Final

'Si los coeficientes tienen valores poco usuales, se da un aviso


Select Case gAlfa
Case Is = 0
gMsg = "El valor del coeficiente de rotura" & Chr(10) & _
"escogido es nulo. " & Chr(10) & _
"De esta forma no se disipará energía" & Chr(10) & _
"por rotura de oleaje." & Chr(10) & Chr(10) & _
"¿Está de acuerdo?"
GoSub MeMarcho
Case Is < 0.7, Is > 1.3
gMsg = "El valor usual del coeficiente" & Chr(10) & _
"de rotura es 1. Usted ha tomado " & Str(gAlfa) & "." & Chr(10) & _
Chr(10) & "¿Está de acuerdo?"
GoSub MeMarcho
Case Else
End Select

If gKf = 0 Then
gMsg = "El valor del coeficiente corrector" & Chr(10) & _
"de fricción escogido es nulo. " & Chr(10) & _
"De esta forma no se disipará energía" & Chr(10) & _
"por fricción con el fondo." & Chr(10) & Chr(10) & _
"¿Está de acuerdo?"
GoSub MeMarcho
End If

'Se continúa modelizando


On Error GoTo 0
gChart(1, 1) = "Lect"
gChart(1, 2) = gTpo

On Error GoTo Captura

'CÁLCULO DE LA LONGITUD DE ONDA Y DEL NÚMERO DE ONDA


gZonaError = "Ecuación de dispersión"
Call LaSonda_Inicio("LONGITUD DE ONDA", Fich.filas, 0)
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
For j = 1 To Fich.Columnas
If gZ(i, j) < gDmin Then
Call LOnda(i, j)
If gL(i, j) <> 0 Then
gNO(i, j) = 2 * pi / gL(i, j)
Else
gNO(i, j) = 0
End If
Else
gNO(i, j) = 0
gL(i, j) = 0
frmMain - 17

End If
Call ValoresExtremos(gNO(i, j), MaxNO, MinNO)
Call ValoresExtremos(gL(i, j), MaxL, MinL)
Next j
Next i
Call LaSonda_Final
gChart(2, 1) = "L"
gChart(2, 2) = gTpo

'CÁLCULO DE LA CELERIDAD DE GRUPO


gZonaError = "Celeridad de grupo"
Call LaSonda_Inicio("CELERIDAD DE GRUPO", Fich.filas, 0)
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
For j = 1 To Fich.Columnas
If gZ(i, j) < gDmin Then
Call Cg(i, j)
Else
gCg(i, j) = 0
End If
Call ValoresExtremos(gCg(i, j), MaxCG, MinCG)
Next j
Next i
Call LaSonda_Final
gChart(3, 1) = "Cg"
gChart(3, 2) = gTpo

'CÁLCULO DE LA OBLICUIDAD
gZonaError = "Oblicuidad"
Call LaSonda_Inicio("OBLICUIDAD", Fich.filas, 0)
Call SnellInicial
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
For j = 2 To Fich.Columnas
If gZ(i, j) < gDmin Then
Call Alfa(i, j)
gOb(i, j) = gOb(i, j) * 180 / pi
Else
gOb(i, j) = 0
End If
Call ValoresExtremos(gOb(i, j), MaxOB, MinOB)
Next j
Next i
Call LaSonda_Final
gChart(4, 1) = "Ob"
gChart(4, 2) = gTpo

'TRANSFORMACIÓN DE OLEAJE
gZonaError = "Transformación de oleaje"
Call LaSonda_Inicio("TRANSFORMACIÓN DE OLEAJE", Fich.filas, 0)
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
gSU(i, 1) = 0
Call TensorRadiacion(i, 1)
Call ValoresExtremos(gSU(i, 1), MaxSU, MinSU)
Call ValoresExtremos(gE(i, 1), MaxE, MinE)
Call ValoresExtremos(gHrms(i, 1), MaxHrms, MinHrms)
Call ValoresExtremos(gSxx(i, 1), MaxSxx, MinSxx)
Call ValoresExtremos(gSxy(i, 1), MaxSxy, MinSxy)
Call ValoresExtremos(gSyy(i, 1), MaxSyy, MinSyy)
For j = 2 To Fich.Columnas
If gZ(i, j) < gDmin Then
gZonaError = "Altura de ola de Miche en (" & Str(i) & ", " & Str(j) & ")"
Call Hm_Miche(i, j - 1)
gZonaError = "Velocidad orbital en (" & Str(i) & ", " & Str(j) & ")"
Call U_orb(i, j - 1)
gZonaError = "Fracción de olas rotas en (" & Str(i) & ", " & Str(j) & ")"
Call Qb(i, j - 1)
gZonaError = "Pérdidas de energía por fricción en (" & Str(i) & ", " & Str(j)
& ")"
Call Df(i, j - 1)
gZonaError = "Pérdidas de energía por rotura en (" & Str(i) & ", " & Str(j) &
")"
Call Db(i, j - 1)
frmMain - 18

gZonaError = "Energía del oleaje en (" & Str(i) & ", " & Str(j) & ")"
Call Energia(i, j)
gZonaError = "Altura de ola Hrms en (" & Str(i) & ", " & Str(j) & ")"
Call Hrms(i, j)
gZonaError = "Tensor de radiación en (" & Str(i) & ", " & Str(j) & ")"
Call TensorRadiacion(i, j)
gZonaError = "Parámetro de Ursell en (" & Str(i) & ", " & Str(j) & ")"
Call Ursell(i, j)
gZonaError = "Set-Up en (" & Str(i) & ", " & Str(j) & ")"
Call SetUp(i, j)
gZonaError = "Circulación en (" & Str(i) & ", " & Str(j) & ")"
Call Corrientes(i, j)
Else
gHm(i, j - 1) = 0
gUorb(i, j - 1) = 0
gQb(i, j - 1) = gQb(i, j - 2)
gDf(i, j - 1) = gDf(i, j - 2)
gDb(i, j - 1) = gDb(i, j - 2)
gE(i, j) = 0
gHrms(i, j) = 0
gSxx(i, j) = 0
gSxy(i, j) = 0
gSyy(i, j) = 0
gUr(i, j) = 0
gSU(i, j) = gSU(i, j - 1)
gRx(i, j) = 0
gRy(i, j) = 0
End If
If j = Fich.Columnas Then
gQb(i, j) = gQb(i, j - 1)
End If
Call ValoresExtremos(gHm(i, j - 1), MaxHm, MinHm)
Call ValoresExtremos(gUorb(i, j - 1), MaxUorb, MinUorb)
Call ValoresExtremos(gQb(i, j - 1), MaxQb, MinQb)
Call ValoresExtremos(gFw(i, j - 1), MaxFw, MinFw)
Call ValoresExtremos(gDf(i, j - 1), MaxDf, MinDf)
Call ValoresExtremos(gDb(i, j - 1), MaxDb, MinDb)
Call ValoresExtremos(gE(i, j), MaxE, MinE)
Call ValoresExtremos(gHrms(i, j), MaxHrms, MinHrms)
Call ValoresExtremos(gSxx(i, j), MaxSxx, MinSxx)
Call ValoresExtremos(gSxy(i, j), MaxSxy, MinSxy)
Call ValoresExtremos(gSyy(i, j), MaxSyy, MinSyy)
Call ValoresExtremos(gUr(i, j), MaxUr, MinUr)
Call ValoresExtremos(gSU(i, j), MaxSU, MinSU)
Call ValoresExtremos(gPx(i, j - 1), MaxPx, MinPx)
Call ValoresExtremos(gPy(i, j - 1), MaxPy, MinPy)
Call ValoresExtremos(gRx(i, j), MaxRx, MinRx)
Call ValoresExtremos(gRy(i, j), MaxRy, MinRy)
Next j
Next i
Call LaSonda_Final
gChart(5, 1) = "T.O."
gChart(5, 2) = gTpo

'ESCRITURA DE LOS ARCHIVOS DE RESULTADOS


gZonaError = "Escritura de resultados"
file_k = "NOnda.grd"
file_L = "LOnda.grd"
file_CG = "CGrupo.grd"
file_OB = "Oblic.grd"
file_Hm = "Hm.grd"
file_Qb = "Qb.grd"
file_Uorb = "Uorb.grd"
file_fw = "fw.grd"
file_Df = "Df.grd"
file_Db = "Db.grd"
file_E = "E.grd"
file_Px = "Px.grd"
file_Py = "Py.grd"
file_Hrms = "Hrms.grd"
file_Sxx = "Sxx.grd"
file_Sxy = "Sxy.grd"
file_Syy = "Syy.grd"
file_Ur = "Ursell.grd"
frmMain - 19

file_SU = "SetUp.grd"
file_Rx = "Rx.grd"
file_Ry = "Ry.grd"

Screen.MousePointer = 11

'Impresión de la lista de archivos de resultados

fileList = FreeFile
Open "ListaResult.dat" For Output As #fileList
Print #fileList, file_k
Print #fileList, file_L
Print #fileList, file_CG
Print #fileList, file_OB
Print #fileList, file_Hm
Print #fileList, file_Qb
Print #fileList, file_Uorb
Print #fileList, file_fw
Print #fileList, file_Df
Print #fileList, file_Db
Print #fileList, file_E
Print #fileList, file_Px
Print #fileList, file_Py
Print #fileList, file_Hrms
Print #fileList, file_Sxx
Print #fileList, file_Sxy
Print #fileList, file_Syy
Print #fileList, file_Ur
Print #fileList, file_SU
Print #fileList, file_Rx
Print #fileList, file_Ry
Close fileList

Select Case gTipo


Case Is = "DSAA" 'Escribe ficheros ASCI
Call LaSonda_Inicio("ESCRITURA - Formato ASCI", Fich.filas, 0)
fNo = FreeFile
Call Escribe_Cabecera_ASCI(file_k, fNo, MinNO, MaxNO)
fLo = FreeFile
Call Escribe_Cabecera_ASCI(file_L, fLo, MinL, MaxL)
fCg = FreeFile
Call Escribe_Cabecera_ASCI(file_CG, fCg, MinCG, MaxCG)
fOb = FreeFile
Call Escribe_Cabecera_ASCI(file_OB, fOb, MinOB, MaxOB)
fHm = FreeFile
Call Escribe_Cabecera_ASCI(file_Hm, fHm, MinHm, MaxHm)
FQb = FreeFile
Call Escribe_Cabecera_ASCI(file_Qb, FQb, MinQb, MaxQb)
fUorb = FreeFile
Call Escribe_Cabecera_ASCI(file_Uorb, fUorb, MinUorb, MaxUorb)
fFw = FreeFile
Call Escribe_Cabecera_ASCI(file_fw, fFw, MinFw, MaxFw)
fDf = FreeFile
Call Escribe_Cabecera_ASCI(file_Df, fDf, MinDf, MaxDf)
fDb = FreeFile
Call Escribe_Cabecera_ASCI(file_Db, fDb, MinDb, MaxDb)
fE = FreeFile
Call Escribe_Cabecera_ASCI(file_E, fE, MinE, MaxE)
fPx = FreeFile
Call Escribe_Cabecera_ASCI(file_Px, fPx, MinPx, MaxPx)
fPy = FreeFile
Call Escribe_Cabecera_ASCI(file_Py, fPy, MinPy, MaxPy)
fHrms = FreeFile
Call Escribe_Cabecera_ASCI(file_Hrms, fHrms, MinHrms, MaxHrms)
fSxx = FreeFile
Call Escribe_Cabecera_ASCI(file_Sxx, fSxx, MinSxx, MaxSxx)
fSxy = FreeFile
Call Escribe_Cabecera_ASCI(file_Sxy, fSxy, MinSxy, MaxSxy)
fSyy = FreeFile
Call Escribe_Cabecera_ASCI(file_Syy, fSyy, MinSyy, MaxSyy)
fUr = FreeFile
Call Escribe_Cabecera_ASCI(file_Ur, fUr, MinUr, MaxUr)
fSU = FreeFile
frmMain - 20

Call Escribe_Cabecera_ASCI(file_SU, fSU, MinSU, MaxSU)


fRx = FreeFile
Call Escribe_Cabecera_ASCI(file_Rx, fRx, MinRx, MaxRx)
fRy = FreeFile
Call Escribe_Cabecera_ASCI(file_Ry, fRy, MinRy, MaxRy)
k = 0
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
For j = 1 To Fich.Columnas
k = k + 1
If k = 9 Then
Call Add_ASCI_fin(file_k, fNo, Str(gNO(i, j)))
Call Add_ASCI_fin(file_L, fLo, Str(gL(i, j)))
Call Add_ASCI_fin(file_CG, fCg, Str(gCg(i, j)))
Call Add_ASCI_fin(file_OB, fOb, Str(gOb(i, j)))
Call Add_ASCI_fin(file_Hm, fHm, Str(gHm(i, j)))
Call Add_ASCI_fin(file_Qb, FQb, Str(gQb(i, j)))
Call Add_ASCI_fin(file_Uorb, fUorb, Str(gUorb(i, j)))
Call Add_ASCI_fin(file_fw, fFw, Str(gFw(i, j)))
Call Add_ASCI_fin(file_Df, fDf, Str(gDf(i, j)))
Call Add_ASCI_fin(file_Db, fDb, Str(gDb(i, j)))
Call Add_ASCI_fin(file_E, fE, Str(gE(i, j)))
Call Add_ASCI_fin(file_Px, fPx, Str(gPx(i, j)))
Call Add_ASCI_fin(file_Py, fPy, Str(gPy(i, j)))
Call Add_ASCI_fin(file_Hrms, fHrms, Str(gHrms(i, j)))
Call Add_ASCI_fin(file_Sxx, fSxx, Str(gSxx(i, j)))
Call Add_ASCI_fin(file_Sxy, fSxy, Str(gSxy(i, j)))
Call Add_ASCI_fin(file_Syy, fSyy, Str(gSyy(i, j)))
Call Add_ASCI_fin(file_Ur, fUr, Str(gUr(i, j)))
Call Add_ASCI_fin(file_SU, fSU, Str(gSU(i, j)))
Call Add_ASCI_fin(file_Rx, fRx, Str(gRx(i, j)))
Call Add_ASCI_fin(file_Ry, fRy, Str(gRy(i, j)))
k = 0
Else
Call Add_ASCI_linea(file_k, fNo, Str(gNO(i, j)))
Call Add_ASCI_linea(file_L, fLo, Str(gL(i, j)))
Call Add_ASCI_linea(file_CG, fCg, Str(gCg(i, j)))
Call Add_ASCI_linea(file_OB, fOb, Str(gOb(i, j)))
Call Add_ASCI_linea(file_Hm, fHm, Str(gHm(i, j)))
Call Add_ASCI_linea(file_Qb, FQb, Str(gQb(i, j)))
Call Add_ASCI_linea(file_Uorb, fUorb, Str(gUorb(i, j)))
Call Add_ASCI_linea(file_fw, fFw, Str(gFw(i, j)))
Call Add_ASCI_linea(file_Df, fDf, Str(gDf(i, j)))
Call Add_ASCI_linea(file_Db, fDb, Str(gDb(i, j)))
Call Add_ASCI_linea(file_E, fE, Str(gE(i, j)))
Call Add_ASCI_linea(file_Px, fPx, Str(gPx(i, j)))
Call Add_ASCI_linea(file_Py, fPy, Str(gPy(i, j)))
Call Add_ASCI_linea(file_Hrms, fHrms, Str(gHrms(i, j)))
Call Add_ASCI_linea(file_Sxx, fSxx, Str(gSxx(i, j)))
Call Add_ASCI_linea(file_Sxy, fSxy, Str(gSxy(i, j)))
Call Add_ASCI_linea(file_Syy, fSyy, Str(gSyy(i, j)))
Call Add_ASCI_linea(file_Ur, fUr, Str(gUr(i, j)))
Call Add_ASCI_linea(file_SU, fSU, Str(gSU(i, j)))
Call Add_ASCI_linea(file_Rx, fRx, Str(gRx(i, j)))
Call Add_ASCI_linea(file_Ry, fRy, Str(gRy(i, j)))
End If
Next j
Call Add_ASCI_fin(file_k, fNo, Fich.Null)
Call Add_ASCI_fin(file_L, fLo, Fich.Null)
Call Add_ASCI_fin(file_CG, fCg, Fich.Null)
Call Add_ASCI_fin(file_OB, fOb, Fich.Null)
Call Add_ASCI_fin(file_Hm, fHm, Fich.Null)
Call Add_ASCI_fin(file_Qb, FQb, Fich.Null)
Call Add_ASCI_fin(file_Uorb, fUorb, Fich.Null)
Call Add_ASCI_fin(file_fw, fFw, Fich.Null)
Call Add_ASCI_fin(file_Df, fDf, Fich.Null)
Call Add_ASCI_fin(file_Db, fDb, Fich.Null)
Call Add_ASCI_fin(file_E, fE, Fich.Null)
Call Add_ASCI_fin(file_Px, fPx, Fich.Null)
Call Add_ASCI_fin(file_Py, fPy, Fich.Null)
Call Add_ASCI_fin(file_Hrms, fHrms, Fich.Null)
Call Add_ASCI_fin(file_Sxx, fSxx, Fich.Null)
Call Add_ASCI_fin(file_Sxy, fSxy, Fich.Null)
Call Add_ASCI_fin(file_Syy, fSyy, Fich.Null)
frmMain - 21

Call Add_ASCI_fin(file_Ur, fUr, Fich.Null)


Call Add_ASCI_fin(file_SU, fSU, Fich.Null)
Call Add_ASCI_fin(file_Rx, fRx, Fich.Null)
Call Add_ASCI_fin(file_Ry, fRy, Fich.Null)
Next i

Case Is = "DSBB"
Call LaSonda_Inicio("ESCRITURA - Formato Binario", 21, 0)
fNo = FreeFile
Call Escribe_Binario(file_k, fNo, MinNO, MaxNO, "k")
frmMain.ProgressBar1.Value = 1
fLo = FreeFile
Call Escribe_Binario(file_L, fLo, MinL, MaxL, "L")
frmMain.ProgressBar1.Value = 2
fCg = FreeFile
Call Escribe_Binario(file_CG, fCg, MinCG, MaxCG, "Cg")
frmMain.ProgressBar1.Value = 3
fOb = FreeFile
Call Escribe_Binario(file_OB, fOb, MinOB, MaxOB, "O")
frmMain.ProgressBar1.Value = 4
fHm = FreeFile
Call Escribe_Binario(file_Hm, fHm, MinHm, MaxHm, "Hm")
frmMain.ProgressBar1.Value = 5
FQb = FreeFile
Call Escribe_Binario(file_Qb, FQb, MinQb, MaxQb, "Qb")
frmMain.ProgressBar1.Value = 6
fUorb = FreeFile
Call Escribe_Binario(file_Uorb, fUorb, MinUorb, MaxUorb, "Uorb")
frmMain.ProgressBar1.Value = 7
fDf = FreeFile
Call Escribe_Binario(file_Df, fDf, MinDf, MaxDf, "Df")
frmMain.ProgressBar1.Value = 8
fDb = FreeFile
Call Escribe_Binario(file_Db, fDb, MinDb, MaxDb, "Db")
frmMain.ProgressBar1.Value = 9
fE = FreeFile
Call Escribe_Binario(file_E, fE, MinE, MaxE, "E")
frmMain.ProgressBar1.Value = 10
fPx = FreeFile
Call Escribe_Binario(file_Px, fPx, MinPx, MaxPx, "Px")
frmMain.ProgressBar1.Value = 11
fPy = FreeFile
Call Escribe_Binario(file_Py, fPy, MinPy, MaxPy, "Py")
frmMain.ProgressBar1.Value = 12
fHrms = FreeFile
Call Escribe_Binario(file_Hrms, fHrms, MinHrms, MaxHrms, "Hrms")
frmMain.ProgressBar1.Value = 13
fSxx = FreeFile
Call Escribe_Binario(file_Sxx, fSxx, MinSxx, MaxSxx, "Sxx")
frmMain.ProgressBar1.Value = 14
fSxy = FreeFile
Call Escribe_Binario(file_Sxy, fSxy, MinSxy, MaxSxy, "Sxy")
frmMain.ProgressBar1.Value = 15
fSyy = FreeFile
Call Escribe_Binario(file_Syy, fSyy, MinSyy, MaxSyy, "Syy")
frmMain.ProgressBar1.Value = 16
fUr = FreeFile
Call Escribe_Binario(file_Ur, fUr, MinUr, MaxUr, "Ur")
frmMain.ProgressBar1.Value = 17
fSU = FreeFile
Call Escribe_Binario(file_SU, fSU, MinSU, MaxSU, "SU")
frmMain.ProgressBar1.Value = 18
fRx = FreeFile
Call Escribe_Binario(file_Rx, fRx, MinRx, MaxRx, "Rx")
frmMain.ProgressBar1.Value = 19
fRy = FreeFile
Call Escribe_Binario(file_Ry, fRy, MinRy, MaxRy, "Ry")
frmMain.ProgressBar1.Value = 20
fFw = FreeFile
Call Escribe_Binario(file_fw, fFw, MinFw, MaxFw, "Fw")
frmMain.ProgressBar1.Value = 21
Case Else
gTitulo = "ERROR EN LOS DATOS"
gMsg = "El formato no coincide." & Chr(10) & _
frmMain - 22

"El tipo " & gTipo & "es desconocido"


MsgBox gMsg, vbExclamation + vbOKOnly, gTitulo
End Select
gZonaError = "Añadiendo resultados a ventana"
Call PopulateTreeViewResultados
gZonaError = ""
Call LaSonda_Final
gChart(6, 1) = "Esc."
gChart(6, 2) = gTpo

frmMain.MSChart1 = gChart
frmMain.MSChart2.chartType = VtChChartType2dLine
frmMain.MSChart2 = gChart2
frmMain.MSChart3 = gChart3
frmMain.MSChart4 = gChart4
frmMain.MSChart1.Visible = True
frmMain.MSChart2.Visible = True
frmMain.MSChart4.Visible = True
Frame8.Caption = Frame8.Caption & " (Hrms)"
Frame10.Caption = Frame10.Caption & " (Qb)"
ProgressBar2.Value = ProgressBar2.min

gModela = 0
Call Ayuda("Modelización finalizada")
Final = Timer
Elapsed = Final - Inicio
Picture1.Print
Call TiempoTranscurrido(Elapsed, 2)

mnuResults.Enabled = True
Toolbar3.Buttons(1).Enabled = True

List1.AddItem (gProyectoNP.Nombre)
ProgressBar1.Value = ProgressBar1.min

Screen.MousePointer = 0

Exit Sub

Captura:
Call errores(Err)
Exit Sub

MeMarcho:
gTitulo = "VALOR INUSUAL"
gResponse = MsgBox(gMsg, vbQuestion + vbYesNo + vbDefaultButton1, gTitulo)
If gResponse = 7 Then Exit Sub Else Return

Salida:
gModela = 0
Close
Screen.MousePointer = 0
gMsg = "Faltan datos" & Chr(10) _
& "Compruebe el árbol de proyecto"
gTitulo = "PROCESO ABORTADO"
MsgBox gMsg, vbOKOnly + vbDefaultButton1 + vbCritical, gTitulo

End Sub

Private Sub MSChart1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Gráfico comparativo de uso de tiempo en tareas")

End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Label19.Caption = Str(Format(X, "###0.00"))


Label20.Caption = Str(Format(Y, "###0.00"))
Call Ayuda("Pantalla multifunción")

End Sub
frmMain - 23

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbRightButton Then


Set mThisControl = Picture1
PopupMenu mnuHelp
End If
Set mThisControl = Nothing

End Sub

Private Sub Playa_Cilindrica_Click()

Dim file As String, fila As Integer, _


MaxZ As Double, Minz As Double, f As Integer

fila = Val(Text1.Text)
MaxZ = -1E+32
Minz = -MaxZ

On Error GoTo salteya


With CommonDialog1
.CancelError = True
.DialogTitle = "Crear playa cilíndrica con perfil " & Text1.Text
.Filter = "Batimetría (*.grd)|*.grd"
.Action = 1
file = .filename
End With

Screen.MousePointer = 11
For j = 1 To Fich.Columnas
If gZ(fila, j) > MaxZ Then MaxZ = gZ(fila, j)
If gZ(fila, j) < Minz Then Minz = gZ(fila, j)
Next j

Call Escribe_Cabecera_ASCI(file, FreeFile, Minz, MaxZ)


f = FreeFile
Open file For Append As #f
k = 0
For i = 1 To Fich.filas
For j = 1 To Fich.Columnas
k = k + 1
If k = 9 Then
Print #f, Str(gZ(fila, j))
k = 0
Else
Print #f, Str(gZ(fila, j)); " ";
End If
Next j
Print #f, Fich.Null
Next i
Close #f
Screen.MousePointer = 0
Exit Sub

salteya:

End Sub

Private Sub Playa_Cilindrica_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As


Single)

Dim Texto As String


Texto = "Crea una playa cilíndrica con la fila " & Text1.Text
Call Ayuda(Texto)

End Sub

Private Sub SSTab1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Dim gMsg As String


gMsg = "Haga click en las pestañas para acceder a los procesos correspondientes"

Call NoXY
Call Ayuda(gMsg)
frmMain - 24

End Sub

Private Sub Text5_GotFocus()

With Text5
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Otros datos de utilidad")

End Sub

Private Sub Text6_GotFocus()

With Text6
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Literatura concerniente al proyecto")

End Sub

Private Sub Text7_GotFocus()

With Text7
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Fecha de último proceso del proyecto")

End Sub

Private Sub Text8_GotFocus()

With Text8
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text8_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Ayuda("Localización del proyecto")

End Sub

Private Sub Descarga()

Unload frmInicial
frmMain.Visible = True

End Sub

Private Sub Timer1_Timer()

StatusBar1.Panels(1).Text = Time
frmMain - 25

End Sub

Private Sub Toolbar2_ButtonClick(ByVal Button As ComctlLib.Button)

Select Case Button.Key


Case Is = "Modelizar"
Call mnuModel_Click
Case Is = "Perfiles"
Call mnuPerfilesUniformidad_Click
End Select

End Sub

Private Sub Toolbar3_ButtonClick(ByVal Button As ComctlLib.Button)

Select Case Button.Key


Case Is = "Resultados"
Call mnuResults_Click
End Select

End Sub

Private Sub TreeView1_Click()

On Error GoTo Cachis


Call Inicializa_Picture1
Picture1.Cls
Picture1.Print TreeView1.SelectedItem.Key
If TreeView1.SelectedItem.Key = gProyectoNP.Batimetria Then
Label26.Caption = gProyecto.Batimetria
Else
Label26.Caption = TreeView1.SelectedItem.Text
End If
Picture1.Print Label26.Caption
Label4.Caption = TreeView1.SelectedItem.Key
Dibujo.Enabled = False
A_Grapher.Enabled = False
Playa_Cilindrica.Enabled = False
Exit Sub

Cachis:
Resume Next

End Sub

Private Sub TreeView1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single


)

Call Ayuda("Estructura de resultados. Haga click para visualizar")

End Sub

Private Sub TreeView2_Click()

Dim f As Integer, k As Long

Call Inicializa_Picture1
Select Case TreeView2.SelectedItem.Key
Case Is = "B" 'Batimetría
With frmMain.Picture1
.Cls
.AutoRedraw = True
.FontItalic = False
.FontBold = False
End With
Picture1.Print "DATOS BATIMÉTRICOS"
Picture1.Print
Picture1.Print "Archivo de datos: ";
Picture1.FontBold = True
Picture1.Print gProyecto.Batimetria
On Error GoTo NoFile
k = FileLen(gProyecto.Batimetria)
frmMain - 26

On Error GoTo 0
f = FreeFile
Open gProyecto.Batimetria For Binary As #f
Get #f, , Fich.Clase
Close #f
Picture1.FontBold = False
Picture1.Print "Tipo: ";
Picture1.FontBold = True
If Fich.Clase = "DSAA" Then
Picture1.Print "ASCI"
Call LeeCabASCI(gProyecto.Batimetria)
ElseIf Fich.Clase = "DSBB" Then
Picture1.Print "BINARIO"
Call LeeCabBinario(gProyecto.Batimetria)
Else
Picture1.Print "DESCONOCIDO"
Exit Sub
End If
Picture1.FontBold = False
Picture1.Print "Tamaño: ";
Picture1.FontBold = True
Picture1.Print k; " bytes"
Picture1.Print
Call ImprimeCabBati

Case Is = "C" 'Oleaje


Picture1.Cls
Picture1.FontBold = False
Picture1.Print "DATOS DE OLEAJE"
Picture1.Print
Picture1.Print "Archivo de datos: ";
Picture1.FontBold = True
Picture1.Print gProyecto.Oleaje
On Error GoTo NoFile
k = FileLen(gProyecto.Oleaje)
On Error GoTo 0

Call LeeOlas(gProyecto.Oleaje)
Call ImprimeOleaje

Case Is = "D" 'Parámetros


Picture1.Cls
Picture1.FontBold = False
Picture1.Print "DATOS DE CALIBRACIÓN"
Picture1.Print
Picture1.Print "Archivo de datos: ";
Picture1.FontBold = True
Picture1.Print gProyecto.Calibracion
On Error GoTo NoFile
k = FileLen(gProyecto.Oleaje)

Call LeeCalibra(gProyecto.Calibracion)
Call ImprimeCalibra

Case Else
Picture1.Cls
End Select

Exit Sub

NoFile:
Screen.MousePointer = 0
gTitulo = "ERROR"
gMsg = "El archivo no existe"
MsgBox gMsg, vbExclamation + vbOKOnly + vbDefaultButton1, gTitulo
Picture1.Cls
Exit Sub
End Sub

Private Sub TreeView2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single


)

Call Ayuda("Estructura del proyecto. Haga click para obtener información")


frmMain - 27

End Sub

Private Sub TreeView2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)


If Button = vbRightButton Then
Set mThisControl = TreeView2
PopupMenu mnuHelp
End If
Set mThisControl = Nothing

End Sub

Private Sub VScroll1_Change()

Label10.Caption = -VScroll1.Value
Text1.Text = Label10.Caption

End Sub

Private Sub VScroll1_GotFocus()

Call Ayuda("Cambia la fila a dibujar")

End Sub

Private Sub VScroll1_Scroll()

Label10.Caption = -VScroll1.Value

End Sub
frmMain - 1

VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{02B5E320-7292-11CF-93D5-0020AF99504A}#1.0#0"; "MSCHART.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Begin VB.Form frmMain
Caption = "DINÁMICA DEL PERFIL DE PLAYA - DPP2"
ClientHeight = 8115
ClientLeft = -30
ClientTop = 540
ClientWidth = 11880
Icon = (Icono)
LinkTopic = "Form1"
ScaleHeight = 8115
ScaleWidth = 11880
Visible = 0 'False
WhatsThisHelp = -1 'True
WindowState = 2 'Maximized
Begin ComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 420
Left = 0
TabIndex = 48
Top = 0
Width = 11880
_ExtentX = 20955
_ExtentY = 741
ButtonWidth = 635
ButtonHeight = 582
Appearance = 1
ImageList = "ImageList3"
_Version = 327680
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 4
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Abrir"
Object.ToolTipText = "Abrir archivo de proyecto"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Oleaje"
Object.ToolTipText = "Crear / Editar archivo de datos de oleaje"
Object.Tag = ""
ImageIndex = 2
EndProperty
BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Calibracion"
Object.ToolTipText = "Crear / Editar parámetros de calibración"
Object.Tag = ""
ImageIndex = 3
EndProperty
BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Salir"
Object.ToolTipText = "Salir del programa"
Object.Tag = ""
ImageIndex = 5
EndProperty
EndProperty
MouseIcon = {Binary}
Begin ComctlLib.Toolbar Toolbar2
Height = 390
Left = 1560
TabIndex = 49
Top = 0
Width = 735
_ExtentX = 1296
_ExtentY = 688
ButtonWidth = 635
ButtonHeight = 582
ImageList = "ImageList3"
_Version = 327680
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 2
frmMain - 2

BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}


Enabled = 0 'False
Key = "Modelizar"
Object.ToolTipText = "Iniciar la modelización"
Object.Tag = ""
ImageIndex = 6
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Enabled = 0 'False
Key = "Perfiles"
Object.ToolTipText = "Evaluar la uniformidad de la playa"
Object.Tag = ""
ImageIndex = 7
EndProperty
EndProperty
MouseIcon = {Binary}
End
Begin ComctlLib.Toolbar Toolbar3
Height = 390
Left = 2400
TabIndex = 50
Top = 0
Width = 375
_ExtentX = 661
_ExtentY = 688
ImageList = "ImageList3"
_Version = 327680
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 1
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Enabled = 0 'False
Key = "Resultados"
Object.ToolTipText = "Visualización de tabla de resultados numéricos"
Object.Tag = ""
ImageIndex = 8
EndProperty
EndProperty
MouseIcon = {Binary}
End
End
Begin VB.Frame Datos_Contenedor
Caption = "INFORMACIÓN"
BeginProperty Font
Name = "Arial Narrow"
Size = 9.75
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 2415
Left = 120
TabIndex = 51
Top = 5400
Width = 10095
Begin VB.Frame Frame10
Caption = "Última modelización"
ForeColor = &H00C00000&
Height = 1695
Left = 7920
TabIndex = 65
Top = 240
Width = 2055
Begin MSChartLib.MSChart MSChart4
Height = 1335
Left = 120
TabIndex = 66
ToolTipText = "Muestra la fracción de olas rotas"
Top = 240
Visible = 0 'False
Width = 1815
End
frmMain - 3

End
Begin VB.Frame Frame9
Caption = "Última modelización"
ForeColor = &H00C00000&
Height = 1695
Left = 3600
TabIndex = 63
Top = 240
Width = 2055
Begin MSChartLib.MSChart MSChart3
Height = 1335
Left = 120
TabIndex = 64
ToolTipText = "Primer perfil transversal"
Top = 240
Visible = 0 'False
Width = 1875
End
End
Begin ComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 120
TabIndex = 58
ToolTipText = "Muestra la progresión de la tarea en ejecución"
Top = 2040
Width = 9855
_ExtentX = 17383
_ExtentY = 450
_Version = 327680
BorderStyle = 1
Appearance = 1
MouseIcon = {Binary}
Min = 1e-4
End
Begin VB.Frame Frame8
Caption = "Última modelización "
ForeColor = &H00C00000&
Height = 1695
Left = 5760
TabIndex = 61
Top = 240
Width = 2055
Begin MSChartLib.MSChart MSChart2
Height = 1335
Left = 120
TabIndex = 62
ToolTipText = "Altura de ola significante en el primer perfil"
Top = 240
Visible = 0 'False
Width = 1815
End
End
Begin VB.Frame Frame7
Height = 615
Left = 120
TabIndex = 59
ToolTipText = "Indica si se ha seleccionado la opción de mostrar información"
Top = 1320
Width = 1455
Begin VB.CheckBox Check4
Caption = "Ver detalles"
Height = 255
Left = 120
TabIndex = 60
Top = 240
Value = 1 'Checked
Width = 1215
End
End
Begin VB.Frame Frame6
Caption = "Modelizaciones"
ForeColor = &H00C00000&
Height = 1695
Left = 1680
frmMain - 4

TabIndex = 56
Top = 240
Width = 1815
Begin VB.ListBox List1
Height = 1230
Left = 120
TabIndex = 57
ToolTipText = "Muestra las modelizaciones realizadas en el último arranque del
Top = 360
Width = 1575
End
End
Begin VB.Frame Frame5
Caption = "Edición"
ForeColor = &H00C00000&
Height = 1095
Left = 120
TabIndex = 52
ToolTipText = "Indica si se ha editado algún dato"
Top = 240
Width = 1455
Begin VB.CheckBox Check3
Caption = "Calibración"
Height = 255
Left = 120
TabIndex = 55
Top = 720
Width = 1095
End
Begin VB.CheckBox Check2
Caption = "Oleaje"
Height = 255
Left = 120
TabIndex = 54
Top = 480
Width = 855
End
Begin VB.CheckBox Check1
Caption = "Batimetría"
Height = 255
Left = 120
TabIndex = 53
Top = 240
Width = 1095
End
End
End
Begin VB.Timer Timer1
Interval = 1000
Left = 10680
Top = 5280
End
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 13
Top = 7860
Width = 11880
_ExtentX = 20955
_ExtentY = 450
SimpleText = ""
_Version = 327680
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 1
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Alignment = 1
AutoSize = 2
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
EndProperty
MouseIcon = {Binary}
frmMain - 5

End
Begin TabDlg.SSTab SSTab1
Height = 4815
Left = 120
TabIndex = 5
Top = 480
Width = 4725
_ExtentX = 8334
_ExtentY = 8493
_Version = 327680
TabOrientation = 1
Tabs = 5
TabsPerRow = 5
TabHeight = 520
BackColor = 12632256
ForeColor = 12582912
TabCaption(0) = "Datos"
TabPicture(0) = {Binary}
Tab(0).ControlCount= 2
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "TreeView2"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "Frame2"
Tab(0).Control(1).Enabled= 0 'False
TabCaption(1) = "Resultado"
TabPicture(1) = {Binary}
Tab(1).ControlCount= 1
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "TreeView1"
Tab(1).Control(0).Enabled= 0 'False
TabCaption(2) = "Dibujo"
TabPicture(2) = {Binary}
Tab(2).ControlCount= 2
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "Frame3"
Tab(2).Control(0).Enabled= 0 'False
Tab(2).Control(1)= "Frame1"
Tab(2).Control(1).Enabled= 0 'False
TabCaption(3) = "Tiempos"
TabPicture(3) = {Binary}
Tab(3).ControlCount= 2
Tab(3).ControlEnabled= 0 'False
Tab(3).Control(0)= "MSChart1"
Tab(3).Control(0).Enabled= 0 'False
Tab(3).Control(1)= "Label27"
Tab(3).Control(1).Enabled= 0 'False
TabCaption(4) = "Validar"
TabPicture(4) = {Binary}
Tab(4).ControlCount= 1
Tab(4).ControlEnabled= 0 'False
Tab(4).Control(0)= "Frame11"
Tab(4).Control(0).Enabled= 0 'False
Begin VB.Frame Frame11
Caption = "Validación"
ForeColor = &H00C00000&
Height = 4215
Left = -74880
TabIndex = 67
Top = 120
Width = 4455
Begin VB.Frame Frame12
Caption = "Nombre de archivo"
Enabled = 0 'False
Height = 855
Left = 2280
TabIndex = 72
Top = 840
Width = 2055
Begin VB.TextBox Text2
Height = 285
Left = 120
TabIndex = 73
Text = " "
ToolTipText = "Introduczca aquí el nombre del archivo de puntos"
frmMain - 6

Top = 360
Width = 1815
End
End
Begin VB.CommandButton Command2
Caption = "&Añadir archivo"
Height = 255
Left = 2400
TabIndex = 71
Top = 480
Width = 1215
End
Begin VB.Frame Frame13
Caption = "Puntos"
Height = 2775
Left = 120
TabIndex = 68
Top = 360
Width = 2055
Begin VB.CommandButton Mostrar
Caption = "&Mostrar"
Height = 255
Left = 120
TabIndex = 70
Top = 2400
Width = 1815
End
Begin VB.FileListBox File1
Height = 2040
Left = 120
MultiSelect = 2 'Extended
Pattern = "*.val"
TabIndex = 69
Top = 240
Width = 1815
End
End
End
Begin MSChartLib.MSChart MSChart1
Height = 4215
Left = -74880
TabIndex = 46
ToolTipText = "Gráfica comparativa de tiempos consumidos en el proceso"
Top = 120
Visible = 0 'False
Width = 4455
End
Begin VB.Frame Frame3
Caption = "Datos del dibujo"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 1815
Left = -74880
TabIndex = 25
Top = 2520
Width = 4455
Begin VB.Label Label26
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 960
TabIndex = 45
Top = 1320
Width = 3375
End
frmMain - 7

Begin VB.Label Label25


AutoSize = -1 'True
Caption = "Resultado: "
Height = 195
Left = 120
TabIndex = 44
Top = 1320
Width = 810
End
Begin VB.Line Line2
X1 = 120
X2 = 4320
Y1 = 1200
Y2 = 1200
End
Begin VB.Label Label24
AutoSize = -1 'True
Caption = "Coordenadas"
Height = 195
Left = 3240
TabIndex = 42
Top = 240
Width = 945
End
Begin VB.Label Label22
AutoSize = -1 'True
Caption = "Y:"
Height = 195
Left = 2640
TabIndex = 37
Top = 840
Width = 150
End
Begin VB.Label Label21
AutoSize = -1 'True
Caption = "X: "
Height = 195
Left = 2640
TabIndex = 36
Top = 480
Width = 195
End
Begin VB.Label Label20
Alignment = 2 'Center
BackColor = &H00FFFF80&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 3120
TabIndex = 35
Top = 840
Width = 1215
End
Begin VB.Label Label19
Alignment = 2 'Center
BackColor = &H00FFFF80&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 3120
TabIndex = 34
Top = 480
Width = 1215
End
Begin VB.Line Line1
X1 = 2520
X2 = 2520
Y1 = 240
Y2 = 1200
End
Begin VB.Label Label18
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1680
frmMain - 8

TabIndex = 33
Top = 840
Width = 735
End
Begin VB.Label Label17
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 1680
TabIndex = 32
Top = 480
Width = 735
End
Begin VB.Label Label16
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 840
TabIndex = 31
Top = 840
Width = 735
End
Begin VB.Label Label15
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 840
TabIndex = 30
Top = 480
Width = 735
End
Begin VB.Label Label14
Alignment = 2 'Center
Caption = "Y"
Height = 255
Left = 1680
TabIndex = 29
Top = 240
Width = 615
End
Begin VB.Label Label13
Alignment = 2 'Center
Caption = "X"
Height = 255
Left = 960
TabIndex = 28
Top = 240
Width = 495
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "Mínimo: "
Height = 195
Left = 120
TabIndex = 27
Top = 840
Width = 615
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "Máximo: "
Height = 195
Left = 120
TabIndex = 26
Top = 480
Width = 630
End
End
Begin VB.Frame Frame1
Caption = "Dibujo de archivo"
BeginProperty Font
frmMain - 9

Name = "MS Sans Serif"


Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 2295
Left = -74880
TabIndex = 14
Top = 120
Width = 4455
Begin VB.CommandButton A_Grapher
Caption = "&ASCI"
Enabled = 0 'False
Height = 255
Left = 3240
TabIndex = 43
Top = 1800
Width = 975
End
Begin VB.Frame Frame4
Caption = "Playa cilíndrica"
Height = 615
Left = 120
TabIndex = 38
Top = 1560
Width = 2055
Begin VB.TextBox Text1
BackColor = &H0080FF80&
ForeColor = &H00C00000&
Height = 285
Left = 480
TabIndex = 40
Top = 240
Width = 375
End
Begin VB.CommandButton Playa_Cilindrica
Caption = "&Crear"
Enabled = 0 'False
Height = 255
Left = 960
TabIndex = 39
Top = 240
Width = 975
End
Begin VB.Label Label23
AutoSize = -1 'True
Caption = "Fila:"
Height = 195
Left = 120
TabIndex = 41
Top = 240
Width = 285
End
End
Begin VB.CommandButton Command1
Caption = "&Leer batimetría"
Height = 255
Left = 240
TabIndex = 24
Top = 720
Width = 1815
End
Begin ComctlLib.ProgressBar ProgressBar2
Height = 255
Left = 240
TabIndex = 23
Top = 1080
Width = 1815
_ExtentX = 3201
_ExtentY = 450
frmMain - 10

_Version = 327680
Appearance = 1
MouseIcon = {Binary}
End
Begin VB.CommandButton Dibujo
Caption = "&Dibujo"
Enabled = 0 'False
Height = 255
Left = 3240
TabIndex = 22
Top = 1440
Width = 975
End
Begin VB.VScrollBar VScroll1
Height = 1335
Left = 2880
Max = 0
TabIndex = 17
Top = 720
Width = 255
End
Begin VB.Shape Shape2
Height = 855
Left = 120
Top = 600
Width = 2055
End
Begin VB.Shape Shape1
Height = 1575
Left = 2280
Top = 600
Width = 2055
End
Begin VB.Label Label10
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 3240
TabIndex = 21
Top = 960
Width = 855
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "Perfil:"
Height = 195
Left = 3360
TabIndex = 20
Top = 720
Width = 480
WordWrap = -1 'True
End
Begin VB.Label Label6
Height = 255
Left = 2400
TabIndex = 19
Top = 1800
Width = 375
End
Begin VB.Label Label5
Height = 255
Left = 2400
TabIndex = 18
Top = 720
Width = 375
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 960
TabIndex = 16
frmMain - 11

Top = 240
Width = 3375
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Archivo: "
Height = 195
Left = 120
TabIndex = 15
Top = 240
Width = 630
End
End
Begin ComctlLib.TreeView TreeView1
Height = 4215
Left = -74880
TabIndex = 12
Top = 120
Width = 4455
_ExtentX = 7858
_ExtentY = 7435
_Version = 327680
Style = 7
ImageList = "ImageList2"
Appearance = 1
MouseIcon = {Binary}
End
Begin VB.Frame Frame2
Caption = "Datos del proyecto"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1695
Left = 120
TabIndex = 7
Top = 2640
Width = 4455
Begin VB.TextBox Text8
Height = 285
Left = 1320
TabIndex = 0
Top = 240
Width = 3015
End
Begin VB.TextBox Text7
Height = 285
Left = 1320
TabIndex = 1
Top = 600
Width = 3015
End
Begin VB.TextBox Text6
Height = 285
Left = 1320
TabIndex = 2
Top = 960
Width = 3015
End
Begin VB.TextBox Text5
Height = 285
Left = 1320
TabIndex = 3
Top = 1320
Width = 3015
End
Begin VB.Label Label8
AutoSize = -1 'True
frmMain - 12

Caption = "Localización: "


Height = 195
Left = 120
TabIndex = 11
Top = 240
Width = 975
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "Último uso: "
Height = 195
Left = 120
TabIndex = 10
Top = 600
Width = 825
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Informe: "
Height = 195
Left = 120
TabIndex = 9
Top = 960
Width = 615
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Observaciones: "
Height = 195
Left = 120
TabIndex = 8
Top = 1320
Width = 1155
End
End
Begin ComctlLib.TreeView TreeView2
Height = 2415
Left = 120
TabIndex = 6
Top = 120
Width = 4455
_ExtentX = 7858
_ExtentY = 4260
_Version = 327680
Indentation = 353
LineStyle = 1
Style = 7
ImageList = "ImageList1"
BorderStyle = 1
Appearance = 1
MouseIcon = {Binary}
End
Begin VB.Label Label27
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Caption = "No existe el gráfico"
BeginProperty Font
Name = "Bookman Old Style"
Size = 9.75
Charset = 0
Weight = 600
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = -74520
TabIndex = 47
Top = 1380
Width = 3855
End
End
Begin VB.PictureBox Picture1
frmMain - 13

AutoRedraw = -1 'True
BackColor = &H8000000E&
FillStyle = 0 'Solid
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4695
Left = 4920
MousePointer = 2 'Cross
ScaleHeight = 4635
ScaleWidth = 6795
TabIndex = 4
Top = 480
Width = 6855
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 10560
Top = 5760
_ExtentX = 847
_ExtentY = 847
_Version = 327680
End
Begin ComctlLib.ImageList ImageList3
Left = 11160
Top = 6480
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 327680
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 8
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Abrir"
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Oleaje"
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Calibracion"
EndProperty
BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Impresoras"
EndProperty
BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Salir"
EndProperty
BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Mdelizar"
EndProperty
BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Perfiles"
EndProperty
BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Resultados"
EndProperty
EndProperty
End
frmMain - 14

Begin ComctlLib.ImageList ImageList2


Left = 11160
Top = 5880
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 327680
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 18
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage10 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage11 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage12 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage13 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage14 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage15 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage16 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
frmMain - 15

Key = ""
EndProperty
BeginProperty ListImage17 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage18 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
EndProperty
End
Begin ComctlLib.ImageList ImageList1
Left = 11160
Top = 5280
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 327680
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 9
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
Object.Tag = "Oleaje"
EndProperty
BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
Object.Tag = "Calibracion"
EndProperty
BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage8 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage9 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
EndProperty
End
Begin VB.Menu mnuFileOpen
Caption = "&Archivo"
Begin VB.Menu mnuFileOpenNuevo
Caption = "&Nuevo"
Shortcut = ^N
End
Begin VB.Menu mnuFileOpenAbrir
Caption = "Abrir &proyecto"
Shortcut = ^P
End
frmMain - 16

Begin VB.Menu mnuFileOpenResultados


Caption = "Abrir &resultados"
Shortcut = ^R
End
Begin VB.Menu mnuFileCrear
Caption = "&Crear / Editar"
Begin VB.Menu mnuFileCrearOleaje
Caption = "&Oleaje"
End
Begin VB.Menu mnuFileCrearCalibracion
Caption = "&Calibración"
End
End
Begin VB.Menu mnuFileOpenSep1
Caption = "-"
End
Begin VB.Menu mnuFileOpenImportar
Caption = "&Importar dato"
Shortcut = ^I
End
Begin VB.Menu mnuFileOpenExportar
Caption = "&Exportar proyecto"
Shortcut = ^E
End
Begin VB.Menu mnuFileExportarResultados
Caption = "E&xportar resultados"
Shortcut = ^X
End
Begin VB.Menu mnuFileOpenSep2
Caption = "-"
End
Begin VB.Menu mnuFileEliminarResutados
Caption = "E&liminar resultados"
Shortcut = ^L
End
Begin VB.Menu mnuFileOpenSep3
Caption = "-"
End
Begin VB.Menu mnuFileOpenSalir
Caption = "&Salir"
Shortcut = ^S
End
End
Begin VB.Menu mnuEdit
Caption = "&Editar"
Begin VB.Menu mnuEditElimina
Caption = "&Eliminar"
Begin VB.Menu mnuEditEliminaActual
Caption = "Archivo &actual"
End
Begin VB.Menu mnuEditEliminaTodos
Caption = "&Todos los archivos"
End
End
End
Begin VB.Menu mnuVer
Caption = "&Ver"
Begin VB.Menu mnuVerInfo
Caption = "&Información"
Checked = -1 'True
End
End
Begin VB.Menu mnuModel
Caption = "&Modelizar"
Enabled = 0 'False
End
Begin VB.Menu mnuPerfiles
Caption = "&Herramientas"
Begin VB.Menu mnuPerfilesUniformidad
Caption = "&Uniformidad"
Enabled = 0 'False
End
End
Begin VB.Menu mnuResults
frmMain - 17

Caption = "&Resultados"
Enabled = 0 'False
End
Begin VB.Menu mnuHelp1
Caption = "A&yuda"
Begin VB.Menu mnuHelp1Acercade
Caption = "&Acerca de"
End
End
Begin VB.Menu mnuHelp
Caption = ""
Begin VB.Menu mnuHelpQuees
Caption = "¿&Qué es esto?"
End
End
End
frmOlas - 1

Option Explicit

Private Sub Command2_Click()

End Sub

Private Sub Command1_Click()

End Sub

Private Sub Abrir_Click()

Dim f As Integer, file As String


Dim H As Single, T As Single, ob As Single

On Error GoTo SalirOlas


With CommonDialog1
.CancelError = True
.Filter = "Oleaje (*.ola)|*.ola"
.DialogTitle = "Abrir archivo de oleaje"
.Action = 1
file = .filename
Label2.Caption = .FileTitle
End With
f = FreeFile
Open file For Input As #f
Input #f, H
Text1.Text = Str(H)
Input #f, T
Text2.Text = Str(T)
Input #f, ob
Text3.Text = Str(ob)
Close #f

SalirOlas:
End Sub

Private Sub Grabar_Click()

Dim f As Integer, file As String

On Error GoTo SalirOlas


With CommonDialog1
.CancelError = True
.Filter = "Oleaje (*.ola)|*.ola"
.DialogTitle = "Grabar archivo de oleaje"
.Action = 2
file = .filename
Label2.Caption = .FileTitle
End With
f = FreeFile

On Error GoTo NoExiste


k = FileLen(file)
Call Existe(file)
If gResponse = 7 Then Exit Sub

sigue:
Open file For Output As #f
Print #f, Text1.Text
Print #f, Text2.Text
Print #f, Text3.Text
Close #f
Call Salir_Click
Exit Sub

NoExiste:
Resume sigue
SalirOlas:

End Sub

Private Sub Salir_Click()


frmOlas - 2

Screen.MousePointer = 11
frmMain.Enabled = True
Unload frmOlas
frmMain.Check2.Value = 1
Screen.MousePointer = 0

End Sub

Private Sub Text1_GotFocus()


With Text1
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub

Private Sub Text2_GotFocus()


With Text2
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub

Private Sub Text3_GotFocus()


With Text3
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
frmOlas - 1

VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Begin VB.Form frmOlas
Caption = "DATOS DE OLEAJE"
ClientHeight = 2280
ClientLeft = 5040
ClientTop = 1350
ClientWidth = 4680
Icon = (Icono)
LinkTopic = "Form1"
ScaleHeight = 2280
ScaleWidth = 4680
Begin VB.Frame Frame2
Height = 1695
Left = 2880
TabIndex = 9
Top = 480
Width = 1575
Begin VB.CommandButton Abrir
Caption = "&Abrir"
Height = 255
Left = 120
TabIndex = 12
Top = 240
Width = 1335
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 480
Top = 1200
_ExtentX = 847
_ExtentY = 847
_Version = 327680
End
Begin VB.CommandButton Salir
Caption = "&Salir"
Height = 255
Left = 120
TabIndex = 11
Top = 960
Width = 1335
End
Begin VB.CommandButton Grabar
Caption = "&Grabar"
Height = 255
Left = 120
TabIndex = 10
Top = 600
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "Datos:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 1695
Left = 120
TabIndex = 5
Top = 480
Width = 2655
Begin VB.TextBox Text3
Height = 285
Left = 1320
TabIndex = 2
Top = 1080
Width = 855
End
frmOlas - 2

Begin VB.TextBox Text2


Height = 285
Left = 1320
TabIndex = 1
Top = 720
Width = 855
End
Begin VB.TextBox Text1
Height = 285
Left = 1320
TabIndex = 0
Top = 360
Width = 855
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "Periodo [s]: "
Height = 195
Left = 120
TabIndex = 8
Top = 720
Width = 840
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "Dirección [º]: "
Height = 195
Left = 120
TabIndex = 7
Top = 1080
Width = 960
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Hrms [m]: "
Height = 195
Left = 120
TabIndex = 6
Top = 360
Width = 705
End
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Height = 255
Left = 960
TabIndex = 4
Top = 120
Width = 3615
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Archivo: "
Height = 195
Left = 120
TabIndex = 3
Top = 120
Width = 630
End
End
frmParametros - 1

Option Explicit

Private Sub Command1_Click()

End Sub

Private Sub Abrir_Click()

Dim f As Integer, file As String, _


k As Single, gp As Single, gG As Single, _
dl As Single, Alfa As Single, fw As Single, _
dmin As Single, inter As Integer, tipo As String

On Error GoTo SalirCalibra


With CommonDialog1
.CancelError = True
.Filter = "Parámetros (*.cal)|*.cal"
.DialogTitle = "Abrir archivo de parámetros"
.Action = 1
file = .filename
Label2.Caption = .FileTitle
End With
f = FreeFile
Open file For Input As #f
Input #f, k
Text1.Text = Str(k)
Input #f, gp
Text2.Text = Str(gp)
Input #f, gG
Text3.Text = Str(gG)
Input #f, dl
Text4.Text = Str(dl)
Input #f, Alfa
Text5.Text = Str(Alfa)
Input #f, fw
Text6.Text = Str(fw)
Input #f, dmin
Text7.Text = Str(dmin)
Input #f, inter
Check1.Value = inter
Input #f, tipo
If tipo = "DSBB" Then
Option1.Value = True
Else
Option2.Value = True
End If
Input #f, gKf
Text8.Text = gKf
Input #f, gUL
Check2.Value = gUL
Close #f
Exit Sub

SalirCalibra:
Close #f
End Sub

Private Sub Ayuda_a_parametros_Click()

'Ayuda para escoger parámetros en función de los datos de oleaje

End Sub

Sub BatStive_Click()

Dim Peralte As Single, arg As Single

Select Case gProyecto.Oleaje


Case Is = ""
gMsg = "No se ha definido el dato de oleaje " & Chr(10) & _
"para el proyecto en estudio"
gTitulo = "FALTAN DATOS"
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo
Exit Sub
frmParametros - 2

Case Else
Call LeeOlas(gProyecto.Oleaje)
Peralte = gHo / gLo
arg = 33 * Peralte
Call Tanh(arg)
gG1 = 0.5 + 0.4 * gTh
Text2.Text = Str(Format(gG1, "###0.00"))
End Select
End Sub

Private Sub Grabar_Click()

Dim f As Integer, file As String

f = FreeFile

On Error GoTo SalirGuardar


With CommonDialog1
.CancelError = True
.Filter = "Parámetros (*.cal)|*.cal"
.DialogTitle = "Guardar archivo de parámetros"
.Action = 2
file = .filename
End With
On Error GoTo NoExiste
k = FileLen(file)
Call Existe(file)
If gResponse = 7 Then Exit Sub

sigue:
Open file For Output As #f
Print #f, Text1.Text
Print #f, Text2.Text
Print #f, Text3.Text
Print #f, Text4.Text
Print #f, Text5.Text
Print #f, Text6.Text
Print #f, Text7.Text
Print #f, Str(Check1.Value)
If Option1.Value = True Then
Print #f, "DSBB"
Else
Print #f, "DSAA"
End If
Print #f, Text8.Text
Print #f, Str(Check2.Value)
Close #f

Call Salir_Click
Exit Sub

NoExiste:
Resume sigue
SalirGuardar:

End Sub

Private Sub Nikuradse_Click()

Dim D50 As Single, d As String


d = InputBox("Introduzca D50 [mm]", "P. de NIKURADSE", "0.05")
D50 = Val(d)
gr = 2.5 * D50
Text6.Text = Str(gr)

End Sub

Private Sub Salir_Click()

Screen.MousePointer = 11
frmMain.Enabled = True
frmMain.SetFocus
Unload frmParametros
frmParametros - 3

frmMain.Check3.Value = 1
Screen.MousePointer = 0

End Sub

Private Sub Text1_GotFocus()

With Text1
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text2_GotFocus()

With Text2
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text3_GotFocus()

With Text3
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text4_GotFocus()

With Text4
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text5_GotFocus()

With Text5
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text6_GotFocus()

With Text6
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text7_GotFocus()

With Text7
.SelStart = 0
.SelLength = Len(.Text)
End With

End Sub

Private Sub Text8_GotFocus()

With Text8
.SelStart = 0
.SelLength = Len(.Text)
frmParametros - 4

End With

End Sub
frmParametros - 1

VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Begin VB.Form frmParametros
Caption = "Parámetros de calibración"
ClientHeight = 4305
ClientLeft = 3840
ClientTop = 4050
ClientWidth = 7020
Icon = (Icono)
LinkTopic = "Form1"
ScaleHeight = 4305
ScaleWidth = 7020
Begin MSComDlg.CommonDialog CommonDialog1
Left = 6120
Top = 1560
_ExtentX = 847
_ExtentY = 847
_Version = 327680
End
Begin VB.Frame Frame2
Height = 1335
Left = 5880
TabIndex = 24
Top = 0
Width = 1095
Begin VB.CommandButton Ayuda_a_parametros
Caption = "&Ayuda"
Height = 255
Left = 120
TabIndex = 30
Top = 960
Width = 855
End
Begin VB.CommandButton Abrir
Caption = "&Abrir"
Height = 315
Left = 120
TabIndex = 26
Top = 240
Width = 855
End
Begin VB.CommandButton Grabar
Caption = "&Grabar"
Height = 255
Left = 120
TabIndex = 25
Top = 600
Width = 855
End
End
Begin VB.CommandButton Salir
Caption = "&Salir"
Height = 375
Left = 5880
TabIndex = 23
Top = 3840
Width = 1095
End
Begin VB.Frame Frame1
Caption = "Parámetros de calibración del modelo"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 4215
Left = 0
TabIndex = 0
Top = 0
frmParametros - 2

Width = 5775
Begin VB.CheckBox Check2
Caption = "Uniformidad longitudinal"
Height = 255
Left = 120
TabIndex = 36
Top = 3240
Width = 2175
End
Begin VB.TextBox Text8
Height = 285
Left = 4800
TabIndex = 35
Text = "1.00"
ToolTipText = "Multiplica Df por este factor"
Top = 2880
Width = 735
End
Begin VB.CommandButton BatStive
Caption = "E&valuar"
Height = 255
Left = 3120
TabIndex = 32
Top = 720
Width = 735
End
Begin VB.CommandButton Nikuradse
Caption = "&Evaluar"
Height = 255
Left = 3000
TabIndex = 31
Top = 2160
Width = 855
End
Begin VB.Frame Frame3
Caption = "Resultados"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 855
Left = 4320
TabIndex = 27
Top = 3240
Width = 1215
Begin VB.OptionButton Option2
Caption = "ASCI"
Height = 255
Left = 120
TabIndex = 29
Top = 480
Width = 735
End
Begin VB.OptionButton Option1
Caption = "Binarios"
Height = 255
Left = 120
TabIndex = 28
Top = 240
Value = -1 'True
Width = 855
End
End
Begin VB.TextBox Text7
Height = 285
Left = 4800
TabIndex = 22
Text = "-0.01"
frmParametros - 3

ToolTipText = "Punto en que se detiene el cálculo"


Top = 2520
Width = 735
End
Begin VB.TextBox Text6
Height = 285
Left = 4800
TabIndex = 21
Text = "0.125"
ToolTipText = "Utilizado para fricción con el fondo"
Top = 2160
Width = 735
End
Begin VB.TextBox Text5
Height = 285
Left = 4800
TabIndex = 20
Text = "1.00"
ToolTipText = "Multiplicador de Db"
Top = 1800
Width = 735
End
Begin VB.TextBox Text4
Height = 285
Left = 4800
TabIndex = 19
Text = "0.40"
Top = 1440
Width = 735
End
Begin VB.TextBox Text3
Height = 285
Left = 4800
TabIndex = 18
Text = "0.40"
Top = 1080
Width = 735
End
Begin VB.TextBox Text2
Height = 285
Left = 4800
TabIndex = 17
Text = "0.80"
Top = 720
Width = 735
End
Begin VB.TextBox Text1
Height = 285
Left = 4800
TabIndex = 16
Text = "0.15"
Top = 360
Width = 735
End
Begin VB.CheckBox Check1
Caption = "Interacción oleaje -corrientes"
Height = 255
Left = 120
TabIndex = 8
Top = 3600
Width = 2415
End
Begin VB.Label Label16
Caption = "Kf ="
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
frmParametros - 4

Left = 4080
TabIndex = 34
Top = 2880
Width = 495
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "Parámetro modificador de pérdidas por fricción: "
Height = 195
Left = 120
TabIndex = 33
Top = 2880
Width = 3360
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "dmin = "
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 15
Top = 2520
Width = 630
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "r ="
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 14
Top = 2160
Width = 240
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "a = "
BeginProperty Font
Name = "Symbol"
Size = 8.25
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 13
Top = 1800
Width = 315
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "d/L = "
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
frmParametros - 5

Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 12
Top = 1440
Width = 540
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "G = "
BeginProperty Font
Name = "Symbol"
Size = 8.25
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 11
Top = 1080
Width = 315
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "g = "
BeginProperty Font
Name = "Symbol"
Size = 8.25
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 10
Top = 720
Width = 315
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "K = "
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 4080
TabIndex = 9
Top = 360
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "Profundidad mínima de cálculo: "
Height = 195
Left = 120
TabIndex = 7
Top = 2520
Width = 2280
frmParametros - 6

End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "Parámetro de Nikuradse: "
Height = 195
Left = 120
TabIndex = 6
Top = 2160
Width = 1800
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "Coeficiente de disipación por rotura: "
Height = 195
Left = 120
TabIndex = 5
Top = 1800
Width = 2580
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "Límite de profundidades reducidas: "
Height = 195
Left = 120
TabIndex = 4
Top = 1440
Width = 2535
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Relación H/d para máxima ola estable (0.35 - 0.50): "
Height = 195
Left = 120
TabIndex = 3
Top = 1080
Width = 3690
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Parámetro de Battjes y Stive: "
Height = 195
Left = 120
TabIndex = 2
Top = 720
Width = 2085
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Parámetro de Dally (0.1 - 0.3): "
Height = 195
Left = 120
TabIndex = 1
Top = 360
Width = 2145
End
End
End
frmResultados - 1

Option Explicit

Dim fFila As Integer, fT As String, fEntrada As String


Sub LlenaGrid(fila As Integer)

Dim rH As Single

With MSFlexGrid1
.Clear
.FixedRows = 1
.FixedCols = 1
.Row = 1
.col = 1
.Rows = 1
.Cols = 1
.CellAlignment = flexAlignCenterCenter
End With
'Cabecera
fEntrada = " Perfil " & fT & " x " & fT & " d " & fT & _
" L. Onda " & fT & " Hrms " & fT & " Hmax " & fT & _
" Rh " & fT & " Qb " & fT & " Set-up " & fT & _
" Sxx " & fT & " Syy " & fT & " Sxy " & fT & _
" Cg " & fT & " Db " & fT & " Df " & fT & _
" P. Ursell " & fT & " Fw " & fT & _
" Rx " & fT & " Ry "

MSFlexGrid1.FormatString = fEntrada

On Error GoTo NoModel


For i = 1 To Fich.Columnas
If gHm(fila, i) > 0 Then rH = gHrms(fila, i) / gHm(fila, i)
fEntrada = Str(i) & fT & Str((i - 1) * gDx) & fT & _
Format(gZ(fila, i), "#0.00") & fT & _
Format(gL(fila, i), "#0.00") & fT & Format(gHrms(fila, i), "#0.00") & fT & _
Format(gHm(fila, i), "#0.00") & fT & Format(rH, "#0.00") & fT & _
Format(gQb(fila, i), "#0.00") & fT & Format(gSU(fila, i), "#0.00") & fT & _
Format(gSxx(fila, i), "#0.00") & fT & Format(gSyy(fila, i), "#0.00") & fT & _
Format(gSxy(fila, i), "#0.00") & fT & Format(gCg(fila, i), "#0.00") & fT & _
Format(gDb(fila, i), "#0.00") & fT & Format(gDf(fila, i), "#0.00") & fT & _
Format(gUr(fila, i), "#0.00") & fT & Format(gFw(fila, i), "#0.00") & fT & _
Format(gRx(fila, i), "#0.00") & fT & Format(gRy(fila, i), "#0.00")

MSFlexGrid1.AddItem fEntrada, i
Next i
sigue:
MSFlexGrid1.Rows = HScroll1.max + 1
Exit Sub

NoModel:
gMsg = "No ha procesado el proyecto"
gTitulo = "NO HAY RESULTADOS"
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo
Resume sigue

End Sub
Private Sub Form_Load()

fT = Chr(9)

With HScroll1
.max = Fich.Columnas
.min = 1
.Value = 1
.SmallChange = 1
Label2.Caption = .Value
End With

frmResultados.Caption = frmResultados.Caption & " - " & gProyecto.Nombre

End Sub

Private Sub Fuente()

Dim Fuente As String, size As Integer


frmResultados - 2

With CommonDialog1
.FontName = "Arial Narrow"
.Flags = cdlCFBoth
.ShowFont
Fuente = .FontName
size = .FontSize
End With
MSFlexGrid1.Font = Fuente
MSFlexGrid1.FontSize = size
MSFlexGrid1.Refresh

End Sub

Private Sub HScroll1_Change()

Screen.MousePointer = 11
Label2.Caption = HScroll1.Value
Call LlenaGrid(HScroll1.Value)
Screen.MousePointer = 0

End Sub

Private Sub Salir_Click()

Unload frmResultados

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)

Select Case Button.Key


Case Is = "Fuente"
Call Fuente
Case Is = "Impresora"
On Error GoTo Salir
CommonDialog1.ShowPrinter
Case Is = "Salir"
Unload frmResultados
End Select
Salir:
End Sub
frmResultados - 1

VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Begin VB.Form frmResultados
Caption = "Resultados"
ClientHeight = 7530
ClientLeft = 360
ClientTop = 450
ClientWidth = 11340
Icon = (Icono)
LinkTopic = "Form1"
ScaleHeight = 7530
ScaleWidth = 11340
Begin MSComDlg.CommonDialog CommonDialog1
Left = 8160
Top = 3840
_ExtentX = 847
_ExtentY = 847
_Version = 327680
End
Begin VB.Frame Frame1
Caption = "Control"
Height = 615
Left = 0
TabIndex = 1
Top = 6840
Width = 11295
Begin ComctlLib.Toolbar Toolbar1
Height = 390
Left = 10080
TabIndex = 5
Top = 120
Width = 1095
_ExtentX = 1931
_ExtentY = 688
Appearance = 1
ImageList = "ImageList1"
_Version = 327680
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 3
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Fuente"
Description = "Fuente"
Object.ToolTipText = "Tipo de fuente a utilizar"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Impresora"
Description = "Impresora"
Object.ToolTipText = "Propiedades de la impresora"
Object.Tag = ""
ImageIndex = 2
EndProperty
BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Salir"
Description = "Salir"
Object.ToolTipText = "Cerrar ventana"
Object.Tag = ""
ImageIndex = 3
EndProperty
EndProperty
End
Begin VB.HScrollBar HScroll1
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 4575
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H8000000E&
frmResultados - 2

BorderStyle = 1 'Fixed Single


Caption = "Label2"
Height = 255
Left = 5280
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Fila: "
Height = 195
Left = 4920
TabIndex = 3
Top = 240
Width = 330
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 6615
Left = 0
TabIndex = 0
Top = 120
Width = 11295
_ExtentX = 19923
_ExtentY = 11668
_Version = 327680
Cols = 10
BackColor = 16777215
WordWrap = -1 'True
FillStyle = 1
AllowUserResizing= 3
MousePointer = 3
End
Begin ComctlLib.ImageList ImageList1
Left = 9600
Top = 6720
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 327680
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 3
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
EndProperty
End
End
frmSonda - 1

Option Explicit
frmSonda - 1

VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Begin VB.Form frmSonda
BackColor = &H00C00000&
ClientHeight = 255
ClientLeft = 1155
ClientTop = 7755
ClientWidth = 9735
ClipControls = 0 'False
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 255
ScaleWidth = 9735
Begin ComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 0
TabIndex = 0
Top = 0
Width = 9735
_ExtentX = 17171
_ExtentY = 450
_Version = 327680
BorderStyle = 1
Appearance = 1
End
End
frmUniform - 1

Option Explicit

Dim fX() As Variant


Private Sub Calcular_Click()

Dim file As String, File1 As String, col As Integer, _


media As Single, std As Single, _
f As Integer, f1 As Integer

Screen.MousePointer = 11
file = "Sigma.prf"
File1 = "Media.prf"
gMsg = "El resultado se guardará" & Chr(10) & _
"en los archivos " & file & " y" & Chr(10) & _
File1
gTitulo = "RESULTADOS"
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo

'Lee el archivo batimétrico


Select Case Fich.Clase
Case Is = "DSAA"
Call leeASCI(gProyecto.Batimetria)
Case Is = "DSBB"
Call LeeBinario(gProyecto.Batimetria)
End Select

f = FreeFile
Open file For Output As #f
f1 = FreeFile
Open File1 For Output As #f1
For col = 1 To Fich.Columnas
ProgressBar1.Value = col
'Media
media = 0
For i = 1 To Fich.filas
media = media + gZ(i, col)
Next i
media = media / Fich.filas
Print #f1, Str(col), Str(Format(media, "##0.0000"))

'Desviación

std = 0
For i = 1 To Fich.filas
std = std + (gZ(i, col) - media) ^ 2
Next i
std = Sqr(std / Fich.filas)
Print #f, Str(col), Str(Format(std, "##0.0000"))
Next col
Close #f, #f1

Toolbar1.Visible = True
Toolbar1.Refresh

Screen.MousePointer = 0

End Sub

Private Sub Form_Load()

ReDim fX(1 To Fich.filas, 1 To 2) As Variant

frmUniform.Caption = frmUniform.Caption & " - " & gProyectoNP.Batimetria


Label4.Caption = Fich.filas
Label5.Caption = Fich.Columnas
Label6.Caption = "[" & Str(gDx) & "," & Str(gDy) & "]"

With ProgressBar1
.min = 0
.max = Fich.Columnas
.Value = 0
End With

End Sub
frmUniform - 2

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Caption_a_cero

End Sub

Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Caption_a_cero

End Sub

Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Caption_a_cero

End Sub

Private Sub Frame3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Call Caption_a_cero

End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

Label9.Caption = Format(X, "###0")


Label10.Caption = Format(Y, "###0.000")

End Sub

Private Sub Salir_Click()

Unload frmUniform

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)

Dim file As String, orden As String, X As Variant, _


f As Integer, f1 As Integer, filas As Integer, XMax As Double, _
Xmin As Double, YMax As Double, Ymin As Double, _
a As Single, b As Single

Picture1.Cls

Select Case Button.Key


Case Is = "Media"
file = "Media.prf"
Case Is = "Desviacion"
file = "Sigma.prf"
End Select

orden = "Notepad.exe " & file

If Ver.Value = 1 Then X = Shell(orden, vbNormalFocus)

f = FreeFile
Open file For Input As #f
f1 = FreeFile
Open "dibujo.tmp" For Output As #f1
For i = 1 To Fich.filas
Input #f, a, b
Print #f1, Str(a) & ", " & Str(b)
Call ValoresExtremos(b, YMax, Ymin)
'Datos del Chart
fX(i, 1) = Str(a)
fX(i, 2) = b
Next i
Close #f, #f1
Select Case file
Case Is = "Media.prf"
MSChart1.TitleText = "PERFIL MEDIO"
frmUniform - 3

MSChart1.chartType = VtChChartType2dLine
Case Else
MSChart1.TitleText = "DESVIACIÓN"
MSChart1.chartType = VtChChartType2dBar
End Select
MSChart1.ChartData = fX

'Dibujo
If -(YMax - Ymin) = 0 Then
gMsg = "El valor de la función" & Chr(10) & _
"es nulo en todo el dominio."
If file = "Sigma.prf" Then gMsg = gMsg & Chr(10) & _
"La batimetría es uniforme"
gTitulo = "UNIFORMIDAD"
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo
Exit Sub
End If

Call perfil(1, "frmUniform", file)


'Ejes
For i = Ymin To YMax
Picture1.ForeColor = RGB(255, 255, 255)
Picture1.Line (0, i)-(filas, i)
Next i
Toolbar2.Buttons(1).Enabled = True

End Sub
Private Sub Caption_a_cero()

Label9.Caption = " "


Label10.Caption = " "

End Sub

Private Sub Toolbar2_ButtonClick(ByVal Button As ComctlLib.Button)

Select Case Button.Key


Case Is = "Grafico"
If MSChart1.Visible = True Then MSChart1.Visible = False Else MSChart1.Visible =
True
End Select

End Sub
frmUniform - 1

VERSION 5.00
Object = "{02B5E320-7292-11CF-93D5-0020AF99504A}#1.0#0"; "MSCHART.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Begin VB.Form frmUniform
Caption = "UNIFORMIDAD"
ClientHeight = 4545
ClientLeft = 165
ClientTop = 1245
ClientWidth = 11595
Icon = (Icono)
LinkTopic = "Form1"
ScaleHeight = 4545
ScaleWidth = 11595
Begin VB.Frame Frame4
BorderStyle = 0 'None
Height = 495
Left = 2040
TabIndex = 20
Top = 3960
Width = 615
Begin ComctlLib.Toolbar Toolbar2
Height = 390
Left = 120
TabIndex = 21
Top = 120
Width = 375
_ExtentX = 661
_ExtentY = 688
ImageList = "ImageList1"
_Version = 327680
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 1
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Enabled = 0 'False
Key = "Grafico"
Object.ToolTipText = "Visualizar gráfico"
Object.Tag = ""
ImageIndex = 3
EndProperty
EndProperty
End
End
Begin VB.Frame Frame3
Caption = "Coordenadas"
ForeColor = &H00C00000&
Height = 975
Left = 120
TabIndex = 13
Top = 2880
Width = 2535
Begin VB.Label Label10
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Caption = "Label10"
Height = 255
Left = 360
TabIndex = 17
Top = 600
Width = 1095
End
Begin VB.Label Label9
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Caption = "Label9"
Height = 255
Left = 360
TabIndex = 16
Top = 240
Width = 1095
End
Begin VB.Label Label8
AutoSize = -1 'True
frmUniform - 2

Caption = "Y: "


Height = 195
Left = 120
TabIndex = 15
Top = 600
Width = 195
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "X: "
Height = 195
Left = 120
TabIndex = 14
Top = 240
Width = 195
End
End
Begin VB.Frame Frame2
Caption = "Uniformidad transversal"
ForeColor = &H00C00000&
Height = 1335
Left = 120
TabIndex = 9
Top = 1440
Width = 2535
Begin ComctlLib.Toolbar Toolbar1
Height = 390
Left = 1680
TabIndex = 12
Top = 240
Visible = 0 'False
Width = 735
_ExtentX = 1296
_ExtentY = 688
ImageList = "ImageList1"
_Version = 327680
BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7}
NumButtons = 2
BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Media"
Description = "Media"
Object.ToolTipText = "Ver archivo de media aritmética"
Object.Tag = ""
ImageIndex = 1
EndProperty
BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7}
Key = "Desviacion"
Description = "Desviación"
Object.ToolTipText = "Ver archivo de desviación típica"
Object.Tag = ""
ImageIndex = 2
EndProperty
EndProperty
End
Begin VB.CheckBox Ver
Caption = "Ver resultado numérico"
Height = 195
Left = 120
TabIndex = 18
Top = 1080
Width = 2295
End
Begin ComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 120
TabIndex = 11
Top = 720
Width = 2295
_ExtentX = 4048
_ExtentY = 450
_Version = 327680
Appearance = 1
End
Begin VB.CommandButton Calcular
frmUniform - 3

Caption = "&Calcular"
Height = 255
Left = 120
TabIndex = 10
Top = 240
Width = 735
End
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
BackColor = &H8000000E&
Height = 4335
Left = 2760
MousePointer = 2 'Cross
ScaleHeight = 4275
ScaleWidth = 8715
TabIndex = 8
Top = 120
Width = 8775
Begin MSChartLib.MSChart MSChart1
Height = 4335
Left = 0
TabIndex = 19
Top = 0
Visible = 0 'False
Width = 8775
End
End
Begin VB.CommandButton Salir
Caption = "&Salir"
Height = 255
Left = 120
TabIndex = 7
Top = 4200
Width = 975
End
Begin VB.Frame Frame1
Caption = "Batimetría"
ForeColor = &H00C00000&
Height = 1335
Left = 120
TabIndex = 0
Top = 0
Width = 2535
Begin VB.Label Label6
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Caption = " "
Height = 255
Left = 1440
TabIndex = 6
Top = 960
Width = 975
End
Begin VB.Label Label5
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Caption = " "
Height = 255
Left = 1440
TabIndex = 5
Top = 600
Width = 975
End
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H8000000E&
BorderStyle = 1 'Fixed Single
Caption = " "
Height = 255
Left = 1440
TabIndex = 4
frmUniform - 4

Top = 240
Width = 975
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Resolución [x, y]: "
Height = 195
Left = 120
TabIndex = 3
Top = 960
Width = 1260
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Columnas: "
Height = 195
Left = 120
TabIndex = 2
Top = 600
Width = 780
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Filas: "
Height = 195
Left = 120
TabIndex = 1
Top = 240
Width = 405
End
End
Begin ComctlLib.ImageList ImageList1
Left = 1200
Top = 3960
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 327680
BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
NumListImages = 3
BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = ""
EndProperty
BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
Picture = {Binary}
Key = "Grafico"
EndProperty
EndProperty
End
End
Module1 - 1

Option Explicit

'Variables de uso general


Global i As Integer, j As Integer, k As Integer
Global gMsg As String, gTitulo As String
Global gResponse As Integer, gTh As Single, _
gSh As Single, gModela As Integer
Global gZonaError As String
Global gInicEvento As Single, gFinEvento As Single, _
gElapsEvento As Single, gTpo As Single
Global gProyectoLista As String

Global gAntes As Integer, gFileVal As String

Type Tipo_gProyecto
Nombre As String
Batimetria As String
Oleaje As String
Calibracion As String
End Type

Type Tipo_gProyecto_NP
Nombre As String
Batimetria As String
Oleaje As String
Calibracion As String
End Type

Global gProyecto As Tipo_gProyecto, gProyectoNP As Tipo_gProyecto_NP

Global Bati As Node, Calibra As Node, Olas As Node

Global Perfil_R As Node, Hm_R As Node, Hrms_R As Node, Cg_R As Node, L_R As Node, _
Q_R As Node, S_R As Node, SXX_R As Node, SXY_R As Node, _
SYY_R As Node, E_R As Node, D_R As Node, DR_R As Node, DF_R As Node, _
Ur As Node, SU As Node, Uorb_R As Node, R As Node, _
Rx_R As Node, Ry_R As Node, Fw_R As Node, _
Px_R As Node, Py_R As Node

Global PBati As Node, POlas As Node, PCalibra As Node

'DATOS BATIMÉTRICOS
Type DatosGrd
Clase As String * 4
Columnas As Integer
filas As Integer
MinX As Double
MaxX As Double
MinY As Double
MaxY As Double
Minz As Double
MaxZ As Double
Null As String * 4
End Type

Global Fich As DatosGrd


Global gZ() As Single
Global gDx As Single, gDy As Single 'Separación entre nodos

'Datos iniciales de oleaje


Global gHo As Single, gTo As Single, gObo As Single, _
gLo As Single, gFrec As Single

'Datos de calibración

Global gK As Single, gG1 As Single, gG2 As Single, gDL As Single, gAlfa As Single, _
gr As Single, gDmin As Single, gInter As Integer, gTipo As String, _
gPrecQb As Single, gPrecLonda As Single, gKf As Single, gUL As Integer

'Parámetros físicos del oleaje


Global gNO() As Single, gL() As Single 'Nº de onda, longitud de onda
Global gCg() As Single 'Celeridad de grupo
Global gOb() As Single 'Oblicuidad
Global gHrms() As Single 'Altura de ola media cuadrática
Module1 - 2

Global gCteOb() As Single 'Constante de Snell [= sen(a)/c]


Global gHm() As Single 'Altura de ola máxima, según Miche
Global gQb() As Single 'Fracción de olas rotas
Global gE() As Single 'Energía del oleaje
Global gPx() As Single 'Proyección X del flujo de energía
Global gPy() As Single 'Proyección Y del flujo de energía
Global gUorb() As Single 'Velocidad orbital de las partículas
Global gDf() As Single 'Disipac. de energía por fricción con el fondo
Global gDb() As Single 'Disipac. de energía por rotura de oleaje
Global gSxx() As Single 'Componente Sxx del tensor de radiación
Global gSxy() As Single 'Componente Sxy del tensor de radiación
Global gSyy() As Single 'Componente Syy del tensor de radiación
Global gUr() As Single 'Parámetro de Ursell
Global gHal() As Single 'Parámetro de Hallermeier
Global gSU() As Single 'Set-up
Global gU() As Single 'Componente normal de la corriente
Global gV() As Single 'Componente tangencial de la corriente
Global gRx() As Single 'Componente x del término impulsor
Global gRy() As Single 'Componente y del término impulsor
Global gFw() As Single 'Parámetro de fricción con el fondo

'Gráfico de utilización
Global gChart() As Variant 'Datos del gráfico
Global gChart2() As Variant 'Datos del gráfico de altura de ola
Global gChart3() As Variant 'Datos del gráfico de perfil
Global gChart4() As Variant 'Datos del gráfico de Qb

'Constantes
Global Const g = 9.8182 'Aceleración de la gravedad
Global Const pi = 3.14159265358979 'Constante circular
Global Const rho = 1.026 'Densidad media del agua del mar
Global Const rhoS = 2.5 'Densidad media del sedimento

Global gVer

Sub ValoresExtremos(Dato As Single, Maximo As Double, Minimo As Double)

If Dato > Maximo Then Maximo = Dato


If Dato < Minimo Then Minimo = Dato

End Sub
Sub errores(codigo)
'Rutina de captura de errores

Dim msg1 As String, msg2 As String

gTitulo = "SE HA PRODUCIDO UN ERROR: Código " & Err


Select Case codigo
Case Is = 5
msg1 = "Llamada a argumento o procedimiento no válido" & Chr(10) & _
" Posiblemente ha intentado calcular la raíz" & Chr(10) & _
" cuadrada de un número negativo"
msg2 = "Pruebe a definir una profundidad límite de cálculo " & Chr(10) & _
" mayor que la actual (" & gDmin & " m.)"
Case Is = 6
msg1 = "Desbordamiento"
msg2 = "Alguna magnitud se ha hecho demasiado grande " & Chr(10) & _
"y el sistema no puede manejarla. " & Chr(10) & _
"Confirme que no hay error de datos. Si son correctos" & Chr(10) & _
"posiblemente el modelo no es capaz de procesarlos" & Chr(10) & _
"según sus hipótesis de cálculo"
Case Is = 9
msg1 = "Subíndice fuera de intervalo"
msg2 = "Lo más probable es que se trate de un problema" & Chr(10) & _
"de codificación. Si no ha ocurrido en otros" & Chr(10) & _
"casos, revise sus datos. En caso contrario" & Chr(10) & _
"póngase en contacto con el programador"
Case Is = 11
msg1 = "División por cero"
msg2 = "Defina una profundidad límite de cálculo " & Chr(10) & _
" mayor que la actual (" & gDmin & " m.)"
Case Is = 53
msg1 = "Archivo no encontrado"
Module1 - 3

msg2 = "El sistema ha intentado abrir " & Chr(10) & _


"un archivo inexistente"
Case Is = 380
msg1 = "Valor de propiedad inválido"
msg2 = "Algún archivo ha dado errores y no se puede " & Chr(10) & _
"procesar. Por ejemplo, si los datos de dibujo " & Chr(10) & _
"de un archivo de resultados son todos nulos" & Chr(10) & _
"la escala del gráfico no se puede establecer." & Chr(10) & _
"En este caso, el gráfico no puede ser representado"
Case Is = 35602
msg1 = "Intentó cargar dos datos del mismo tipo"
msg2 = "Los tres datos deben ser de tipos diferentes: " & Chr(10) & _
"batimétricos: *.grd" & Chr(10) & _
"oleaje : *.ola" & Chr(10) & _
"calibración : *.cal" & Chr(10) & Chr(10) & _
"Si desea sustituir algún dato, elimínelo antes" & Chr(10) & _
"utilizando el menú 'Editar'"
Case Else
msg1 = "Desconocido"
msg2 = "Consulte el código de errores de Visual Basic 5.00"
End Select
gMsg = "Calculando: " & gZonaError & Chr(10) & Chr(10) & _
"Tipo de error: " & msg1 & Chr(10) & Chr(10) & _
"Posible solución: " & msg2
Close
Screen.MousePointer = 0
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo
Unload frmSonda

End Sub
Sub Dimensionar(i, j)

ReDim gNO(1 To i, 1 To j) As Single, gL(1 To i, 1 To j) As Single, _


gCg(1 To i, 1 To j) As Single, gOb(1 To i, 1 To j) As Single, _
gHrms(1 To i, 1 To j) As Single, gCteOb(1 To i) As Single, _
gHm(1 To i, 1 To j) As Single, gQb(i, j) As Single, _
gE(1 To i, 1 To j) As Single, gPx(1 To i, 1 To j) As Single, _
gPy(1 To i, 1 To j) As Single, gUorb(1 To i, 1 To j) As Single, _
gDf(1 To i, 1 To j) As Single, gDb(1 To i, 1 To j) As Single, _
gSxx(1 To i, 1 To j) As Single, gSxy(1 To i, 1 To j) As Single, _
gSyy(1 To i, 1 To j) As Single, gUr(1 To i, 1 To j) As Single, _
gHal(1 To i, 1 To j) As Single, gSU(1 To i, 1 To j) As Single, _
gU(1 To i, 1 To j) As Single, gV(1 To i, 1 To j) As Single, _
gRx(1 To i, 1 To j) As Single, gRy(1 To i, 1 To j) As Single, _
gFw(1 To i, 1 To j) As Single, gChart2(1 To j, 1 To 2) As Variant, _
gChart3(1 To j, 1 To 2) As Variant, gChart4(1 To j, 1 To 2) As Variant

Call DibujaPerfilChart

End Sub
Sub DibujaPerfilChart()

Screen.MousePointer = 11
For j = 1 To Fich.Columnas
gChart3(j, 1) = Str(j)
gChart3(j, 2) = gZ(1, j)
Next j
frmMain.MSChart3 = gChart3
frmMain.Frame9.Caption = gProyectoNP.Nombre & " (perfil)"
frmMain.MSChart3.Visible = True
Screen.MousePointer = 0

End Sub
Sub HSeno(X As Single)

gSh = 0.5 * (Exp(X) - Exp(-X))

End Sub
Sub Ayuda(Texto As String)

frmMain.StatusBar1.Panels(4).Text = Texto

End Sub
Sub NoImplementado()
Module1 - 4

gMsg = "Esta función " & Chr(10) _


& "aún no ha sido implementada"
gTitulo = "SOFTWARE EN DESARROLLO"

MsgBox gMsg, vbInformation + vbOKOnly + vbDefaultButton1, gTitulo

End Sub
Sub Existe(file As String)

gTitulo = "¡ATENCIÓN!"
gMsg = "El archivo " & file & _
" existe." & Chr(10) & "¿Sobreescribo?"
gResponse = MsgBox(gMsg, vbCritical + vbYesNo + vbDefaultButton1, gTitulo)

End Sub
Public Sub Tanh(X As Single)

gTh = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))

End Sub
Sub LaSonda_Inicio(mensaje As String, Maximo As Integer, Minimo As Integer)

If gModela = 0 Then Call Inicializa_Picture1


gInicEvento = Timer
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print mensaje & ": "
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print " Inicio: "; Time; " -> ";
frmMain.Picture1.Refresh
frmMain.ProgressBar1.max = Maximo
frmMain.ProgressBar1.min = Minimo

End Sub
Sub Inicializa_Picture1()

frmMain.Picture1.Cls
frmMain.Picture1.ScaleHeight = 4635
frmMain.Picture1.ScaleLeft = 0
frmMain.Picture1.ScaleTop = 0
frmMain.Picture1.ScaleWidth = 6675
frmMain.Picture1.CurrentX = 0
frmMain.Picture1.CurrentY = 0

End Sub
Sub LaSonda_Final()

frmMain.Picture1.FontBold = False
frmMain.Picture1.Print " Final: "; Time; " (";
gFinEvento = Timer
gElapsEvento = gFinEvento - gInicEvento
Call TiempoTranscurrido(gElapsEvento, 1)
gTpo = gElapsEvento
frmMain.StatusBar1.Panels(1).Text = Time
frmMain.Refresh
Unload frmSonda

End Sub
Sub TiempoTranscurrido(tiempo As Single, formato As Integer)

If formato = 1 Then
frmMain.Picture1.Print Str(Format(tiempo, "##0.00")) _
& " segundos)"
Else
frmMain.Picture1.Print "Se emplearon " & _
Str(Format(tiempo, "##0.00")) _
& " segundos en total"
End If

End Sub
Sub Elimina(file As String, sonda As Integer)

frmMain.ProgressBar1.Value = sonda
On Error GoTo Salir
Module1 - 5

Kill file
On Error GoTo 0
Exit Sub

Salir:
frmMain.Picture1.Print "Archivo " & file & " no encontrado"
End Sub
Module2 - 1

Option Explicit
Sub Herramientas()

'Actualiza la ficha de herramientas


Screen.MousePointer = 11
frmMain.Label4.Caption = gProyectoNP.Batimetria
Call TipoGrd(gProyecto.Batimetria)
Select Case Fich.Clase
Case Is = "DSAA"
Call LeeCabASCI(gProyecto.Batimetria)
Case Is = "DSBB"
Call LeeCabBinario(gProyecto.Batimetria)
End Select
frmMain.Label5.Caption = Fich.filas
frmMain.Label6.Caption = 1
frmMain.VScroll1.min = -Fich.filas
frmMain.VScroll1.max = -1
frmMain.VScroll1.Value = frmMain.VScroll1.max
Screen.MousePointer = 0

End Sub

Sub LeeCabASCI(file As String)

Dim f As Integer

Screen.MousePointer = 11
f = FreeFile
Open file For Input As #f
Input #f, Fich.Clase
Input #f, Fich.Columnas
Input #f, Fich.filas
Input #f, Fich.MinX
Input #f, Fich.MaxX
Input #f, Fich.MinY
Input #f, Fich.MaxY
Input #f, Fich.Minz
Input #f, Fich.MaxZ
'Input #f, Fich.Null
Close #f
gDy = (Fich.MaxY - Fich.MinY) / (Fich.filas - 1)
gDx = (Fich.MaxX - Fich.MinX) / (Fich.Columnas - 1)
Screen.MousePointer = 0

End Sub
Sub LeeCabBinario(file As String)

Dim f As Integer

Screen.MousePointer = 11
f = FreeFile
Open file For Binary As #f
Get #f, , Fich.Clase
Get #f, , Fich.Columnas
Get #f, , Fich.filas
Get #f, , Fich.MinX
Get #f, , Fich.MaxX
Get #f, , Fich.MinY
Get #f, , Fich.MaxY
Get #f, , Fich.Minz
Get #f, , Fich.MaxZ
Close #f
gDy = (Fich.MaxY - Fich.MinY) / (Fich.filas - 1)
gDx = (Fich.MaxX - Fich.MinX) / (Fich.Columnas - 1)
Screen.MousePointer = 0
End Sub
Sub NoHay()

Screen.MousePointer = 0
gMsg = "No existe el archivo especificado" & Chr(10) _
& "Por favor, compruebe que el nombre" & Chr(10) _
& "y la ruta son correctos"

gTitulo = "ERROR DE LECTURA"


Module2 - 2

MsgBox gMsg, vbCritical + vbOKOnly, gTitulo

End Sub
Sub leeASCI(file As String)

Dim f As Integer, cont As Integer, k As Single

Screen.MousePointer = 11
f = FreeFile
Open file For Input As #f
Input #f, Fich.Clase
Input #f, Fich.Columnas
Input #f, Fich.filas
Input #f, Fich.MinX
Input #f, Fich.MaxX
Input #f, Fich.MinY
Input #f, Fich.MaxY
Input #f, Fich.Minz
Input #f, Fich.MaxZ

ReDim gZ(1 To Fich.filas, 1 To Fich.Columnas) As Single

frmMain.Picture1.FontBold = True
frmMain.ProgressBar2.min = 0
frmMain.ProgressBar2.max = Fich.filas
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
frmMain.ProgressBar2.Value = i
For j = 1 To Fich.Columnas
Input #f, gZ(i, j)
Next j
Input #f, Fich.Null
Next i
Close #f
frmMain.Dibujo.Enabled = True
frmMain.Playa_Cilindrica.Enabled = True
frmMain.A_Grapher.Enabled = True
Screen.MousePointer = 0

End Sub
Sub LeeBinario(file As String)

Dim f As Integer, cont As Integer, k As Single

Screen.MousePointer = 11
f = FreeFile
Open file For Binary As #f
Get #f, , Fich.Clase
Get #f, , Fich.Columnas
Get #f, , Fich.filas
Get #f, , Fich.MinX
Get #f, , Fich.MaxX
Get #f, , Fich.MinY
Get #f, , Fich.MaxY
Get #f, , Fich.Minz
Get #f, , Fich.MaxZ

ReDim gZ(1 To Fich.filas, 1 To Fich.Columnas) As Single

frmMain.Picture1.FontBold = True

frmMain.ProgressBar2.min = 1
frmMain.ProgressBar2.max = Fich.filas
frmMain.ProgressBar1.min = 1
frmMain.ProgressBar1.max = Fich.filas
For i = 1 To Fich.filas
frmMain.ProgressBar1.Value = i
frmMain.ProgressBar2.Value = i
For j = 1 To Fich.Columnas
Get #f, , gZ(i, j)
Next j
Next i
Module2 - 3

Close #f

frmMain.Dibujo.Enabled = True
frmMain.Playa_Cilindrica.Enabled = True
frmMain.A_Grapher.Enabled = True
Screen.MousePointer = 0

End Sub
Sub TipoGrd(file As String)

Dim f As Integer

f = FreeFile
Open file For Binary As #f
Get #f, , Fich.Clase
Close #f

End Sub
Sub ImprimeCabBati()

Screen.MousePointer = 11
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Filas: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.filas,
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Columnas: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.Columnas
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Coordenada X: Entre ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.MinX;
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print " y ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.MaxX
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Coordenada Y: Entre ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.MinY;
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print " y ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.MaxY
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Coordenada Z: Entre ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.Minz;
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print " y ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Fich.MaxZ
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Distancia entre filas: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Format(gDy, "#####0.00")
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Distancia entre columnas: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Format(gDx, "#####0.00")
Screen.MousePointer = 0

End Sub
Sub LeeOlas(file As String)

Dim f As Integer

Screen.MousePointer = 11
Module2 - 4

f = FreeFile

Open file For Input As #f


Input #f, gHo
Input #f, gTo
Input #f, gObo
Close #f
gLo = g * gTo * gTo / (2 * pi)
gFrec = 2 * pi / gTo

Screen.MousePointer = 0

End Sub

Sub ImprimeOleaje()

Screen.MousePointer = 11
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Altura de ola media cuadrática [m]: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Format(gHo, "###0.00")
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Periodo [s]: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Format(gTo, "###0.00")
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Oblicuidad [º]: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Format(gObo, "###0.00")
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print
frmMain.Picture1.Print "Longitud de onda Lo [m]: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Format(gLo, "###0.00")
frmMain.Picture1.FontBold = False

Screen.MousePointer = 0

End Sub

Sub LeeCalibra(file As String)

Dim f As Integer

Screen.MousePointer = 11

On Error GoTo Incompleto


f = FreeFile

Open file For Input As #f


Input #f, gK
Input #f, gG1
Input #f, gG2
Input #f, gDL
Input #f, gAlfa
Input #f, gr
Input #f, gDmin
Input #f, gInter
Input #f, gTipo
Input #f, gKf
Input #f, gUL
Close #f
Screen.MousePointer = 0
Exit Sub

Incompleto:
Resume Next

End Sub
Sub ImprimeCalibra()
Module2 - 5

Screen.MousePointer = 11
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Parámetro de Dally: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gK, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Parámetro de Battjes y Stive: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gG1, "0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Relación H/d para máxima ola estable: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gG2, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Límite de profundidades reducidas: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gDL, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Coeficiente de disipación de energía por rotura de oleaje: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gAlfa, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Parámetro modificador de la fricción con el fondo: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gKf, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Parámetro de Nikuradse: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gr, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print "Profundidad mínima de cálculo: ";
frmMain.Picture1.FontBold = True
frmMain.Picture1.Print Str(Format(gDmin, "####0.00"))
frmMain.Picture1.Print
frmMain.Picture1.FontBold = True
If gInter = 1 Then
frmMain.Picture1.Print "Interacción oleaje - corriente /";
Else
frmMain.Picture1.Print "Sin interacción oleaje - corriente /";
End If
frmMain.Picture1.FontItalic = True
frmMain.Picture1.FontUnderline = True
frmMain.Picture1.ForeColor = vbRed
If gUL = 1 Then
frmMain.Picture1.Print " Playa cilíndrica";
Else
frmMain.Picture1.Print " Playa no uniforme";
End If
frmMain.Picture1.FontItalic = False
frmMain.Picture1.FontUnderline = False
frmMain.Picture1.ForeColor = vbBlack
frmMain.Picture1.Print
frmMain.Picture1.FontBold = False
frmMain.Picture1.Print
frmMain.Picture1.Print "Tipo de archivos de resultados: ";
frmMain.Picture1.FontBold = True
If gTipo = "DSBB" Then
frmMain.Picture1.Print "Binario"
ElseIf gTipo = "DSAA" Then
frmMain.Picture1.Print "ASCI"
Else
frmMain.Picture1.Print "Binario"
gTipo = "DSBB"
End If

Screen.MousePointer = 0
Module2 - 6

End Sub
Module3 - 1

Option Explicit

Dim XMax As Single, Xmin As Single, _


YMax As Single, Ymin As Single
Dim X() As Single 'Coordenada X del dibujo
Dim d() As Single 'Coordenada Y del dibujo
Sub NoXY()

frmMain.Label19.Caption = ""
frmMain.Label20.Caption = ""

End Sub
Sub perfil(fila As Integer, ventana As String, file As String)
'Rutina de dibujo del perfil_dato

Screen.MousePointer = 11
ReDim d(1 To Fich.Columnas) As Single, _
X(1 To Fich.Columnas) As Single

Call Extremos("Dibujo.tmp")
Call Escala(ventana)
Call ejes(ventana)
Call Grafico(ventana, file)
Call Rotulos(ventana)
Call Grid(ventana)

Screen.MousePointer = 0

End Sub
Sub Rotulos(ventana As String)

Select Case ventana


Case "frmMain"
With frmMain
.Picture1.CurrentX = 0
.Picture1.CurrentY = 0
.Picture1.FontSize = 4
.Picture1.Print "NMM"
End With
Case "frmUniform"
End Select

End Sub
Sub Grid(ventana As String)

Dim i As Double, st As Double

Select Case ventana


Case "frmMain"
With frmMain
End With
Case "frmUniform"
With frmUniform
If YMax - Ymin < 1 Then st = 0.1 Else st = 1
For i = Ymin To YMax Step st
.Picture1.DrawMode = 13
.Picture1.DrawStyle = 2
.Picture1.ForeColor = QBColor(8)
.Picture1.Line (0, i)-(Fich.Columnas, i)
.Picture1.ForeColor = QBColor(0)
.Picture1.DrawStyle = 0
.Picture1.FontName = "Arial Narrow"
.Picture1.FontSize = 7
.Picture1.CurrentX = 1
.Picture1.CurrentY = i
.Picture1.Print Format(i, "#0.00")
Next i
End With
End Select

End Sub
Sub Escala(ventana As String)

Dim Alto As Single, Ancho As Single


Module3 - 2

Alto = YMax - Ymin


Ancho = XMax - Xmin

On Error GoTo aiaiai


Select Case ventana
Case Is = "frmMain"
With frmMain.Picture1
.ScaleLeft = Xmin
.ScaleTop = YMax
.ScaleHeight = -Alto
.ScaleWidth = Ancho
End With
Case Is = "frmUniform"
With frmUniform.Picture1
.ScaleLeft = Xmin
.ScaleTop = YMax
.ScaleHeight = -Alto
.ScaleWidth = Ancho
End With
End Select
Exit Sub

aiaiai:
gZonaError = "Dibujo de perfiles"
Call errores(Err.Number)
End Sub
Sub Extremos(file As String)
'Rutina de cálculo de extremos de los datos contenidos en el archivo "file"

Dim f As Integer
f = FreeFile

XMax = -1E+32
Xmin = -XMax
YMax = XMax
Ymin = Xmin

On Error GoTo NoTmp


i = 0
Open file For Input As #f
Do While Not EOF(f)
i = i + 1
Input #f, X(i), d(i)
If X(i) > XMax Then XMax = X(i)
If X(i) < Xmin Then Xmin = X(i)
If d(i) > YMax Then YMax = d(i)
If d(i) < Ymin Then Ymin = d(i)
Loop
Close #f
With frmMain
.Label15.Caption = Str(Format(XMax, "###0.00"))
.Label16.Caption = Str(Format(Xmin, "###0.00"))
.Label17.Caption = Str(Format(YMax, "###0.00"))
.Label18.Caption = Str(Format(Ymin, "###0.00"))
End With
Exit Sub

NoTmp:
Screen.MousePointer = 0
gMsg = "No se ha generado el archivo temporal"
gTitulo = "ERROR DE DIBUJO"
MsgBox gMsg, vbCritical + vbOKOnly, gTitulo
Exit Sub

End Sub
Sub ejes(ventana As String)

Select Case ventana


Case Is = "frmMain"
With frmMain
.Picture1.Line (Xmin, 0)-(XMax, 0), RGB(255, 0, 0)
End With
Module3 - 3

Case Is = "frmUnifrom"
With frmUniform
.Picture1.Line (Xmin, 0)-(XMax, 0), RGB(255, 0, 0)
End With
End Select
End Sub

Sub Grafico(ventana As String, file As String)

Dim X1 As Single, X2 As Single, Color As String

Select Case ventana


Case Is = "frmMain"
With frmMain
For i = 2 To Fich.Columnas
X1 = gDx * (i - 1)
X2 = gDx * i
.Picture1.Line (X(i - 1), d(i - 1))-(X(i), d(i)), RGB(0, 0, 255)
Next i
End With
Case Is = "frmUniform"
With frmUniform
.Picture1.Cls
For i = 2 To Fich.Columnas
X1 = gDx * (i - 1)
X2 = gDx * i
If file = "Sigma.prf" Then
Select Case d(i)
Case Is < 0.3
Color = RGB(0, 255, 0)
Case 0.3 To 0.6
Color = RGB(255, 255, 0)
Case Is > 0.6
Color = RGB(255, 0, 0)
End Select
.Picture1.FillColor = Color
.Picture1.FillStyle = 0
.Picture1.Circle (X(i), d(i)), 1, Color
Else
.Picture1.Line (X(i - 1), d(i - 1))-(X(i), d(i)), RGB(0, 0, 255)
End If
Next i
End With
End Select
End Sub
Module4 - 1

'**************************************************************
'* MODULO "Modelo_BJG" *
'* ---------------------------------------------------------- *
'* Modelo de Battjes & Janssen (1.978)eliminando la hipótesis *
'* de uniformidad longitudinal *
'**************************************************************

'En el presente módulo se incluyen todos los cálculos necesarios _


para la modelización según Battjes y Janssen (1.978), conser _
vando todas las simplificaciones excepto la de uniformidad _
longitudinal
'Las variables globales se han definido en el módulo 1(global.bas)
'El contorno inicial debe encontrarse lo suficientemente alejado del _
inicio de la zona de surf como para poder suponer, sin error, que _
el set-up allí es nulo
Sub Corrientes(i As Integer, j As Integer)

'Evalúa las componentes de la circulación próxima a la orilla _


No toma en consideración las pérdidas por fricción con el fondo _
y mezcla lateral.

Dim Deno As Single

'1º: Evaluación de los términos impulsores Rx y Ry (función del _


tensor de radiación)

Deno = 1 / (rho * (-gZ(i, j) + gSU(i, j)))

Select Case i
Case Is = 1
gRx(i, j) = (gSxx(i, j) - gSxx(i, j - 1)) / gDx
gRx(i, j) = Deno * gRx(i, j)

gRy(i, j) = (gSxy(i, j) - gSxy(i, j - 1)) / gDx


gRy(i, j) = Deno * gRy(i, j)
Case Else
gRx(i, j) = (gSxx(i, j) - gSxx(i, j - 1)) / gDx + _
(gSxy(i, j) - gSxy(i - 1, j)) / gDy
gRx(i, j) = Deno * gRx(i, j)

gRy(i, j) = (gSxy(i, j) - gSxy(i, j - 1)) / gDx + _


(gSyy(i, j) - gSyy(i - 1, j)) / gDy
gRy(i, j) = Deno * gRy(i, j)
End Select

End Sub

Sub SetUp(i As Integer, j As Integer)

Dim S As Single, IncSu As Single, delta As Single

Select Case i
Case Is = 1
S = (gSxx(i, j) - gSxx(i, j - 1)) / gDx
Case Else
S = (gSxx(i, j) - gSxx(i, j - 1)) / gDx + _
(gSxy(i, j) - gSxy(i - 1, j)) / gDy
End Select

IncSu = S / (rho * g * (-gZ(i, j) + gSU(i, j - 1)))


gSU(i, j) = gSU(i, j - 1) - IncSu * gDx

End Sub
Sub TensorRadiacion(i As Integer, j As Integer)

'Calcula las componentes del tensor de radiación

Dim g As Single, ob As Single

ob = gOb(i, j) * pi / 180
g = 2 * gNO(i, j) * (-1) * gZ(i, j)
Call HSeno(g)
Module4 - 2

g = g / gSh

'Componentes del tensor de radiación


gSxx(i, j) = 0.5 * gE(i, j) * ((1 + g) * Cos(ob) * Cos(ob) + g)
gSxy(i, j) = 0.5 * gE(i, j) * ((1 + g) * Cos(ob) * Sin(ob))
gSyy(i, j) = 0.5 * gE(i, j) * ((1 + g) * Sin(ob) * Sin(ob) + g)

End Sub
Sub Ursell(i As Integer, j As Integer)

'Calcula el parámetro de Ursell en cada punto, así como el _


parámetro de intensidad de flujo de Hallermeier (1.982)

gUr(i, j) = gHrms(i, j) * gL(i, j) * gL(i, j) / ((-1) * gZ(i, j)) ^ 3

End Sub

Sub Energia(i As Integer, j As Integer)

'Integración de la ecuación del flujo convectivo _


de energía, para la obtención de la altura de _
ola media cuadrática a partir de ella

Dim EFilAnt As Single, PerdAntJ As Single, PerdAntI As Single, _


ObAntJ As Double, ObAntI As Double, ob As Single, M As Single

ObAntJ = gOb(i, j - 1) * pi / 180


PerdAntJ = (gDf(i, j - 1) + gDb(i, j - 1)) * Cos(ObAntJ)
ob = gOb(i, j) * pi / 180
Select Case gUL
Case Is = 1 'Uniformidad longitudinal
gPx(i, j - 1) = gE(i, j - 1) * gCg(i, j - 1) * Cos(ObAntJ)
gE(i, j) = (gPx(i, j - 1) * gDy - gDx * PerdAntJ) / (gCg(i, j) * Cos(ob) * gDy)
Case Is = 0
Select Case i
Case Is = 1
gPx(i, j - 1) = gE(i, j - 1) * gCg(i, j - 1) * Cos(ObAntJ)
gE(i, j) = (gPx(i, j - 1) * gDy - gDx * PerdAntJ) / (gCg(i, j) * Cos(ob)
* gDy)
Case Else
ObAntI = gOb(i - 1, j) * pi / 180
PerdAntI = (gDf(i - 1, j) + gDb(i - 1, j)) * Sin(ObAntI)
gPx(i, j - 1) = gE(i, j - 1) * gCg(i, j - 1) * Cos(ObAntJ)
gPy(i - 1, j) = gE(i - 1, j) * gCg(i - 1, j) * Sin(ObAntI)
M = gDy * gPx(i, j - 1) + gDx * gPy(i - 1, j) - _
gDx * gDy * (PerdAntJ + PerdAntI)
gE(i, j) = M / (gCg(i, j) * (gDy * Cos(ob) + gDx * Sin(ob)))
End Select
End Select
End Sub
Sub Flujos(i As Integer, j As Integer)

'Cálculo de los flujos de energía en ambas direcciones, con el _


fin de simplificar el cálculo de Hrms

Dim Alfa As Single

Alfa = gOb(i, j) * pi / 180 'Paso a radianes

gPx(i, j) = gE(i, j) * gCg(i, j) * Cos(Alfa)


gPy(i, j) = gE(i, j) * gCg(i, j) * Sin(Alfa)

End Sub
Sub Hrms(i, j)

'Cálculo de la altura de ola media cuadrática en función de la energía _


del oleaje

If gE(i, j) >= 0 Then


gHrms(i, j) = Sqr(8 * gE(i, j) / (rho * g))
Else
gHrms(i, j) = 0
End If
Module4 - 3

End Sub
Sub Qb(i As Integer, j As Integer)

Dim rH As Single, mi As Single, _


k As Integer, delta As Single

delta = 10000
mi = 0.00001
rH = (gHrms(i, j) / gHm(i, j)) ^ 2
Select Case gHrms(i, j)
Case Is < gHm(i, j)
Do While delta > 0.0001
gQb(i, j) = Exp(-(1 - mi) / rH)
delta = Abs(gQb(i, j) - mi)
mi = gQb(i, j)
Loop
Case Else
gQb(i, j) = rH
End Select

If gQb(i, j) < 0 Then gQb(i, j) = 0


If gQb(i, j) > 1 Then gQb(i, j) = 1

End Sub
Sub U_orb(i As Integer, j As Integer)

Call HSeno(gNO(i, j) * (-1) * gZ(i, j))

gUorb(i, j) = gFrec * gHrms(i, j) / (2 * gSh)

End Sub
Sub Df(i As Integer, j As Integer)

'Calcula la disipación de energía por fricción con el fondo _


según Tolman (1.992)

Dim k As Single

If gUorb(i, j) <> 0 Then


'Cálculo de fw
k = gFrec * gr / gUorb(i, j)
Select Case factor
Case Is >= 0.638
gFw(i, j) = 0.3
Case Else
gFw(i, j) = Exp(5.5 * k ^ 0.2 - 6.3)
End Select

'gDf(i, j) = (2 * rho * gfw(i,j) * gUorb(i, j) ^ 3) / (3 * pi)


Call HSeno(gNO(i, j) * (-1) * (gZ(i, j)))
gDf(i, j) = gKf * (1 / 8) * rho * gFw(i, j) * Sqr(pi) * (gFrec * gHrms(i, j) / gSh) ^
3
Else
gDf(i, j) = 0
End If

End Sub
Sub Db(i As Integer, j As Integer)

'Calcula la disipación de energía por rotura de oleaje, en la celda anterior _


de la misma fila. Se utiliza la formulación proporcionada por _
Southgate (1.993), que él achaca a BJ (1.978), aunque no la he localizado _
en ese paper

Dim FQb As Single

'FQb = gQb(i, j) * (-Log(gQb(i, j)) / (1 - gQb(i, j))) ^ (1.5)


'gDb(i, j) = gAlfa * rho * g ^ (1.5) * gNO(i, j) * gHrms(i, j) ^ 3 * FQb / _
(8 * pi * Sqr((-1) * gZ(i, j)))

gDb(i, j) = 0.25 * gAlfa * rho * g * (gFrec / (2 * pi)) * _


gQb(i, j) * gHrms(i, j) ^ 2
Module4 - 4

End Sub
Sub Cg(i As Integer, j As Integer)

Dim num1 As Single, num2 As Single

num1 = gNO(i, j) * Abs(gZ(i, j))


Call Tanh(num1)
Call Senh(2 * num1)
num2 = 1 + 2 * num1 / gSh
gCg(i, j) = 0.5 * Sqr((g / gNO(i, j)) * gTh) * num2

End Sub

Sub Senh(arg As Single)

gSh = (Exp(arg) - Exp(-1 * arg)) / 2

End Sub

Sub Datos_Iniciales()

'Lee los datos del archivo de oleaje y los asigna a la


' columna inicial

Dim f As Integer

Screen.MousePointer = 11
frmMain.Picture1.FontBold = True

Call LeeOlas(gProyecto.Oleaje)

For i = 1 To Fich.filas
gHrms(i, 1) = gHo
gOb(i, 1) = gObo
gE(i, 1) = rho * g * gHo * gHo / 8
gSU(i, 1) = 0
Next i

Screen.MousePointer = 0

End Sub
Sub LOnda(i As Integer, j As Integer)

'Esta rutina calcula la longitud de onda en cada punto iterando


'a partir de la ecuación de dispersión en teoría lineal
'El valor base para la iteración es el obtenido en el nodo anterior
'y en el caso de la primera columna, es el valor de Lo

Dim Lant As Single, Lm As Single, num1 As Single

If j = 1 Then Lant = gLo Else Lant = gL(i, j - 1)


k = 0
Do While Abs(gL(i, j) - Lant) > 0.1
If k > 0 Then Lant = Lm
num1 = Exp(-4 * pi * Abs(gZ(i, j)) / Lant)
gL(i, j) = gLo * (1 - num1) / (1 + num1)
Lm = gL(i, j)
k = k + 1
Loop
End Sub
Sub SnellInicial()

Dim ob As Single

For i = 1 To Fich.filas
ob = gOb(i, 1) * pi / 180
'gCteOb(i) = Sin(ob) / gCg(i, 1) 'Evalúa la constante en radianes
gCteOb(i) = Sin(ob) * gNO(i, 1) 'Evalúa la constante en radianes
Next i

End Sub
Sub Alfa(i As Integer, j As Integer)
Module4 - 5

'Esta rutina calcula el valor de la oblicuidad en cada punto de la malla.


'Se basa en la constancia del valor sen(a)/c

Dim arg As Single

'arg = gCg(i, j) * gCteOb(i)


arg = gCteOb(i) / gNO(i, j)

gOb(i, j) = Atn(arg / Sqr(1 - arg * arg)) 'En radianes

End Sub
Sub Hm_Miche(i As Integer, j As Integer)

'Calcula la altura de ola máxima en cada punto de acuerdo don _


el criterio de Battjes y Stive (1.985)

Dim arg1 As Single

'gS = 8.80148 * (gHrms(i, j) / gL(i, j)) + 0.527953

'arg1 = gG1 * gNO(i, j) * (-1) * gZ(i, j) / 0.88


arg1 = 33 * gHo / gLo
Call Tanh(arg1)
'gHm(i, j) = (0.88 / gNO(i, j)) * gTh
gHm(i, j) = (0.5 + 0.4 * gTh) * (-1) * gZ(i, j)

End Sub
Module5 - 1

Option Explicit

Sub Escribe_Cabecera_ASCI(file As String, canal As Integer, _


min As Double, max As Double)

Open file For Output As #canal


Print #canal, Fich.Clase
Print #canal, Fich.Columnas;
Print #canal, Fich.filas
Print #canal, Str(Fich.MinX);
Print #canal, Str(Fich.MaxX)
Print #canal, Str(Fich.MinY);
Print #canal, Str(Fich.MaxY)
Print #canal, Str(min);
Print #canal, Str(max)
Close #canal

End Sub
Sub Escribe_Binario(file As String, canal As Integer, _
min As Double, max As Double, variable As String)

Open file For Binary As #canal


Put #canal, , "DSBB"
Put #canal, , Fich.Columnas
Put #canal, , Fich.filas
Put #canal, , Fich.MinX
Put #canal, , Fich.MaxX
Put #canal, , Fich.MinY
Put #canal, , Fich.MaxY
Put #canal, , min
Put #canal, , max
For i = 1 To Fich.filas
For j = 1 To Fich.Columnas
Select Case variable
Case Is = "k"
Put #canal, , gNO(i, j)
Case Is = "L"
Put #canal, , gL(i, j)
Case Is = "O"
Put #canal, , gOb(i, j)
Case Is = "Cg"
Put #canal, , gCg(i, j)
Case Is = "Hm"
Put #canal, , gHm(i, j)
Case Is = "Qb"
Put #canal, , gQb(i, j)
If i = 1 Then
gChart4(j, 1) = Str(j)
gChart4(j, 2) = gQb(i, j)
End If
Case Is = "Uorb"
Put #canal, , gUorb(i, j)
Case Is = "Df"
Put #canal, , gDf(i, j)
Case Is = "Db"
Put #canal, , gDb(i, j)
Case Is = "E"
Put #canal, , gE(i, j)
Case Is = "Px"
Put #canal, , gPx(i, j)
Case Is = "Py"
Put #canal, , gPy(i, j)
Case Is = "Hrms"
Put #canal, , gHrms(i, j)
If i = 1 Then
gChart3(j, 1) = Str(j)
gChart2(j, 2) = gHrms(i, j)
End If
Case Is = "Sxx"
Put #canal, , gSxx(i, j)
Case Is = "Sxy"
Put #canal, , gSxy(i, j)
Case Is = "Syy"
Put #canal, , gSyy(i, j)
Module5 - 2

Case Is = "Ur"
Put #canal, , gUr(i, j)
Case Is = "SU"
Put #canal, , gSU(i, j)
Case Is = "Rx"
Put #canal, , gRx(i, j)
Case Is = "Ry"
Put #canal, , gRy(i, j)
Case Is = "Fw"
Put #canal, , gFw(i, j)
Case Else
gTitulo = "FALTA ALGO"
gMsg = "El archivo con referencia " & variable & Chr(10) & _
"no se ha grabado satisfactoriamente." & Chr(10) & _
"Hay un fallo de codificación"
MsgBox gMsg, vbInformation + vbOKOnly, gTitulo
Close #canal
Exit Sub
End Select
Next j
Next i
Close #canal

End Sub
Sub Add_ASCI_linea(file As String, canal As Integer, cadena As String)

Open file For Append As #canal


Print #canal, cadena;
Close #canal

End Sub
Sub Add_ASCI_fin(file As String, canal As Integer, cadena As String)

Open file For Append As #canal


Print #canal, cadena
Close #canal

End Sub

You might also like