-
Notifications
You must be signed in to change notification settings - Fork 0
Control Strategies
Paolo Grasso edited this page Jul 25, 2020
·
1 revision
A control strategy script relies on:
- JSON file with contains catalog IP, catalog port, devID and plantID to which it is associated
- A script functions.py which contains generic functions in common with all strategies
When launched, a control strategy should:
- Start a thread which continuously checks if the current time of the machine corresponds to one entry of the hour timetable TIME_LIST. If it corresponds, it calls the get_results() functions and delete the entry from the timetable.
- Loop on a function which asks the catalog the hours of irrigation of the plant and appends them to the hour timetable. This happens once a day (sleep 86400 seconds). Except for the irrigation strategy, all hours appended in the hour timetable get anticipated by 5 minutes with respect to the ones present in the catalog.
This is a generic function which can be adapted according to the sensor and the plant for which the strategy is designed. It should:
- Ask the ThingSpeak Adaptor the past environmental data for a specific interval (e.g. 4 hours).
- Compute a variation of the irrigation parameters (e.g. too dry -> add 1000 seconds to the irrigation)
- Use the post_mod() function to publish modifications on dynamic catalog via REST.
Main scripts
Sensors
Control strategies
User interface