1

I'm trying to create a custom block in Simscape that convert energy from pressurized water into a torque. Here is my code:

component pelton_turbine
% Ce composant calcule le couple généré par l'eau sur la turbine.

% 🔹 Déclaration des ports
nodes
    H = foundation.hydraulic.hydraulic; % Port hydraulique
    R = foundation.mechanical.rotational.rotational; % Port mécanique rotatif
end

% 🔹 Déclaration des paramètres
parameters
    eta = {0.85, '1'};      % Rendement de la turbine
    rho = {1000, 'kg/m^3'}; % Densité de l'eau
    r = {0.5, 'm'};         % Rayon moyen de la roue
    g = {9.81, 'm/s^2'};    % Gravité
end

% 🔹 Déclaration des variables internes
variables
    Q = {0, 'm^3/s'};
    T = {0, 'N*m'};  % Couple généré
    H_head = {0, 'm'}; % Hauteur d'eau équivalente
end

branches
 % Débit hydraulique pris directement depuis le port H
    Q : H.q -> *;
end

equations

    % Calcul de la hauteur d'eau (pression convertie en mètre de colonne d'eau)
    H_head == H.p/ (rho * g);

    % Calcul du couple généré par l'eau
    T == {eta * rho * Q * r * sqrt(H_head * 2 * g), 'N*m'}; 

    % Transmission du couple à l’axe mécanique
    R.t == T;
end

end

My problem is that I have this error when I try to build my component:

Invalid use of a value with unit cm^3*kg/(m*s^2) when attempting to bind a unit.
The value to which the unit is bound must not have an associated unit.
   • In pelton_turbine.pelton_turbine (line 36)
   eta = 0.8500
   rho = {1000, 'kg/m^3'}
   Q = {[1x1 double], 'cm^3/s'}
   r = {0.5000, 'm'}
   H_head = {[1x1 double], 'm'}
   g = {9.8100, 'm/s^2'}

I don't get why the flow rate (Q) is in cm^3/s instead of m^3/s and I don't know how to change it. Do you have an idea ?

Since Q is a through variable I can't define his unit. I also tried changing the units in the Configuration Parameters in my .slx file (I changed cm^3/s into m^3/s for the flow rate) but it didn't have any effect on my .ssc file and I keep getting the error.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.