Geo SCADA Scripting with Basic — Automating Logic and Custom Calculations
Key Takeaway
How to write Basic scripts in Geo SCADA Expert for custom calculations, automation logic, time-based scheduling, and event-driven actions.
Quick Answer
Geo SCADA uses a dialect of BASIC for server-side scripting. Scripts are attached to scripted point objects and run on the server at configured intervals or in response to value changes. They can read point values, perform calculations, write outputs, and trigger actions.
What Is Geo SCADA Basic Scripting?
Geo SCADA includes a server-side scripting engine using a BASIC dialect (similar to VBScript but specific to the Geo SCADA environment). Scripts run in the server process and have access to all points, groups, and objects in the database. They are the primary mechanism for custom calculations, automated logic, and integration with external systems.
Where Scripts Run
- Server-side only — All Geo SCADA scripts execute on the server, not on client machines. This ensures consistent behavior regardless of which client is connected and maintains execution during client disconnections.
- Scripted Point objects — Scripts are attached to scripted point objects in the database. The scripted point defines when the script runs and what value it produces.
Scripted Point Type — When to Use It
Use a scripted point when you need:
- A calculated value from multiple input points (e.g., net flow = gross flow - water cut)
- Conditional logic (e.g., equipment mode determination based on several digital inputs)
- Time-based actions (e.g., daily production totalization at midnight)
- Event-driven responses (e.g., automatic report generation when a batch completes)
Basic Syntax Overview
' Variables and types
Dim pressure As Double
Dim pumpStatus As Boolean
Dim siteName As String
' Conditionals
If pressure > 500 Then
alarmLevel = "HIGH"
ElseIf pressure < 50 Then
alarmLevel = "LOW"
Else
alarmLevel = "NORMAL"
End If
' Loops
Dim i As Integer
For i = 1 To 10
total = total + GetValue("Station_" & i & ".Flow")
Next
Reading Point Values
' Read the current value of a point
currentPressure = GetValue("Pipeline_North.Station_001.Pressure_PSIG")
' Read with quality check
If GetQuality("Pipeline_North.Station_001.Pressure_PSIG") = "Good" Then
' Use the value
End If
Writing Point Values
' Write a calculated value to an output point
calculatedFlow = grossFlow * (1 - waterCut / 100)
SetPoint "Pipeline_North.Station_001.Net_Flow", calculatedFlow
Time-Based Script Scheduling
Scripted points can be configured to execute at fixed intervals (e.g., every 60 seconds), at specific times (e.g., midnight for daily totals), or on change of a trigger point's value. The execution schedule is configured in the scripted point's properties, not in the script code itself.
Example: Calculated Efficiency Point
' Calculate pump efficiency from discharge pressure and power
Dim discharge As Double
Dim power As Double
discharge = GetValue("Pump_Station.Discharge_PSIG")
power = GetValue("Pump_Station.Motor_KW")
If power > 0 Then
SetValue discharge * 2.31 * flowRate / (power * 1341.02) * 100
Else
SetValue 0
End If
Example: Automatic Alarm Acknowledgment Script
' Auto-acknowledge low-priority informational alarms after 5 minutes
If GetAlarmState("Tank_Farm.Level_Info") = "Unacknowledged" Then
If GetAlarmDuration("Tank_Farm.Level_Info") > 300 Then
AcknowledgeAlarm "Tank_Farm.Level_Info", "Auto-ack by script"
End If
End If
Debugging Scripts in ViewX
Use the scripted point's diagnostic output to view script execution
results, error messages, and variable values. Check the event journal for
script execution errors. For complex scripts, add intermediate logging
using LogMessage to trace execution flow and variable
values.
Frequently Asked Questions
Geo SCADA uses a dialect of BASIC for server-side scripting, distinct from VBA or VBScript but syntactically similar. Scripts are configured on scripted point objects.
Yes. Using the SetPoint function in a Geo SCADA script, you can send control outputs to connected field devices, subject to the user's control permission level.