Example Import Program

This example demonstrates how Mimic script might be used to import Forecast data.

Example:

On a particular Geo SCADA Expert system, Mimic script is used to import hard coded Forecast data for demonstration and test purposes. The script comprises:

 

option explicit
Sub GenerateForecast
Dim Frc
Dim FrcData(9)
Dim StartTime
Dim ForecastName

 

' Find the forecast in the database
Set Frc = Server.FindObject("Region 1 Forecasts.MyTestForecast")
if Frc is nothing then

MsgBox "Cannot find forecast object."

else

' Hard coded data for demonstration purposes
FrcData(0) = 30.4
FrcData(1) = 30.5
FrcData(2) = 30.6
FrcData(3) = 30.7
FrcData(4) = 30.75
FrcData(5) = 30.7
FrcData(6) = 30.65
FrcData(7) = 30.6
FrcData(8) = 30.55
FrcData(9) = 30.5

 

' Start time
StartTime = Now

 

' Forecast name
ForecastName = FormatDateTime( StartTime, vbLongDate ) + " "
ForecastName = ForecastName + FormatDateTime( StartTime, vbShortTime )

 

' Write the forecast
Frc.Interface.SetForecast ForecastName, StartTime, FrcData

 

end if

End Sub

The script is configured to run whenever a ‘Generate Forecast Data’ button is selected on the Mimic on which the script exists.

Further Information

Mimic Scripts: see Mimic Scripts in the Geo SCADA Expert Guide to Scripting.


Disclaimer

Geo SCADA Expert 2019