Variables koleksiyonu, geçerli projede tanımlanmış tüm değişkenleri içerir. Bu koleksiyonla tüm değişkenlere veya seçili değişkenlere erişebilirsiniz. İndeks üzerinden erişimin yanı sıra bir değişken, benzersiz adı veya benzersiz kanal kimliği ile de bulunabilir.
| Ortam | Kullanılabilirlik |
|---|---|
| Engineering Studio | Kullanılabilir |
| Service Engine | Kullanılabilir |
| VBA | Kullanılabilir |
| VSTA | Kullanılabilir |
VBA
Sub CreateVariable()
Dim zVariables As Variables 'Object from type Variables
Dim zVariable As Variable 'Child object from type Variables
Dim zDrivers As Drivers 'Object from type Drivers
Dim zVarTypes As VarTypes 'Object from type VarTypes
Dim zEdLimit As EdLimit 'Object from type EdLimit
'Fill the objects
Set zVariables = MyWorkspace.ActiveDocument.Variables
Set zDrivers = MyWorkspace.ActiveDocument.Drivers
Set zVarTypes = MyWorkspace.ActiveDocument.VarTypes
'Create a "intern driver" variable called "TestVariable" with object type "internal variable" and datatype "INT"
Set zVariable = zVariables.CreateVar("TestVariable", zDrivers.Item(0), 33, zVarTypes.Item("INT"))
'Create a limit at the "TestVariable"
zVariable.CreateEdLimit
'Select the first limit of the variable
Set zEdLimit = zVariable.EDLimitItem(0)
'Set the limit active
zEdLimit.Active = True
'Set limit text
zEdLimit.Text = "Limit reached"
'Set limit value to 10
zEdLimit.LimitValue = 10
'Set the limit as maximum
zEdLimit.IsMax = True
'Set the limit as alarm
zEdLimit.Alarm = True
'Limit should be recognized in the CEL
zEdLimit.Cel = True
Call CreateArrayVariable
End Sub
Sub CreateArrayVariable()
Dim zVariables As Variables 'Object from type Variables
Dim zVariable As Variable 'Child object from type Variables
Dim zArrEl As Variable 'Object from type Variables
Dim zEdLimit As EdLimit 'Object from type EdLimit
Dim i As Integer
'Fill the objects
Set zVariables = MyWorkspace.ActiveDocument.Variables
Set zDrivers = MyWorkspace.ActiveDocument.Drivers
Set zVarTypes = MyWorkspace.ActiveDocument.VarTypes
'Create a "intern driver" array variable called "ArrayVar" from object type "internal variable", datatype "INT", start at index 1,
'dimension of 5 and automatic addressing
Set zVariable = zVariables.CreateArrayVar("ArrayVar", zDrivers.Item(0), 33,
zVarTypes.Item("INT"), 1, 5, 0, 0, True, False, False)
'Activate all array elements
For i = 0 To 4
zVariable.ActivateSubItem (i)
Next i
'Read the first array element
Set zArrEl = zVariable.SubItem(0)
'Create a limit at the array element
zArrEl.CreateEdLimit
'Select the first limit of the variable
Set zEdLimit = zArrEl.EDLimitItem(0)
'Set the limit active
zEdLimit.Active = True
'Set limit text
zEdLimit.Text = "Limit reached"
'Set limit value to 10
zEdLimit.LimitValue = 10
'Set the limit as maximum
zEdLimit.IsMax = True
'Set the limit as alarm
zEdLimit.Alarm = True
'Limit should be recognized in the CEL
zEdLimit.Cel = True
End SubBu konuda sorunuz mu var?SGE AI bu sayfaya ve ilgili yardım konularına dayanarak yanıtlar.
Bu bölümdeki konular
- AddressingOption
- BulkChangedEventArgs
- ChangedEventArgs
- ChannelType
- DataType
- DriverMode
- DriverState
- IDataType
- IDataTypeCollection
- IDriver
- IDriverCollection
- IecType
- IEditorLimitValue
- ILimitValue
- ILimitValueCollection
- IOnlineVariableContainer
- IOnlineVariableContainerCollection
- IStructureElement
- IVariable
- IVariableCollection
- ServiceGridAccessPermissionLevel
- ShowCreateDriverDialogReturnResult
- ShowCreateVariableDialogReturnResult
- VariableEventMode
- Variable özellikleri
- Variable metotları
- DynProperties
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.