Demo entry 6397685

产量推算

   

Submitted by anonymous on May 24, 2017 at 14:55
Language: Matlab. Code size: 7.2 kB.

%根据2010-2015年数据推算出各生产线产能利用率,进而得出2009年各生产线产量
clinker_line=zeros(n,26);total_clinker=zeros(n,1);
i=2009;
    for j=1:n
        if m(j,1)==0
            if kilns_type_ID(j,1)==1
               if province_capacity_PC(province_ID(j,1),i-1989)~=0
                   clinker_line(j,i-1989)=year_capacity_1(j,i-1989)*province_clinker_1(province_ID(j,1),i-1989)/province_capacity_PC(province_ID(j,1),i-1989);
               else
                   clinker_line(j,i-1989)=0; 
               end
            elseif kilns_type_ID(j,1)==2
               if province_capacity_OR(province_ID(j,1),i-1989)~=0
                   clinker_line(j,i-1989)=year_capacity_2(j,i-1989)*province_clinker_2(province_ID(j,1),i-1989)/province_capacity_OR(province_ID(j,1),i-1989);
               else
                   clinker_line(j,i-1989)=0; 
               end
            else
               if province_capacity_SK(province_ID(j,1),i-1989)~=0
                   clinker_line(j,i-1989)=year_capacity_3(j,i-1989)*province_clinker_3(province_ID(j,1),i-1989)/province_capacity_SK(province_ID(j,1),i-1989);
               else
                   clinker_line(j,i-1989)=0; 
               end
            end
        elseif syear(j,1)>=2010
            clinker_line(j,i-1989)=0;
        else
            total_clinker(j,1)=0;
            for k=1:6
                if l(j,k)==0
                    if eyear(j,1)==k+2009
                        total_clinker(j,1)=total_clinker(j,1)+clinker_2010_2015(j,k)*12/emonth(j,1);
                    else
                        total_clinker(j,1)=total_clinker(j,1)+clinker_2010_2015(j,k);
                    end
                else
                end
            end
            clinker_line(j,i-1989)=total_clinker(j,1)/m(j,1);
        end
    end
%假设每条生产线产能利用率不变,算出1990-2008年产量
for i=1990:2008
    for j=1:n
        if m(j,1)==0
            if kilns_type_ID(j,1)==1
               if province_capacity_PC(province_ID(j,1),i-1989)~=0
                   clinker_line(j,i-1989)=year_capacity_1(j,i-1989)*province_clinker_1(province_ID(j,1),i-1989)/province_capacity_PC(province_ID(j,1),i-1989);
               else
                   clinker_line(j,i-1989)=0; 
               end
            elseif kilns_type_ID(j,1)==2
               if province_capacity_OR(province_ID(j,1),i-1989)~=0
                   clinker_line(j,i-1989)=year_capacity_2(j,i-1989)*province_clinker_2(province_ID(j,1),i-1989)/province_capacity_OR(province_ID(j,1),i-1989);
               else
                   clinker_line(j,i-1989)=0; 
               end
            else
               if province_capacity_SK(province_ID(j,1),i-1989)~=0
                   clinker_line(j,i-1989)=year_capacity_3(j,i-1989)*province_clinker_3(province_ID(j,1),i-1989)/province_capacity_SK(province_ID(j,1),i-1989);
               else
                   clinker_line(j,i-1989)=0; 
               end
            end
        elseif syear(j,1)>=2010
            clinker_line(j,i-1989)=0;
        elseif ((i>syear(j,1))&(eyear(j,1)==0))|((i>syear(j,1))&(i<eyear(j,1)))
            clinker_line(j,i-1989)=clinker_line(j,20);
        elseif i==syear(j,1)
            clinker_line(j,i-1989)=clinker_line(j,20)*(13-smonth(j,1))/12;
        else
            clinker_line(j,i-1989)=0;
        end
    end
end
%分配至PC、OR、SK各生产线产量
c1=0;
c2=0;
c3=0;
for i=1:n
    if kilns_type_ID(i,1)==1
        c1=c1+1;
        clinker_line_PC(c1,:)=clinker_line(i,:);
    elseif kilns_type_ID(i,1)==2
        c2=c2+1;
        clinker_line_OR(c2,:)=clinker_line(i,:);
    else
        c3=c3+1;
        clinker_line_SK(c3,:)=clinker_line(i,:);
    end
