1
1
classdef epanet <handle
2
- %EPANET-Matlab Toolkit version EMT v2.2.2 : A Matlab Class for EPANET and EPANET-MSX
2
+ %EPANET-Matlab Toolkit version EMT v2.2.6 : A Matlab Class for EPANET and EPANET-MSX
3
3
%libraries
4
4
%
5
5
%
390
390
391
391
end
392
392
properties (Constant = true)
393
- classversion='v2.2.5 - Last Update: 10 /05/2023';
393
+ classversion='v2.2.6 - Last Update: 26 /05/2023';
394
394
395
395
LOGOP={'IF', 'AND', 'OR'} % Constants for rule-based controls: 'IF', 'AND', 'OR' % EPANET Version 2.2
396
396
RULEOBJECT={'NODE', 'LINK', 'SYSTEM'}; % Constants for rule-based controls: 'NODE', 'LINK', 'SYSTEM' % EPANET Version 2.2
@@ -4164,7 +4164,7 @@ function apiMSXMatlabCleanup(obj)
4164
4164
if strcmpi(varargin{2}, 'BIN')
4165
4165
obj.LibEPANET = 'epanet2';
4166
4166
obj.BinTempfile=[obj.InputFile(1:end-4), '_temp.inp'];
4167
- copyfile(obj.InputFile, obj.BinTempfile);
4167
+ copyfile(obj.InputFile, obj.BinTempfile, 'f' );
4168
4168
obj.InputFile=obj.BinTempfile;
4169
4169
obj.Bin=0;
4170
4170
if nargin==3, if strcmpi(varargin{3}, 'LOADFILE'); return; end; end
@@ -4261,7 +4261,7 @@ function apiMSXMatlabCleanup(obj)
4261
4261
%Save the temporary input file
4262
4262
obj.BinTempfile=[obj.InputFile(1:end-4), '_temp.inp'];
4263
4263
4264
- copyfile(obj.InputFile, obj.BinTempfile);
4264
+ copyfile(obj.InputFile, obj.BinTempfile, 'f' );
4265
4265
%obj.saveInputFile(obj.BinTempfile); % create a new INP file (Working Copy) using the SAVE command of EPANET
4266
4266
4267
4267
obj.closeNetwork; %apiENclose; %Close input file
@@ -4537,14 +4537,16 @@ function apiMSXMatlabCleanup(obj)
4537
4537
end
4538
4538
else
4539
4539
obj.MSXTempFile=[obj.MSXFile(1:end-4), '_temp.msx'];
4540
- copyfile(obj.MSXFile, obj.MSXTempFile);
4540
+ copyfile(obj.MSXFile, obj.MSXTempFile, 'f' );
4541
4541
end
4542
4542
4543
4543
%Open the file
4544
4544
[obj.Errcode] = obj.apiMSXopen(obj);
4545
4545
if obj.Errcode, warning(obj.getMSXError(obj.Errcode)); end
4546
- if any(strcmpi(varargin{1}, loadfile_options))
4547
- return
4546
+ if ~isempty(varargin)
4547
+ if any(strcmpi(varargin{1}, loadfile_options))
4548
+ return
4549
+ end
4548
4550
end
4549
4551
obj.MSXEquationsTerms = obj.getMSXEquationsTerms;
4550
4552
obj.MSXEquationsPipes = obj.getMSXEquationsPipes;
@@ -9527,7 +9529,7 @@ function setCurveValue(obj, index, curvePnt, value)
9527
9529
obj.closeQualityAnalysis;
9528
9530
end
9529
9531
function value = getComputedTimeSeries(obj)
9530
- obj.saveInputFile(obj.TempInpFile );
9532
+ obj.saveInputFile();
9531
9533
[fid, binfile, ~] = runEPANETexe(obj);
9532
9534
if fid < 0
9533
9535
value = obj.getComputedTimeSeries_ENepanet();
@@ -9543,7 +9545,8 @@ function setCurveValue(obj, index, curvePnt, value)
9543
9545
end
9544
9546
end
9545
9547
function value = getComputedTimeSeries_ENepanet(obj)
9546
- obj.saveInputFile(obj.TempInpFile);
9548
+ obj.saveInputFile();
9549
+ obj.closeNetwork();
9547
9550
uuID = char(java.util.UUID.randomUUID);
9548
9551
rptfile=[obj.TempInpFile(1:end-4), '.txt'];
9549
9552
binfile=['@#', uuID, '.bin'];
@@ -13537,10 +13540,10 @@ function saveHydraulicsOutputReportingFile(obj)
13537
13540
if nargin == 1
13538
13541
inpname = obj.TempInpFile;
13539
13542
end
13540
- [Errcode] = obj.apiENsaveinpfile('@#' , obj.LibEPANET, obj.ph);
13543
+ [Errcode] = obj.apiENsaveinpfile(inpname , obj.LibEPANET, obj.ph);
13541
13544
obj.apiENgeterror(obj.Errcode, obj.LibEPANET, obj.ph);
13542
- copyfile('@#', inpname);% temporary
13543
- delete('@#');
13545
+ % copyfile('@#', inpname);% temporary
13546
+ % delete('@#');
13544
13547
end
13545
13548
function writeLineInReportFile(obj, line)
13546
13549
% Writes a line of text to the EPANET report file.
@@ -16749,7 +16752,7 @@ function BinClose(obj)
16749
16752
end
16750
16753
function saveBinInpFile(obj, varargin)
16751
16754
if ~isempty(varargin)
16752
- copyfile(obj.BinTempfile, varargin{1}); return;
16755
+ copyfile(obj.BinTempfile, varargin{1}, 'f' ); return;
16753
16756
end
16754
16757
[tlines]=regexp( fileread([obj.BinTempfile]), '\n', 'split');
16755
16758
f = writenewTemp(obj.BinTempfile);
0 commit comments