A Resource Oriented Route Selection Framework Using Contextual Information Based on Fuzzy Logic

: Internet of Things (IoT) is expected to have a signiﬁcant impact on city’s service provisioning and make a smart city more accessible and pragmatic since the deployment of heterogeneous smart devices in each infrastructure of cities is increasing. So far, the IPv6 routing protocol for low power and lossy networks (RPL) is considered to ﬁt on IoT infrastructure for achieving the expected network requirements. While RPL meets the IoT network requirements quite well, there are some issues that need to be addressed, such as adaptability to network dynamics. This issue signiﬁcantly limits the use of RPL in many smart city application scenarios, such as emergency alerts with high tra ﬃ c ﬂows. As part of a smart city vision, IoT applications are becoming more diverse, which requires context-awareness in routing protocols to support the behavior of the network. To address this issue, we design an objective function that performs the route selection based on fuzzy logic techniques while using contextual information from the application. For this, we present a new context-oriented objective function (COOF) that comprises both nodes as well as link metrics. Further, we suggest two new routing metrics, known as queue ﬂuctuation index (QFI) and residual energy index (REI), which consider the status of queue utilization and remaining energy, respectively. The metrics used are designed to respond to the dynamic needs of the network. The proposed approach has been examined and evaluated in di ﬀ erent scenarios when compared to other similar approach and default RPL objective functions. Simulation experiments are conducted in Cooja network simulator for Contiki OS. The evaluation results show that COOF can cope with network dynamics and IoT-based smart city application requirements.


Introduction
The concept of smart city has become one of the major areas where the Internet of Things (IoT) is unanimously identified as core technology enabler for the development of future intelligent environment. Smart cities will soon provide citizens with useful information to help them to improve their quality of life and make important daily decisions. All of this valuable information can be made available to citizens through the public Internet. The concept of smart cities comes from the idea of using resources efficiently to provide citizens with a better living environment. The smart city vision can include various aspects, such as resource management, participatory governance, efficient mobility, sustainable environment, and quality of life [1]. There is still no clear and well-known definition of a smart city, but the ultimate goal is to more efficiently use resources and improve the quality of service delivery while reducing the operating costs. These objectives can be obtained through smart interaction by using innovative information and communications technologies (ICT) with the help of IoT, where smart objects play a crucial role. routes to meet specific application contexts. The metrics used are designed to respond to the dynamic needs of the network. • We propose a new routing metric called queue fluctuation index, which considers the queue utilization of a node. We utilize queue fluctuations that take the difference between the current queue length and the last-round queue occupancy into account.

•
We aim to put forward a simple conceptual context-aware system architecture for IoT based smart city applications. The hybrid architecture indicates the characteristic of the metric parameters.

•
We conduct extensive simulation tests to verify that COOF can adapt to network dynamicity and context changes than the default OFs.
The remaining of the paper is organized, as follows. Section 2 discusses the related research work. A brief description of the RPL protocol is presented in Section 3. In Section 4, we describe our proposed approach in detail. Section 5 presents the experiment setup and evaluates the performance of the proposed work in different scenarios and compares the results. Section 6 discusses the key aspects of the proposed work and future plan. Finally, in Section 7, we conclude the paper.

