Gencost.m
资源名称:power.rar [点击查看]
上传用户:eighthdate
上传日期:2014-05-24
资源大小:270k
文件大小:1k
源码类别:
其他行业
开发平台:
Matlab
- % This program computes the total generation cost. It requires the
- % real power generation schedule and the cost matrix.
- % Copyright (C) 1998 by H. Saadat
- %function [totalcost]=gencost(Pgg, cost)
- if exist('Pgg')~=1
- Pgg=input('Enter the scheduled real power gen. in row matrix ');
- else,end
- if exist('cost')~=1
- cost = input('Enter the cost function matrix ');
- else, end
- ngg = length(cost(:,1));
- Pmt = [ones(1,ngg); Pgg; Pgg.^2];
- for i = 1:ngg
- costv(i) = cost(i,:)*Pmt(:,i);
- end
- totalcost=sum(costv);
- fprintf('nTotal generation cost = % 10.2f $/h n', totalcost)