Writing Transmission Formatting Python Scripts¶
The transmission message may be modified using Python scripts. This tutorial will show you how.
You do not need to have the full Python development environment setup for this. LinkComm will suffice.
- The manual has crucial information about how scripts work.
Please take the time to read the chapter on Python scripts. Without that knowledge, it is going to be difficult to work with Satlink 3 and XLink 500 scripts.
Appending Data to Transmissions¶
In this example, we want to append a specific data string to the transmission message.
Suppose that the system currently uses CSV formatting to transmit data, making the transmission message look like this:
Our goal is to append the following fixed string to the message:
Little Creek A21938
Such that the final message is
04/02/2018,09:00:00,STAGE,20.501 04/02/2018,09:00:00,TEMP,23.5 Little Creek A21938
These are the steps that the station will take:
- The system will create a standard transmission message based on the setup
- The Python script will be invoked
- The standard message will be provided to the script
- The script will modify the message
- The script will return the modified message to the system
- The system will transmit the modified message
Python code would look like this:
@TXFORMAT def append_info(standard): return standard + "Little Creek A21938"
- Note that all transmission formatting scripts must have the @TXFORMAT descriptor.
Here is the completed Python script:
Now that we have the script, we need to integrate it into the setup using LinkComm.
- Run LinkComm
- Choose Station Type XLink 500
- Click Work offline.
- Go to the Script tab of LinkComm and open the append_info script file.
- Go to the Telemetry tab of LinkComm.
- Setup the Transmission format:
- Set Tx Format CSV
- Check Custom Script Format
- Choose append_info as the Script Format Function
- Completed setup file:
That completes this example. For more example scripts, please see