Set/Get node & link tags added

This commit is contained in:
Lew Rossman
2025-02-19 09:49:09 -05:00
parent c8db9c1655
commit 7a1673994c
20 changed files with 252 additions and 61 deletions

View File

@@ -5,7 +5,7 @@ Attribute VB_Name = "Module1"
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL)
'Last updated on 06/23/2024
'Last updated on 02/14/2025
' These are codes used by the DLL functions
Public Const EN_ELEVATION = 0 ' Node parameters
@@ -297,8 +297,8 @@ Public Const EN_TRUE = 1 ' boolean true
Declare Function ENclose Lib "epanet2.dll" () As Long
Declare Function ENgetcomment Lib "epanet2.dll" (ByVal ObjectType As Long, ByVal index As Long, ByVal comment As String) As Long
Declare Function ENsetcomment Lib "epanet2.dll" (ByVal ObjectType As Long, ByVal index As Long, ByVal comment As String) As Long
Declare Function ENgettag Lib "epanet2.dll" (ByVal ObjectType As Long, ByVal index As Long, ByVal tag As String) As Long
Declare Function ENsettag Lib "epanet2.dll" (ByVal ObjectType As Long, ByVal index As Long, ByVal tag As String) As Long
'Hydraulic Analysis Functions
Declare Function ENsolveH Lib "epanet2.dll" () As Long
Declare Function ENsaveH Lib "epanet2.dll" () As Long
@@ -408,6 +408,7 @@ Public Const EN_TRUE = 1 ' boolean true
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Long, ByVal period As Long, ByVal value As Single) As Long
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Long, value As Single) As Long
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Long, values As Any, ByVal len_ As Long) As Long
Declare Function ENloadpatternfile Lib "epanet2.dll" (ByVal filename As String, ByVal id As String) As Long
'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Long

View File

@@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
//epanet2.cs[By Oscar Vegas]
//Last updated on 06/23/2024
//Last updated on 02/14/2025
//Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
//(EPANET2.DLL) for use with C#
@@ -303,7 +303,18 @@ namespace EpanetCSharpLibrary
[DllImport(EPANETDLL, EntryPoint = "ENsettitle")]
public static extern int ENsettitle(string titleline1, string titleline2, string titleline3);
[DllImport(EPANETDLL, EntryPoint = "ENgetcomment")]
public static extern int ENgetcomment(int type, int index, string comment);
[DllImport(EPANETDLL, EntryPoint = "ENsetcomment")]
public static extern int ENsetcomment(int type, int index, string comment);
[DllImport(EPANETDLL, EntryPoint = "ENgettag")]
public static extern int ENgettag(int type, int index, string tag);
[DllImport(EPANETDLL, EntryPoint = "ENsettag")]
public static extern int ENsettag(int type, int index, string tag);
[DllImport(EPANETDLL, EntryPoint = "ENsaveinpfile")]
public static extern int ENsaveinpfile(string filename);
@@ -600,6 +611,9 @@ namespace EpanetCSharpLibrary
[DllImport(EPANETDLL, EntryPoint = "ENsetpattern")]
public static extern int ENsetpattern(int index, ref float[] values, int len);
[DllImport(EPANETDLL, EntryPoint = "ENloadpatternfile")]
public static extern int ENdeletepattern(string filename, string id);
//Data Curve Functions
[DllImport(EPANETDLL, EntryPoint = "ENaddcurve")]

View File

@@ -68,6 +68,7 @@ EXPORTS
ENgetruleenabled = _ENgetruleenabled@8
ENgetruleID = _ENgetruleID@8
ENgetstatistic = _ENgetstatistic@8
ENgettag = _ENgettag@12
ENgetthenaction = _ENgetthenaction@20
ENgettimeparam = _ENgettimeparam@8
ENgettitle = _ENgettitle@12
@@ -76,7 +77,8 @@ EXPORTS
ENgetvertexcount = _ENgetvertexcount@8
ENinit = _ENinit@16
ENinitH = _ENinitH@4
ENinitQ = _ENinitQ@4
ENinitQ = _ENinitQ@4
ENloadpatternfile = _ENloadpatternfile@8
ENnextH = _ENnextH@4
ENnextQ = _ENnextQ@4
ENopen = _ENopen@12
@@ -126,6 +128,7 @@ EXPORTS
ENsetruleenabled = _ENsetruleenabled@8
ENsetrulepriority = _ENsetrulepriority@8
ENsetstatusreport = _ENsetstatusreport@4
ENsettag = _ENsettag@12
ENsettankdata = _ENsettankdata@32
ENsetthenaction = _ENsetthenaction@20
ENsettimeparam = _ENsettimeparam@8

View File