Related Works
In recent years, various routing protocols have been designed to take the importance of determining the path towards a destination for a communication network into account. In general, these protocols have been specifically designed for specific network environments and applications. RPL was standardized for 6LoWPAN networks bringing the concept of IoT into real life. Since then, many studies have evaluated the performance of RPL and they have suggested some improvements to potential shortcomings and open issues [13,14]. In the literature, many research works have carried out on various aspects of RPL based wireless sensor networks (WSNs), such as load balancing, energy conservation, QoS support, and protocol optimization [15]. However, context awareness in the LLN based IoT network is still a broadly unexplored research area. While RPL has substantially satisfied LLN's requirements for traditional WSN based applications, some subjects, such as context-aware routing to support IoT based smart city application requirements, are open for improvement. Many efforts have been made to design the objective function of RPL [16] while using a composite routing metric to meet routing requirements in a diverse application domain. The proposed OF enhancements differ in such a way that how they combine multiple metrics. Several mechanisms are adopted to combine the respective metrics. Some of the widely adopted mechanisms of metric composition are additive and lexical. [17]. However, all of them have positive and negative aspects. We have summarized the work that is focused on improving the RPL OFs while using the various metric composition techniques. The Taxonomy of objective function enhancements is as shown in Figure 1.
Topology construction and path selection in the RPL protocol is performed based on the OF. OF defines how a node calculates its rank and how to combine different metrics and constraints during the rank calculation process. However, the RPL specification [5] does not obligate using a specific objective function or set of rules. Therefore, you can achieve the specific application objective by manipulating the default objective function and its parameters. This flexibility allows for choosing different routing metrics during OF design, but combining the multiple metrics is not that easy. In [9], IETF RFC 6551 has presented a set of routing metrics and constraints used in OF, but it has not explained how to combine them. Therefore, it is the designer who makes the ultimate decision regarding which metrics to select or how to combine them into OF. Different implementations of RPL use different metrics, such as ETX, hop count, or a combination of both. For instance, the Contiki RPL implemented by Contiki OS uses MRHOF as the default OF and also implements OF0. As a result, in RPL scope, designing OFs according to the application and network needs is still an open issue. Topology construction and path selection in the RPL protocol is performed based on the OF. OF defines how a node calculates its rank and how to combine different metrics and constraints during the rank calculation process. However, the RPL specification [5] does not obligate using a specific objective function or set of rules. Therefore, you can achieve the specific application objective by manipulating the default objective function and its parameters. This flexibility allows for choosing different routing metrics during OF design, but combining the multiple metrics is not that easy. In [9], IETF RFC 6551 has presented a set of routing metrics and constraints used in OF, but it has not explained how to combine them. Therefore, it is the designer who makes the ultimate decision regarding which metrics to select or how to combine them into OF. Different implementations of RPL use different metrics, such as ETX, hop count, or a combination of both. For instance, the Contiki RPL implemented by Contiki OS uses MRHOF as the default OF and also implements OF0. As a result, in RPL scope, designing OFs according to the application and network needs is still an open issue.
In [18], the authors have presented hybrid (additive and lexical) composition mechanisms, which combines two routing metrics in order to optimize the network performance. The authors design primary metrics that capture network characteristics and holds the monotonicity property to build composite metrics to ensure varied application requirements. In the additive method, different metrics and their respective weights are combined in an additive manner to build a composite function, where the two components must maintain the same ordering relationship to ensure the validity of the composite metric. However, in a lexical approach, such strict order relation is not required. Unlike the additive approach, the lexical combination method provides clear prioritization of metrics. While using a lexical approach, a node selects the preferred parent that is based on the maximum or minimum value of the first referential routing metric. However, not all referential routing metrics can be made valid using this approach. The authors in [19] describe the problems of the additive based metric composition method and a new, chaotic genetic algorithm-based approach has been proposed to solve these problems.
The authors in [20] proposed an energy efficient and reliable composite metric for RPL networks. This composite metric takes both energy efficiency and reliability into account. Reliability is represented by the ETX metric, which aimed at selecting paths with good quality, and the energy metric aims to balance energy consumption between nodes in the network. The proposed composite metric is known as the lifetime and latency aggregateable metric (L2AM) and it enables protocol finding optimized routes. L2AM presents two methods for estimating the remaining energy of the In [18], the authors have presented hybrid (additive and lexical) composition mechanisms, which combines two routing metrics in order to optimize the network performance. The authors design primary metrics that capture network characteristics and holds the monotonicity property to build composite metrics to ensure varied application requirements. In the additive method, different metrics and their respective weights are combined in an additive manner to build a composite function, where the two components must maintain the same ordering relationship to ensure the validity of the composite metric. However, in a lexical approach, such strict order relation is not required. Unlike the additive approach, the lexical combination method provides clear prioritization of metrics. While using a lexical approach, a node selects the preferred parent that is based on the maximum or minimum value of the first referential routing metric. However, not all referential routing metrics can be made valid using this approach. The authors in [19] describe the problems of the additive based metric composition method and a new, chaotic genetic algorithm-based approach has been proposed to solve these problems.
The authors in [20] proposed an energy efficient and reliable composite metric for RPL networks. This composite metric takes both energy efficiency and reliability into account. Reliability is represented by the ETX metric, which aimed at selecting paths with good quality, and the energy metric aims to balance energy consumption between nodes in the network. The proposed composite metric is known as the lifetime and latency aggregateable metric (L2AM) and it enables protocol finding optimized routes. L2AM presents two methods for estimating the remaining energy of the nodes. However, for LLN networks with heterogeneous applications in terms of varied QoS requirement, it may not be adapted. Moreover, this approach focuses on distributed solutions to improve network lifetime, which might not be an obvious choice for heterogeneous networks under heavy and dynamic traffic scenarios, such as smart city networks. Besides, efficient resource utilization is an important aspect of heterogeneous networks, which is not included in L2AM.
The authors in [21] considered the unreliability and instability issues of RPL. The authors state that the instability in RPL might occur from the frequent route changes, which negatively impact on network performance. They further claimed that there are no metrics in the RPL scope, which indicates the stability of the nodes. Therefore, a new routing metric, called stability index (SI), has been proposed that takes advantage of the stability characteristics of nodes. SI relies on the control message transmission rate to estimate the stability of routing topology. Besides, this mechanism uses passive network layer to calculate the bi-directional ETX. However, this improvement is favorable for homogeneous networks and it does not consider heterogeneity character of the nodes, which is usual in smart city network infrastructure. In addition, traffic estimation on nodes is only possible in networks with symmetrical and bi-directional links, but this is not always reasonable.
In [22], the authors proposed a lexical composite based new energy-aware objective function, called (EAOF), for the RPL routing protocol. It selects the routes based on the combination of link ETX with residual energy to enhance the network lifetime. This study highlights the issue of energy efficiency and balance in RPL based biomedical wireless sensor networks. This issue is obvious, because the current RPL objective function does not use any energy-based routing metrics. Each node running EAOF selects the nodes that have lower ETX (reliable link) to the root (sink) from its neighbors. Subsequently, from this candidate parent subset, a node selects the best parent based on the maximum remaining energy. Even though EAOF attempt to address the energy consumption and reliability issue for medical application, it may not resolve the extensive resource constraints issue in heterogeneous network scenarios. It is because EAOF only considers the energy resource, which is not satisfactory for highly diverse and dynamic network scenarios, like the smart city concept.
The authors in [23] present the solution of long single-hop problem in MRHOF and OF0. They report that, as the number of nodes in the network increases, both OFs introduce long-hops, causing bottlenecks that limit the network. To solve the long-hop problem in RPL, a new routing metric, called SIGMA-ETX, has been proposed and optimizes both MRHOF and OF0. A composite metric SIGMA-ETX is designed by combining the ETX and min hop count metrics while using the standard deviation of ETX among each node. Although this metric combination mechanism ensures better routing performance in large scale network, it is unclear that, in heterogeneous network scenarios, like smart city, how it addresses the resource constraints issue with SIGMA-ETX metric. Another key issue with this approach is that the monotonicity property of the rank calculation. The SIGMA-ETX metric might violate this property, which results in a high risk of loop formation in the network.
The fuzzy logic-based RPL objective functions have also been presented in some studies. The authors in [24] highlighted that the combination of only two routing metrics might be unable to fulfill the requirement of the multi-purpose network as the network might have different applications with different performance objectives. To deal with this matter, the authors point out the comprehensive objective function should be designed that combine multiple routing metrics to optimize different application requirements. To achieve this goal, the authors presented a new QoS-aware fuzzy logic-based objective function, called OF-FL. It works with fuzzy logic and forms a configurable routing scheme while using fuzzy parameters. Similar to other OF, a node that receives a DIO message executes the fuzzy process to compute the rank. OF-FL incorporates four different routing metrics such as link quality, hop count, end-to-end delay, and node energy, to optimize the parent selection process. OF-FL considers various network aspects during the route construction phase.
In [25], the authors present a fuzzy sets-based cluster RPL called FC-RPL to prolong the network lifetime. FC-RPL operation has three different subsequent phases, the cluster formation phase, cluster head selection phase, and cluster head parent selection phase. Based on the Euclidean distance, the clusters are formed. To select the cluster head for each cluster, it applies the fuzzy set to three metrics, such as centrality, number of neighbors, and residual energy. A similar fuzzy-based approach for energy efficiency in LLN is presented in [26]. The authors propose fuzzy logic based energy aware routing protocol, called FLEA-RPL. It includes three routing metrics, ETX, Load, and residual energy (RER), to select the best path towards the root for efficient data delivery.
Another similar fuzzy logic based method for combining the different routing metrics is proposed in [27]. Unlike [24][25][26], the proposed fuzzy inference method has adopted the two-stage fuzzy process and it includes three routing metrics, namely energy, delay, and ETX. The first stage of the fuzzy process combines both ETX and delay metrics in order to compute QoS. Later, this QoS value is taken as input for the next stage of the fuzzy process and combined with the energy metric. Another similar fuzzy based approach has been followed in [28]. The authors in [29] also adopted a similar fuzzy process to design multiple objective functions for RPL. Four different OFs are designed to use in one application. According to the requirements of the application, these objective functions are substituted to construct the DODAG. Dynamically changing the OFs is based on the context of the application. To classify the best route using fuzzy logic rules, it uses three routing metrics that is the number of hops (NH), energy consumed (EC), and ETX. All of these metrics that are used in four different OFs are specified in the default RPL specification and are based on the application requirements, these metrics are classified, and prioritize accordingly. In addition, out of the four proposed OFs, only one objective function (DQCA-OF4) combines all three metrics in order to classify the best route. It indicates that other OFs might not ensure the decision making of the best route because fuzzy inference system requires three input variables (NH, EC, and ETX) to estimate the degree of quality of the routes. In terms of a fuzzy process and context-based information, this approach is close to our proposal. However, some design characteristic of RPL is distinct in our proposition. For instance, we use a single objective function in one RPL Instance. Adopting multiple OFs in single RPL Instance might not be a viable approach for heterogeneous network [5,15]. Besides, the routing metrics that were considered by these two fuzzy-based systems are not the same. Unlike [29], COOF proposes a new RPL compliant routing metric called queue fluctuation index (QFI). Another metric, called the residual energy index (REI), is defined in a way that it indicates the status of residual energy of nodes recursively. Both of the metrics are representative of the node's resource availability, and their information is carried as node state object and energy object, respectively, in the DIO message. The common metric used by both the fuzzy system is ETX. However, we obtain the average ETX by using a sliding window-based averaging method. Using four different OFs in a single RPL Instance may result in more latency, especially in the heterogeneous network and it may not work effectively in emergency response application of smart city vision.
There are also some other enhancements on RPL objective functions, in which metric composition is based on Game Theory [30] and MCDM [31]. These improvements are basically for congestion control in LLNs. Different routing metrics are used to calculate the rank of a node in a network. Each child node uses a potential game theory-based strategy to select the best parent. Similarly, the parent selection process can be developed as a multi-criteria decision making (MCDM) problem by combining different routing metrics.
In the IoT paradigm, context-aware communication is a salient technique that enables intelligent interactions between applications and devices [32]. Context awareness is a process in which context information is treated as an evaluation attributes. As described in [32], these contexts can be divided into several groups of awareness, such as resource state, information, privacy, QoS, and mobility. Moreover, context can be used to determine what services and information need to be presented to the user. Many research papers in the literature concentrate on efforts to deal with the issue of context-sensitivity of IoT applications [33]. In regards to context awareness, the authors in [34] have proposed a scalable context-aware objective function (SCAOF) that adapts the RPL for the environmental monitoring in the agricultural sector with contextual facts. It is designed according to the composite routing metrics approach by combining the reliability-aware, robustness-aware, resource-aware, and energy-aware contexts. The testbed experiments confirm that SCAOF can prolong network lifetime as well as improve the QoS of agriculture-oriented applications. However, each node running SCAOF has to pass a relatively large number of parameters in the DIO message header, which increases the risk of layer-2 fragmentation. This obligation makes resource-constraint devices prone to resource depletion.
However, most of the above-mentioned objective function enhancements does not consider the context awareness in RPL routing mechanism. Communicating with a set of IoT devices that share the context is essential in smart city vision. In this backdrop, context-sensitive computing is now considered to be an important component of IoT, so it has become more relevant in the research community and market. It is because context-sensitive systems can adjust behavior to the current situation without user's intervention. This relevance motivated the authors to suggest the state-of-art approach to improving the RPL. Furthermore, SCAOF takes into account the composite routing metrics approach in the path selection process; therefore, we include it in the comparative analysis that was performed in this work along with RPL.

