MATLAB Code : SNR distribution for indoor VLC

Indoor VLC means Communication is possible in a small range that is useful in home, office and small area environments. Indoor VLC is next level of Home automation system. Whenever people think about Indoor VLC first question is why we use this and what is a feature?

1) Minimum Data Speed is 1 Gbps
2) No Signal Loss
3) Light is Not harmed the human body
4) Reusable Concept of Light
5) More Secure
Now Look like advantages are so many compare to current Wireless techniques but one disadvantage is this concept covers the only small area. Now How many Area’s are covered we see in next post currently we measure an important parameter of VLC SNR(Singal to Noise Ratio) for 1 V LED. Here MATLAB code is attached. Run in code in MATLAB and enjoy a graph of SNR.
For this Program assume 1 V LED is located in (0,0) point.

clear all;
clc;
close all;
% SNR Performance For VLC SYSTEM %
% Coded BY Er. PANCHAL PRATIK
% pattu310@gmail.com
% Easy USe Consider Following Example
%
%
% BASIC PARAMETER REQUIRED %
Incidence = 70*pi/180;
TX_FOV = 70; % Transmitter Field Of View
RX_FOV = 90; % Receivers Field Of View
Tx = [2,2,2]; % Transmitter Location
%Rxp = [2,2]; % Receiver Location
W_Room = 4; % Width of Room
L_Room = 4; % Length of Room
H_Room = 2; % Height Between Transmitter and Receiver
R = 1; % Responsivity of Photodiode
Apd = 1e-4; % Area of PhotoDetector
Rb = 1e6; % Data rate of system
Iamp = 5e-12; % Amplifier Current
q = 1.6e-19; % Electron Charge
Bn = 50e6; % Noise Bandwidth
I2 = 0.562; % Noise Bandwidth Factor
PLED = 1; % Power Emitted by LED
index =1;
HLED = 1;
[W L] = meshgrid(-(W_Room/2) : 0.50 : (W_Room/2)); % Consideer Length of BLock for Room
xydist = sqrt((W).^2 + (L).^2);
hdist = sqrt(xydist.^2 + HLED.^2);
%D = Tx – Rx;
%d = norm(D);
%Incidence = acos()
A_Irradiance = ((Tx(3)-HLED)./hdist);
%I(index) = Irradiance*180/pi;
%if abs(Incidence <= RX_FOV)
p = TX_FOV ;
Tx_FOV = (TX_FOV*pi)/180;
% BASIC CALCULATION IN VLC SYSTEM %
% Lambertian Pattern
m = real(-log(2)/log(cos(Tx_FOV)));
% Radiation Intensity at particular point
Ro = real(((m+1)/(2*pi)).*A_Irradiance^m);
% Transmitted power By LED
Ptx = PLED .* Ro;
% Channel Gain ( Channel Coefficient Of LOS Channel )
%Theta=atand(sqrt(sum((Tx-Rx).^2))/H_Room);
HLOS = (Apd./hdist.^2).*cos(Incidence).*Ro;
% Received Power By PhotoDetector
Prx = HLOS.*Ptx;
% Calculate Noise in System
Bs = Rb*I2;
Pn = Iamp/Rb;
Ptotal = Prx+Pn;
new_shot = 2*q*Ptotal*Bs;
new_amp = Iamp^2*Bn;
% Calculate SNR
new_total = new_shot + new_amp;
SNRl = (R.*Prx).^2./ new_total;
SNRdb = 10*log10(SNRl);
% else
% SNRl = 0;
% SNRdb = 0;
% end
index = index + 1;
% Plot Graph %
figure;
mesh(W,L,SNRdb);
%mesh(SNRdb);
%ylim([0 30]);
title(‘SNR Distribution in Room’);
xlabel(‘Length of Room’);
ylabel(‘Width of Room’);
zlabel(‘SNR in dB’);

Output : MATLAB graph
SNR of SISO VLC

PHP for beginners – Chapter 4

Today we will learn how to write a code in php.

To write a code in php there is predefined syntax.

Whenever you want to start to write code you have to type <?php

then you can write your business logic.

After this to end your php code you have to type ?>

So simple, write your code within

<?php

/*  Your code here */

?>

In next chapter we will learn how to use looping conditions, how to do comments and other things.

 

