Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mos:using_the_modular_output_system [2024/09/18 01:10]
optrix created
mos:using_the_modular_output_system [2024/09/18 01:39] (current)
optrix
Line 1: Line 1:
 ====Using the Modular Output System==== ====Using the Modular Output System====
  
-If you'd like to use the Modular Output System in your own projects, the system is relatively easy to use.+If you'd like to use the [[mos:welcome|Modular Output System]] in your own projects, the system is relatively easy to use.
  
 ===Include the Library=== ===Include the Library===
  
-<script python>+<code python> 
 import ardi.util.outputengine as outie import ardi.util.outputengine as outie
-</script>+ 
 +</code>
  
 ===Create and Start an Instance=== ===Create and Start an Instance===
  
-<script python>+<code python>
 oe = outie.OutputEngine("My Source Name") oe = outie.OutputEngine("My Source Name")
 oe.Start() oe.Start()
-</script>+</code>
  
 This creates an instance of the Output Engine. You pass a name that identifies your application. This creates an instance of the Output Engine. You pass a name that identifies your application.
-Calling 'start' may block for a few moments, depending on the output configuration. This varies, as some output types are //outgoing// (they only **send** data) while some are //incoming// (they host a service for other systems to query).+ 
 +Note that calling 'start' may block for a few moments, depending on the output configuration. This varies, as some output types are //outgoing// (they only **send** data) while some are //incoming// (they host a service for other systems to query).
  
 ===Writing Key/Value Pairs=== ===Writing Key/Value Pairs===
  
 If you want to write numeric, status or other key-value data, you use the [[WriteValue|WriteValue]] function of the OutputEngine object. If you want to write numeric, status or other key-value data, you use the [[WriteValue|WriteValue]] function of the OutputEngine object.
 +
 +<code python>
 +oe.WriteValue('TemperatureA',25.6)
 +</code>
  
 To record an event, use [[WriteLog|WriteLog]]. To record an event, use [[WriteLog|WriteLog]].
  
 +<code python>
 +oe.WriteLog('Stoppage')
 +</code>
 +
 +===Closing===
 +
 +When finished, you should call 'Stop'.
 +
 +<code python>
 +oe.Stop()
 +</code>
  
 +This will stop any HTTP, Modbus/TCP, OPC-UA or other services that were brought up by the Modular Output System.