@@ -1,13 +1,13 @@
/*
******************************************************************************
Project: OWA EPANET
Version: 2.2
Version: 2.3
Module: epanet2.h
Description: declarations of the legacy style EPANET 2 API functions
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 09/28/2023
Last Updated: 02/14/2025
******************************************************************************
*/
@@ -84,6 +84,10 @@ extern "C" {
int DLLEXPORT ENsetcomment(int object, int index, const char *comment);
int DLLEXPORT ENgettag(int object, int index, char *tag);
int DLLEXPORT ENsettag(int object, int index, const char *tag);
int DLLEXPORT ENgetcount(int object, int *count);
int DLLEXPORT ENsaveinpfile(const char *filename);
@@ -328,7 +332,7 @@ extern "C" {
********************************************************************/
int DLLEXPORT ENaddpattern(const char *id);
int DLLEXPORT ENdeletepattern(int index);
int DLLEXPORT ENgetpatternindex(const char *id, int *index);
@@ -346,7 +350,7 @@ extern "C" {
int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value);
int DLLEXPORT ENsetpattern(int index, EN_API_FLOAT_TYPE *values, int len);
int DLLEXPORT ENloadpatternfile(const char *filename, const char *id);
/********************************************************************

View File

@@ -3,7 +3,7 @@ unit epanet2;
{ Declarations of imported procedures from the EPANET PROGRAMMERs TOOLKIT }
{ (EPANET2.DLL) }
{Last updated on 06/06/2024}
{Last updated on 02/14/2025}
interface
@@ -314,6 +314,8 @@ const
function ENsettitle(Line1: PAnsiChar; Line2: PAnsiChar; Line3: PAnsiChar): Integer; cdecl; external EpanetLib;
function ENgetcomment(ObjType: Integer; Index: Integer; Comment: PAnsiChar): Integer; cdecl; external EpanetLib;
function ENsetcomment(ObjType: Integer; Index: Integer; Comment: PAnsiChar): Integer; cdecl; external EpanetLib;
function ENgettag(ObjType: Integer; Index: Integer; Tag: PAnsiChar): Integer; cdecl; external EpanetLib;
function ENsettag(ObjType: Integer; Index: Integer; Tag: PAnsiChar): Integer; cdecl; external EpanetLib;
function ENsaveinpfile(F: PAnsiChar): Integer; cdecl; external EpanetLib;
function ENclose: Integer; cdecl; external EpanetLib;
@@ -473,8 +475,8 @@ const
var Status: Integer; var Setting: Single): Integer; cdecl; external EpanetLib;
function ENsetelseaction(RuleIndex: Integer; ActionIndex: Integer; LinkIndex: Integer;
Status: Integer; Setting: Single): Integer; cdecl; external EpanetLib;
function ENgetruleenabled(Index: Integer; out_enabled: Integer): Integer; cdecl; external EpanetLib;
function ENsetruleenabled(Index: Integer; var enabled: Integer): Integer; cdecl; external EpanetLib;
function ENgetruleenabled(Index: Integer; var enabled: Integer): Integer; cdecl; external EpanetLib;
function ENsetruleenabled(Index: Integer; enabled: Integer): Integer; cdecl; external EpanetLib;
implementation

View File

@@ -4,7 +4,7 @@
'Declarations of functions in the EPANET PROGRAMMERs TOOLKIT
'(EPANET2.DLL) for use with VB.Net.
'Last updated on 06/23/2024
'Last updated on 02/14/2025
Imports System.Runtime.InteropServices
Imports System.Text
@@ -281,6 +281,10 @@ Public Const EN_TRUE = 1 ' boolean true
Declare Function ENopenX Lib "epanet2.dll" (ByVal inpFile As String, ByVal rptFile As String, ByVal outFile As String) As Int32
Declare Function ENgettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENsettitle Lib "epanet2.dll" (ByVal titleline1 As String, ByVal titleline2 As String, ByVal titleline3 As String) As Int32
Declare Function ENgetcomment Lib "epanet2.dll" (ByVal type_ As Int32, ByVal index As Int32, ByVal comment As String) As Int32
Declare Function ENsetcomment Lib "epanet2.dll" (ByVal type_ As Int32, ByVal index As Int32, ByVal comment As String) As Int32
Declare Function ENgettag Lib "epanet2.dll" (ByVal type_ As Int32, ByVal index As Int32, ByVal tag As String) As Int32
Declare Function ENsettag Lib "epanet2.dll" (ByVal type_ As Int32, ByVal index As Int32, ByVal tag As String) As Int32
Declare Function ENsaveinpfile Lib "epanet2.dll" (ByVal filename As String) As Int32
Declare Function ENclose Lib "epanet2.dll" () As Int32
@@ -393,6 +397,7 @@ Public Const EN_TRUE = 1 ' boolean true
Declare Function ENsetpatternvalue Lib "epanet2.dll" (ByVal index As Int32, ByVal period As Int32, ByVal value As Single) As Int32
Declare Function ENgetaveragepatternvalue Lib "epanet2.dll" (ByVal index As Int32, value As Single) As Int32
Declare Function ENsetpattern Lib "epanet2.dll" (ByVal index As Int32, values As Any, ByVal len_ As Int32) As Int32
Declare Function ENloadpatternfile Lib "epanet2.dll" (ByVal filename As String, ByVal id As String) As Int32
'Data Curve Functions
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal id As String) As Int32

View File

@@ -5,13 +5,13 @@
/*
******************************************************************************
Project: OWA EPANET
Version: 2.2
Version: 2.3
Module: epanet2.h
Description: API function declarations
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 09/28/2023
Last Updated: 02/14/2025
******************************************************************************
*/
@@ -184,6 +184,27 @@ typedef struct Project *EN_Project;
int DLLEXPORT EN_setcomment(EN_Project ph, int object, int index,
const char *comment);
/**
@brief Retrieves a tag string assigned to a Node or Link.
@param ph an EPANET project handle.
@param object a type of object (either EN_NODE or EN_LINK)
@param index the object's index starting from 1
@param[out] out_tag the tag string assigned to the object
@return an error code
*/
int DLLEXPORT EN_gettag(EN_Project ph, int object, int index, char *out_tag);
/**
@brief Assigns a tag string to a Node or Link.
@param ph an EPANET project handle.
@param object a type of object (either EN_NODE or EN_LINK)
@param index the object's index starting from 1
@param tag the tag string assigned to the object
@return an error code
*/
int DLLEXPORT EN_settag(EN_Project ph, int object, int index,
const char *tag);
/**
@brief Retrieves the number of objects of a given type in a project.
@param ph an EPANET project handle.

View File

@@ -9,7 +9,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 07/17/2023
Last Updated: 02/14/2025
******************************************************************************
*/