IPv6 Routing Protocol for Low Power and Lossy Networks (RPL)
RPL, standardized by IETF, is a distance vector routing protocol for LLNs that is compliant with the 6LoWPAN protocol that makes use of IPv6. It operates at the network layer and supports several link-layer technologies, such as ZigBee, Bluetooth low energy (BLE), and IEEE 802. 15.4. In this section, we present brief RPL mechanisms and features.

Support of Routing Metrics and Constraints
The routing metrics can be a node or link-based. In general, the node-level metrics take the current state of the node into account. Typically, this state includes resources, like remaining energy, available memory, etc. As RPL specification does not have any obligation for using metric, rather it is open to choose the metrics that best suit the application requirements. Therefore, it is undesirable to adopt the same single metric or a combination of metrics for all applications, because, in the IoT network, diverse applications may exist with different requirements. Furthermore, a constraint in RPL, as an additional criterion, can be used for the pruning of links or nodes from a path, for instance, ignoring the nodes that have remaining energy below a certain threshold.

DODAG Construction
As described in [5], in the network, each device running RPL can be connected in a manner where no cycles are present. To achieve this, in RPL, topology is constructed and maintained through a destination oriented directed acyclic graph (DODAG), known as DODAG root. In a DAG structure, unlike a traditional tree, one node can have multiple parent nodes. The topology construction process starts at the DODAG root, also commonly known as the LoWPAN border router (LBR). RPL specifies a set of internet control message protocol version 6 (ICMPv6) messages for exchanging topology related information. Typically, RPL uses four types of ICMPv6 control messages. Table 1 enlists these control messages and their respective functions. The DODAG root starts broadcasting the information about the network while using the DIO message to build a new DAG. Upon receiving the message, neighboring nodes decide according to their OF and local policy (DAG characteristic, the cost of the path announced) whether to join the DODAG or not. Once the node decides to join the network, it has a path toward the DODAG root, and then the DODAG root is termed as the 'parent' of the node. Later, each node computes its rank within the tree structure and then checks if the rank is greater than every listed parent. If the node is not configured as a router, it simply joins to the network and it does not broadcast DIO message, commonly referred to as 'leaf node'. However, if the node is configured as a router, it will start broadcasting DIO message to all neighboring peers with the updated information. Neighboring nodes repeat this process until all of the nodes in the network participate in DODAG to form a tree topology. If a node does not receive a DIO message within a definite time, it sends a DIS message to request a DIO message from a neighboring node. Finally, in this construction, each node of the DODAG has routing entry to its parent, through which the leaf nodes can send its data packet towards the DODAG root in a hop-by-hop manner.
In RPL specification, two types of routes are defined that are upward and downward routing. The upward routing is a standard process that enables nodes to send data toward a root. It is also known as the multipoint-to-point (MP2P) forwarding model, where the traffic flows upward from the non-root node to the root. However, to create downward routes, DAO messages are used by the non-root nodes to advertise prefix reachability towards the leaf nodes. Unlike MP2P, the point-to-multipoint (P2MP) model supports traffic flows in the opposite direction that is toward the leaf nodes. Each node that joins the network sends a DAO message to its immediate parent set. Upon receiving the DAO, each parent node appends the routing entry in the routing table and then sends a DAO to its parents. This procedure continues until the information reaches the DODAG root. This operation comes under the "storing" mode of operation. It should be noted that RPL defines two modes of operation for downward routing in the DODAG, which is "storing" i.e., table-driven and "non-storing" i.e., source routing. In addition, the RPL protocol also supports traffic from one node to another node in the DODAG network, which is referred to as point-to-point (P2P) communication. For more detail, refer to [5]. Figure 2 depicts the details of constructing upward and downward routing.
The DODAG root starts broadcasting the information about the network while using the DIO message to build a new DAG. Upon receiving the message, neighboring nodes decide according to their OF and local policy (DAG characteristic, the cost of the path announced) whether to join the DODAG or not. Once the node decides to join the network, it has a path toward the DODAG root, and then the DODAG root is termed as the 'parent' of the node. Later, each node computes its rank within the tree structure and then checks if the rank is greater than every listed parent. If the node is not configured as a router, it simply joins to the network and it does not broadcast DIO message, commonly referred to as 'leaf node'. However, if the node is configured as a router, it will start broadcasting DIO message to all neighboring peers with the updated information. Neighboring nodes repeat this process until all of the nodes in the network participate in DODAG to form a tree topology. If a node does not receive a DIO message within a definite time, it sends a DIS message to request a DIO message from a neighboring node. Finally, in this construction, each node of the DODAG has routing entry to its parent, through which the leaf nodes can send its data packet towards the DODAG root in a hop-by-hop manner.
In RPL specification, two types of routes are defined that are upward and downward routing. The upward routing is a standard process that enables nodes to send data toward a root. It is also known as the multipoint-to-point (MP2P) forwarding model, where the traffic flows upward from the non-root node to the root. However, to create downward routes, DAO messages are used by the non-root nodes to advertise prefix reachability towards the leaf nodes. Unlike MP2P, the point-to-multipoint (P2MP) model supports traffic flows in the opposite direction that is toward the leaf nodes. Each node that joins the network sends a DAO message to its immediate parent set. Upon receiving the DAO, each parent node appends the routing entry in the routing table and then sends a DAO to its parents. This procedure continues until the information reaches the DODAG root. This operation comes under the "storing" mode of operation. It should be noted that RPL defines two modes of operation for downward routing in the DODAG, which is "storing" i.e. table-driven and "non-storing" i.e. source routing. In addition, the RPL protocol also supports traffic from one node to another node in the DODAG network, which is referred to as point-to-point (P2P) communication. For more detail, refer to [5]. Figure 2 depicts the details of constructing upward and downward routing.  The function of one or more DODAGs that provide a specific objective is known as RPL Instance. A single network can use multiple RPL Instances concurrently to meet different application criteria, and each RPL Instance can provide different and potentially antagonistic criteria. Within a network, a unique identifier, called Instance_ID, identifies each RPL Instance. To distinguish DODAGs in an RPL Instance, each DODAG is recognized by a unique identifier called DODAG_ID. Each node can only join a particular DODAG within an RPL Instance, but it can be associated with the several RPL Instances simultaneously. Figure 3 shows the DAG structure that enables two RPL instances. criteria, and each RPL Instance can provide different and potentially antagonistic criteria. Within a network, a unique identifier, called Instance_ID, identifies each RPL Instance. To distinguish DODAGs in an RPL Instance, each DODAG is recognized by a unique identifier called DODAG_ID. Each node can only join a particular DODAG within an RPL Instance, but it can be associated with the several RPL Instances simultaneously. Figure 3 shows the DAG structure that enables two RPL instances.

