VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Modelli"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Public Sub SpiderFC(numgraph, C0, F, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

f1 = Val(F)

NumModSpi(numgraph) = NumModSpi(numgraph) + 1


Close #1
Open App.Path + "\data\SpiMod_" + Trim(NumModSpi(numgraph)) + ".txt" For Output As #1

Write #1, numgraph, C0, F, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

'fractional cryst.

'On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To 15

For ii = 1 To Numelem

If REE1(i) = True And Elementi(ii) = REE(i) Then

SpModello0(i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

GoTo poi

End If

Next ii

poi:

Next i



rr = 0



For ii = 1 To 15

If SpModello0(ii) <= 0 Then
SpModello0(ii) = 0
GoTo yyy
End If



SPModello(ii) = SpModello0(ii) * (f1 ^ (ModD(ii) - 1))
SPModello(ii) = Val(Format$(SPModello(ii), "0.000000"))
yyy:

Write #1, REE(ii), SPModello(ii)

Next ii

ret1:

Close #1

GoTo rety1
rety:

MsgBox "An Error Occurred During FC Model Elaboration", , "Error"

rety1:

Close #1

End Sub





Public Sub FC(numgraph, C0, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'fractional cryst.

'On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

ddq = Step / 100
'For i = ffin To finit + stepF Step -stepF
For i = ffin To finit Step -stepF 'sett 2004

rr = rr + 1

For ii = 1 To NumModelElem

If (DatiModello(0, ii) * i) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If


DatiModello(rr, ii) = DatiModello(0, ii) * (i ^ (ModD(ii) - 1))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii



Next i



NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Close #2
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "FC"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i
Close #1
End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF
Close #2
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "FC"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i
Close #1
End If

GoTo rety1
rety:

MsgBox "An Error Occurred During FC Model Elaboration", , "Error"

rety1:

Close #1

End Sub


Public Sub ISC(numgraph, C0, fa, ff, mminit As Variant, mmfin As Variant, stepm As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'in situ cryst.

ff1 = Val(ff)
fa1 = Val(fa)

On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = mmfin To mminit + stepm Step -stepm


rr = rr + 1

For ii = 1 To NumModelElem

If (DatiModello(0, ii) * i) <= 0 Then
'DatiModello(rr, ii) = 0
GoTo yyy
End If


E1 = ff1 * (ModD(ii) - 1) / (ModD(ii) * (1 - ff1) + ff1)

DatiModello(rr, ii) = DatiModello(0, ii) * (i ^ E1)
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii



Next i



NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF
Close #2
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "ISC"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2
Close #1
Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i
Close #1
End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "ISC"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i
Close #1
End If

GoTo rety1
rety:

MsgBox "An Error Occurred During ISC Model Elaboration", , "Error"

rety1:

Close #1

End Sub


Public Sub ZR(numgraph, C0, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

'For i = finit To ffin Step stepF
For i = finit + stepF To ffin Step stepF

rr = rr + 1

For ii = 1 To NumModelElem

If (DatiModello(0, ii) * i) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If

If ModD(ii) = 0 Then
MsgBox "An Error Occurred: division by Zero"
Exit Sub
End If

DatiModello(rr, ii) = DatiModello(0, ii) * ((1 / ModD(ii)) - (((1 / ModD(ii)) - 1) * Exp(-(i * ModD(ii)))))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2

Print #2, "Zone Refining"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 1, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

If CambiaMod = True Then

CambiaMod = False

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2

Print #2, "Zone Refining"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 1, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

GoTo rety1
rety:

MsgBox "An Error Occurred During ZR Model Elaboration", , "Error"
Close #1
rety1:



End Sub

Public Sub BM(numgraph, C0, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = ffin To finit Step -(stepF)

rr = rr + 1

For ii = 1 To NumModelElem

If (ModD(ii) + (i * (1 - ModD(ii)))) = 0 Then
MsgBox "An Error Occurred: division by Zero", , "Error"
Exit Sub
End If

DatiModello2 = DatiModello(0, ii) * (1 / (ModD(ii) + (i * (1 - ModD(ii)))))
DatiModello(rr, ii) = Val(Format$(DatiModello2, "0.000000"))


Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:


If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Batch melting(mod. D0 or DR)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Batch melting(mod. D0 or DR)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

GoTo rety1
rety:

MsgBox "An Error Occurred During BM Model Elaboration", , "Error"
Close #1
rety1:

End Sub



Public Sub BMnonModal(numgraph, C0, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = ffin To finit Step -(stepF)

rr = rr + 1

For ii = 1 To NumModelElem

If (ModDO(ii) + (i * (1 - ModPI(ii)))) = 0 Then
MsgBox "An Error Occurred: division by Zero", , "Error"
Exit Sub
End If

DatiModello2 = DatiModello(0, ii) * (1 / (ModDO(ii) + (i * (1 - ModPI(ii)))))
DatiModello(rr, ii) = Val(Format$(DatiModello2, "0.000000"))


Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:


If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Batch melting(non modal)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

If CambiaMod = True Then

CambiaMod = False

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Batch melting(non modal)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

GoTo rety1
rety:

MsgBox "An Error Occurred During BM Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub FM(numgraph, C0, finit, ffin, stepF, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'Fractional melting

On Error GoTo rety




'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For iO = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(iO) = Elementi(ii) Then

DatiModello(0, iO) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next iO



rr = 0


For IU = ffin To finit Step -(stepF)


rr = rr + 1

For ii = 1 To NumModelElem

If (DatiModello(0, ii) * IU) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If

If ModD(ii) = 0 Then
MsgBox "An Error Occurred: division by Zero"
Exit Sub
End If



DatiModello(rr, ii) = (DatiModello(0, ii) / ModD(ii)) * ((1 - IU) ^ ((1 / (ModD(ii)) - 1)))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii


Next IU
qwqww:
NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Close #2
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "FM"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "FM"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If


GoTo rety1
rety:

MsgBox "An Error Occurred During FM Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub CM(numgraph, C0, mp, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'Continuous Melting Albarede 1995

mp1 = Val(mp)

On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = ffin To finit Step -(stepF)



If i > 1 Then
MsgBox "Attention in CM model F have to be <1"
GoTo qwqww
End If

rr = rr + 1

For ii = 1 To NumModelElem

If (DatiModello(0, ii) * i) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If

If ModD(ii) = 0 Then
MsgBox "An Error Occurred: division by Zero"
Exit Sub
End If

d1 = ((1 - mp1) * ModD(ii)) + mp1

DatiModello(rr, ii) = (DatiModello(0, ii) / d1) * ((1 - i) ^ ((1 / (d1) - 1)))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii

qwqww:
Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "CM"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "CM"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If


GoTo rety1
rety:

MsgBox "An Error Occurred During CM Model Elaboration", , "Error"
Close #1
rety1:

End Sub


Public Sub EC(numgraph, C0, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'Equilibriun cryst.

On Error GoTo rety

'inserisco i dati del parent C0
For i = 1 To Numcamp1
If NomeCamp(i) = C0 Then
qq = i
End If
Next i

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = ffin To finit + stepF Step -stepF

rr = rr + 1

For ii = 1 To NumModelElem

If (DatiModello(0, ii) * i) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If

If (i + (ModD(ii) - (i * ModD(ii)))) = 0 Then
MsgBox "An Error Occurred: division by Zero", , "Error"
Exit Sub
End If

DatiModello(rr, ii) = DatiModello(0, ii) * (1 / (i + (ModD(ii) - (i * ModD(ii)))))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If




For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If


For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "EC"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "EC"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, C0 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2

Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1
End If

GoTo rety1
rety:

MsgBox "An Error Occurred During EC Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub AFC(numgraph, C01, CA, R, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

r1 = Val(R)

If r1 > 1 Or r1 < 0 Then
MsgBox "R value must be 0<R<1"
Exit Sub
End If

'inserisco i dati del parent C0

For i = 1 To Numcamp1
If NomeCamp(i) = C01 Then
qq = i
GoTo ee12
End If
Next i

Exit Sub

ee12:

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i

'inserisco i dati dell'assimilante CA

For i = 1 To Numcamp1
If NomeCamp(i) = CA Then
qqq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

CAss(i) = Val(Format$(DatiOrigine(qqq, ii), "0.000000"))

End If

Next ii

Next i


rr = 0

'For i = ffin To finit + stepF Step -stepF
For i = ffin To finit Step -stepF 'sett 2004

rr = rr + 1



For ii = 1 To NumModelElem

ff = i ^ -((r1 - 1 + ModD(ii)) / (r1 - 1))

If (DatiModello(0, ii) * i) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If

If (r1 - 1 + ModD(ii)) = 0 Then
MsgBox "An Error Occurred: division by Zero", , "Error"
Exit Sub
End If

DatiModello(rr, ii) = (DatiModello(0, ii) * ff) + ((r1 / (r1 - 1 + ModD(ii))) * CAss(ii) * (1 - ff))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If





For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If

For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then

NumModelli(Indeks) = NumModelli(Indeks) + 1



initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2

Print #2, "AFC"
Print #2, R 'R
Print #2, "/" 'R
Print #2, C01 'C0
Print #2, CA 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2

Print #2, "AFC"
Print #2, R 'R
Print #2, "/" 'R
Print #2, C01 'C0
Print #2, CA 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

GoTo rety1
rety:

MsgBox "An Error Occurred During AFC Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub RAFC(numgraph, C01, CA, CR, ra, rr, Rc, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'On Error GoTo rety

r1a = Val(ra)
r1r = Val(rr)
r1c = Val(Rc)



'inserisco i dati del parent C0

For i = 1 To Numcamp1
If NomeCamp(i) = C01 Then
qq = i
GoTo ee12
End If
Next i

Exit Sub

ee12:

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i

'inserisco i dati dell'assimilante CA

For i = 1 To Numcamp1
If NomeCamp(i) = CA Then
qqq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

CAss(i) = Val(Format$(DatiOrigine(qqq, ii), "0.000000"))

End If

Next ii

Next i


'inserisco i dati dell'assimilante Cr

For i = 1 To Numcamp1
If NomeCamp(i) = CR Then
qqq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

Crval(i) = Val(Format$(DatiOrigine(qqq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = ffin To finit + stepF Step -stepF

rr = rr + 1



For ii = 1 To NumModelElem

ff = i ^ -((r1 - 1 + ModD(ii)) / (r1 - 1))

If (DatiModello(0, ii) * i) <= 0 Then
DatiModello(rr, ii) = 0
GoTo yyy
End If



If (r1r + r1a - r1c) < 10 ^ -5 Then
MsgBox "An Error Occurred: division by Zero", , "Error"
Exit Sub
End If

p1 = ((r1r * Crval(ii)) + (r1a * CAss(i))) / (r1r + r1a - r1c)
q1 = (r1r + r1a + r1c * (ModD(ii) - 1)) / (r1r + r1a - r1c)

DatiModello(rr, ii) = ((p1 / q1) * (1 - (i ^ (-q1)))) + (DatiModello(0, ii) * (i ^ (-q1)))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If





For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If

For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then

NumModelli(Indeks) = NumModelli(Indeks) + 1



initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2

Print #2, "RAFC"
Print #2, r1r 'R
Print #2, r1a 'R
Print #2, C01 'C0
Print #2, CA 'CA
Print #2, r1c  'C1
Print #2, CR  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2

Print #2, "RAFC"
Print #2, r1r 'R
Print #2, r1a 'R
Print #2, C01 'C0
Print #2, CA 'CA
Print #2, r1c  'C1
Print #2, CR  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

GoTo rety1
rety:

MsgBox "An Error Occurred During RAFC Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub AFCiso(numgraph, C01, CA, R, finit As Variant, ffin As Variant, stepF As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

r1 = Val(R)

If r1 > 1 Or r1 < 0 Then
MsgBox "R value must be 0<R<1"
Exit Sub
End If


'inserisco i dati del parent C0

For i = 1 To Numcamp1
If NomeCamp(i) = C01 Then
qq = i
GoTo ee12
End If
Next i

Exit Sub

ee12:

NumModelElem = 2

ModElementi(1) = Elementi(AXX(numgraph))
ModElementi(2) = Elementi(AXY(numgraph))

ModAsseX(Indeks) = 1
ModAssey(Indeks) = 2

For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i

'inserisco i dati dell'assimilante CA

For i = 1 To Numcamp1
If NomeCamp(i) = CA Then
qqq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

CAss(i) = Val(Format$(DatiOrigine(qqq, ii), "0.000000"))

End If

Next ii

Next i


rr = 0

'For i = ffin To finit + stepF Step -stepF
For i = ffin To finit Step -stepF 'sett 2004

rr = rr + 1

ff = i ^ -((r1 - 1 + ModD(1)) / (r1 - 1))

If (DatiModello(0, 1) * i) <= 0 Then
DatiModello(rr, 1) = 0
GoTo yyy
End If

If (r1 - 1 + ModD(1)) = 0 Then
MsgBox "An Error Occurred: division by Zero", , "Error"
Exit Sub
End If

'elemento
DatiModello(rr, 1) = (DatiModello(0, 1) * ff) + ((r1 / (r1 - 1 + ModD(1))) * CAss(1) * (1 - ff))
DatiModello(rr, 1) = Val(Format$(DatiModello(rr, 1), "0.000000"))

'isotopo
zeta = (r1 + ModD(1) - 1) / (R - 1)

num = ((R / (R - 1)) * (CAss(1) / zeta) * (1 - ff) * CAss(2)) + (DatiModello(0, 1) * ff * DatiModello(0, 2))
den = ((R / (R - 1)) * (CAss(1) / zeta) * (1 - ff)) + (DatiModello(0, 1) * ff)
'num = 1 - (r1 / (r1 - ModD(1) - 1)) * (CAss(1) / DatiModello(rr, 1))
'den = 1 - (r1 / (r1 - ModD(1) - 1)) * (CAss(1) / DatiModello(0, 1))

DatiModello(rr, 2) = (num / den)
'DatiModello(rr, 2) = CAss(2) + (DatiModello(0, 2) - CAss(2)) * (num / den)
DatiModello(rr, 2) = Val(Format$(DatiModello(rr, 2), "0.000000"))
yyy:


Next i

NumModDati = rr




If CambiaMod = False Then

NumModelli(Indeks) = NumModelli(Indeks) + 1



initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2

Print #2, "AFCiso"
Print #2, r1 'R
Print #2, "/" 'R
Print #2, C01 'C0
Print #2, CA 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2

Print #2, "AFCiso"
Print #2, r1 'R
Print #2, "/" 'R
Print #2, C01 'C0
Print #2, CA 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

GoTo rety1
rety:

MsgBox "An Error Occurred During AFC Model Elaboration", , "Error"
Close #1
rety1:

End Sub


Public Sub RFT(numgraph, Cw1, Cz1, M0, numcicli, stcicli1, yyVal, xxVal, wwVal, zzVal, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

m01 = Val(M0)
yyVal1 = Val(yyVal)
xxVal1 = Val(xxVal)
wwVal1 = Val(wwVal)
zzVal1 = Val(zzVal)

Dim CzM1(20) As Double
Dim CwM1(20) As Double

'inserisco i dati Cw

For i = 1 To Numcamp1
If NomeCamp(i) = Cw1 Then
qqq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

CwM1(i) = Val(Format$(DatiOrigine(qqq, ii), "0.000000"))

End If

Next ii

Next i


'inserisco i dati Cz

For i = 1 To Numcamp1
If NomeCamp(i) = Cz1 Then
qqq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

CzM1(i) = Val(Format$(DatiOrigine(qqq, ii), "0.000000"))

End If

Next ii

Next i



rr = 0

For i = 0 To numcicli Step stcicli1

rr = rr + 1

For ii = 1 To NumModelElem

mmca = m01 * ((1 - xxVal1 - yyVal1) ^ i) + (zzVal1 + wwVal1) * ((1 - (1 - xxVal1 - yyVal1) ^ i) / (1 - (1 - xxVal1 - yyVal1)))

aaa = ((1 - xxVal1 - yyVal1) * ((1 - xxVal1) ^ (ModD(ii) - 1))) ^ (i - 1)
bbb = ((1 - xxVal1 - yyVal1) * ((1 - xxVal1) ^ (ModD(ii) - 1)))

ccma = (CzM1(ii) * aaa / mmca) + ((CzM1(ii) * zzVal1 + CwM1(ii) * wwVal1) / mmca) * ((1 - aaa) / (1 - bbb))

DatiModello(rr, ii) = ccma * ((1 - xxVal1) ^ (ModD(ii) - 1))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.0000000"))

yyy:

Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If


For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If

For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then

NumModelli(Indeks) = NumModelli(Indeks) + 1



initF(Indeks, NumModelli(Indeks)) = finit
finF(Indeks, NumModelli(Indeks)) = ffin
StepFF(Indeks, NumModelli(Indeks)) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2

Print #2, "RFT"
Print #2, yyVal1
Print #2, xxVal1
Print #2, Cz1 'C0
Print #2, Cw1 'CA
Print #2, wwVal1  'C1
Print #2, zzVal1  'C2
Print #2, numcicli
Print #2, stcicli1
Print #2, m01
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

If CambiaMod = True Then

CambiaMod = False

initF(Indeks, MODiD) = finit
finF(Indeks, MODiD) = ffin
StepFF(Indeks, MODiD) = stepF

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2

Print #2, "RFT"
Print #2, yyVal1
Print #2, xxVal1
Print #2, Cz1 'C0
Print #2, Cw1 'CA
Print #2, wwVal1  'C1
Print #2, zzVal1  'C2
Print #2, numcicli
Print #2, stcicli1
Print #2, m01
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, ModD(i)
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i

Close #1

End If

GoTo rety1
rety:

MsgBox "An Error Occurred During RFT Model Elaboration", , "Error"
Close #1
rety1:

End Sub








Public Sub Mix(numgraph, C1, C2, stepx As Variant, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

maxw = 1 / stepx

If maxw <> Int(maxw) Then

MsgBox "An Error Occurred", , "Error"
GoTo eee

End If

'inserisco i dati del parent C1

For i = 1 To Numcamp1
If NomeCamp(i) = C1 Then
qq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(0, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i

'inserisco i dati del parent C2

For i = 1 To Numcamp1
If NomeCamp(i) = C2 Then
qq = i
End If
Next i


For i = 1 To NumModelElem

For ii = 1 To Numelem

If ModElementi(i) = Elementi(ii) Then

DatiModello(maxw, i) = Val(Format$(DatiOrigine(qq, ii), "0.000000"))

End If

Next ii

Next i


rr = 0

For i = (0 + stepx) To (1 - stepx) Step stepx

rr = rr + 1

For ii = 1 To NumModelElem


'If (DatiModello(0, ii) * i) <= 0 Then
'DatiModello(rr, ii) = 0
'GoTo yyy
'End If
'
'If (DatiModello(maxw, ii) * i) <= 0 Then
'DatiModello(rr, ii) = 0
'GoTo yyy
'End If

DatiModello(rr, ii) = (DatiModello(maxw, ii) * i) + (DatiModello(0, ii) * (1 - i))
DatiModello(rr, ii) = Val(Format$(DatiModello(rr, ii), "0.000000"))
yyy:

Next ii


Next i

NumModDati = rr

' eseguo le operazioni

'asse x
If numopX = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXX(Indeks)) Then
    ModAsseX(Indeks) = i
    GoTo ret
    End If
    Next i
   End If





For i = 1 To numopX Step 3

c$ = ModXop(i)
b$ = ModXop(i + 1)
a$ = ModXop(i + 2)

INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAsseX(Indeks) = NumModelElem

ret:

'asse y
If numopY = 3 Then
    For i = 1 To NumModelElem
    If ModElementi(i) = Elementi(AXY(Indeks)) Then
    ModAssey(Indeks) = i
    GoTo ret1
    End If
    Next i
   End If

For i = 1 To numopY Step 3

c$ = ModYop(i)
b$ = ModYop(i + 1)
a$ = ModYop(i + 2)


INP.ModOperazione Val(a$), Val(b$), c$

Next i

ModAssey(Indeks) = NumModelElem

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "mixing (Elem Vs Elem)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, "/" 'C0
Print #2, "/" 'CA
Print #2, C1  'C1
Print #2, C2  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If

If CambiaMod = True Then

CambiaMod = False
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "mixing (Elem Vs Elem)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, "/" 'C0
Print #2, "/" 'CA
Print #2, C1  'C1
Print #2, C2  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If


eee:
GoTo rety1
rety:

MsgBox "An Error Occurred During Mixing Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub MixRR(numgraph, x11, y11, x22, y22, b1, b2, d1, d2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety



ii = 0

For i = x11 To x22 Step (x22 - x11) / 40

ii = ii + 1

AM1 = (d2 * b1 * y22) - (d1 * b2 * y11)
BM1 = (d1 * b2) - (d2 * b1)
CM1 = (d2 * b1 * x11) - (d1 * b2 * x22)
DM1 = (d1 * b2 * x22 * y11) - (d2 * b1 * x11 * y22)


DatiModello(ii, 2) = -(AM1 * i + DM1) / (BM1 * i + CM1)
DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
DatiModello(ii, 1) = i
DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))
yyy:




Next i

'ii = ii + 1
'DatiModello(ii, 2) = -(AM1 * x22 + DM1) / (BM1 * x22 + CM1)
'DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
'DatiModello(ii, 1) = x22
'DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))


NumModDati = ii - 1
NumModelElem = 2
 
ModAsseX(Indeks) = 1

ModAssey(Indeks) = 2

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Mixing(R-R)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, "/" 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If

If CambiaMod = True Then

CambiaMod = False
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Mixing(R-R)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, "/" 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If


eee:
GoTo rety1
rety:

MsgBox "An Error Occurred During Mixing Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub MixRR1(numgraph, x11, y11, x22, y22, b1, b2, d1, d2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

'On Error GoTo rety

Indeks = numgraph

ii = 0

For i = 0 To 1 Step 0.1

ii = ii + 1

'AM1 = (d2 * b1 * y22) - (d1 * b2 * y11)
'BM1 = (d1 * b2) - (d2 * b1)
'CM1 = (d2 * b1 * x11) - (d1 * b2 * x22)
'DM1 = (d1 * b2 * x22 * y11) - (d2 * b1 * x11 * y22)



DatiModello(ii, 2) = ((y11 * d1 * i) + (y22 * d2 * (1 - i))) / ((d1 * i) + (d2 * (1 - i)))
DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
DatiModello(ii, 1) = ((x11 * b1 * i) + (x22 * b2 * (1 - i))) / ((b1 * i) + (b2 * (1 - i)))
DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))
yyy:




Next i

'ii = ii + 1
'DatiModello(ii, 2) = -(AM1 * x22 + DM1) / (BM1 * x22 + CM1)
'DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
'DatiModello(ii, 1) = x22
'DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))


NumModDati = ii
NumModelElem = 2
 
ModAsseX(Indeks) = 1

ModAssey(Indeks) = 2

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Mixing(R-R)"
Print #2, x11 'R
Print #2, y11  'R
Print #2, x22 'C0
Print #2, y22 'CA
Print #2, b1  'C1
Print #2, b2  'C2
Print #2, d1
Print #2, d2
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2

Close #1
Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.00000000"))

Next ii


Next i



Close #1
End If

If CambiaMod = True Then

CambiaMod = False
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Mixing(R-R)"
Print #2, x11 'R
Print #2, y11  'R
Print #2, x22 'C0
Print #2, y22 'CA
Print #2, b1  'C1
Print #2, b2  'C2
Print #2, d1
Print #2, d2
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 1 To NumModDati

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.00000000"))

Next ii


Next i



Close #1
End If


eee:
GoTo rety1
rety:

MsgBox "An Error Occurred During Mixing Model Elaboration", , "Error"
Close #1
rety1:

End Sub

Public Sub MixRE(numgraph, x11, y11, x22, y22, d1, d2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety



ii = 0

For i = x11 To x22 Step (x22 - x11) / 100

ii = ii + 1

AM1 = (d2 * y22) - (d1 * y11)
BM1 = (d1 - d2)
CM1 = (d2 * x11) - (d1 * x22)
DM1 = (d1 * x22 * y11) - (d2 * x11 * y22)


DatiModello(ii, 2) = -(AM1 * i + DM1) / (BM1 * i + CM1)
DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
DatiModello(ii, 1) = i
DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))
yyy:




Next i

'ii = ii + 1
'DatiModello(ii, 2) = -(AM1 * x22 + DM1) / (BM1 * x22 + CM1)
'DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
'DatiModello(ii, 1) = x22
'DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))


NumModDati = ii - 1
NumModelElem = 2
 
ModAsseX(Indeks) = 1

ModAssey(Indeks) = 2

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Mixing(R-E)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, "/" 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If

If CambiaMod = True Then

CambiaMod = False
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Mixing(R-E)"
Print #2, "/" 'R
Print #2, "/" 'R
Print #2, "/" 'C0
Print #2, "/" 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, "/"
Print #2, "/"
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If


eee:
GoTo rety1
rety:

MsgBox "An Error Occurred During Mixing Model Elaboration", , "Error"
Close #1
rety1:

End Sub


Public Sub MixRE1(numgraph, x11, y11, x22, y22, d1, d2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo rety

Indeks = numgraph

ii = 0

For i = 0 To 1 Step 0.1

ii = ii + 1



DatiModello(ii, 2) = (y11 * d1 * i + y22 * d2 * (1 - i)) / (d1 * i + d2 * (1 - i))
DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
DatiModello(ii, 1) = d1 * i + d2 * (1 - i)
DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))
yyy:




Next i

'ii = ii + 1
'DatiModello(ii, 2) = -(AM1 * x22 + DM1) / (BM1 * x22 + CM1)
'DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
'DatiModello(ii, 1) = x22
'DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))


NumModDati = ii - 1
NumModelElem = 2
 
ModAsseX(Indeks) = 1

ModAssey(Indeks) = 2

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Mixing(R-E)"
Print #2, x11 'R
Print #2, y11  'R
Print #2, x22 'C0
Print #2, y22 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, d1
Print #2, d2
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If

If CambiaMod = True Then

CambiaMod = False
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Mixing(R-E)"
Print #2, x11 'R
Print #2, y11  'R
Print #2, x22 'C0
Print #2, y22 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, d1
Print #2, d2
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If


eee:
GoTo rety1
rety:

MsgBox "An Error Occurred During Mixing Model Elaboration", , "Error"
Close #1
rety1:

End Sub


Public Sub MixRunoSuE1(numgraph, x11, y11, x22, y22, d1, d2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid)

On Error GoTo eee

Indeks = numgraph

ii = 0

For i = 0 To 1 Step 0.1

ii = ii + 1



DatiModello(ii, 2) = (y11 * d1 * i + y22 * d2 * (1 - i)) / (d1 * i + d2 * (1 - i))
DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
DatiModello(ii, 1) = 1 / (d1 * i + d2 * (1 - i))

DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))
yyy:




Next i

'ii = ii + 1
'DatiModello(ii, 2) = -(AM1 * x22 + DM1) / (BM1 * x22 + CM1)
'DatiModello(ii, 2) = Val(Format$(DatiModello(ii, 2), "0.000000"))
'DatiModello(ii, 1) = x22
'DatiModello(ii, 1) = Val(Format$(DatiModello(ii, 1), "0.000000"))


NumModDati = ii - 1
NumModelElem = 2
 
ModAsseX(Indeks) = 1

ModAssey(Indeks) = 2

ret1:

If CambiaMod = False Then
NumModelli(Indeks) = NumModelli(Indeks) + 1

Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(NumModelli(Indeks)) + ".txt" For Output As #2
Print #2, "Mixing(R-1/E)"
Print #2, x11 'R
Print #2, y11  'R
Print #2, x22 'C0
Print #2, y22 'CA
Print #2, "/"  'C1
Print #2, "/"  'C2
Print #2, d1
Print #2, d2
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(NumModelli(Indeks)) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If

If CambiaMod = True Then

CambiaMod = False
Open App.Path + "\data\" + Trim(Indeks) + "modelExplain" + Trim(MODiD) + ".txt" For Output As #2
Print #2, "Mixing(R-1/E)"
Print #2, x11 'R
Print #2, y11  'R
Print #2, x22 'C0
Print #2, y22 'CA
Print #2, "/"  'C1
Print #2, "/" 'C2
Print #2, d1
Print #2, d2
Print #2, "/"
Print #2, NumModelElem
For i = 1 To NumModelElem
Print #2, ModElementi(i)
Next i
For i = 1 To NumModelElem
Print #2, "/"
Next i
Close #2


Open App.Path + "\data\" + Trim(Indeks) + "modello" + Trim(MODiD) + ".txt" For Output As #1

Print #1, NumModelElem, NumModDati + 2, ModelLineSp, ModelLineCol, ModelSymb, ModelSymbSp, ModelSymbCol, ModelSymbWid

For ii = 1 To NumModelElem

Print #1, ModElementi(ii)

Next ii


For i = 0 To NumModDati + 1

For ii = 1 To NumModelElem

Print #1, Val(Format$(DatiModello(i, ii), "0.000000"))

Next ii


Next i



Close #1
End If


eee:
GoTo rety1
rety:

MsgBox "An Error Occurred During Mixing Model Elaboration", , "Error"
Close #1
rety1:

End Sub
