Skip to content

Defining a logic.yaml file

Bruce edited this page Aug 11, 2019 · 1 revision

The logic.yaml file is required by the Framework supervisor to:

  • Launch all the instances of the control logic that is required to run the system. Note that the same logic file can be instantiated multiple times with different points.
  • Start all loggers for the system.
  • Start all alarm notifiers for the system.

Taken from the supplied sample project, here is a section that starts 2 instances of the pump controller. Different points are assigned to each instance. Note that the point index is the name as seen in the logic module, and the name property defines the name of the point as it appears in the global point database.

pump_controller_1:  # unique name of this control instance 
    logger: controller
    package: .
    module: logic.PumpController  # python module containing the control logic located at ./logic/PumpController.py
    points:                       # list of points as defined in _points_list in PumpController.py
      point_liquid_level:                # name of the point as it's defined in PumpController.py's _point_list
        name: point_tank_1_liquid_level  # name of the point as defined in the global point database (points.yaml)
        access: ro                       # this routine will only read the following point. Any attempt to write will 
                                         # result in an exception.
        type: ProcessValue               # the object type in the global point database *probably no longer necessary*
      point_run_pump_1:
         name: point_tank_1_pump_1_run
         access: rw
         type: PointDiscrete
      point_run_pump_2:
        name: point_tank_1_pump_2_run
        access: rw
        type: PointDiscrete
    alarms:                              # alarms associated with this control logic instance.
      alarm_pump_runtime_fault:          # name of the alarm as it's defined in PumpController.py's _point_list
        name: alarm_tank_1_pump_fault    # name of the alarm as defined in the global point database (i.e.
                                         # points.yaml)
        access: rw                       # this routine will own this alarm. No other routines will be allowed to
                                         # write to the input property of this alarm.
        type: Alarm                      # the object type in the global point database *probably no longer necessary*

  pump_controller_2:                     # Another instance of the same PumpController that is attached to different
                                         # points.
    logger: controller
    package: .
    module: logic.PumpController
    points:
      point_liquid_level:
        name: point_tank_2_liquid_level
        access: ro
        type: ProcessValue
      point_run_pump_1:
         name: point_tank_2_pump_1_run
         access: rw
         type: PointDiscrete
      point_run_pump_2:
        name: point_tank_2_pump_2_run
        access: rw
        type: PointDiscrete
    alarms:                           
      alarm_pump_runtime_fault:        
        name: alarm_tank_2_pump_fault 
        access: rw                     
        type: Alarm

Another section will configure and start any loggers for the system. The loggers use the Python logging library and are configured as rotating logs. the backupCount specifies the number of files to be kept and maxBytes specifies the size of each file. level specifies the logging level of the file, valid levels are DEBUG, WARNING, INFO, etc.

loggers:
  alarms:
    backupCount: 1
    file: ./logs/alarms.log
    maxBytes: 2048000
    level: INFO

  controller:
    backupCount: 1
    file: ./logs/controller.log
    maxBytes: 2048000
    level: INFO

  devices:
    backupCount: 1
    file: ./logs/devices.log
    maxBytes: 2048000
    level: INFO

  supervisory:
    backupCount: 1
    file: ./logs/supervisory.log
    maxBytes: 2048000
    level: INFO
Clone this wiki locally