Visible Light Communication (Part – 3)

VLC SYSTEM MODEL SISO

  • SISO: Single Input Single Output

In this section, we describe the Single Input Single Output VLC system and discuss the parameter of the VLC link. First, we consider the LOS link between the single transmitter and the receiver. The link configuration is shown in (fig1) [1].

SISO VLC SYSTEM MODEL

 

Where θ is the angle of incidence with respect to the axis of the receiver surface. Ҩ is receiver’s FOV. At transmitter side viewing angle (Irradiance) with respect to transmitter surface is Ø and transmitter FOV is ɸ. Lambertian emission defined as m [11].

Equation 1

Optical concentrator gain of the receiver [2] defined as.

Equation 2

VLC channel gain for LOS link determined by HLOS is,

Equation 2

Where 𝑅0(Ҩ) is [11],

𝑅0(Ҩ)=(𝑚+1)/(2∗𝜋)*𝑐𝑜𝑠2(∅) [4]

Where 𝐴𝑝𝑑 the collection area of the receiver is, 𝑑2is the distance from the transmitter to the receiver. θ is the angle of incidence on the receiver and Ҩ is the receiver’s FOV. For SISO system we have to consider only one LOS link so at receiver side only one channel gain calculated. A received signal is given by [2]

𝑅𝑥 = R∗𝑃𝑡∗HLOS + √σ2 [5]

Where R is the photodiode responsively. Pt is transmitted optical power and σ2 is the mean square noise current of a receiver. Transmitted power is defined as [11]

𝑃𝑡=𝑃𝐿𝐸𝐷∗𝑅0(Ҩ) [6]

Where PLED is, the power emitted by LED. Received data is recovered using the inverse of HLOS as [2]

𝑅𝑟𝑒𝑐𝑜𝑣𝑒𝑟𝑒𝑑=𝑅𝑥∗𝐻𝑇 [7]

Received power 𝑃𝑟 depends upon the filter transmission 𝑇𝑠(𝜃) and concentrator gain. Ideally, concentrator gain and transmission filter are considered as 1 [2].

𝑃𝑟= 𝑃𝑡∗𝐻𝐿𝑂𝑆∗g(𝜃)∗𝑇𝑠(𝜃), 0≤θ≤Ҩ [8]

SNR depend upon the photodetector responsivity R, received optical power and noise variance. SNR is [2]

SNR = (𝑅𝑃𝑡)2/𝜎𝑠ℎ𝑜𝑡2+𝜎𝑡ℎ𝑒𝑟𝑚𝑎𝑙2 [9]

Shot noise is photon generated noise in the detector by received signal and calculated as [1]

𝜎𝑠ℎ𝑜𝑡2=2𝑞𝑅𝑃𝑟𝐵 [10]

Thermal noise is given by [1],

𝜎𝑡ℎ𝑒𝑟𝑚𝑎𝑙2= 4𝐾𝑇𝐵𝐹𝑅𝑡 [11]

BER depends on the modulation scheme and SNR of the system. Where Q is a function that depends upon the modulation scheme which used.

BER = Q√𝑆𝑁𝑅 [12]

Visible Light Communication (Part – 2)

VLC SYSTEM OVERVIEW

VLC system block diagram is shown in Figure 1.

VLC Block Diagram

A. VLC Transmitter

Precise dimming control can be done by LED. Driving circuit combines the input data of communication module and they drive a dimming control of LED array. LED arrays are generating multiple light signal.
For transmitting Light signal, the LED luminaire can be used. LED luminaire unit which consists of an LED lamp, ballast housing, and other components, and Driving circuit which controls the current flowing through LEDs to control its brightness.

White light is the most commonly used form of illumination in both indoor as well as outdoor applications. This is because colors of objects as seen under the white light closely resemble the colors of the same objects under the natural light.

White light is produced in two ways [5]. First one is blue LED with the yellow phosphor coating on the outside. When the blue light traverses through the yellow coating, the combination produces a white light. Different variations of the white light are produced by modifying the thickness of the phosphor layer. The second one is RGB combinations in which white light can be produced by proper mixing of red, green and blue lights. In this method, three separate LEDs are used which increase the cost of LED luminaire compared to using the blue LED with phosphor. RGB combination is more preferable for communication because we use color shift keying to modulate the data using three different wavelengths.

