You can use Python and ODBC to access data in Fernhill SCADA. This article shows you how to do the following:
You can find the complete source code for this example in the file ODBCReadAnalogTag.py, which can be found in the Data Access Examples folder.
Fernhill SCADA places a shortcut to the Data Access Examples on the Windows Start Menu. Use this table to find the shortcut based on the Version of Windows you are using:
Windows Version | Shortcut Location |
---|---|
Windows 11 |
|
Windows 10 Windows Server 2019 Windows Server 2016 |
|
Windows 8 Windows Server 2012 |
|
Windows 7 Windows Server 2008 |
|
For Linux distributions, the Data Access Examples can be found here:
/usr/share/fernhill-scada/data-access-examples
# Use the pyodbc library to access ODBC import pyodbc def queryTagValue( connection, fullTagName ): # Create the cursor cursor = connection.cursor() # execute the statement cursor.execute("Select Value From TagDataPointAnalog Where FullName = ?", (fullTagName)) # get the first row row = cursor.fetchone() # Print the value print( "Value =", row.Value ) return print("Connecting to Fernhill SCADA...") # Selecting the Driver to use avoids us having to set up a DSN connection = pyodbc.connect( "Driver={Fernhill SCADA};Server=localhost" ) # Run the query queryTagValue( connection, "PumpStation.TotalCurrent")
To learn about the structured query language (SQL) supported by Fernhill SCADA.
To learn about configuring ODBC data Source Names.
Using ODBC Connection Strings to Connect to Fernhill SCADA
To learn about the keywords Fernhill SCADA supports in ODBC connection strings.
To learn how the Fernhill SCADA ODBC Driver can provide data to other applications.
For the meaning of terms used in Fernhill SCADA.