From 8ac15bc5efafa2afc053c293152605b0e6ae60ff Mon Sep 17 00:00:00 2001 From: Siddharth Agarwal Date: Tue, 3 Sep 2019 18:27:40 +0530 Subject: Xcos examples from textbooks and for blocks --- Working_Examples/83/CH7/EX7.5/example_7_5.sce | 69 ++++++++++++++++++++++ .../83/CH7/EX7.5/result_example_7_5.txt | 13 ++++ 2 files changed, 82 insertions(+) create mode 100755 Working_Examples/83/CH7/EX7.5/example_7_5.sce create mode 100755 Working_Examples/83/CH7/EX7.5/result_example_7_5.txt (limited to 'Working_Examples/83/CH7/EX7.5') diff --git a/Working_Examples/83/CH7/EX7.5/example_7_5.sce b/Working_Examples/83/CH7/EX7.5/example_7_5.sce new file mode 100755 index 0000000..aed5fe2 --- /dev/null +++ b/Working_Examples/83/CH7/EX7.5/example_7_5.sce @@ -0,0 +1,69 @@ +//Chapter 7 +//Example 7.5 +//page 264 +//To find savings when losses are coordinated +clear;clc; + +function [lamdaprev,Pg]=optimum(Pd) + n=2; //number of generators + Alpha=[0.02 0.04]; + Beta=[16 20]; + lamda=20; //initial guess for lambda + lamdaprev=lamda; + eps=1; //tolerance + deltalamda=0.25; //increment in lamda + Pgmax=[200 200]; + Pgmin=[0 0]; + Pg=100*ones(n,1); + while abs(sum(Pg)-Pd)>eps + for i=1:n + Pg(i)=(lamda-Beta(i))/Alpha(i); + if Pg(i)>Pgmax(i) then + Pg(i)=Pgmax(i); + end + if Pg(i)