Simple Configuration File - Subroutine

Hello Everyone,

I’ve created a config file where all the numeric settings, for my PAC strategy are stored. For example, temperature settings, sprinkler system settings, offsets, temperature limits, etc. Strategy periodically reads the config file for new settings and applies them. So right now in order to adjust any settings in my program, I don’t have to stop the strategy and hard code new values, all I have to do is to edit the config file (manually or thru my web interface).

I’ve created two SUBs:

  • read_config_file - it reads specified file from root directory of the controller and puts its content into the string table (config table).
  • read_config_table - it reads numeric value of parameter from the config table

I’ve attached 4 files:

  • subs read_config_file and read_config_table,
  • test.conf - config file which needs to be uploaded to root directory of your controller,
  • demo strategy.

Demo strategy reads the config file (test.conf) and waits number of seconds defined in refresh_rate and goes back to beginning to read the file again.


Reviving an old one,

Anyone have the files jatrn originally posted? or have links to similar examples? (16.5 KB)

Files have been attached to this post.

“contest” folder included main example
“sub” includes subroutines mentions in the above post (you will need to reincluded them in your strategy)
test.conf is a config that you need to upload to your controller.