ArchiveValues

ArchiveValues: "ArchiveValue" nesnelerini yöneten koleksiyon; "ArchiveFilterVariable" nesnesi tarafından kullanılır.

"ArchiveValues" nesnesi, "ArchiveValue" nesnelerini yönetir. Bu nesne, "ArchiveValue" nesneleri koleksiyonuna erişmek için "ArchiveFilterVariable" nesnesi tarafından kullanılır.

OrtamKullanılabilirlik
Engineering StudioKullanılmaz
Service EngineKullanılabilir
VBAKullanılabilir
VSTAKullanılabilir
C#

                  public void ArchiveValues(IArchiveFilterVariable zenonArvFilterVariable)
{
    IArchiveValues zenonArvValues = zenonArvFilterVariable.ArchiveValues();
    if (zenonArvValues == null)
    { 
        //There are no archive values, inform the user
        this.Parent.Parent.DebugPrint("There are no archive values",
            tpDebugPrintStyle.tpErr);
        return;
    }
    //Create a new archive value
    /* ##############################################################
     * #                           Attention                        #
     * #   This code is designed for spontaneous archive types.     #
     * #   If it is used in combination with a cyclic archive, the  #
     * #   code may corrupt the archive which results in a loss of  #
     * #   data.                                                    #
     * #                                                            #
     * #   Use at your own risk                                     #
     * ##############################################################
     */
    IArchiveValue zenonArvValue = zenonArvValues.CreateArchiveValue();
    zenonArvValue.Status = 0x1000;
    zenonArvValue.Time = (int)TimeConversion.SystemToZenOn(
        new DateTime(2007, 07, 30, 12, 0, 0));
    zenonArvValue.TimeMilliSec = 0;
    
    //Set your desired value
    zenonArvValue.Value = 1531;
    //Apply changes to the value
    zenonArvValue.SetModified();
    //For every archive value within the collection
    for (int i = 0; i < zenonArvValues.Count; ++i)
    {
        zenonArvValue = zenonArvValues.Item(i);
        
        //Print the current objects value
        this.Parent.Parent.DebugPrint(i + 1 + ". Value", tpDebugPrintStyle.tpMsg);
        
        //Print the current objects recording time
        this.Parent.Parent.DebugPrint("Date / Time: " +
            TimeConversion.ZenOnToSystem((uint)zenonArvValue.Time).ToString(),
            tpDebugPrintStyle.tpMsg);
        //Print the current objects recorded value
        this.Parent.Parent.DebugPrint("Recorded value: " + zenonArvValue.Value,
            tpDebugPrintStyle.tpMsg);
        //Print the current objects state
        this.Parent.Parent.DebugPrint("State: &H" + zenonArvValue.Status.ToString("X"),
            tpDebugPrintStyle.tpMsg);
    }
}
VB.NET

                  Public Sub ArchiveValues(zenonArvFilterVariable As IArchiveFilterVariable)
    Dim zenonArvValues As IArchiveValues = zenonArvFilterVariable.ArchiveValues()
    If zenonArvValues Is Nothing Then
        'There are no archive values, inform the user
        Me.Parent.Parent.DebugPrint("There are no archive values", tpDebugPrintStyle.tpErr)
        Return
    End If
    'Create a new archive value
    ' ##############################################################
'     * #                           Attention                        #
'     * #   This code is designed for spontaneous archive types.     #
'     * #   If it is used in combination with a cyclic archive, the  #
'     * #   code may corrupt the archive which results in a loss of  #
'     * #   data.                                                    #
'     * #                                                            #
'     * #   Use at your own risk                                     #
'     * ##############################################################
'     
    Dim zenonArvValue As IArchiveValue = zenonArvValues.CreateArchiveValue()
    zenonArvValue.Status = &H1000
    zenonArvValue.Time = CInt(TimeConversion.SystemToZenOn(New DateTime(2007, 7, 30, 12, 0, 0)))
    zenonArvValue.TimeMilliSec = 0
    'Set your desired value
    zenonArvValue.Value = 1531
    'Apply changes to the value
    zenonArvValue.SetModified()
    'For every archive value within the collection
    For i As Integer = 0 To zenonArvValues.Count - 1
        zenonArvValue = zenonArvValues.Item(i)
        'Print the current objects value
        Me.Parent.Parent.DebugPrint(i + 1 & ". Value", tpDebugPrintStyle.tpMsg)
        'Print the current objects recording time
        Me.Parent.Parent.DebugPrint("Date / Time: " & TimeConversion.ZenOnToSystem(CUInt(zenonArvValue.Time)).ToString(), tpDebugPrintStyle.tpMsg)
        'Print the current objects recorded value
        Me.Parent.Parent.DebugPrint("Recorded value: " + zenonArvValue.Value, tpDebugPrintStyle.tpMsg)
        'Print the current objects state
        Me.Parent.Parent.DebugPrint("State: &H" & zenonArvValue.Status.ToString("X"), tpDebugPrintStyle.tpMsg)
    Next
End Sub
VBA

                  Sub zenOn_ArchiveValues(ByRef zArvFilterVar As ArchiveFilterVariable)
'Declarations
Dim zArvValues As ArchiveValues
Dim zArvValue As ArchiveValue
Dim zTimeConvert As clsTimeConvert
Dim i As Integer
'Initialize zArvValue with the archive values collection of the current archive variable
Set zArvValues = zArvFilterVar.ArchiveValues
'Initialize zTimeConvert by creating a new instance of the zenOn "clsTimeConvert" macro
Set zTimeConvert = New clsTimeConvert
'If no value is available ...
If zArvValues Is Nothing Then

'... then inform the user

MsgBox ("No archive values available!")

'Otherwise:
Else

'Create a new archive value

'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

'!! ATTENTION: !!

'!! This code is designed for spontaneous archive types. !!

'!! If it is used in combination with a cyclic archive, this !!

'!! code may corrupt the archive, which results in an loss of !!

'!! data. !!

'!! !!

'!! USE AT YOUR OWN RISK !!

'!! !!

'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

'Initialize zArvValue by creating a new value entry

Set zArvValue = zArvValues.CreateArchiveValue

'Set the state of the value to a manual entry

zArvValue.Status = &H1000

'Set the time when the value was entered

zArvValue.Time = zTimeConvert.System2zenOn(CDbl(CDate("30.07.2007 12:00:00")))

'Set the milliseconds, in addition to the time

zArvValue.TimeMilliSec = 0

'Set the desired value

zArvValue.Value = 1531

'Apply the modifications to the value

zArvValue.SetModified

'For every archive value within the collection

For i = 0 To zArvValues.Count - 1

'Assign the current archive value to zArvValue

Set zArvValue = zArvValues.Item(i)

'Output the count of the value

Debug.Print i + 1 & ". Value"

'Output the date and time when the value was recorded

Debug.Print vbTab & "Date / Time: " & 

Format(zTimeConvert.zenOn2System(CDbl(zArvValue.Time)), "yyyy-mm-dd hh:mm:ss") & "." & zArvValue.TimeMilliSec

'Output the recorded value

Debug.Print vbTab & "Recorded value: " & zArvValue.Value

'Output the state of the value

Debug.Print vbTab & "State: &H" & Hex(zArvValue.Status)

Next i
End If
End Sub

Bu bölümdeki konular

Bu sayfa, COPA-DATA zenon 16 çevrimiçi yardımının Türkçe çevirisidir. Menü ve ayar adları, programdaki gibi bulmanız için İngilizce bırakılmıştır.