Skip to content

Commit

Permalink
Update mp.cost_table constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdzman committed Dec 23, 2023
1 parent b00a426 commit 691450f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/+mp/cost_table.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
% See https://matpower.org for more info.

methods
function obj = cost_table(poly_n, poly_coef, pwl_n, pwl_qty, pwl_cost)
function obj = cost_table(varargin)
% ::
%
% T = cost_table()
% T = cost_table(poly_n, poly_coef, pwl_n, pwl_qty, pwl_cost)
%
% *For descriptions of the inputs, see the corresponding column in
Expand All @@ -67,9 +68,15 @@
% Outputs:
% T (mp.cost_table) : the cost table object

obj.tab = mp_table_subclass(poly_n, poly_coef, pwl_n, pwl_qty, pwl_cost, ...
'VariableNames', ...
{'poly_n', 'poly_coef', 'pwl_n', 'pwl_qty', 'pwl_cost'});
if nargin == 0
args = {};
elseif nargin == 5
args = {varargin{:}, 'VariableNames', ...
{'poly_n', 'poly_coef', 'pwl_n', 'pwl_qty', 'pwl_cost'}};
else
error('mp.cost_table: constructor must be called with 0 or 5 arguments.')
end
obj@mp_table_subclass(args{:});
end
end %% methods
end %% classdef

0 comments on commit 691450f

Please sign in to comment.