Skip to content

Commit

Permalink
Merge pull request #234 from OpenWaterAnalytics/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Mariosmsk authored Jul 12, 2023
2 parents 3d4a8f0 + 309ba65 commit 3824332
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.asv
.idea/*
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ The `EPANET-Matlab Toolkit` is based/inspired on the [EPANET-Matlab Toolkit](htt
|getNodeHydaulicHead|Retrieves the computed values of all hydraulic heads|
|getNodeIndex|Retrieves the indices of all nodes or some nodes with a specified ID|
|getNodeInitialQuality|Retrieves the value of all node initial quality|
|getNodeJunctionActualDemand|Retrieves the computed value of all actual demands for junctions|
|getNodeJunctionBaseDemands|Retrieves the value of all junction base demands|
|getNodeJunctionCount|Retrieves the number of junctions|
|getNodeJunctionDemandName|Gets the name of a node's demand category|
|getNodeJunctionIndex|Retrieves the junctions indices|
Expand Down
4 changes: 3 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
### EPANET Matlab Toolkit (EMT) v2.2.6.1

- Add the example [Fasted Parallel computation](./EX27_Fasted_Parallel_computations.m)
- Add the example [Fasted Parallel computation](./EX27_Fasted_Parallel_computation.m)
- Update the function `getComputedTimeSeries_ENepanet` to work in parallel
- Add the function `readEpanetBinaryFile`
- Add the function `getNodeJunctionBaseDemands` #230
- Add the function `getNodeJunctionActualDemand` #230

### EPANET Matlab Toolkit (EMT) v2.2.5

Expand Down
49 changes: 49 additions & 0 deletions epanet_matlab_toolkit/epanet.m
Original file line number Diff line number Diff line change
Expand Up @@ -6900,6 +6900,35 @@ function deleteNodeJunctionDemand(obj, varargin)
[obj.Errcode, Line1, Line2, Line3] = obj.apiENgettitle(obj.LibEPANET, obj.ph);
obj.apiENgeterror(obj.Errcode, obj.LibEPANET, obj.ph);
end
function value = getNodeJunctionBaseDemands(obj, varargin)
% Retrieves the value of all junction base demands.
%
% Example 1:
% d.getNodeJunctionBaseDemands
% d.getNodeJunctionBaseDemands{1} % Get categories 1
%
% Example 2:
% d.getNodeJunctionBaseDemands(2) % Get junction base demand with categories for specific node index
%
% See also setNodeBaseDemands, getNodeDemandCategoriesNumber,
% getNodeDemandPatternIndex, getNodeDemandPatternNameID.
[indices, ~] = getNodeJunctionIndices(obj, varargin);
numdemands = obj.getNodeDemandCategoriesNumber(indices);
value = cell(1, max(numdemands));
cnt = length(indices);
val = zeros(max(numdemands), cnt);j=1;
for i=indices
v=1;
for u=1:numdemands(j)
[obj.Errcode, val(v, j)] = obj.apiENgetbasedemand(i, u, obj.LibEPANET, obj.ph);v=v+1;
obj.apiENgeterror(obj.Errcode, obj.LibEPANET, obj.ph);
end
j=j+1;
end
for i=1:size(val, 1)
value{i} = val(i, :);
end
end
function value = getNodeBaseDemands(obj, varargin)
% Retrieves the value of all node base demands.
%
Expand Down Expand Up @@ -7234,6 +7263,26 @@ function deleteNodeJunctionDemand(obj, varargin)
% getNodeTankMaximumWaterLevel, getNodeTankMinimumWaterLevel.
value = get_node_link(obj, 'tank', 'apiENgetnodevalue', obj.ToolkitConstants.EN_TANKLEVEL, varargin);
end
function value = getNodeJunctionActualDemand(obj, varargin)
% Retrieves the computed value of all actual demands for
% junctions.
%
% Example 1:
% d.getNodeJunctionActualDemand % Retrieves the computed value of all junction actual demands
%
% Example 2:
% d.getNodeJunctionActualDemand(1) % Retrieves the computed value of the first junction actual demand
%
% For more, you can type `help getNodePressure` and check examples 3 & 4.
%
% See also getNodeActualDemandSensingNodes, getNodeActualDemand, getNodePressure,
% getNodeActualQuality, getNodeMassFlowRate, getNodeActualQualitySensingNodes.
[indices, value] = getNodeJunctionIndices(obj, varargin);j=1;
for i=indices
[obj.Errcode, value(j)] = obj.apiENgetnodevalue(i, obj.ToolkitConstants.EN_DEMAND, obj.LibEPANET, obj.ph);
j=j+1;
end
end
function value = getNodeActualDemand(obj, varargin)
% Retrieves the computed value of all node actual demands.
%
Expand Down

0 comments on commit 3824332

Please sign in to comment.