Effacer les filtres
Effacer les filtres

Toolkit Matlab Epanet 2.2

23 vues (au cours des 30 derniers jours)
Alfonso
Alfonso le 8 Jan 2024
Hi, i have a problem with the following code:
% Load the EPANET input file
d = epanet('CASALNUOVO.inp');
% Perform hydraulic analysis
d.solveCompleteHydraulics;
% Specify the ID of the node of interest (replace 'NodeID' with the actual ID)
nodeID = Junction_1001; % Converted to number instead of string '4'
% Get the base demand associated with the node
demand = d.getNodeBaseDemands(nodeID);
% Calculate the approximate number of users based on demand (assuming an average demand per user)
average_demand_per_user = 297; % Replace with the average demand value per user
% Check and convert 'demand' to 'double' if necessary
if iscell(demand)
demand = demand{1}; % Accessing the value within the cell array
end
% Verify and convert 'demand' to 'double' if it is not already of type 'double'
if ~isa(demand, 'double')
error('The demand value is not of type double.');
end
% Calculate the approximate number of users
number_of_users = (demand / average_demand_per_user) * 3.38;
fprintf('The approximate number of users associated with node %d is: %f\n', nodeID, number_of_users);
% Unload the EPANET input file
d.unload;
The purpose of the code is to get the number of users of a single junction thanks to the fixing of the average demand per user. But i have the following error:
Error using epanet
File "CASALNUOVO.inp" is not a valid.
Error in Ut_Nodi (line 3)
d = epanet(['CASALNUOVO.inp']);
Now, i don't know how to solve the problem. Can you help me?
The file is attached to this post.

Réponses (1)

UDAYA PEDDIRAJU
UDAYA PEDDIRAJU le 15 Jan 2024
Hi Alfonso,
I understand that you're encountering an error while using the “epanet” function. It is very likely that you might be having trouble with setting up the EPANET-MATLAB Toolkit. I would suggest you ensure that the toolkit is correctly set up by ensuring the following.
Make sure that you have downloaded the latest version of the EPANET-MATLAB Toolkit from the official repository. Extract the ZIP file and save the folder in a convenient location on your computer. Open MATLAB and navigate to the folder where you saved the toolkit. Run the “RunTests.m” script to verify that all the functions are working correctly. This script will execute a series of commands that test the toolkit's functionality.
You can refer to the following documentation for detailed information on “epanet”: https://www.mathworks.com/matlabcentral/fileexchange/25100-openwateranalytics-epanet-matlab-toolkit.

Catégories

En savoir plus sur Weather and Atmospheric Science dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by