0% found this document useful (0 votes)
26 views6 pages

Asignment - 2 (Aitee) B20ee101

note 2_Zbusbuilding algorithm_solution of linear equations_Sparsity oriented programming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views6 pages

Asignment - 2 (Aitee) B20ee101

note 2_Zbusbuilding algorithm_solution of linear equations_Sparsity oriented programming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

AI Techniques in Electrical Engineering

Assignment- 2(UNIT – III & IV)


1. Develop the fuzzy rule base for two area load frequency control (LFC).
1. Simulate the two area LFC with fuzzy plus PI controller.
2. Develop the fuzzy membership functions for input variables.
3. Develop the fuzzy membership functions for output variables
ANS:

Fuzzy LFC with Fuzzy-PI Controller and MATLAB Code

the fuzzy rule base, membership functions, and sample MATLAB code for simulating
a two-area LFC system with a fuzzy-PI controller:

1. Fuzzy Rule Base:

consider two input variables:

• Δf (Change in Frequency): Negative Big (NB), Zero (ZE), Positive Big (PB)
• ΔPtie (Change in Tie-Line Power): Negative Big (NB), Zero (ZE), Positive
Big (PB)
The output variable is ΔΔUref (Change in reference change of governor control
signal) for each area.
Rule Base Table:

Δf (Area 1) Δf (Area 2) ΔPtie ΔΔUref (Area 1) ΔΔUref (Area 2)

NB NB NB PB PB

NB NB ZE PB PM

NB NB PB PB PS

PB PB NB NB NB

PB PB ZE NM NB
PB PB PB NS NB

2. Fuzzy Membership Functions:

Triangular membership functions are used for both Δf and ΔPtie:

Matlab
% Define membership functions (example)
Δf_NB = triangularMF(-2, -3, -1);
Δf_ZE = triangularMF(-1, 0, 1);
Δf_PB = triangularMF(1, 3, 2);

ΔPtie_NB = triangularMF(-2, -3, -1);


ΔPtie_ZE = triangularMF(-1, 0, 1);
ΔPtie_PB = triangularMF(1, 3, 2);

3. Fuzzy-PI Controller:

The fuzzy controller outputs a correction term (ΔUref_fuzzy) that is added to the
reference signal (Uref) of the PI controller. The PI controller output (Uref_PI) is then
used to adjust the governor control signal.

4. Sample MATLAB Code:

This code provides a basic structure for simulating the two-area LFC system with a
fuzzy-PI controller. It defines the fuzzy rules, membership functions, and simulates
the system response to a load disturbance.

Matlab
% Define fuzzy variables and membership functions (as shown in point 2)

% Define fuzzy rules (using if-then statements)


rule1 = rule(Δf_NB & ΔPtie_NB, ΔΔUref_PB);
rule2 = rule(Δf_NB & ΔPtie_ZE, ΔΔUref_PM);
% ... Define additional rules based on the rule base table

% Create fuzzy controller object


fuzzy_ctrl = FuzzyLogicController;

% Add rules to the controller


fuzzy_ctrl.addRule(rule1, rule2, ...); % Add all defined rules

% Define PI controller parameters (Kp, Ki)


Kp = 1;
Ki = 2;
% Simulate the two-area LFC system with fuzzy-PI controller
% ... (Simulink model development with fuzzy controller integration)

% Apply load disturbance to the system

% Plot system response (frequency, tie-line power)

Note: This is a simplified example. A complete simulation would involve building a


Simulink model of the two-area power system, integrating the fuzzy-PI controller, and
implementing disturbance scenarios.
• The fuzzy controller can be further enhanced by including an integral term
within the fuzzy rules themselves.
• Tuning the membership functions and PI controller parameters requires
optimization techniques or simulations with various scenarios.

This code provides a starting point for simulating a two-area LFC system with a
fuzzy-PI controller in MATLAB. You'll need to fill in the details of the Simulink model
development and integrate the fuzzy controller logic within the simulation
environment.

2. Write a suitable MATLAB code for the optimal placement of FACTS devices using Genetic Algorithm
(GA) (Consider an IEEE30 bus system for the problem formulation and calculation).
Determine the following:
1. Find the optimal location of FACTS devices.
2. Generate the cost coefficients of individual generators.
3. Calculate the total losses in the system with and without FACTS devices.
Ans:

MATLAB code outline for optimal placement of FACTS devices using a Genetic
Algorithm (GA) on an IEEE30 bus system:

Matlab
% 1. Load IEEE30 bus data
busdata = readcase('ieee30');

% 2. Define function to calculate bus power injections (P_gi, Q_gi)


function [Pg, Qg] = bus_injection(busdata)
% Implement logic to calculate real and reactive power injections
% based on busdata (generator buses, generator parameters)
Pg = zeros(size(busdata.bus,1),1);
Qg = zeros(size(busdata.bus,1),1);
% ... (consider generator active/reactive power limits)
return;
end

% 3. Define function to calculate power flow (using Newton-Raphson or


other)
function [bus_sol] = power_flow(busdata)
% Implement power flow solution using chosen method (NR, etc.)
% Update bus voltages and angles based on power injections
bus_sol = busdata;
% ... (consider line resistances, reactances, etc.)
return;
end

% 4. Define function to calculate total power losses


function [losses] = total_losses(busdata)
% Calculate real and reactive power losses on each line
% Sum losses across all lines for total system loss
losses = 0;
for i = 1:size(busdata.branch,1)
% ... (use bus voltages and line parameters)
end
return;
end

% 5. GA Parameters (iterations, population size, etc.)


ga_iterations = 100;
population_size = 20;

% 6. Chromosome representation (e.g., binary string for bus selection)


chromosome_length = size(busdata.bus,1); % One gene for each bus

% 7. GA Initialization (random population of chromosomes)


population = randi([0 1], population_size, chromosome_length);

% 8. Fitness function (minimize total power losses with FACTS devices)


function fitness = fitness_function(chromosome, busdata)
% Apply FACTS device based on chromosome value (e.g., set bus type)
modified_busdata = busdata;
% ... (modify busdata based on FACTS device type and location)

% Perform power flow with modified busdata


bus_sol = power_flow(modified_busdata);

% Calculate total losses with FACTS devices


losses = total_losses(bus_sol);

% Fitness is negative of total losses (minimize losses)


fitness = -losses;
return;
end
% 9. GA Loop (selection, crossover, mutation)
for i = 1:ga_iterations
% ... (implement selection, crossover, mutation operators)
% ... (evaluate fitness of new generation)
end

% 10. Select best chromosome (optimal device placement)


best_chromosome = population(fitness == max(fitness), :);

% 11. Cost coefficients of generators (based on active power dispatch)


% ... (need additional power system analysis or economic dispatch
methods)

% 12. Total losses with and without FACTS devices


losses_without_facts = total_losses(busdata);
losses_with_facts = fitness_function(best_chromosome, busdata);

% Display results (optimal location, cost coefficients, losses)

Explanation:
1. The code loads the IEEE30 bus data.
2. Functions are defined to calculate bus power injections, power flow, and total
losses.
3. GA parameters and chromosome representation are defined.
4. The code initializes a random population of chromosomes.
5. A fitness function evaluates each chromosome by simulating the power flow
with FACTS devices placed based on the chromosome and calculating total
losses (minimized).
6. The GA loop iterates, performing selection, crossover, and mutation to evolve
the population towards optimal solutions.
7. The best chromosome represents the optimal placement of FACTS devices.
8. Cost coefficients require additional power system analysis (not included here).
9. The code calculates total losses with and without FACTS devices using the
defined functions.

P.SUSHMA
B20EE101

You might also like