您可以透過 API,將時間系列資料做為出圖的獨立值來使用。這便是動畫的表示方式。
此範例會執行以下工作:
當您要讀取特定結果集,或將資料放入新的結果集中時,可以使用此範例。
'@ '@ DESCRIPTION '@ Split Presssure Time Series Result into Individual Results. '@ Recreate the Pressure Time Series Result '@ '@ SYNTAX '@ ReadingPressureData '@ '@ PARAMETERS '@ none '@ '@ DEPENDENCIES/LIMITATIONS '@ none '@ '@ History '@ Created DRA 9/8/2006 '@@ Option Explicit SetLocale("en-us") Dim Synergy Set Synergy = CreateObject("synergy.Synergy") Synergy.SetUnits "METRIC" Dim PlotManager Dim ResultID, Header, UserPlot, Indp, nodeID, Value, IndpValues, i, j ,Ave, Count, Str ResultID = 1180 ' Split Presssure Result into Individual Results. Set PlotManager = Synergy.PlotManager() Set IndpValues = Synergy.CreateDoubleArray() PlotManager.GetIndpValues ResultID, IndpValues ' Display to Screen Average Pressure at interval through results For i = 0 to IndpValues.size()-1 Step 5 Set PlotManager = Synergy.PlotManager() Set Indp = Synergy.CreateDoubleArray() Indp.AddDouble(IndpValues.val(i)) Set nodeID = Synergy.CreateIntegerArray() Set Value = Synergy.CreateDoubleArray() PlotManager.GetScalarData ResultID, Indp, nodeID, Value Ave = 0.0 Count = 0.0 For j = 0 To nodeID.size - 1 Count = Count +1 Ave = Ave + Value.val(j) Next If Count > 0 Then Ave = Ave / cdbl(count) End If Str = Str + "Time=" & CStr(IndpValues.val(i)) & " Average P =" & Ave &" MPa" & vbCRLF Next MsgBox Str 'Recreate current Time Series Pressure Result Set UserPlot = PlotManager.CreateUserPlot() Header = "New Pressure Time Series" PlotManager.DeletePlotByName(Header) UserPlot.SetName(Header) UserPlot.SetDataType("NDDT") UserPlot.SetDeptUnitName("MPa") UserPlot.SetDeptName("Time") UserPlot.SetVectorAsDisplacement(False) For i = 0 to IndpValues.size-1 Set Indp = Synergy.CreateDoubleArray() Indp.AddDouble(IndpValues.Val(i)) Set nodeID = Synergy.CreateIntegerArray() Set Value = Synergy.CreateDoubleArray() PlotManager.GetScalarData ResultID, Indp, nodeID, Value UserPlot.AddScalarData IndpValues.Val(i), nodeID, Value Next UserPlot.Build() MsgBox "Script Complete" Wscript.Quit