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:
Simscape language: definition of constants

Subject: Simscape language: definition of constants

From: pietro

Date: 5 Jun, 2013 15:00:09

Message: 1 of 2

Hi all,

I have just created a custom convective coefficient block, which it sets the convective coefficient in function of the the speed. You can see my code at the end of the post.
I get the following error in simple model.

Number of variables exceeds number of equations. Check for missing reference node.

I tested it with a very simple simscape I'm very sure the simscape model is correct since it works with the standard convective block.

 I think it's related to the definition of constants that is performed defining variables, since I solved it defining the AirKinViscosity and AirHeatTransfCoeff as parameters rather than variables. but I don't want to see them in the block mask. Is there a best way to define constants?

Thanks

Any help is appreciated.

cheers

Pietro

component conv_lat < foundation.thermal.branch
    parameters
    area = { 1e-4, 'm^2' }; % Area
    DiscDiam={1,'m'}; %Disc diameter
    AmbientTemp={300,'K'}; %Ambient temperature
  end
  
  inputs
     w = {0, 'rad/s'}; % Ang rate : left
  end
  
  variables
         AirKinViscosity={19.32*10^-6,'(m^2)/(s)'};
        AirHeatTransfCoeff={0.0294,'W/(m*K)' };
  end
  function setup
    % Parameter range checking
    if area <= 0
         pm_error('simscape:GreaterThanZero','Area')
    end
    
    if AmbientTemp <= 0
         pm_error('simscape:GreaterThanZero','Ambient Temperature')
    end
end
  equations
      let
        Re=(w*(DiscDiam/2)^2)/AirKinViscosity;
         heat_tr_coeff=3.974*AirHeatTransfCoeff/DiscDiam*Re^0.55;
      in
        Q == area * heat_tr_coeff * T;
      end
  end

end

Subject: Simscape language: definition of constants

From: pietro

Date: 6 Jun, 2013 06:37:09

Message: 2 of 2

Hi all,

I have just found the solution it was necessary to write the following statement:

parameters (access=private)

end

cheers

Pietro

"pietro " <bracardi82@email.it> wrote in message <konjpp$mpb$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I have just created a custom convective coefficient block, which it sets the convective coefficient in function of the the speed. You can see my code at the end of the post.
> I get the following error in simple model.
>
> Number of variables exceeds number of equations. Check for missing reference node.
>
> I tested it with a very simple simscape I'm very sure the simscape model is correct since it works with the standard convective block.
>
> I think it's related to the definition of constants that is performed defining variables, since I solved it defining the AirKinViscosity and AirHeatTransfCoeff as parameters rather than variables. but I don't want to see them in the block mask. Is there a best way to define constants?
>
> Thanks
>
> Any help is appreciated.
>
> cheers
>
> Pietro
>
> component conv_lat < foundation.thermal.branch
> parameters
> area = { 1e-4, 'm^2' }; % Area
> DiscDiam={1,'m'}; %Disc diameter
> AmbientTemp={300,'K'}; %Ambient temperature
> end
>
> inputs
> w = {0, 'rad/s'}; % Ang rate : left
> end
>
> variables
> AirKinViscosity={19.32*10^-6,'(m^2)/(s)'};
> AirHeatTransfCoeff={0.0294,'W/(m*K)' };
> end
> function setup
> % Parameter range checking
> if area <= 0
> pm_error('simscape:GreaterThanZero','Area')
> end
>
> if AmbientTemp <= 0
> pm_error('simscape:GreaterThanZero','Ambient Temperature')
> end
> end
> equations
> let
> Re=(w*(DiscDiam/2)^2)/AirKinViscosity;
> heat_tr_coeff=3.974*AirHeatTransfCoeff/DiscDiam*Re^0.55;
> in
> Q == area * heat_tr_coeff * T;
> end
> end
>
> end

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