VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "SPIDER"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim n(30) As Integer


Public Sub DeterminaSpiderPresenti()

On Error GoTo ret

For i = 1 To NumSpider
Spider1(i) = True
Next i


For i = 1 To NumSpider

n(i) = 101
For ii = 1 To Numelem
If Elementi(ii) = EleMSpider(i) Then
n(i) = i
End If
Next ii
If n(i) = 101 Then
Spider1(i) = False
End If

Next i

GoTo ret1
ret:
MsgBox "An Error Occurred: Spider Diagram Failed", , "Attention"
ret1:

End Sub

Public Sub CaricaNormalizzazioneSpider(file As String)

On Error GoTo ret

Close #1
Open file For Input As #1

Input #1, aa

NumSpider = aa



For i = 1 To NumSpider

Input #1, aa
Input #1, bb

EleMSpider(i) = aa
NormSpider(i) = Val(bb)

Next i



GoTo ret1
ret:
MsgBox "An Error Occurred: Spider Diagram Failed", , "Attention"
ret1:
Close #1

End Sub




Public Sub DeterminaValoriSpider(NumCamp)

'On Error GoTo ret

For i = 1 To NumSpider
SpiderAbsent(i) = True
SpiderAbsent1(i) = True
Next i


'determino le colonne degli elementi per gli spider

For ii = 1 To NumSpider

n(ii) = 101
For i = 1 To Numelem
If EleMSpider(ii) = Elementi(i) Then
n(ii) = i
SpiderAbsent(ii) = False
SpiderAbsent1(ii) = False
End If
Next i

If n(ii) = 101 Then
SpiderAbsent(ii) = True
SpiderAbsent1(ii) = True
GoTo f1
End If

If DatiOrigine(NumCamp, n(ii)) <= 0 Then
SpiderAbsent(ii) = True
SpiderAbsent1(ii) = True
End If
f1:

Next ii



'inserisco i dati nella matrice ElemSpider(n)

'prima valuto quali elementi posseggono il fattore di normalizzazione

For i = 1 To NumSpider

If NormSpider(i) = 0 Then
SpiderAbsent(i) = True
SpiderAbsent1(i) = True
End If

Next i


'prima quelli presenti nelle analisi

For i = 1 To NumSpider

If SpiderAbsent(i) = False Then
ValSpider(i) = DatiOrigine(NumCamp, n(i))
ValSpiderNorm(i) = DatiOrigine(NumCamp, n(i)) / NormSpider(i)
End If
If SpiderAbsent(i) = True Then
ValSpider(i) = 0
ValSpiderNorm(i) = 0
End If

Next i

'i dati non presenti in origine li interpolo


If SpiderAbsent1(1) = True Then
    
    n1 = 0
    n2 = 0
    
    For ii = 1 To NumSpider
    
    If n1 = 0 Then
        If SpiderAbsent1(ii) = False Then
        n1 = ii
        GoTo ee2
        End If
    End If
    
    If n1 <> 0 Then
        If SpiderAbsent1(ii) = False Then
        n2 = ii
        GoTo aa1
        End If
    End If
ee2:
    Next ii
    
aa1:

If n1 <= 0 Or n2 <= 0 Or ValSpiderNorm(n1) <= 0 Or ValSpiderNorm(n2) <= 0 Then
ValSpiderNorm(1) = 0 ' 11-06-02
Exit Sub
End If
'----------12-06-02
logspi = LOG10(ValSpiderNorm(n1)) + (((LOG10(ValSpiderNorm(n1)) - LOG10(ValSpiderNorm(n2))) / (n2 - n1)))
ValSpiderNorm(1) = EXP10(logspi)
SpiderAbsent1(1) = False

'---------
    
    
'    ValSpiderNorm(1) = ValSpiderNorm(n1) + (n1 * (ValSpiderNorm(n1) - ValSpiderNorm(n2)) / (n2 - n1))
'    SpiderAbsent1(1) = False
End If
    
If SpiderAbsent1(NumSpider) = True Then
    
    n1 = 0
    n2 = 0
    
    For ii = NumSpider To 1 Step -1
    
    If n1 = 0 Then
        If SpiderAbsent1(ii) = False Then
        n1 = ii
        GoTo ee1
        End If
    End If
    
    If n1 <> 0 Then
        If SpiderAbsent1(ii) = False Then
        n2 = ii
        GoTo aa44
        End If
    End If
ee1:
    Next ii
    
aa44:
    
If n1 <= 0 Or n2 <= 0 Or ValSpiderNorm(n1) <= 0 Or ValSpiderNorm(n2) <= 0 Then
ValSpiderNorm(NumSpider) = 0 ' 11-06-02
Exit Sub
End If

logspi = LOG10(ValSpiderNorm(n1)) - (((LOG10(ValSpiderNorm(n2)) - LOG10(ValSpiderNorm(n1))) / (n2 - n1)))
ValSpiderNorm(NumSpider) = EXP10(logspi)
SpiderAbsent1(NumSpider) = False
    
       
End If



For i = 1 To NumSpider

If SpiderAbsent1(i) = True Then

n1 = 0
n2 = 0
For ii = i To 1 Step -1
If SpiderAbsent1(ii) = False Then
n1 = ii
GoTo aa2
End If
Next ii
aa2:

For ii = i To NumSpider
If SpiderAbsent1(ii) = False Then
n2 = ii
GoTo aa3
End If
Next ii
aa3:

'ValSpiderNorm(i) = ValSpiderNorm(n1) - (((ValSpiderNorm(n1) - ValSpiderNorm(n2)) / (n2 - n1)) * (i - n1))
'SpiderAbsent1(i) = False

If n1 <= 0 Or n2 <= 0 Or ValSpiderNorm(n1) <= 0 Or ValSpiderNorm(n2) <= 0 Then
ValSpiderNorm(NumSpider) = 0 ' 11-06-02
Exit Sub
End If

'---------------- 04-06-2002
logSpider = LOG10(ValSpiderNorm(n1)) - (((LOG10(ValSpiderNorm(n1)) - LOG10(ValSpiderNorm(n2))) / (n2 - n1)) * (i - n1))
ValSpiderNorm(i) = EXP10(logSpider)
SpiderAbsent1(i) = False
'-----------------


End If

Next i


GoTo ret1
ret:
MsgBox "An Error Occurred: Spider Diagram Failed", , "Attention"
ret1:

End Sub

