# A Regional Multi-Agent Air Monitoring Platform
## 4 The ACreM Platform
### Air Monitor Agent
We distinguish two types of subgoals:  
* Achievement goals (denoted by \"!\")  
Figure 10: Segment of the AM’s Beliefs Base (initial state). Figure 9: AM general architecture. Test subgoals are commonly used to extract data from various data structures or repositories. AM's reasoning cycle is based on the concept of practical reasoning by rational agents [31] and includes the following steps (Figure 11):  
Initialization. During initialization, the agent perceives the environment (Air Pollution Ontology and Sensor DB) to initialize the static Beliefs Base. Limiting and threshold values of observed air pollutants are usually obtained from the Air Pollution Ontology. This phase also specifies the initial intention!start_air_monitoring causing the monitoring process to start. Reasoning. In this phase, the dynamic Beliefs Base is periodically updated by reading the Sensor DB. This database stores the current values of the observed sensors for measuring  
Figure 11: AM’s reasoning cycle state chart diagram. various air pollutants. Practical BDI agents operate by continuously handling events, which represent either perceived changes in the environment or changes in the agent's own goals. The AM agent continuously monitors its environment for changes. This could be new sensor data (interacting with the Sensor DB also located in the environment), updates to the Air Pollution Ontology, or external events. Thus, changes in the Belief's Base cause the generation of a current event, which is used in the next phase to select an applicable plan. Plan Selection. The plan selection is done in two steps. First, a set of possible plans is determined through the successful unification of the triggering event of a plan with the current event. Second, from the set of possible plans, one applicable plan is selected through the successful unification of the context of the plan with the Belief's Base. Plan Execution. The AM agent executes the selected applicable plan. The plan consists of a series of actions, which may include subgoals that need to be achieved. Typical actions are comparisons between the current values of the monitored pollutants and the permissible threshold values to determine whether the air condition is normal or anomalies are observed. In both cases, AM prepares informative messages for users. The actions could also involve querying the ontology, updating the Belief's Base, or triggering external processes. If the plan includes subgoals, the agent will recursively apply the reasoning cycle to achieve these subgoals. Subgoals can be either achievement goals (denoted by \"!\") or test subgoals (denoted by \"?\"). Termination. The reasoning cycle continues until the AM agent's intentions are achieved or the agent is terminated. For example, if the agent's intention is to monitor air quality continuously, the cycle will repeat indefinitely. In each cycle, the agent informs the user whether any deviations have been detected during air monitoring. If the agent is shut down, it will terminate its reasoning cycle and stop monitoring the environment. The execution of the reasoning cycle is supported by JaCaMo run-time interpreter [30]. Part of the code that implements the library plan and reasoning cycle is given in Figure 12.  
Figure 13 shows a sample test session for working with the AM. _AM Environment._ Two main repositories are located in the AM environment. The core knowledge for understanding and monitoring air quality is stored in an ontology called Air Pollution Ontology, developed under the World Health Organization's global air quality guidelines of [32]. The Executive Environmental Agency of Bulgaria [33] and Environmental Monitoring System of Plovdiv Municipality [34] offer comprehensive information on air quality in Bulgaria, including measurements of key pollutants such as PM10, PM2.5, SO2, O3, CO, and NO2, available on their official website. This foundational knowledge serves as the basis for evaluating air quality by comparing it with dynamically entered data in the databases.