Public Sub zenOn_RemasExample()
'Declarations
Dim zRemas As Remas
Dim zBinRema As Rema
Dim zAnaRema As Rema
Dim i As Integer
'Initialization of zRemas
Set zRemas = MyWorkspace.ActiveDocument.Remas
'Intialization of zBinRema by creating a new binary rema
Set zBinRema = zRemas.Create(tpBinaer, "zenOn_BinaryRema")
'Intialization of zAnaRema by creating a new analog rema
Set zAnaRema = zRemas.Create(tpAnalog, "zenOn_AnalogRema")
'Output some details on the remas
For i = 0 To zRemas.Count - 1
'Display name
Debug.Print "Name: " & zRemas.Item(i).Name
'Show type of Reaction Matrix
Select Case zRemas.Item(i).Type
Case Is = 1
Debug.Print "Type: Binary"
Case Is = 2
Debug.Print "Type: Analog"
Case Is = 3
Debug.Print "Type: MultiBinary"
Case Is = 4
Debug.Print "Type: MultiAnalog"
Case Is = 5
Debug.Print "Type: String"
End Select
Next i
'Delete the binary rema by its position
Debug.Print zRemas.Delete(1)
'Delete the analog rema by its name
Debug.Print zRemas.Delete("zenOn_AnalogRema")
End Sub
Sub zenOn_SetStateForBinaryRema(ByRef zRema As Rema)
'Declaration zState
Dim zState As State
'Intialize zState with the first state inside the passed binary rema
Set zState = zRema.StateItem(1)
'Defines the matching bit combination
zState.ReaWert = &H89 'Sets Bit0, Bit3 and Bit7 TRUE
zState.ReaWertMaske = &H81 'Defines that Bit0 and Bit7 will be checked (Bit3 is ignored)
'User message that will be displayed when the event occurs
zState.Text = "Bit combination is matched!"
'Moreover, the first defined function will be called when the event occurs
zState.Function = MyWorkspace.ActiveDocument.RtFunctions.Item(0)
'The function will only be executed when the tpBitFkt is set. Additionaly the tpBitAlarm flag is set too.
zState.Status = tpBitFkt Or tpBitAlarm
End Sub
Private Sub zenOn_SetStateForAnalogRema(ByRef zRema As rema)
'Declaration zState
Dim zState As State
'Intialize zState with the first state inside the passed analog rema
Set zState = zRema.StateItem(1)
'Sets the comparision mode to "greater"
zState.CheckArt = 1
'This definition constitutes the threshold value, where the alarm will be triggered
zState.ReaAlarm = 11
'This definition means that the system will be set back to its normal configuration, when "ReaAlarm" goes below 10 (hysteresis)
zState.Hysterese = 1
'User message that will be displayed when the event occurs
zState.Text = "Limit is reached!"
'Moreover, the first defined function will be called when the event occurs
zState.Function = MyWorkspace.ActiveDocument.RtFunctions.Item(0)
'The function will only be executed when the tpBitFkt is set. Additionaly the tpBitAlarm flag is set too.
zState.Status = tpBitFkt Or tpBitAlarm
End Sub
This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.
The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.
Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.
Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.
COPA-DATA reserves the right to change this document from time to time at own discretion.
Ing. Punzenberger COPA-DATA GmbH
Karolingerstraße 7b · 5020 Salzburg · Austria
www.copadata.com