
Customization FAQ A-25
A-25
j. Add the following to the Initialization function:
k. Add the following to the Execute function:
13. How do I change the name of an unit operation extension in
the PFD?
Ans: A Text Entry widget must be added to the EDF file to
allow the name of the extension to be changed.
Code
Set ComponentNames = hyContainer.FindVariable("ComponentNames").Variable
Set MatrixData = hyContainer.FindVariable("MatrixData").Variable
' IsRecalling Is only False when the extension Is first added To the
simulation.
If IsRecalling = False Then
Set hyComponents = hyContainer.Flowsheet.FluidPackage.Components
ComponentNames.SetBounds hyComponents.Count, 0, 0
ComponentNames.Values = hyComponents.Names
DummyMatrix = MatrixData.Values
ReDim DummyMatrix(hyComponents.Count, hyComponents.Count)
' This Is used To Set default values For the matrix. Note that the
diagonal Is Set To -32768, which makes it uneditable
For i = 0 To hyComponents.Count - 1
For j = 0 To hyComponents.Count - 1
If i = j Then
DummyMatrix(i, j) = -32768
Else
DummyMatrix(i, j) = 0
End If
Next j
Next i
MatrixData.SetBounds hyComponents.Count, hyComponents.Count, 0
MatrixData.Values = DummyMatrix
End If
DummyMatrix = MatrixData.Values
For i = 0 To hyComponents.Count - 1
For j = 0 To hyComponents.Count - 1
if i = j Then DummyMatrix(i, j) = -32768
Next j
Next i
MatrixData.Values = DummyMatrix
Komentáře k této Příručce