Proposed Approach
In this proposition, the improvement of the objective function in RPL is to optimize routing to meet the context requirements of IoT based smart city application. In this section, we describe the following regarding the proposed approach: metric formulation, context-oriented objective function with fuzzy logic based route selection framework, and context-aware system architecture.
The primary purpose of any IoT application is to enable the end users to seamlessly access information and services. Sensors, actuators, and smart objects must, therefore, be aware of the primary purpose of the underlying application. Context is any information that can be used to characterize the situation of an entity, in which an entity can be a place, person, an object, which is involved in the interaction between the user and the application. Therefore, the contextual information is used as a parameter for a given application. In our proposition, we have taken smart devices as entities. Using context-awareness, we want to enhance the routing process in RPL. In resource-constrained devices, the queue size is generally small, therefore, with high data traffic, small queues start to overflow before link loss, because traffic backlog becomes heavy enough to be detected while using ETX. [12]. Therefore, even though ETX generally reasonably evaluates link conditions, using merely ETX is not enough to understand the network situation. Thus, we need to combine other metrics that are related to the node buffer, which allows for monitoring both link dynamicity and node status.
As explained in [22,24,27,31,[34][35][36], there are also other routing metrics used for a different purpose. However, none of them take into account the difference between the current queue length and the last-round queue occupancy. Besides, the previous states of the node are not considered during the path selection process. When considering this fact, we proposed a new context-oriented OF, called COOF. This COOF recursively examines the last state of a node on the path to the root. Besides the OF also consider the link as well as nodes situation at the time of route construction.

Proposed Approach
In this proposition, the improvement of the objective function in RPL is to optimize routing to meet the context requirements of IoT based smart city application. In this section, we describe the following regarding the proposed approach: metric formulation, context-oriented objective function with fuzzy logic based route selection framework, and context-aware system architecture.
The primary purpose of any IoT application is to enable the end users to seamlessly access information and services. Sensors, actuators, and smart objects must, therefore, be aware of the primary purpose of the underlying application. Context is any information that can be used to characterize the situation of an entity, in which an entity can be a place, person, an object, which is involved in the interaction between the user and the application. Therefore, the contextual information is used as a parameter for a given application. In our proposition, we have taken smart devices as entities. Using context-awareness, we want to enhance the routing process in RPL. In resource-constrained devices, the queue size is generally small, therefore, with high data traffic, small queues start to overflow before link loss, because traffic backlog becomes heavy enough to be detected while using ETX. [12]. Therefore, even though ETX generally reasonably evaluates link conditions, using merely ETX is not enough to understand the network situation. Thus, we need to combine other metrics that are related to the node buffer, which allows for monitoring both link dynamicity and node status.
As explained in [22,24,27,31,[34][35][36], there are also other routing metrics used for a different purpose. However, none of them take into account the difference between the current queue length and the last-round queue occupancy. Besides, the previous states of the node are not considered during the path selection process. When considering this fact, we proposed a new context-oriented OF, called COOF. This COOF recursively examines the last state of a node on the path to the root. Besides the OF also consider the link as well as nodes situation at the time of route construction.
We considered serval routing metrics as being representative of different application requirement. These metric values are used as context parameters to select the optimum route that can forward data traffic to ensure the QoS level that is required for a particular application. The paper in [12] shows that queue utilization correlates with packet loss. Therefore, queue fluctuation is the core metric that represent node status and are useful for reducing packet loss. Moreover, along with queue utilization, the energy metric is also used to consider the node's status. On the other hand, the ETX is used to represent the link status of the network. These routing metrics are used for defining an OF based on a fuzzy logic technique, which is as follows: Expected Transmission Count (ETX): it is defined as the expected number of transmissions required by a data packet to be successfully delivered on a wireless link. ETX is an additive link reliability metric that appends ETX of each link in the path. ETX is considered to be a reliable indicator of link quality between the nodes. As the ETX value decreases, link quality improves, so ETX value close to one render the best communication link. Thus, it obtains the high-throughput path in multi-hop wireless networks and known as a reliability metric [37]. In our proposal, it is calculated every second as in Equation (1). We use a sliding window-based average with a window size of four seconds to obtain the average ETX at the node.
where, d ij represents the measured probability that a packet is received successfully by the neighbor node and d ji represents the measured probability that the acknowledgment packet is received successfully. As a queue fluctuation, the difference between the current queue length and last round queue utilization is considered. We define the state of the nodes based on the queue fluctuation. It is an important routing metric, because data packet spent in the queue impacts the packet delivery ratio and end-to-end packet delivery delay. Since some IoT based smart city applications (patient monitoring, real-time application) do not perform well if delay is larger than predefined threshold.
As explained, the smart city networking is typically characterized by the heterogeneity of networks and these networks present multi-service that provides more than one application or service. This indicates not only the presence of several traffic types within the network, but also the large and sudden surge of data. As a result, a high data generation rate is often uncontrolled and it leads to congestion in response to queue fill up. Thus, queue fluctuations can be a simple indication of traffic trends (how a node's queue grows or shrinks) and reflect the situation of a congested node in terms of occupied buffer space. The queue length information is recorded in per unit time t, in which the information indicates the changing tendency of the traffic load and it is calculated based on the sliding window. We assume that, at any time, each LLN device is able to compute its queue length. We define the queue fluctuation as in Equation (2).
In which ζ(n) denotes the ratio of the queue length fluctuation of a node n. Where, Q cur represent the current queue length of a node n, Q lst represent the last round queue length of a node n, Q mx represent the max queue length of a node. The queue length fluctuation of a node is set to zero only if it satisfies the condition Q cur (n) = Q mx (n) at a node n. In fact, the ratio of the queue fluctuation reflects the trend of the queue length. The larger value of ζ(n) indicates the higher queue overflow probability.
where, φ(n) is the dynamic traffic indicator in the network. It indicates the traffic tendency during last m times for ζ(n). P n represents the parent of a node n. The m value is a design parameter that can be based on resources in the network. During the simulation tests, we consider m as the queue utilization counter within a certain time. In our experiment, the value of m is set to 6, while taking into account the resource of the Tmote sky node. Finally, the queue fluctuation index (QFI) is obtained as in Equation (5).
where, α is the weight factor, such that 0 < α < 1, and used to prioritize the current measurement of the queue. The QFI metric is used to avoid selecting a parent node with limited resources. In the context of resource availability, we define three states depending on the QFI: High, Medium, and Low.
The residual energy index (REI) is an energy metric that allows for us to make a wise decision by providing a better understanding of the network situation. Considering the residual energy for the nodes in the OF will be useful in terms of network lifetime, since it is essential for all applications. The REI of a node n is defined, as in Equation (6).
where, E max (n) is the maximum energy level of a node n initially. E cur (n) is the current energy level of a node n. The E cur (n) of a node can be obtained based on the energy consumptions during the different operating states of the node. These states are as follows: transmission (T x ), reception (R x ), CPU (processing), and LPM (low power mode). The LPM state is typically known as sleep mode. The Contiki operating system [38] uses an energy estimation unit, known as Energest to obtain information regarding how long a system has been in various states. In addition, the power that is consumed by these states can be obtained through the datasheet of the CC2420 chipset. Finally, the E cur (n) of a node n based on each state over time is obtained, as shown in Equation (7).
where, T state is the time duration the node spent in each state. P state represents the corresponding power that is consumed in that state in a certain time unit. The REI (n) is for current node where n = DODAG root. The following context correlation is used in order to consider the residual energy of a node in a recursive way, reducing the influence of the parent's residual energy. The REI (n), for the current node, where n DODAG root, is obtained, as in Equation (8).
where, β is the smoothing factor used to reduce the influence of the parent's residual energy on the routing. In our experiment, the value of β is set to 0.35, so that the power depletion does not affect greatly in the network. As the value of the smoothing factor β close to zero, the smoothing effect increases during the experiments.

Combining of Routing Metrics
The objective function that is based on the single metric may not entirely meet the requirements of the diverse applications. We have defined three routing metrics to consider in COOF design. With COOF, each node can select a preferred parent (optimal path) based on context information that was obtained from the application. Each metric describes the important attributes of a neighbor node that can serve as a parent. Therefore, these attributes contributing to the formation of a path towards the root. In the parent selection problem, we use the fuzzy logic technique as a decision-making framework. The use of intelligent computing to support decision making is widely used in recent studies in the low power and lossy networks. For IoT based smart city application requirements, our proposed OF determines the best parent from the candidate parent set in an efficient way using the fuzzy logic technique.
The basic concept of fuzzy logic system is that a variable can belong to a set that lies between true and false. Instead of using numerical values, a linguistic variable is an input or output variable whose value is a word or sentence. For example, in our proposition, as input, the linguistic variable of the ETX metric is a member of three sets according to the information that was obtained at a node through a DIO message: 'Short', 'Average', and 'Long'. Figure 4 shows the membership function for the fuzzy variable ETX. In general, the membership value for the respective fuzzy variable is determined based on several trialing [39]. Simulation tests determine the minimum, maximum, and average values of these variables experimentally. The key points of the membership function can be computed based on the upper limit of the network criterion. In this work, the maximum ETX value is determined as 15. As depicted in Figures 4-6 root. In the parent selection problem, we use the fuzzy logic technique as a decision-making framework. The use of intelligent computing to support decision making is widely used in recent studies in the low power and lossy networks. For IoT based smart city application requirements, our proposed OF determines the best parent from the candidate parent set in an efficient way using the fuzzy logic technique. The basic concept of fuzzy logic system is that a variable can belong to a set that lies between true and false. Instead of using numerical values, a linguistic variable is an input or output variable whose value is a word or sentence. For example, in our proposition, as input, the linguistic variable of the ETX metric is a member of three sets according to the information that was obtained at a node through a DIO message: 'Short', 'Average', and 'Long'.  Figure 4 shows the membership function for the fuzzy variable ETX. In general, the membership value for the respective fuzzy variable is determined based on several trialing [39]. Simulation tests determine the minimum, maximum, and average values of these variables experimentally. The key points of the membership function can be computed based on the upper limit of the network criterion. In this work, the maximum ETX value is determined as 15. As depicted in Figures 4-6   true and false. Instead of using numerical values, a linguistic variable is an input or output variable whose value is a word or sentence. For example, in our proposition, as input, the linguistic variable of the ETX metric is a member of three sets according to the information that was obtained at a node through a DIO message: 'Short', 'Average', and 'Long'.  Figure 4 shows the membership function for the fuzzy variable ETX. In general, the membership value for the respective fuzzy variable is determined based on several trialing [39]. Simulation tests determine the minimum, maximum, and average values of these variables experimentally. The key points of the membership function can be computed based on the upper limit of the network criterion. In this work, the maximum ETX value is determined as 15. As depicted in Figures 4-6   The membership functions of a fuzzy logic system are used to quantify the linguistic relations. Numerous membership function, such as sigmoid, Gaussian, and triangular, are defined in the fuzzy system to be used in the fuzzification and defuzzification process [39]. However, the most common form of membership used in fuzzy system is trapezoidal. The membership function relates the value in the interval of [0-1] and it is computed by the membership function. Three sets of each input variables are as follows: The membership functions of a fuzzy logic system are used to quantify the linguistic relations. Numerous membership function, such as sigmoid, Gaussian, and triangular, are defined in the fuzzy system to be used in the fuzzification and defuzzification process [39]. However, the most common form of membership used in fuzzy system is trapezoidal. The membership function relates the value in the interval of [0-1] and it is computed by the membership function. Three sets of each input variables are as follows: After the fuzzification step, the next important step is the fuzzy inference, which is used to combine the fuzzy rules from the rule base. After establishing all the rules, the defuzzification will be the next step. It is the process of producing a fuzzy output value from the given fuzzy sets and corresponding membership degrees to produce a crisp value. In our defuzzification step, we use centroid defuzzifier. It is the most commonly used method that returns the center of gravity of the fuzzy set. We determine the membership function of each output variable of parent quality, as shown in Figure 7. The output of the defuzzifier can be obtained while using Equation in (12).
where, θ r is the output of the rule r and µ r is the output product-inference engine (membership function). After defuzzification, the output of the fuzzy logic system Q becomes the crisp value. The membership functions of a fuzzy logic system are used to quantify the linguistic relations. Numerous membership function, such as sigmoid, Gaussian, and triangular, are defined in the fuzzy system to be used in the fuzzification and defuzzification process [39]. However, the most common form of membership used in fuzzy system is trapezoidal. The membership function relates the value in the interval of [0-1] and it is computed by the membership function. Three sets of each input variables are as follows: After the fuzzification step, the next important step is the fuzzy inference, which is used to combine the fuzzy rules from the rule base. After establishing all the rules, the defuzzification will be the next step. It is the process of producing a fuzzy output value from the given fuzzy sets and corresponding membership degrees to produce a crisp value. In our defuzzification step, we use centroid defuzzifier. It is the most commonly used method that returns the center of gravity of the fuzzy set. We determine the membership function of each output variable of parent quality, as shown in Figure 7. The output of the defuzzifier can be obtained while using Equation in (12).   (12) where, θr is the output of the rule r and μr is the output product-inference engine (membership function). After defuzzification, the output of the fuzzy logic system Q becomes the crisp value.
The route selection process of COOF is based on the fuzzy logic system, as shown in Figure 8. Where the input variable sets are ETX, QFI, and REI. The route selection process of COOF is based on the fuzzy logic system, as shown in Figure 8. Where the input variable sets are ETX, QFI and REI. In the path selection process, the fuzzy rules govern the combination of three different metrics that represent input fuzzy sets, as shown in Figure 8. In our fuzzy system, three input fuzzy controller with three membership function for each input exists, therefore our rule base consists of 3

27
= rules. The knowledge base consists of two components, database and rule base. The database component consists of linguistics terms for each variable and membership. Moreover, it also contains the objective function attributes and local policy. The rule base components relate the inputs to their outputs for the decision making of linguistic terms. Moreover, the rule base plays an important role in generating the results that were produced by the inference engine through the In the path selection process, the fuzzy rules govern the combination of three different metrics that represent input fuzzy sets, as shown in Figure 8. In our fuzzy system, three input fuzzy controller with three membership function for each input exists, therefore our rule base consists of 3 3 = 27 rules.
The knowledge base consists of two components, database and rule base. The database component consists of linguistics terms for each variable and membership. Moreover, it also contains the objective function attributes and local policy. The rule base components relate the inputs to their outputs for the decision making of linguistic terms. Moreover, the rule base plays an important role in generating the results that were produced by the inference engine through the mapping of the inputs to outputs. It is worth mentioning that all of the information obtained from a node is received through a DIO message. The fuzzy inference engine uses this information to determine the quality of the path. Table 2 shows a few rules that have been formulated according to the criteria, as well as based on application scenarios. In addition, the table also contains the output fuzzy variable, which indicates the path quality, and this quality consists of five fuzzy sets from 'Excellent' to 'Bad'. The last column of Table 2 shows the quality variable, which is a fuzzy output variable, and the route selection is performed based on this quality variable. In the fuzzy rule, we define the 'Excellent' path quality to the candidate parent node that has high link quality, short queue fluctuation, and high remaining energy. Hence, based on this quality indicator, a node will decide through which parent node, data should be transmitted towards the root. The proposed parent selection framework can be used for other similar IoT infrastructure in different application domains. For this, according to the application requirements, the fuzzy input variables (ETX, QFI, REI) values can be customized based on different scenarios, such as network structure and device capability. Besides, the fuzzy rules and fuzzy sets are used according to the application requirements and device processing capability [40]. Hence, the membership function of the quality classes can be consist of more than five. The fuzzy rule that was applied in our OF indicates that a node must forward data through the highest quality path by perceiving context-information contained in the data repository.

Conceptual Context-Aware System Architecture
The contextual interpreter on the node confirms the context by collecting data (sensed and context information) from various sources and splitting the composite attributes into the basic attributes. We propose the use of simple context-aware system architecture in order to access various information and adjusting complexity in information gathering, managing, processing and disseminating, as shown in Figure 9.
The context-analyzer manages low-level communications with context sources and provides source discovery and configuration services. The context source uses the data repository to describe itself in terms of identity, attributes, and functionality. The context analyzer preprocesses raw context data into advanced context information events. It also analyzes the nodes' status, such as battery level. Based on the information that was supplied by the context-analyzer, context events are prepared: sensed phenomena and node position. The context monitoring captures the relevant concepts and relationships that were required by the applications. It abstracts the raw data collected from the context information source. These raw data may need to be pre-processed to obtain the forms defined by the situation analyzer. After being pre-processed, this raw data should provide the necessary high-level context information. The smart devices that generates data in the application layer that is based on the context (QoS, delay, reliability) that are analyzed by the functional model of COOF.
1 Figure 9. A simple functional context model of context-oriented objective function (COOF).

Performance Evaluation and Results
In this section, we evaluate and analyze the performance of the proposed work. This approach requires different scenarios to extensively investigate its behavior. Therefore, to validate that COOF can quantitatively improve RPL performance in LLNs, we examine the proposed work through multiple simulation trials. In addition, to verify that COOF is suitable for heavy and dynamic traffic scenarios, we compare COOF against that of the existing related approach SCA-OF [34] and default RPL OFs [10,11].

Network Scenario and Simulation Environment Settings
The proposed approach is designed for IoT-based smart city networks that take high and dynamic traffic conditions into account. Such heavy and dynamic traffic may arise from emergency situations, such as emergency alerts. Therefore, the simulation network scenario includes application attributes of emergency monitoring, such as chemical leakage in the industry and healthcare monitoring in the hospital. By deploying the sensor nodes and smart embedded devices in the monitoring area, the emergency monitoring network can be built to regularly response about unusual situations. It should be emphasized that the proposed approach is designed not only for emergency monitoring in hospital and industry, but also for other similar IoT applications in smart city vision.
For simulation testing, the Tmote sky devices were configured with a CC2420 wireless transceivers, which are IEEE 802.15.4 compliant devices with a data transfer rate of 250 kbps. The network topology is static, and 25 devices were deployed in the network field, including LLN border router (LBR). The proposed work was implemented in the Contiki 2.7 operating system [38]. It is an open-source operating system that is designed for resource-constrained devices of IoT. The simulation tests were conducted in Cooja simulator [41]. It is a Java-based cross-layer simulator of Contiki OS. Moreover, we used constant bit rate (CBR) traffic flow, and each packet size was 40 bytes. During the test, each simulation run lasts for 10 min. Over the simulation period, the source node was freely selected for each simulation test and kept them stable. In our simulation experiments, we have set α = 0.4. All lf the simulation tests were run in 10 iterations to avoid random errors. Finally, the average result has been extracted and presented. Table 3 shows the remaining simulation parameter.

Performance Analysis
Packet reception ratio: the number of packet received by the root node per unit time. We set the inter packet interval to two seconds and evaluate the packet reception ratio (PRR) with respect to different transmission success ratio (Tx) and receiving success ratio (Rx). For this, we only consider data packets. Congestion may occur on a parent node because of high and dynamic traffic flow from many sensing devices. Consequently, the data packets may drop due to queue limitation. The backlog situation leads to a smaller number of data packets being received at the root node and, hence, the packet reception ratio declines. Figure 10a shows the packet reception ratio of OF0, MRHOF, SCAOF, and COOF with respect to the Tx/Rx ratio. It can be seen that the packet reception ratio is high under high transmit success ratio and receive success ratio. The result shows that the packet reception ratio of all objective functions is gradually increasing with the increasing of the Tx/Rx ratio. However, COOF achieves the higher packet receiving ratio than others under high and dynamic traffic scenarios. Conversely, as compared to COOF, SCAOF, and MHROF, OF0 lost most of the packets in the buffer. It is expected because OF0 does not include the link quality metric in the path selection process. On the other hand, in COOF, along with link quality metric, queue utilization and energy metric are also taken into account, during path selection. As transmit and receive success ratio reflect the quality of the link in the network. Therefore, when Tx/Rx is low, the quality of the link is poor, and thus the re-transmission of the packet causes the packet loss problem, and hence a decrease in packet receiving rate.
Additionally, we analyze the packet receiving ratio in terms of the varying packet arrival interval. For this, the varied time interval is offered. Figure 10b depicts the tendency of packet receiving ratio in the network, where it increases with the increased packet arrival interval. As compared to others, COOF achieves the higher packet receiving ratio in high and dynamic traffic scenarios. Furthermore, it maintains the minimum and maximum packet receiving ratio of 56.9% and 94.2%, while SCAOF maintains 54.2% and 80.2%, respectively. On the other hand, OF0 severely reduces packet receiving ratio when packet arrival interval decreases and it reaches a minimum of 39.6%. However, COOF is 14% and 22% better than SCAOF and MRHOF, respectively. Meantime, it is also resilient against the steady growth of data traffic. Therefore, at high traffic dynamicity, COOF achieves high packet receiving ratio by effectively using the network resources.
scenarios. Furthermore, it maintains the minimum and maximum packet receiving ratio of 56.9% and 94.2%, while SCAOF maintains 54.2% and 80.2%, respectively. On the other hand, OF0 severely reduces packet receiving ratio when packet arrival interval decreases and it reaches a minimum of 39.6%. However, COOF is 14% and 22% better than SCAOF and MRHOF, respectively. Meantime, it is also resilient against the steady growth of data traffic. Therefore, at high traffic dynamicity, COOF achieves high packet receiving ratio by effectively using the network resources. Packet loss ratio: it is the ratio of the total number of data packets lost due to the queue limitation to the total number of data packet sent. Figure 11a depicts the comparison of the packet loss ratio with respect to the Tx/Rx among different OFs. The result shows that the packet loss ratio decreases as the Tx/Rx ratio increases. However, as compared to other, COOF loses fewer packet due to the queue limitation. It is obvious, because COOF takes into account queue fluctuation index metric to properly handle the queue overflow issue on a node. At the low Tx/Rx ratio, 50%, the packet loss ratio of OF0, MRHOF, SCAOF, and COOF are about 89.4%, 79.6%, 71.2%, and 60.7%, respectively. In addition, Figure 11b shows the packet loss ratio with respect to the inter packet arrival interval. When the packet arrival time is short, COOF can handle the packet in the queue effectively and reduces the packet loss ratio. In particular, when the packet arrival interval is 1 and 2 second, COOF reduces the packet loss ratio by approximately 10.9% as compared to SCAOF. The reason for the performance improvement of COOF is that it reacts more accurately to dynamic traffic than others. Packet loss ratio: it is the ratio of the total number of data packets lost due to the queue limitation to the total number of data packet sent. Figure 11a depicts the comparison of the packet loss ratio with respect to the Tx/Rx among different OFs. The result shows that the packet loss ratio decreases as the Tx/Rx ratio increases. However, as compared to other, COOF loses fewer packet due to the queue limitation. It is obvious, because COOF takes into account queue fluctuation index metric to properly handle the queue overflow issue on a node. At the low Tx/Rx ratio, 50%, the packet loss ratio of OF0, MRHOF, SCAOF, and COOF are about 89.4%, 79.6%, 71.2%, and 60.7%, respectively. In addition, Figure 11b shows the packet loss ratio with respect to the inter packet arrival interval. When the packet arrival time is short, COOF can handle the packet in the queue effectively and reduces the packet loss ratio. In particular, when the packet arrival interval is 1 and 2 second, COOF reduces the packet loss ratio by approximately 10.9% as compared to SCAOF. The reason for the performance improvement of COOF is that it reacts more accurately to dynamic traffic than others. Average end-to-end delay: It represents the average time difference between the time when the data packet was sent and the time when the data packet was received at the root node. The average end-to-end delay has been evaluated under different inter-packet interval, as shown in Figure 12. The result shows that, as compared to other, COOF achieves the lowest packet delivery delay. The average delay in OF0 is significantly greater than MRHOF, SCAOF, and COOF. It was obvious, because OF0 could not deliver data packets on time and it has to be in the queue for a long time when there was heavy traffic. In contrast, the COOF can handle the traffic dynamicity efficiently and it performs better. When data traffic is high, COOF is aware of resources in terms of queue utilization, and thus traffic is routed through the less congested parent node. As a result, the packets are not queued in the node's buffer for a long time. Average end-to-end delay: It represents the average time difference between the time when the data packet was sent and the time when the data packet was received at the root node. The average end-to-end delay has been evaluated under different inter-packet interval, as shown in Figure 12. The result shows that, as compared to other, COOF achieves the lowest packet delivery delay. The average delay in OF0 is significantly greater than MRHOF, SCAOF, and COOF. It was obvious, because OF0 could not deliver data packets on time and it has to be in the queue for a long time when there was heavy traffic. In contrast, the COOF can handle the traffic dynamicity efficiently and it performs better. When data traffic is high, COOF is aware of resources in terms of queue utilization, and thus traffic is routed through the less congested parent node. As a result, the packets are not queued in the node's buffer for a long time.
average delay in OF0 is significantly greater than MRHOF, SCAOF, and COOF. It was obvious, because OF0 could not deliver data packets on time and it has to be in the queue for a long time when there was heavy traffic. In contrast, the COOF can handle the traffic dynamicity efficiently and it performs better. When data traffic is high, COOF is aware of resources in terms of queue utilization, and thus traffic is routed through the less congested parent node. As a result, the packets are not queued in the node's buffer for a long time. Energy consumption: it is defined as the average residual energy of nodes in the network. It represents the application that requires priority in terms of lifetime. The total energy consumption is the sum of the energy consumed due to the reception and transmission of per successful packet from source to the destination. Figure 13 shows the average energy consumption in the network with respect to different inter-packet interval. The energy consumption of COOF is significantly lower than other approaches. It is because COOF loses fewer packets in the queue, and thus minimizes the re-transmission of packets. In addition, REI gives the better understanding of the network situation during parent selection. As retransmission is high in OF0, MRHOF, and SCAOF, so sending and receiving lost packets due to buffer overflow is necessary and thus waste energy. Moreover, OF0 and MRHOF do not include any energy metric thus performing poorly as compared to SCAOF and COOF. Energy consumption: it is defined as the average residual energy of nodes in the network. It represents the application that requires priority in terms of lifetime. The total energy consumption is the sum of the energy consumed due to the reception and transmission of per successful packet from source to the destination. Figure 13 shows the average energy consumption in the network with respect to different inter-packet interval. The energy consumption of COOF is significantly lower than other approaches. It is because COOF loses fewer packets in the queue, and thus minimizes the re-transmission of packets. In addition, REI gives the better understanding of the network situation during parent selection. As retransmission is high in OF0, MRHOF, and SCAOF, so sending and receiving lost packets due to buffer overflow is necessary and thus waste energy. Moreover, OF0 and MRHOF do not include any energy metric thus performing poorly as compared to SCAOF and COOF.

Performance with Different Network Size
In this section, we investigate the scalability of the proposed objective function at varying network size in a fixed network area. We constructed different network topologies with the number of nodes varying from 25 to 115. The impact of the topology variation is analyzed while considering the various aspects of LLN. To this end, we consider that all of the nodes in the network generate source traffic with a rate of 120 ppm. Besides, the traffic generation rate follows Poisson function. We keep other simulation parameters the same, as in Section 5.1. Figure 14a-d show various performance metrics of COOF and other OFs under different network size.
As shown in Figure 14a, the packet loss ratio of all objective function increases with the network size. The packet loss ratio of OF0 and MRHOF is relatively high, as compared to others, it is because of the routing metric used during parent selection. Under our proposed OF, queue fluctuation at each node is considered to be a routing metric during path selection. Thus, the packet loss rate significantly reduces in COOF than default OFs. In contrast, SCAOF, MRHOF, and OF0 are unable to be aware of backlog packets at the node's buffer. As a result, a node may select preferred parent that is suffering from buffer overflow. As the network size increases, the packet loss tendency becomes more severe. In this situation, SCA-OF, MRHOF, and OF0 experience 16%, 22%, and 28%, respectively, whereas the COOF is less than 15%. The experimental results show that the composite

Performance with Different Network Size
In this section, we investigate the scalability of the proposed objective function at varying network size in a fixed network area. We constructed different network topologies with the number of nodes varying from 25 to 115. The impact of the topology variation is analyzed while considering the various aspects of LLN. To this end, we consider that all of the nodes in the network generate source traffic with a rate of 120 ppm. Besides, the traffic generation rate follows Poisson function. We keep other simulation parameters the same, as in Section 5.1. Figure 14a each of the OFs. However, COOF achieves the lowest end-to-end delay as compared to others. Besides, the delay variations in COOF with respect to increased network size are also more subtle than other OFs. This outcome, as expected, highlights the importance of efficient queue utilization in the route selection process. The effect of metric combination based parent selection on the end-to-end delay is lower than the single metric based approach. The OF0 has the longest delay and largest delay variation in comparison to others with increasing network size.

Impact of Traffic Dynamicity
In this section, we examine the effect of traffic dynamicity on performance with varying traffic loads. The average packet generation rate varies from 1 to 10 packets per second to evaluate the performance of the proposed work with different traffic loads. The nodes deployed in the sensing region generate traffic while using poison function. We keep the other simulation parameters the same, as in Section 5.1.
The network lifetime under OF0, MRHOF, SCA-OF, and our proposed COOF are shown in Figure 15a. All of the nodes in the network start with the equal battery power level. In this paper, the network lifetime is the time until the first node dies. We assume that when a node depletes 95% of initial energy, the node dies. In the proposed OF, each node consumes less energy than others. This indicates that the parent selection based on the combined metric is more energy-efficient than traditional RPL. As the traffic flows increases, network lifetime in all OFs decreases. However, as compared to others, the network lifetime under COOF is longer. On the other hand, the network lifetime of OF0 is the shortest among all others. One of the reasons is that it constructs the network topology based on hop counts, which creates the long-hops problem in the DODAG. Besides, the depth of the DODAG is higher than others, and the routing decision may spread to the bottleneck nodes. As shown in Figure 14a, the packet loss ratio of all objective function increases with the network size. The packet loss ratio of OF0 and MRHOF is relatively high, as compared to others, it is because of the routing metric used during parent selection. Under our proposed OF, queue fluctuation at each node is considered to be a routing metric during path selection. Thus, the packet loss rate significantly reduces in COOF than default OFs. In contrast, SCAOF, MRHOF, and OF0 are unable to be aware of backlog packets at the node's buffer. As a result, a node may select preferred parent that is suffering from buffer overflow. As the network size increases, the packet loss tendency becomes more severe. In this situation, SCA-OF, MRHOF, and OF0 experience 16%, 22%, and 28%, respectively, whereas the COOF is less than 15%. The experimental results show that the composite metric scenario yields better results in the packet loss rate than the default RPL OFs. Figure 14b shows the packet receiving ratio in terms of different network size. As the size of the network grows, the proposed OF explores more routing paths to deliver data successfully to the root. As a result, COOF improves the aggregate throughput as compared to others. With the increased network size, the packet receiving ratio is decreasing for all the OFs. However, COOF achieves higher PRR than others. When the network size is 25 and 115, the PRR of COOF is about 91.4% and 82.6%, respectively. Whereas, the PRR of SCA-OF, MRHOF, and OF0 is about 88.4% and 76.3%, and 83.7% and 67.1%, 78.4%, and 59.2%, respectively. The reason behind the higher PRR in COOF is that it uses multiple metrics for route selection to respond to the network dynamicity. Besides, COOF takes into account the network resource utilization effectively.
We evaluated the aggregated throughput for different network size. It is the total number of data bytes received by the root node. As shown in Figure 14c, the proposed OF leads to more throughput as compared to all others. The result shows that with the increasing of the network size, the throughput under all OFs increases. However, the variation is observed when the network size is different. As compared to default RPL OFs, SCA-OF and COOF both ensure higher throughput. This show that both metric composition based OF can perform effectively. When the number of node is high, i.e., 110, COOF achieves about 9.95% more throughput than SCA-OF and 39.6% than OF0. On the other hand, SCA-OF achieves about 20% more throughput than MRHOF. This is because both OFs combine multiple metrics for efficient route selection towards the root. Figure 14d shows that the end-to-end delay linearly increases as the network size increases for each of the OFs. However, COOF achieves the lowest end-to-end delay as compared to others. Besides, the delay variations in COOF with respect to increased network size are also more subtle than other OFs. This outcome, as expected, highlights the importance of efficient queue utilization in the route selection process. The effect of metric combination based parent selection on the end-to-end delay is lower than the single metric based approach. The OF0 has the longest delay and largest delay variation in comparison to others with increasing network size.

Impact of Traffic Dynamicity
In this section, we examine the effect of traffic dynamicity on performance with varying traffic loads. The average packet generation rate varies from 1 to 10 packets per second to evaluate the performance of the proposed work with different traffic loads. The nodes deployed in the sensing region generate traffic while using poison function. We keep the other simulation parameters the same, as in Section 5.1.
The network lifetime under OF0, MRHOF, SCA-OF, and our proposed COOF are shown in Figure 15a. All of the nodes in the network start with the equal battery power level. In this paper, the network lifetime is the time until the first node dies. We assume that when a node depletes 95% of initial energy, the node dies. In the proposed OF, each node consumes less energy than others. This indicates that the parent selection based on the combined metric is more energy-efficient than traditional RPL. As the traffic flows increases, network lifetime in all OFs decreases. However, as compared to others, the network lifetime under COOF is longer. On the other hand, the network lifetime of OF0 is the shortest among all others. One of the reasons is that it constructs the network topology based on hop counts, which creates the long-hops problem in the DODAG. Besides, the depth of the DODAG is higher than others, and the routing decision may spread to the bottleneck nodes. Similarly, we compare the end-to-end delay concerning the increasing traffic loads. It is defined as the average time interval from packet generation to packet delivery. As shown in Figure 15b, the delay in all OFs increases as the traffic load increases. However, we can see that the end-to-end delay in COOF is lower as compared to other OFs. It can be seen that, as the traffic load increases, OF0 and MRHOF delays both increase significantly when compared to COOF. The reason is that both OF0 and MRHOF select the parent based on a single metric, and these metrics are not aware of the node's queue status. On the other hand, when the traffic load is high, the delay of COOF decreases, because the QFI metric is aware of queue utilization. As a result, it can select the resource-efficient parent next node towards the root node that reduces the buffer overflow and packet loss; therefore, end-to-end delay decreases.

Impact of Design Parameters α and ꞵ
In this section, we analyze the effect of the design parameters α and ꞵ in COOF. The main purpose of this investigation is to determine how these parameters contribute to improving COOF performance. To this end, each design parameter is selectively included in the COOF, and compares the performance of each factor with different performance metrics. Figure 16a shows the impact of smoothing factor in COOF. During parent selection process, it reduces the influence of the parent node's remaining energy. With the increasing value of the smoothing parameter, the average parent change frequency also increases accordingly. In particular, when the smoothing factor was set to 0.35, COOF achieved the best performance regarding the parent change frequency of the node. Similarly, with this parameter, COOF also achieves the best performance in terms of the network lifetime, which is shown in Figure 16b. It is because the REI considers the residual energy of the nodes recursively.
The effect of weighting factor in COOF is depicted in Figure 16c-d. Particularly, the weighting Similarly, we compare the end-to-end delay concerning the increasing traffic loads. It is defined as the average time interval from packet generation to packet delivery. As shown in Figure 15b, the delay in all OFs increases as the traffic load increases. However, we can see that the end-to-end delay in COOF is lower as compared to other OFs. It can be seen that, as the traffic load increases, OF0 and MRHOF delays both increase significantly when compared to COOF. The reason is that both OF0 and MRHOF select the parent based on a single metric, and these metrics are not aware of the node's queue status. On the other hand, when the traffic load is high, the delay of COOF decreases, because the QFI metric is aware of queue utilization. As a result, it can select the resource-efficient parent next node towards the root node that reduces the buffer overflow and packet loss; therefore, end-to-end delay decreases.

Impact of Design Parameters α and β
In this section, we analyze the effect of the design parameters α and β in COOF. The main purpose of this investigation is to determine how these parameters contribute to improving COOF performance. To this end, each design parameter is selectively included in the COOF, and compares the performance of each factor with different performance metrics. Figure 16a shows the impact of smoothing factor in COOF. During parent selection process, it reduces the influence of the parent node's remaining energy. With the increasing value of the smoothing parameter, the average parent change frequency also increases accordingly. In particular, when the smoothing factor was set to 0.35, COOF achieved the best performance regarding the parent change frequency of the node. Similarly, with this parameter, COOF also achieves the best performance in terms of the network lifetime, which is shown in Figure 16b. It is because the REI considers the residual energy of the nodes recursively.

Discussion
In the IoT concept, LLN is one of the core network infrastructure for smart city applications. The effectiveness of these applications depends on the reliability, longevity, and delivering required information timely. Route selection plays an important role in meeting the application objectives in LLNs. Context-awareness in the IoT paradigm envisions the ability of a system that can provide efficient services to the users. Contextual information collected from the requirements of the application can be used to provide context-awareness. Our proposed COOF can select the efficient route under high and dynamic traffic scenarios. Simulation results and performance analysis show that COOF performs outstanding when compared to others. This performance superiority comes from the metrics composition mechanism, along with other aspects. Before we conclude, we emphasize the important aspects of the proposal, which are as follows:  Unlike default RPL OF, COOF uses multiple routing metrics for selecting the best parent The effect of weighting factor in COOF is depicted in Figure 16c-d. Particularly, the weighting factor α is used to prioritize the current measurement of the queue. The queue loss ratio is defined as the ratio between the dropped packets and the injected packets into the queue of the network layer. As the weighting factor is used to prioritize between current queue occupancy than previous, the queue loss ratio is lower when the weighting factor is set below 0.5. Figure 16c shows the queue loss ratio with varying weight factors. Similarly, with this weighting factor, the packet receiving ratio is high. It can be noticed that the packet receiving ratio is almost similar when the weighting factor is set to below 0.5.
From this analysis, we come up with the conclusion that these parameters affect the performance of COOF. In addition, by observing the network performance, these parameters can be empirically optimized. From the results, it is clear that COOF enhances the performance when the parameters are set to α = 0.4 and β = 0.35. Therefore, we have used these values throughout the evaluation.

Discussion
In the IoT concept, LLN is one of the core network infrastructure for smart city applications. The effectiveness of these applications depends on the reliability, longevity, and delivering required information timely. Route selection plays an important role in meeting the application objectives in LLNs. Context-awareness in the IoT paradigm envisions the ability of a system that can provide efficient services to the users. Contextual information collected from the requirements of the application can be used to provide context-awareness. Our proposed COOF can select the efficient route under high and dynamic traffic scenarios. Simulation results and performance analysis show that COOF performs outstanding when compared to others. This performance superiority comes from the metrics composition mechanism, along with other aspects. Before we conclude, we emphasize the important aspects of the proposal, which are as follows: • Unlike default RPL OF, COOF uses multiple routing metrics for selecting the best parent through which a node forwards the data towards the root. The proposed OF is based on the combination of different metrics for IoT network environments. The routing metrics used in COOF efficiently utilizes the network resources since the IoT devices are resource-constrained. • QFI and REI metrics are used to prefer the nodes with high resource availability. In addition, QFI is considered as a simple indicator of traffic tendency in the network, where it monitors the queue fluctuation in per unit time. Thus, it is designed to respond to the dynamic needs of the network. The ETX metric is used to indicate the availability of the quality of the link(s). According to the application requirements, these metrics values are used in the fuzzy system as an input variable to construct a single output variable.

•
The single routing metric based problem in RPL is addressed using fuzzy logic techniques that simultaneously use multiple routing metrics. This technique estimates the quality of the route based on the metric values that are present in the OF.

•
Another aspect that enhances the effectiveness of COOF is context information. It utilizes knowledge regarding the application requirements, and it is aware of the context through its ability to gather contextual information regarding the condition of a given link and node in the network.
Overall, for the evaluated scenarios, it is clear that the COOF can improve network performance for use in IoT based smart city applications. In this proposition, we only consider a static network scenario, even though some smart city network may consist of the mobility of nodes. However, in the future, we plan to optimize and evaluate the COOF in mobility scenarios.

Conclusions
In this paper, we propose an objective function that enhances the route selection process for IoT based smart city network while using the contextual information from the requirements of the application. The proposed context-oriented objective function can comprehensively assess the proposed routing metrics ETX, QFI, and REI and combine them using a fuzzy logic technique. QFI takes the status of the parent chain into account before choosing the preferred parent of a node. Each application may have diverse requirements that simultaneously need up to some extent and using contextual information through three routing metrics the proposed fuzzy system classify the routes that are based on the defined fuzzy rules to perform the specific application objective. Meantime, a simple conceptual context-aware system architecture indicates the characteristic of the metric parameters. This way, we tried to balance the network resources to be used by IoT based smart city applications. In general, to meet the application requirements, COOF recognizes the network conditions by taking different node and link characteristics into consideration in dynamic traffic scenarios.
Extensive simulation testing is performed to verify the performance supremacy. The simulation results verify that the proposed approach improves the packet receiving ratio, packet loss ratio, end-to-end delay, and average energy consumption, as compared to others. In our proposed approach, the explicit benefit of handling traffic dynamicity makes COOF capable of prolonging the network lifetime and maintaining lower delay, even at high traffic flows. Moreover, in large scale networks, the COOF improves significantly in terms of the packet loss ratio, packet receiving ratio, end-to-end delay, and average throughput, as compared to other OFs. Additionally, two different design parameters in COOF significantly contributed to the performance of an IoT based smart city network. Overall, COOF is able to find the optimum path and along with ensuring the maximum network resource utilization, regardless of network dynamicity.