B. VLC Receiver

The optical concentrator is used in the receiver, to set the receiver at a particular angle of light beam. An optical filter is also used to filter out data distorted by noise and multipath effect. Two types of receivers can be used to receive the signal transmitted by an LED [5]. First one is Photodetector, also referred to as photodiode or non-imaging receiver which receives the précised light incident on it and then converts into a current. The second one is Imaging Sensor which is also called a camera sensor. Camera sensor consists of many photodetectors arranged in a matrix or array in an integrated circuit [5].

C. VLC Channel

In VLC channel, experimental arrangement or setup is made with LED as transmitter and photodetectors as a receiver in a Line of Sight(LOS) link. For calculating channel gain we have to analyze indoor link. For VLC, indoor link four types are possible [4]. First is Line of Sight (LOS) link, in which receiver and transmitter are in-line. Second is Non-directed LOS link where at receiver side there is LOS path and multipath due to physical obstacles and the wall of a room. A third is a diffuse link with no LOS path but having only multipath signals on the receiver side Fourth is Quasi-diffuse link with multiple narrow beam transmitters and narrow Field of View (FOV) receiver, achieving lower multipath effects and lower path loss.

Visible Light Communication (Part – 1)

What is VLC?

Visible Light Communication system (VLC) is dual use of illumination and communication concept. VLC concepts are that the data is propagated through a visible light wave. Visible Lightwave produced by LED or LASER. But LED has many advantages like energy savings and longer lifespans and also other benefits. Usage of LED is increased exponentially. LED has a short range of illumination so that it can be used in indoor environments for both purpose illuminations as well as communication. The LEDs are capable of switching to different light intensity levels at a very fast rate. The switching rate is fast enough to be imperceptible by a human eye. This functionality can be used for communication where the data is encoded in the emitting light in various ways. A photodetector or an image sensor (matrix of photodiodes) can receive the modulated signals and decode the data. Visible Light Communication provides many benefits. First visible light spectrum in Figure 1 includes hundreds of terahertz of license-free bandwidth which is completely untapped for communication. Second due to its high frequency, visible light cannot penetrate through most object and walls. It can also increase the capability of an available wireless channel. Third, VLC facilitates the reuse of existing lighting infrastructure for purpose of communication.

In MIMO VLC system, as the number of transmitters and receivers increases, large adjacent channel interference is introduced. The adjacent channel interference is helpful to achieve the higher strength of a signal at receiver side due to use of MIMO diversity repetition coding technique. Repetition coding means simply transmit same data by multiple transmitters.

spectrum of VLC
In this section, we discuss equalizer, which is used for removing Inter-Symbol Interference (ISI). Performance of MIMO VLC can also be increased by applying different equalizer. The type of simple equalizer is the Zero Forcing (ZF) and Minimum Mean Squared Error (MMSE). We can also improve the performance of the system by adding the Successive Interference Cancellation (SIC) approach to the equalizer. ZF – SIC and MMSE – SIC equalizers give better performance because SIC uses adjacent channel interference to improve the performance of MIMO VLC system. For remove perfect effect of Inter-Symbol Interference (ISI), we use optimal ordering in a different equalizer. All different equalizers applied in MIMO VLC system, and the related simulations have been implemented in MATLAB.

Magento Architecture & Customization (Part – 3)

Magento Module Section

Module located in ‘App/code/Vendor_Name/Module_Name’ or using composer located in ‘Vendor/Vendor_Name/Module_Name’.

