Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed swmm_setNodeInflow #45

Merged
merged 2 commits into from
Jul 3, 2017
Merged

Conversation

bemcdonnell
Copy link
Member

This addresses #40

Also a few other enhancements (Next time these will be separate branches/PRs - Sorry In advance).

  • Updated some API error Keys
  • Updated swmm_getSimulationTime -> No longer outputs a char array.

I broke apart the function that originally parsed lines of the input file into three pieces:

  1. parsing
  2. validations
  3. inserting into the data model.

@bemcdonnell bemcdonnell added this to the v5.2.0 milestone Jun 20, 2017
@bemcdonnell bemcdonnell self-assigned this Jun 20, 2017
Copy link

@michaeltryby michaeltryby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was a great improvement on the last version of the swmm_setNodeInflow().

}
}

return(inflow_setExtInflow(j, param, type, tseries, basePat,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more clear if the call to inflow_validate() happens here as opposed to nested within inflow_setExtInflow().

Also seems to be a little confusion about separation of concerns - parse, validate, and set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swmm_setNodeInflow API function needs to be validated too. So the data is prepared by either the parser or the API function.. Then validated. .then pushed to the data model.

The validation step assigns the units conversion factor too (cf). Why is this important the way it is now? Future expansion. The swmm_setNodeInflow function can be expanded later to allow mass/concentration inflows.

Honestly, that's about the only thing the validation features does

type = FLOW_INFLOW;
cf = 1.0/UCF(FLOW);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear why this was moved to inflow_validate(). This is an assignment based on a value parsed from the input file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my answer below

The validation step assigns the units conversion factor too (cf). Why is this important the way it is now? Future expansion. The swmm_setNodeInflow function can be expanded later to allow mass/concentration inflows.

{
*cf /= LperFT3;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't a lot of what I would classify as validation going on in the original function to begin with. So I guess part of the separation depends on how you want to present the API to the developer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's not a huge amount of validation. I still think separating is sensible.

inflow->basePat = basePat;
inflow->extIfaceInflow = extIfaceInflow;
}
return(errcode);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good separation of the set concern from the other functionality.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@bemcdonnell
Copy link
Member Author

@stoiver, do you have any issues/concerns with the updated function?

@bemcdonnell bemcdonnell merged commit 127a845 into pyswmm:toolkitapi Jul 3, 2017
@bemcdonnell bemcdonnell deleted the fixnodeinflow branch July 6, 2017 22:05
michaeltryby added a commit to SWMM-Project/swmm-solver that referenced this pull request Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants