Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Actor programs with lots of config/ini data

My test programs tend to have lots of settings (say 100+) that I load from config (ini) files. In previous non-actor programs I would just have big, dedicated clusters (type def'd) that I would initialize at program start, and then re-write changes to the ini file at program close. This was fine for the in-house programs I was writing, but did seem somewhat crude. Anyway, how do you guys go about handling large data settings like this in actor programs? For example, is it okay to have lots of data settings in an actor class private data, which get initialized at start-up? Is using type def clusters in class private data okay? Or is it better to just pass around a config file reference to each actor (or program section) that needs settings from the file, and have the actor read those settings when it gets launched (or as needed), and then re-write the changes straight away?

0 Kudos
Message 1 of 3
(4,580 Views)

In my current (and first) AF project, most of my 25 actors have a "config file path" (INI) in their private data. The top level actor passes the path to the config file to it's nested actors who pass it on to theirs. It's each actor's responsibility to read from the given INI file their settings from the appropriate section. My users edit the INI file to make any changes before running the app (the INI has around 40 settings). Also, the private data for my actors is fairly small. The exception is my user interface. Some of the private data are typedef clusters. I haven't found any major disadvantages or issues with this scheme. Sure a lot easier when creating a new actor to just add a section in the INI.

0 Kudos
Message 2 of 3
(3,218 Views)

I use JSON instead of INI format (though I'm not expecting the User to modify these files directly).  JSON is more hierarchal than INI, so subactors' config info can be embedded as part of their Caller.  One can also have arrays of subactor configurations.   Below is an example; an array of three actors** (dynamically loaded, so the top-level actor also stores thier class names) with a total of four subactors (I've coloured the embeded subactor configurations in blue).  The configuration is read or written only by the top-level actor; it divides the JSON up and sends individual pieces to its Callees, who in turn take out parts to send to thier own subactors.  Or, for writing, the top level requests configuration JSON from its Calless, who themselves request configuration info from their subactors.

**Note: not AF actors, but these techniques can be used in the AF also.

[

  {

    "Actor Type": "Fourier Transform¦¦.lvclass",

    "Config": {

      "Analysis Method": "Asymmetric (Mertz ramp)",

      "Apodisation Window": 60,

      "Bounds": {

        "1": 0.0622726091476091,

        "2": 0.942392151767152

      },

      "Calculation": "Absorption",

      "Calibration Constants": {

        "cm^-1/pixel": 5.35,

        "zero offset (cm^-1)": 0.5

      },

      "Collection Mode": {

        "Averaging": "Auto",

        "Number": 10

      },

      "IgramCursors": {

        "Graph Options": {

          "Hide after": "30 sec",

          "Reverse Text Colours": false,

          "Text Size": "Default size",

          "Update Time": "500 ms"

        }

      },

      "Low cutoff (cm^-1)": 200,

      "Phase Correction": "Mertz Phase Correction",

      "Reference Collection (s)": 20,

      "Reference File": "<Not A Path>",

      "Sample Collection (s)": 20,

      "SpectrumCursors": {

        "Graph Options": {

          "Hide after": "30 sec",

          "Reverse Text Colours": false,

          "Text Size": "Default size",

          "Update Time": "500 ms"

        }

      },

      "Time Filter": {

        "Filtering": "None",

        "Time Constant (s)": 0

      },

      "Zero Padding": "No Padding",

      "window parameter": 5

    },

    "Description": "Fourier Transform"

  },

  {

    "Actor Type": "Trim Spectrum¦¦.lvclass",

    "Config": {

      "Cur0": 611.55575444449,

      "Cur1": 1740.14363397204,

      "Cursors": {

        "Graph Options": {

          "Hide after": "5 sec",

          "Reverse Text Colours": false,

          "Text Size": "Default size",

          "Update Time": "500 ms"

        }

      },

      "enable": true

    },

    "Description": "Trim Spectrum"

  },

  {

    "Actor Type": "Absorption Database¦¦.lvclass",

    "Config": {

      "DB File": "\\\\psf\\Home\\Desktop\\AbsorptionSim.DB",

      "DB Viewer": {

        "Averaging Time (s)": 5,

        "Averaging Type": "Simple Average",

        "DBpath": "\\\\psf\\Home\\Desktop\\AbsorptionSim.DB",

        "Selection Type": "All points",

        "WN Regions": [

          {

            "Colour": 1198079,

            "End": 900,

            "Name": "Region1",

            "Scale": "Left",

            "Start": 800,

            "Type": "Maximum",

            "Use": true

          },

          {

            "Colour": 10420323,

            "End": 1407.47663551402,

            "Name": "Region2",

            "Scale": "Left",

            "Start": 1330.84112149533,

            "Type": "Maximum",

            "Use": true

          }

        ]

      }

    },

    "Description": "Absorption Database"

  }

]

0 Kudos
Message 3 of 3
(3,218 Views)