As we saw earlier in the introduction to DALI, a typical DALI line is logically composed of up to 64 ECGs and 63 ECDs plus a controller, which typically covers a small section of a larger site.
If we want to configure or monitor any of those fixtures, or control them using inputs which exist on another DALI line or in coordination with other nearby fittings, then we need to introduce the concept of a network.
The zencontrol controllers, like most modern connected devices, use IP (Internet Protocol) for their communications with eachother and with external systems. IP is a complex topic which you probably won't need to understand completely to be competent within a lighting controls context, but we'll go into enough detail here to give you a good foundation to build upon.
IP
IP comes in two flavours: IPv4 and IPv6. In this guide we'll be focusing on IPv4, as that's where most of the industry still sits.
IP is a protocol that allows devices to communicate with each other over a network, like the internet or a local network. Every device on a network needs to have a unique IP Address, which is a numerical address that identifies it on that network. IPv4 addresses are made up of four numbers, separated by dots, where each number can be between 0 and 255. For example, an IP address might look like this: 192.168.0.1.
Just like with a regular decimal number, when incrementing we start on the right and when we roll over we increment one column to the left. For example, the address after 192.168.0.255 is 192.168.1.0.
When a device wants to sends data over a network, it packs up that data and addresses it to the IP address of the device that it wants to communicate with, then it sends it out onto the network to be delivered to its destination.
Network components
A network is typically composed of several components, but these can be simplified as hosts, switches and routers.
Hosts
Hosts are any devices that are connected to a network, such as zencontrol Application Controllers and LCMs, but also computers, phones, servers, security cameras, access-control gates, and other devices throughout the building or site. Hosts generate, receive, and transmit data on the network to communicate with other hosts.
Switches
Switches are devices that connect multiple hosts together within a local area network (LAN). They typically operate at the Data Link Layer (more on this in the next section) and are responsible for forwarding data between connected devices based on the destination MAC address. Switches improve network performance by reducing network congestion and enabling devices to communicate directly with each other without interfering with other devices on the network.
Switches can have different levels of sophistication. Those called unmanaged are typically plug-and-play devices which simply forward network packets from one device to another, without any intervention. Managed switches, on the other hand, can be configured and managed by a network administrator. Managed switches provide advanced features such as virtual LAN (VLAN) support, Quality of Service (QoS) traffic prioritization, and network segmentation. They can also be used to monitor network traffic, configure security settings, and troubleshoot network problems.
Routers
Routers are devices that connect different networks together, such as LANs and WANs. They operate at the Network Layer (more on this below) and are responsible for forwarding data between connected networks based on the destination IP address.
Layers
The various pieces which are required for a device to communicate over the internet, commonly talked about as either the "TCP/IP stack" or the "OSI Model" are structured as layers that sit on top of one-another.
Side note: Understanding this section won't be required to be proficient with the zencontrol system, but it will help you to understand how everything fits together and how to design and troubleshoot more complex scenarios.
Even if you don't absorb it all right now, you'll at least be able to capture some of the terminology and should remember where to come looking to refresh your memory. Networked building services aren't going anywhere anytime soon, and as the industry develops you'll come across more and more customers, consultants and peers who will assume a reasonable level of understanding.
Layer 1 (Physical)
Depending on where you're coming from (OSI model or the TCP/IP stack), this bottom layer may or may not get a mention. We'll just discuss it very briefly because it's very low-level and any troubleshooting which you may do would be limited to basic electrical tests (eg. continuity tests): This first layer defines exactly how the bits should be transmitted across the physical copper cable, or radio waves.
Layer 2 (Link)
Moving up, next we come to Layer 2: the Link or Data Link layer. The role of this layer is to get the data where it needs to go within a local network. We can think of the boundary of a local network as everything a host can talk to without needing to cross through a router.
To enable this, every device with an IP network adaptor is given a unique number (usually in the factory) which can be used to identify it within a local network. This number is called the MAC address. These MAC addresses are 12-digit hexadecimal* numbers where the first 6 digits are unique to the manufacturer and the latter 6 digits are unique to the device.
An example of a zencontrol MAC address might be: 7C:BA:CC:20:46:14. If we look at just the manufacturer prefix we can see that we should expect that if we come across 7C:BA:CC at the start of a MAC address when troubleshooting then we can expect that that device should be a zencontrol device.
We saw earlier that network switches typically operate at Layer 2, which means in practice that they keep track of which MAC addresses are connected to the segments of the local network which exist on the other side of each of their ports, and then as they receive incoming packets they look at the destination MAC address and then retransmit the data out towards its destination.
If the switch doesn't know behind which of their ports the destination address is, they'll send it out to all of them. The consequence of this is that a lot of layer 2 traffic is heard by the entire local network and is one of the reasons that we try to limit the size of local networks.
* Hexadecimal just means that each digit in the number goes from 0 to 15 instead of from 0 to 9. We use the letters A to F to represent the numbers 10 to 15 in a single digit, so counting from 0 to 15 would look like: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Layer 3 (Network / Internet)
Now we arrive at Layer 3, which is where the majority of our time will be spent when working with networking for a zencontrol lighting control system. This is the layer where the IP protocol runs and this is where we introduce IP Addresses.
While a MAC Address uniquely identifies a network adaptor, the IP address is what gives that control system, computer, phone or security camera a meaningful address within a wider network. It might be helpful to think of the MAC address like a vehicle identification number (VIN) on a car, while IP Addresses are more like a license plate.
When we think of two hosts (eg. two zencontrol controllers) communicating, we reason about it and configure it in terms of IP Addresses. It's then left to the network hardware to get the message across the local network. To do this, down at layer 2 the component looks at the IP of the destination and then looks up or queries the network for the corresponding MAC address. To make this process easier, hosts and switches maintain a small cache of known relationships between IP Addresses and MAC addresses.
If the IP Address exists on another local network, this is where routers come in. Routers operate here at layer 3 and forward network traffic (or not) based on whether they know how to get to the destination network. To do this, when a new packet of data comes in for them they first look at its destination IP address, then at their routing table, which pair destination networks to network interfaces, and if a route exists for the destination network (or they have a default configured) then they will forward the data to that interface.
We'll look more at how we determine a network address shortly, but first we'll cover the remaining 2 layers.
Layer 4 (Transport)
The Transport Layer is responsible for ensuring reliable data delivery between applications running on different hosts. It has two primary protocols: the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). TCP provides reliable, connection-oriented communication between applications, while UDP provides fast, connectionless communication.
For our purposes, the key things to understand here are the following:
- UDP is "Fire and Forget", it has no connections and no retries, but it's fast and because it's connectionless it can be broadcast or multicast to reach multiple destinations with a single packet.
- TCP uses a defined handshake to establish a reliable connection between two devices. This initial handshake takes time, so it may be less suited to applications where a controller might need to send packets to a number of different destinations, but it does provide greatly improved reliability of delivery.
Layer 5 (Application)
The top of the stack is the Application layer, where there are a number of protocols that define how applications interact with the network. For us, the important ones are the following:
-
NTP (Network Time Protocol): Used for synchronizing clocks on networked devices.
-
DNS (Domain Name System): Used for resolving domain names to IP addresses, enabling access to websites and other resources on the internet using human-readable names eg. connect.zencontrol.com.
-
DHCP (Dynamic Host Configuration Protocol): Used for dynamically assigning IP addresses to devices on a network, allowing them to communicate with other devices on the network and access network resources. DHCP also provides additional network configuration information to devices, such as subnet masks and default gateways (more on these in the next section), and NTP & DNS server addresses.
Network Masks and Default Gateways
Now that we have some basic understanding of the different protocols which make up our network stack, we can start to build up some example scenarios.
Let's imagine that we have a zencontrol Application Controller with a zc-switch which sits behind the reception desk in the foyer of Acme Corporation's new head office. The switch has been configured to control the external lighting, which is some distance away and has been wired to another application controller on the same network.
We know from earlier that to reach another host on the same network, all a control system would need to do is locate its MAC Address. But how does our controller in reception know that the destination controller is on the same network? For this we need to introduce the Subnet Mask.
Subnet Masks
An IP Address can be split into two parts, the part which identifies the network, and the part which identifies the host. But networks can be of different sizes, and it would be either wasteful or limiting to enforce the same length of network address and host address everywhere. To solve this, we bring in an extra piece of information, the subnet mask, to draw the line between where the network address stops and the host address starts.
The subnet mask is made up of four numbers, all from 0 to 255, separated by dots just like an IP address. A complete understanding of how these work would require a good understanding of binary numbers (numbers represented as 0s and 1s), but we shouldn't need to go quite that far to be able to use them in most scenarios.
By far the most common subnet mask that you'll come across is 255.255.255.0. The 255s here define the network segment, leaving the final number for the host address. The lowest host address (in this particular case, 0) for each network address is reserved as the "network address" and the highest (in this case, 255) is reserved as the "broadcast" address, which leaves us space on this particular network for 254 hosts.
Some common IP ranges which have been made available for private use are:
- 192.168.0.0 to 192.168.255.254
- 10.0.0.0 to 10.255.255.254
- 172.16.0.0 to 172.31.255.254
The following table shows the most common subnet masks that you may come across, for an example host at the address 192.168.1.100. You'll notice that as the subnet mask gets smaller the size of the host address space gets larger, and vice versa.
Mask | Abbreviation | Number of Hosts | Example Host Address | Network Address | First Host Address | Last Host Address | Broadcast Address |
---|---|---|---|---|---|---|---|
255.255.252.0 | /22 | 1022 | 192.168.1.100 | 192.168.0.0 | 192.168.0.1 | 192.168.3.254 | 192.168.3.255 |
255.255.254.0 | /23 | 510 | 192.168.1.100 | 192.168.0.0 | 192.168.0.1 | 192.168.1.254 | 192.168.1.255 |
255.255.255.0 | /24 | 254 | 192.168.1.100 | 192.168.1.0 | 192.168.1.1 | 192.168.1.254 | 192.168.1.255 |
255.255.255.128 | /25 | 126 | 192.168.1.100 | 192.168.1.0 | 192.168.1.1 | 192.168.1.126 | 192.168.1.127 |
255.255.255.192 | /26 | 62 | 192.168.1.100 | 192.168.1.64 | 192.168.1.65 | 192.168.1.126 | 192.168.1.127 |
To make this more practical, let's look at it from the two ways that you may need to approach it on site:
- Provisioning your own network: You arrive to a site with 260 zencontrol controllers and have made the decision to put them all on one local network. You can see from the above table that to fit 260 controllers on a network the smallest subnet mask you can use is 255.255.254.0, which gives you room for 510 controllers. You might choose to use the network 10.9.8.0 and put the controllers on the addresses from 10.1.1.1 to 10.1.2.254.
- The onsite IT services are provisioning the network: They let you know that they have reserved a /25 subnet for you at 192.168.2.0 (they might also phrase this as "192.168.2.0/25"). You look at the table up above and understand that this means that you have space on the network for 126 controllers, starting at 192.168.2.1 and ending at 192.168.2.126.
So now we can circle back to the question in our first example: How does our controller in reception know that the destination controller is on the same network?
The answer is that the controller can simply look at its own address and its subnet mask and it will know immediately if any other given IP can be reached locally. If it can, it will drop down to layer 2 and get the message out onto the network to be switched across to its destination. If it determines that it can't reach the destination IP, because it's outside of its local network, it makes the assumption that it probably needs the assistance of a router, and here we introduce the Default Gateway.
Default Gateway
The default gateway is the IP address that a host is configured to use when it needs to send something outside of its local network. The controller in our example looks up the MAC Address of the router at its default gateway, sends the message out and then the router takes it and (if a route exists for the packet) forwards it on to the larger network on the other side.
Routers also can have what's known as a default route, which is essentially the same concept.
Multicast Groups
The last concept that we'll introduce here is multicast. Multicast groups are special reserved IP addresses which multiple hosts can subscribe to, allowing for a single message to reach multiple hosts.
To join a multicast group, a device sends a request to the multicast address, indicating that it wants to receive messages sent to that address. The network devices that are part of the multicast group maintain a list of all the devices that have joined the group and forward the multicast messages to each of them.
Multicast groups are identified by their IP addresses, which are in the range of 224.0.0.0 to 239.255.255.255. These addresses are reserved for multicast use and are not used for individual devices or hosts.
In the zencontrol ecosystem we use multicast groups for designating zones of controllers which need to be controlled together, and for some synchronization purposes.
Note: When commissioning a site where the network is provisioned by another party, it's helpful to inform them of the multicast groups which you plan to use. This is because other systems might also be using multicast groups on the same network and because in some cases the network equipment will need to be configured to pass those groups.
Comments
0 comments
Article is closed for comments.