Translational Hydro-Mechanical Converter with variable area.

1 回表示 (過去 30 日間)
Oscar Pena
Oscar Pena 2018 年 2 月 21 日
回答済み: Martin 2018 年 6 月 11 日
I would like to create a custom component, similar to the Translational Hydro-Mechanical Converter, however, I'd like it to accept an external area value to be used as the parameter that converts the hydraulic pressure to a force. The intent is to be able to vary the area throughout the simulation.
I have tried modifying the source code for the component to achieve this but do not have enough of a fundamental understanding of the language to do so. How can I define an input and communicate that input to the internal component "chosen_converter"?
Something like this:
% component translational_converter_area
inputs
AR = {1e-3, 'in^2'}; % AR:left
end
nodes
C = foundation.mechanical.translational.translational; % C:left
A = foundation.hydraulic.hydraulic; % A:left
R = foundation.mechanical.translational.translational; % R:right
end
parameters
area = AR;
or = { 1, '1' };
compressibility = { 0, '1' };
init_pos = { 0, 'm' };
V_dead = { 1e-4, 'm^3' };
k_sh = { 1.4, '1' };
initial_pressure = { 0, 'Pa' };
end
if ~compressibility
equations
% Assertions
assert(area > 0);
end
components
chosen_converter = foundation.hydraulic.elements.translational_converter_incompressible...
(area=area, or=or);
end
else
equations
assert(area > 0)
assert(V_dead > 0)
assert(k_sh >= 1)
assert(k_sh < 2)
assert(init_pos >= 0)
assert(initial_pressure >= {-1, 'atm'})
end
components
chosen_converter = foundation.hydraulic.elements.translational_converter_compressible...
(area=area, or=or, init_pos=init_pos, V_dead=V_dead, k_sh=k_sh,...
initial_pressure=initial_pressure);
end
end
connections
connect(chosen_converter.A,A);
connect(chosen_converter.C,C);
connect(chosen_converter.R,R);
end
end
In the original code the input is not invoked and the parameter 'area' has a constant value. The modified version does not work (AR faults out as 'undefined') but I lack the understanding of the way the code communicates information to make it work.
Are there any suggestions or similar exercises I can use as reference?

採用された回答

Martin
Martin 2018 年 6 月 11 日
Parameters are fixed during compilation, therefore the definition area = AR is not valid. In the Foundation Library block, it picks one file or the other for its internal component based on the compressibility setting. These files contain the math. You will need to modify these as well, as your system has different math (area as input instead of parameter). You can then use a connect statement to connect the input from your outer block to the input of your inner block.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeUpgrading Hydraulic Models to Use Isothermal Liquid Blocks についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by