end 
%将生产线产量修正
clinker_line_PC(:,21:26)=clinker_line_2010_2015_PC(:,1:6);
clinker_line_OR(:,21:26)=clinker_line_2010_2015_OR(:,1:6);
clinker_line_SK(:,21:26)=clinker_line_2010_2015_SK(:,1:6);
province_capacity_line_PC=zeros(31,26);
province_capacity_line_OR=zeros(31,26);
province_capacity_line_SK=zeros(31,26);
for i=1990:2015
    for j=1:n_PC
        province_capacity_line_PC(province_ID(PC_raw_ID(j,1),1),i-1989)=province_capacity_line_PC(province_ID(PC_raw_ID(j,1),1),i-1989)+clinker_line_PC(j,i-1989);
    end 
    for j=1:n_OR
        province_capacity_line_OR(province_ID(OR_raw_ID(j,1),1),i-1989)=province_capacity_line_OR(province_ID(OR_raw_ID(j,1),1),i-1989)+clinker_line_OR(j,i-1989);
    end
    for j=1:n_SK
        province_capacity_line_SK(province_ID(SK_raw_ID(j,1),1),i-1989)=province_capacity_line_SK(province_ID(SK_raw_ID(j,1),1),i-1989)+clinker_line_SK(j,i-1989);
    end
end
clinker_line_fill_PC=zeros(n_PC,26);
clinker_line_fill_OR=zeros(n_OR,26);
clinker_line_fill_SK=zeros(n_SK,26);
for i=1990:2015
    for j=1:n_PC
        if clinker_line_PC(j,i-1989)~=0&&province_capacity_PC(province_ID(PC_raw_ID(j,1),1),i-1989)~=0
        clinker_line_fill_PC(j,i-1989)=clinker_line_PC(j,i-1989)+(province_clinker_1(province_ID(PC_raw_ID(j,1),1),i-1989)-province_capacity_line_PC(province_ID(PC_raw_ID(j,1),1),i-1989))*year_capacity_PC(j,i-1989)/province_capacity_PC(province_ID(PC_raw_ID(j,1),1),i-1989);
        end
    end
    for j=1:n_OR
        if clinker_line_OR(j,i-1989)~=0&&province_capacity_OR(province_ID(OR_raw_ID(j,1),1),i-1989)~=0
        clinker_line_fill_OR(j,i-1989)=clinker_line_OR(j,i-1989)+(province_clinker_2(province_ID(OR_raw_ID(j,1),1),i-1989)-province_capacity_line_OR(province_ID(OR_raw_ID(j,1),1),i-1989))*year_capacity_OR(j,i-1989)/province_capacity_OR(province_ID(OR_raw_ID(j,1),1),i-1989);
        end
    end
    for j=1:n_SK
        if clinker_line_SK(j,i-1989)~=0&&province_capacity_SK(province_ID(SK_raw_ID(j,1),1),i-1989)~=0
        clinker_line_fill_SK(j,i-1989)=clinker_line_SK(j,i-1989)+(province_clinker_3(province_ID(SK_raw_ID(j,1),1),i-1989)-province_capacity_line_SK(province_ID(SK_raw_ID(j,1),1),i-1989))*year_capacity_SK(j,i-1989)/province_capacity_SK(province_ID(SK_raw_ID(j,1),1),i-1989);
        end
    end
end
for i=1990:2015
    for j=1:n_PC
        if clinker_line_PC(j,i-1989)~=0
        clinker_line_fill_PC(j,i-1989)=clinker_line_fill_PC(j,i-1989)+(sum_PC(1,i-1989)-sum_fill_PC(1,i-1989))*year_capacity_PC(j,i-1989)/total_capacity_PC(2,i-1989);
        end
    end
    for j=1:n_OR
        if clinker_line_OR(j,i-1989)~=0
        clinker_line_fill_OR(j,i-1989)=clinker_line_fill_OR(j,i-1989)+(sum_OR(1,i-1989)-sum_fill_OR(1,i-1989))*year_capacity_OR(j,i-1989)/total_capacity_OR(2,i-1989);
        end
    end
    for j=1:n_SK
        if clinker_line_SK(j,i-1989)~=0
        clinker_line_fill_SK(j,i-1989)=clinker_line_fill_SK(j,i-1989)+(sum_SK(1,i-1989)-sum_fill_SK(1,i-1989))*year_capacity_SK(j,i-1989)/total_capacity_SK(2,i-1989);
        end
    end
end
for i=1990:2015
    for j=1:n_PC
        if clinker_line_fill_PC(j,i-1989)<=0
            clinker_line_fill_PC(j,i-1989)=0;
        end
    end
    for j=1:n_OR
        if clinker_line_fill_OR(j,i-1989)<=0
            clinker_line_fill_OR(j,i-1989)=0;
        end
    end
    for j=1:n_SK
        if clinker_line_fill_SK(j,i-1989)<=0
            clinker_line_fill_SK(j,i-1989)=0;
        end
    end
end

This snippet took 0.02 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).