Skip to content

Commit

Permalink
[MATLAB] Expose zeroD names
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Aug 8, 2024
1 parent d39ef1e commit ba501da
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
17 changes: 15 additions & 2 deletions interfaces/matlab_experimental/Reactor/FlowDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

properties (SetAccess = public)

name % name of flow device.

% Upstream object of type :mat:class:`Reactor` or :mat:class:`Reservoir`.
upstream

Expand All @@ -56,17 +58,20 @@
methods
%% FlowDevice Class Constructor

function x = FlowDevice(typ)
function x = FlowDevice(typ, name)
% Create a :mat:class:`FlowDevice` object.

ctIsLoaded;

if nargin == 0
error('please specify the type of flow device to be created');
end
if nargin < 2
name = '(none)';
end

x.type = typ;
x.id = ctFunc('flowdev_new', typ);
x.id = ctFunc('flowdev_new3', typ, name);
x.upstream = -1;
x.downstream = -1;
end
Expand Down Expand Up @@ -112,12 +117,20 @@ function install(f, upstream, downstream)

%% FlowDevice Get Methods

function name = get.name(f)
name = ctString('flowdev_name', f.id);
end

function mdot = get.massFlowRate(f)
mdot = ctFunc('flowdev_massFlowRate2', f.id);
end

%% FlowDevice Set Methods

function set.name(f, name)
ctFunc('flowdev_setName', f.id, name);
end

function set.massFlowRate(f, mdot)

if strcmp(f.type, 'MassFlowController')
Expand Down
12 changes: 10 additions & 2 deletions interfaces/matlab_experimental/Reactor/Reactor.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

properties (SetAccess = public)

name % Name of reactor.

contents

% Density of the reactor contents at the end of the last call to
Expand Down Expand Up @@ -131,8 +133,6 @@

r.type = char(typ);
r.id = ctFunc('reactor_new3', typ, content.solnID, name);


end

%% Reactor Class Destructor
Expand Down Expand Up @@ -160,6 +160,10 @@ function addSensitivityReaction(r, m)

%% Reactor Get Methods

function name = get.name(r)
name = ctString('reactor_name', r.id);
end

function temperature = get.T(r)
temperature = ctFunc('reactor_temperature', r.id);
end
Expand Down Expand Up @@ -215,6 +219,10 @@ function addSensitivityReaction(r, m)

%% Reactor set methods

function set.name(r, name)
ctFunc('reactor_setName', r.id, name);
end

function set.V(r, v0)

ctFunc('reactor_setInitialVolume', r.id, v0);
Expand Down
17 changes: 15 additions & 2 deletions interfaces/matlab_experimental/Reactor/Wall.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

properties (SetAccess = protected)

name % Name of wall.

left % Reactor on the left.
right % Reactor on the right.

Expand Down Expand Up @@ -87,15 +89,18 @@
methods
%% Wall Class Constructor

function w = Wall(l, r)
function w = Wall(l, r, name)
% Create a :mat:class:`Wall` object.
ctIsLoaded;

% At the moment, only one wall type is implemented
typ = 'Wall';
if nargin < 3
name = '(none)';
end

w.type = char(typ);
w.id = ctFunc('wall_new', w.type);
w.id = ctFunc('wall_new3', w.type, name);

% Install the wall between left and right reactors
w.left = l;
Expand Down Expand Up @@ -127,6 +132,10 @@ function delete(w)

%% ReactorNet get methods

function name = get.name(w)
name = ctString('wall_name', w.id);
end

function a = get.area(w)
a = ctFunc('wall_area', w.id);
end
Expand All @@ -141,6 +150,10 @@ function delete(w)

%% ReactorNet set methods

function set.name(w, name)
ctFunc('wall_setName', w.id, name);
end

function set.area(w, a)
ctFunc('wall_setArea', w.id, a);
end
Expand Down

0 comments on commit ba501da

Please sign in to comment.