USEPA / SWMM-EPANET_User_Interface

User interface for the Stormwater-Management-Model
112 stars 67 forks source link

ENsetpatternvalue sets zero value (passing a reference rather than value) #253

Closed ehsanMa86 closed 4 years ago

ehsanMa86 commented 6 years ago

ENsetpatternvalue sets zero value (passing a reference rather than value)

Version: EPANET MTP4r2 (master branch) Priority: High

eladsal commented 6 years ago

@ehsanMa86 is this a GUI issue or a problem with the engine API call?

ehsanMa86 commented 6 years ago

@eladsal It is a GUI issue. In the epanet2.py they pass a reference to API rather than value. It is just a question of minor fix. API works just fine.

ehsanMa86 commented 6 years ago

fValue2 = ctypes.c_float() fValue2.value = fValue self.errcode = self.ENlib.ENset...value(iIndex, iCode, fValue2)

is the solution to fix it.

michaeltryby commented 6 years ago

@ehsanMa86 How about issuing that fix in a PR? That would be even better!

ehsanMa86 commented 6 years ago

@michaeltryby sure I will. Thanks!

michaeltryby commented 6 years ago

@ehsanMa86 have you made any progress on that PR?

TongZhai commented 6 years ago

@michaeltryby ok, the function in question takes in 3 arguments as below

* iIndex  = time pattern index
* iPeriod = time pattern period
* fValue  = pattern multiplier

the proposed ctypes conversion is for 'fValue', what about the two integer arguments, ctypes has c_int32 and c_int64 (actually a couple others), I suppose we would use c_int64. In fact, let's use this one as a guide for the 4 other similar issues posted by @ehsanMa86. Could you help confirm the necessity for this update, especially since the API works in its current state.

PaulDudaRESPEC commented 4 years ago

Closing old issues, assuming this issue is not relevant to the current version of the software. Feel free to re-open if the problem still occurs.