Module __main__
Top 

The __main__ module exports your GSEOS block and item definitions. You can access data items with the usual Block.Item notation. All the block definitions from the block definition files are exported so you can directly access them from the Console window. If you want to use the block definitions in your scripts you have to include an import __main__ statement at the top of your script. Alternatively you can use the GseosBlocks module which gives you access to the defined data blocks. When you read data items you get their current value, that means two consecutive reads may result in two different values if the data changes in the meantime. To access arrays you use Python's slicing syntax. To get the first 20 elements of the TLM.Data you would type the following:
TLM.Data[:20]

Keep in mind that writing a data item does not result in the block being posted to GSEOS, nor can you read the value you just wrote! In order to make the data available to the system you have to call the SendBlock() function on the block once you have written all the data items you want to set for that block. Check the GseosDecoder module for more detailed information on how to create derived data blocks. Keep in mind that the block variables are shared resources, if you want to write to a block from multiple threads you have to synchronize access to the block. The GseosBlocks module allows you to access GSEOS blocks in a thread safe manner. Refer to the Python thread module for more detailed information about threading and synchronization.

Decoders and Monitors

To write a GseosDecoder or GseosMonitor you want to take action whenever a new data block arrives in the system. You can create an instance of the TDecoder or TMonitor objects and add them to the list of Decoders or Monitors for that particular block. Your Decoder or Monitor function will be called and evaluated every time a new block of that type arrives. Please refer to the documentation of the GseosDecoder and GseosMonitor modules for more detailed information.

Data Sources

GSEOS supports the concept of data sources. The Bios, Recorder, Net, etc. are all data sources. They are mutually exclusive, i.e. if you turn on the recorder for playback the Bios data source will be stopped and not generate any data (which otherwise could interfere with the recorder output). By default all blocks you generate from your Python scripts will be handled as decoder output (not as a data source). This means all your decoders will operate no matter what the input data source is. This is usually the behavior you would expect if you write a Decoder. If you plan on using Python as a data source you will have to first enable the Python data source by calling
GseosBlocks.EnableDataSource(strName, bEnable). Once you call this function with the bEnable parameter set to True all data sources except your Python scripts will be disabled. All the blocks you want to generate from the data source take an additional parameter in the send() call. If you pass True as the bDataSource parameter of the send() call your blocks will be generated from the exclusive data source source and participate in the mutually exclusive data source scheme. If the bDataSource parameter is False your blocks will be generated from a non-exclusive task which does not partake in the switching of data sources. That means that when you turn on the recorder for playback you will still see the blocks you generate in this way. This means that a decoder function should never set the bDataSource parameter in a send() call since a decoder is by definition not a data source.