Updated def file and float types in function APIs
Added the new funcions to the DEF file. Updated VB headers from Double to Single Changed a few APIs calls to support EN_API_FLOAT_TYPE - this needs more work for the rest of the new functions
This commit is contained in:
@@ -75,3 +75,15 @@ EXPORTS
|
||||
ENsetcurvevalue = _ENsetcurvevalue@16
|
||||
ENsetcurve = _ENsetcurve@16
|
||||
ENaddcurve = _ENaddcurve@4
|
||||
ENgetrule = _ENgetrule@20
|
||||
ENsetrulepriority = _ENsetrulepriority@8
|
||||
ENgetpremise = _ENgetpremise@36
|
||||
ENsetpremise = _ENsetpremise@40
|
||||
ENsetpremiseindex = _ENsetpremiseindex@12
|
||||
ENsetpremisestatus = _ENsetpremisestatus@12
|
||||
ENsetpremisevalue = _ENsetpremisevalue@16
|
||||
ENgettrueaction = _ENgettrueaction@20
|
||||
ENsettrueaction = _ENsettrueaction@24
|
||||
ENgetfalseaction = _ENgetfalseaction@20
|
||||
ENsetfalseaction = _ENsetfalseaction@24
|
||||
ENgetruleID = _ENgetruleID@8
|
||||
@@ -234,15 +234,15 @@ Global Const EN_CUSTOM = 2 ' user-defined custom curve
|
||||
Declare Function ENsetcurve Lib "epanet2.dll" (ByVal Index As Long, X As Any, Y As Any, ByVal N As Long) As Long
|
||||
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Long
|
||||
|
||||
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nTrueActions As Long, nFalseActions As Long, priority As Double) As Long
|
||||
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Double) As Long
|
||||
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, logop As Long, object As Long, indexObj As Long, variable As Long, relop As Long, status As Long, value As Double) As Long
|
||||
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal logop As Long, ByVal object As Long, ByVal indexObj As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Double) As Long
|
||||
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Long, nPremises As Long, nTrueActions As Long, nFalseActions As Long, priority As Single) As Long
|
||||
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Long, ByVal priority As Single) As Long
|
||||
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, logop As Long, object As Long, indexObj As Long, variable As Long, relop As Long, status As Long, value As Single) As Long
|
||||
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal logop As Long, ByVal object As Long, ByVal indexObj As Long, ByVal variable As Long, ByVal relop As Long, ByVal status As Long, ByVal value As Single) As Long
|
||||
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal indexObj As Long) As Long
|
||||
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal status As Long) As Long
|
||||
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal value As Double) As Long
|
||||
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Double) As Long
|
||||
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Double) As Long
|
||||
Decalre FUnction ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Double) As Long
|
||||
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Double) As Long
|
||||
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexPremise As Long, ByVal value As Single) As Long
|
||||
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
|
||||
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
|
||||
Declare FUnction ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, indexLink As Long, status As Long, setting As Single) As Long
|
||||
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Long, ByVal indexAction As Long, ByVal indexLink As Long, ByVal status As Long, ByVal setting As Single) As Long
|
||||
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Long, ByVal id As String) As Long
|
||||
|
||||
@@ -915,7 +915,7 @@ extern "C" {
|
||||
@param priority The priority of a rule-based control.
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFalseActions, double *priority);
|
||||
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFalseActions, EN_API_FLOAT_TYPE *priority);
|
||||
|
||||
/**
|
||||
@brief Sets the priority of the existing rule-based control.
|
||||
@@ -923,7 +923,7 @@ extern "C" {
|
||||
@param priority The priority to be set in the rule-based control.
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENsetrulepriority(int index, double priority);
|
||||
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority);
|
||||
|
||||
/**
|
||||
@brief Gets the components of a premise/condition in an existing rule-based control.
|
||||
@@ -938,7 +938,7 @@ extern "C" {
|
||||
@param value The value of the variable to be checked (e.g. 5.5)
|
||||
@return Error code.
|
||||
*/
|
||||
int DLLEXPORT ENgetpremise(int indexRule, int indexPremise, int *logop, int *object, int *indexObj, int *variable, int *relop, int *status, double *value);
|
||||
int DLLEXPORT ENgetpremise(int indexRule, int indexPremise, int *logop, int *object, int *indexObj, int *variable, int *relop, int *status, EN_API_FLOAT_TYPE *value);
|
||||
|
||||
/**
|
||||
@brief Sets the components of a premise/condition in an existing rule-based control.
|
||||
|
||||
@@ -229,17 +229,17 @@ Public Const EN_CUSTOM = 2 ' user-defined custom curve
|
||||
|
||||
Declare Function ENaddcurve Lib "epanet2.dll" (ByVal ID As String) As Long
|
||||
|
||||
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Int32, ByRef nPremises As Int32, ByRef nTrueActions As Int32, ByRef nFalseActions As Int32, ByRef priority As Double) As Int32
|
||||
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Int32, ByVal priority As Double) As Int32
|
||||
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByRef logop As Int32, ByRef object As Int32, ByRef indexObj As Int32, ByRef variable As Int32, ByRef relop As Int32, ByRef status As Int32, ByRef value As Double) As Int32
|
||||
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal logop As Int32, ByVal object As Int32, ByVal indexObj As Int32, ByVal variable As Int32, ByVal relop As Int32, ByVal status As Int32, ByVal value As Double) As Int32
|
||||
Declare Function ENgetrule Lib "epanet2.dll" (ByVal index As Int32, ByRef nPremises As Int32, ByRef nTrueActions As Int32, ByRef nFalseActions As Int32, ByRef priority As Single) As Int32
|
||||
Declare Function ENsetrulepriority Lib "epanet2.dll" (ByVal index As Int32, ByVal priority As Single) As Int32
|
||||
Declare Function ENgetpremise Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByRef logop As Int32, ByRef object As Int32, ByRef indexObj As Int32, ByRef variable As Int32, ByRef relop As Int32, ByRef status As Int32, ByRef value As Single) As Int32
|
||||
Declare Function ENsetpremise Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal logop As Int32, ByVal object As Int32, ByVal indexObj As Int32, ByVal variable As Int32, ByVal relop As Int32, ByVal status As Int32, ByVal value As Single) As Int32
|
||||
Declare Function ENsetpremiseindex Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal indexObj As Int32) As Int32
|
||||
Declare Function ENsetpremisestatus Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal status As Int32) As Int32
|
||||
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal value As Double) As Int32
|
||||
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Double) As Int32
|
||||
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Double) As Int32
|
||||
Decalre FUnction ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Double) As Int32
|
||||
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Double) As Int32
|
||||
Declare Function ENsetpremisevalue Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexPremise As Int32, ByVal value As Single) As Int32
|
||||
Declare Function ENgettrueaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32
|
||||
Declare Function ENsettrueaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
|
||||
Decalre FUnction ENgetfalseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByRef indexLink As Int32, ByRef status As Int32, ByRef setting As Single) As Int32
|
||||
Declare Function ENsetfalseaction Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal indexAction As Int32, ByVal indexLink As Int32, ByVal status As Int32, ByVal setting As Single) As Int32
|
||||
Declare Function ENgetruleID Lib "epanet2.dll" (ByVal indexRule As Int32, ByVal id As StringBuilder) As Int32
|
||||
|
||||
|
||||
|
||||
36
src/epanet.c
36
src/epanet.c
@@ -3169,8 +3169,7 @@ int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
|
||||
|
||||
|
||||
|
||||
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFalseActions, double *priority)
|
||||
{
|
||||
int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFalseActions, EN_API_FLOAT_TYPE *priority)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of the rule
|
||||
** nPremises = number of conditions (IF AND OR)
|
||||
@@ -3181,13 +3180,13 @@ int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFal
|
||||
** Returns: error code
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
{
|
||||
int count;
|
||||
struct Premise *p;
|
||||
struct Action *c;
|
||||
|
||||
if (index > Nrules) return(257);
|
||||
*priority = Rule[index].priority;
|
||||
*priority = (EN_API_FLOAT_TYPE)Rule[index].priority;
|
||||
count = 1;
|
||||
p = Rule[index].Pchain;
|
||||
while (p->next != NULL)
|
||||
@@ -3221,10 +3220,10 @@ int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFal
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENgetpremise(int indexRule, int idxPremise, int *logop, int *object, int *indexObj, int *variable, int *relop, int *status, double *value)
|
||||
{
|
||||
int DLLEXPORT ENgetpremise(int indexRule, int idxPremise, int *logop, int *object, int *indexObj, int *variable, int *relop, int *status, EN_API_FLOAT_TYPE *value)
|
||||
{
|
||||
int count = 1, error = 0, nPremises, a, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Premise *p;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3245,11 +3244,10 @@ int DLLEXPORT ENgetrule(int index, int *nPremises, int *nTrueActions, int *nFal
|
||||
*status = p->status;
|
||||
*value = p[0].value;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int DLLEXPORT ENsetrulepriority(int index, double priority)
|
||||
{
|
||||
int DLLEXPORT ENsetrulepriority(int index, EN_API_FLOAT_TYPE priority)
|
||||
/*----------------------------------------------------------------
|
||||
** Input: index = index of the rule
|
||||
** priority = rule priority
|
||||
@@ -3257,7 +3255,7 @@ int DLLEXPORT ENsetrulepriority(int index, double priority)
|
||||
** Returns: error code
|
||||
**----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
{
|
||||
if (index > Nrules) return(257);
|
||||
Rule[index].priority = priority;
|
||||
|
||||
@@ -3268,7 +3266,7 @@ int DLLEXPORT ENsetrulepriority(int index, double priority)
|
||||
int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int object, int indexObj, int variable, int relop, int status, double value)
|
||||
{
|
||||
int count = 1,error = 0, nPremises, a, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Premise *p;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3295,7 +3293,7 @@ int DLLEXPORT ENsetpremise(int indexRule, int indexPremise, int logop, int obje
|
||||
int DLLEXPORT ENsetpremiseindex(int indexRule, int indexPremise, int indexObj)
|
||||
{
|
||||
int count = 1,error = 0, nPremises, a, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Premise *p;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3316,7 +3314,7 @@ int DLLEXPORT ENsetpremiseindex(int indexRule, int indexPremise, int indexObj)
|
||||
int DLLEXPORT ENsetpremisestatus(int indexRule, int indexPremise, int status)
|
||||
{
|
||||
int count = 1, error = 0, nPremises, a, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Premise *p;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3337,7 +3335,7 @@ int DLLEXPORT ENsetpremisestatus(int indexRule, int indexPremise, int status)
|
||||
int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, double value)
|
||||
{
|
||||
int count = 1,error = 0, nPremises, a, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Premise *p;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3358,7 +3356,7 @@ int DLLEXPORT ENsetpremisevalue(int indexRule, int indexPremise, double value)
|
||||
int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, int *status, double *setting)
|
||||
{
|
||||
int count = 1, error = 0, nTrueAction, c, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Action *a;
|
||||
|
||||
if (indexRule > Nrules) return(252);
|
||||
@@ -3381,7 +3379,7 @@ int DLLEXPORT ENgettrueaction(int indexRule, int indexAction, int *indexLink, i
|
||||
int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, int status,double setting)
|
||||
{
|
||||
int count = 1, error = 0, nTrueAction, c, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Action *a;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3404,7 +3402,7 @@ int DLLEXPORT ENsettrueaction(int indexRule, int indexAction, int indexLink, in
|
||||
int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink, int *status, double *setting)
|
||||
{
|
||||
int count = 1, error = 0, nFalseAction, c, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Action *a;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
@@ -3427,7 +3425,7 @@ int DLLEXPORT ENgetfalseaction(int indexRule, int indexAction, int *indexLink,
|
||||
int DLLEXPORT ENsetfalseaction(int indexRule, int indexAction, int indexLink, int status,double setting)
|
||||
{
|
||||
int count = 1, error = 0, nFalseAction, c, b;
|
||||
double priority;
|
||||
EN_API_FLOAT_TYPE priority;
|
||||
struct Action *a;
|
||||
|
||||
if (indexRule > Nrules) return(257);
|
||||
|
||||
Reference in New Issue
Block a user