Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
this S function shows fault please help me out..it is for a PV cell

Subject: this S function shows fault please help me out..it is for a PV cell

From: deadsea

Date: 30 Jul, 2009 19:16:02

Message: 1 of 3

it shows that ssetinput parameter methode is not registered properly.
function MPPT (block)

setup (block);
function [Pa_max,Imp,Vmp]=find_mpp(G,TaC)
Va=12;
Pa_max=0;
while Va<48-TaC/8
    Ia=bp_sx150s(Va,G,TaC);
    Pa_new=Ia*Va;
    if Pa_new>Pa_max
        Pa_max=Pa_new;
        Imp=Ia;
        Vmp=Va;
    end
    Va=Va+.005;
end
function setup (block)
block.NumInputPorts=2;
block.NumOutputPorts=2;
block.RegBlockMethod('SetInputPortSamplingMode', @SetInPortSamplingMode);
    function SetInputPortSamplingMode(block, idx, fd)
 block.InputPort(idx).SamplingMode = fd;
 block.InputPort(idx).SamplingMode = fd;

block.OutputPort(1).SamplingMode = fd;
block.OutputPort(2).SamplingMode = fd;

block.InputPort(1).Complexity='Real';
block.InputPort(1).DataTypeID= 0;
block.InputPort(1).SamplingMode='Sample';
block.InputPort(1).Dimensions=1;
block.InputPort(2).Complexity='Real';
block.InputPort(2).DataTypeID= 0;
block.InputPort(2).SamplingMode='Sample';
block.InputPort(2).Dimensions=1;
block.OutputPort(1).Complexity='Real';
block.Outputport(1).DataTypeID=0;
block.OutputPort(1).SamplingMode='Sample';
block.OutputPort(1).Dimensions=1;
block.OutputPort(2).Complexity='Real';
block.Outputport(2).DataTypeID=0;
block.OutputPort(2).SamplingMode='Sample';
block.OutputPort(2).Dimensions=1;
block.RegBlockMethod('SetInputPortSamplingMode', @SetInPortSamplingMode);
    
block.RegBlockMethod('Outputs',@Outputs);

  

 
block.SetAccelRunOnTLC(true);
function Outputs(block)
     block.OutputPort(1).Data = block.InputPort(1).Data;
  block.OutputPort(2).Data = block.InputPort(2).Data;

G =block.InputPort(1).Data;
TaC=block.InputPort(2).Data;
C=0.1;
Va=24.0;
Ia=bp_sx150(Va,G,TaC);
Pa=Va*Ia;
Vref_new=Va+C;
for n=1:100;
    Va_new=Vref_new;
    Ia_new=bp_sx150s(Vref_new,G,TaC);
    Pa_new=Va_new*Ia_new;
    deltaPa=Pa_new-Pa;
    if deltaPa>0
        if Va_new>Va
            Vref_new=Va_new+C;
        else
            Vref_new=Va_new-C;
        end
    else if deltaPa<0
            if Vref_new>Va
                Vref_new=Va_new-C;
                
            else Vref_new=Va_new+C;
            end
        else Vref_new=Va_new;
        end
        Va=Va_new;
        Pa=Pa_new;
    end
    Vmp=Va;
    Ia=Ia_new;
    block.OutputPort(1).Data=Ia;
    block.OutputPort(2).Data=Vmp;
end
    
    

Subject: this S function shows fault please help me out..it is for a PV cell

From: Phil Goddard

Date: 31 Jul, 2009 01:53:01

Message: 2 of 3


You are registering a method called SetInportSamplingMode
> block.RegBlockMethod('SetInputPortSamplingMode', @SetInPortSamplingMode);

But you do not have a method with that name.

However you do have one called SetInputPortSamplingMode,
> function SetInputPortSamplingMode(block, idx, fd)

Phil.

Subject: this S function shows fault please help me out..it is for a PV cell

From: sudarshan13

Date: 12 Feb, 2014 17:25:35

Message: 3 of 3

why is it Va<48-TaC/8 ??

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us