In Vendor_Name/Module_Name these section is included…

  • API: New API interface class or extended api interface class of core magento 2.
  • Block: PHP files of blocks. block PHP file is to collect data from the model and use in PHTML. In the layout file, we also declare a support block for PHTML.
  • Console: PHP classes for CLI (Command Line Interface) calls. Need to create this class when in the module we create some extra command who handle module operation by SSH.
  • Controller: Controller is defined as Two types. Who route in Magento admin that define in ‘Controller/Adminhtml’ directory & route in frontend that defines in ‘Controller’ directory. controller template URI is normally defined as uri_1/uri_2/Controller. uri_1 & uri_2 is define in module’s  route.xml.
  • etc: This directory contains two directory frontend & adminhtml. In this directory module.xml is required file for creating a module, also config.xml, di.xml, ack.xml, and Cron’s XML files are also included in etc, frontend or adminhtml directory as per requirement.
  • Helper: Auxiliary classes. these classes access in controller, block and in PHTML.
  • i18n: Language Pack CSV is uploaded here. Like de_DE/de_DE.csv.
  • Model: models, model resources are defined. A model who collects data and interact with View. Resource model is the connection between MySql and Model.
  • Services: These sections contain many Directory. Directory’s list is Observer, Plugin & UI.
    1. Observer: Observer Directory contains an event class. Magento has many predefined events so some module wants to use event then define in etc/di.xml and their classes are in Observer.
    2. Plugin: Plugin’s PHP file who’s extended version of Magento core Module, Controller & Block’s file.
    3. Ui: Required UI Components of a module.
  • Setup: This directory contains database files.
    1. InstallSchema.php: Create Database
    2. InstallData.php: Installation Data (Customer’s, Category’s, Product’s attributes)
    3. UpgradeSchema.php: Update Database
    4. UpgradeData.php: Update Data (Customer’s, Category’s, Product’s attributes)
  • Test: This Directory contains Test Data of Module.
    • View: Template( PHTML, HTML), CSS, js, media file. As usual, This directory contains divide into Adminhtml, Frontend & Base (Applied for both Adminhtml, frontend) Directory. This Directory is used to collect user input and display data according to the user’s data.
  • registration.php: This file is required for a module.
  • composer.json:  This file is required if a module is installed by the Composer. this JSON schema is contained the dependent module, module version, PHP version and other require module and system.

Bootstrap CSS – Grid System

Bootstrap is divided into 12 columns. It includes predefined classes for simple layout. Also you can design complex layout with easy predefined classes.

Class hierarchy is given as per follow :

  • .container or .container-fluid : This is a main class. .container-fluid is used for full width
    • .row – This class is used to make horizontal group of columns. After this class children must be .col-*
      • .col-* – This is used to display content.

 

Bootstrap has inbuilt classed to display page responsive.

Classes bifurcation is as per below.

  • For Large device : col-lg-*
  • For Medium device : col-md-*
  • For Small device : col-sm-*
  • For Extra small device : col-xs-*

Now, we learn how to display columns.

    1. To display content in full page.
    2. To display content in equal two column.
    3.  To display content in equal three column.

You can replace -md with -lg,-sm-xs according to device support.

Magento Architecture & Customization (Part – 2)

Make own module in Magento 2.

  • Why create a module?

Magento is basically a collection of a module, Developer needs to create module whenever Magento shop want to extend & change core feature, add some extra logic or feature, add extra content & integration of other websites(eBay, Instagram,  Amazon etc.) with Magento.

  • Where located module?

Magento core module is located in Magento directory ‘vendor/magento’.  If we create module we have to place in ‘vendor’ folder or ‘app/code/’. if we have to put a module in vendor required module compser.json file.

  • How to create a Module?

First, we have to declare module name like {company_name}{module_name}.

  • Which section and file are included in the Module structure?

In module required file is

  1. Registration.php
  2. Composer.json
  3. etc Folder
  4. In etc folder Module.xml
  • How to install and uninstall module?

Magento Module is installed by two method

  1. Copying Module files in ‘app/code’ or ‘vendor’ directory.
  2. Install by Composer through SSH. (Module have the compulsory composer.json file)

Magento Architecture & Customization (Part – 1)

Magento is MVC Framework, Magento module architecture is EDA.

What is MVC Framework?

  • Model: Work with data, stores, take out data from the database. It is also work in data performance and accuracy of data optimization.
  • View: Showing changes of the system to a user according to data of the model.
  • Controller: Interaction between View and Model. Collect Data from Model and Display on View.

Now Discuss Magento module architecture, Magento module is implemented by MVVM architecture.

  • Model: This model behaves as a normal model. Data management, data handling is performed in this section.
  • View: Graphical Interface handle, Interaction process handle between model and View Model. sending values according to user input in View Model.
  • View Model: this section provides or displays user data, that comes from View section. Model present so converts data into view.

Interaction of the View and View model is identified as a presentation layer. Interaction of the Model and View Model is identified as a Business logic layer.