How does the OSI model work?
The OSI Model works by establishing a set of rules and standards for communication in and between the different layers. These rules ensure that different products can communicate between each other because they are developed around the same guidelines. As building automation systems move further into the information technology sector we are seeing the OSI model’s upper layers become even more vital. The picture below is a high level view of how messages are transferred between the different layers of the OSI model. For a more detailed understanding of how the OSI model works refer to this step by step analysis here.
OSI Layers:-

Layer 1: physical layer:-
The physical layer is the lowest layer in the OSI reference Model. Its primary function is to move bits across a communications channel from one system to another. The basic unit of exchange at this layer is the binary digit, also known as a bit..It defines electrical and physical specifications for devices. In particular, it defines the relationship between a device and a transmission medium, such as a copper or fiber optical cable.This layer conveys the bit stream - electrical impulse, light or radio signal -- through the network at the electrical and mechanical level. It provides the hardware means of sending and receiving data on a carrier, including defining cables, cards and physical aspects.
The major functions and services performed by the physical layer are:
- Establishment and termination of a connection to a communications medium.
- Participation in the process whereby the communication resources are effectively shared among multiple users. For example, contention resolution and flow control.
- Modulation or conversion between the representation of digital data in user equipment and the corresponding signals transmitted over a communications channel. These are signals operating over the physical cabling (such as copper and optical fiber) or over a radio link.
Layer 2: data link layer:-

Layer 3: network layer:-

The network layer may be divided into three sublayers:
1.Subnetwork access – that considers protocols that deal with the interface to networks, such as X.25;
2.Subnetwork-dependent convergence – when it is necessary to bring the level of a transit network up
to the level of networks on either side
3.Subnetwork-independent convergence – handles transfer across multiple networks.
Layer 4: transport layer:-


Layer 5: session layer:-
The session layer controls the dialogues (connections) between computers. This layer establishes, manages and terminates connections between applications. The session layer sets up, coordinates, and terminates conversations, exchanges, and dialogues between the applications at each end. It deals with session and connection coordination. It establishes, manages and terminates the connections between the local and remote application. It provides for full-duplex, half-duplex, or simplex operation, and establishes checkpointing, adjournment, termination, and restart procedures. The OSI model made this layer responsible for graceful close of sessions, which is a property of the Transmission Control Protocol, and also for session checkpointing and recovery, which is not usually used in the Internet Protocol Suite. The session layer is commonly implemented explicitly in application environments that use remote procedure calls. On this level, Inter-Process communication happen (SIGHUP, SIGKILL, End Process, etc.).
Layer 6: presentation layer:-
The presentation layer establishes context between application-layer entities, in which the higher-layer entities may use different syntax and semantics if the presentation service provides a mapping between them. If a mapping is available, presentation service data units are encapsulated into session protocol data units, and passed down the stack. ) This layer provides independence from differences in data representation (e.g., encryption) by translating from application to network format, and vice versa. This layer formats and encrypts data to be sent across a network, providing freedom from compatibility problems. It is sometimes called the syntax layer. This layer provides independence from data representation.
Layer 7: application layer:-
