business.commons.mixins package

Submodules

business.commons.mixins.cost module

class business.commons.mixins.cost.PipesCostMixin

Bases: object

Functionalities to evaluate the cost of _piped_segments.

property get_cost

Return cost estimates for a Trunk*or a *SoilStretch

Note

Precondition: piping_list is set.

Returns

The cost of the sequence of PipingList instances associated with the Trunk*or or with the *SoilStretch.

Return type

decimal.Decimal

business.commons.mixins.interpolation module

class business.commons.mixins.interpolation.PointFactoryMixin

Bases: object

Mixin holding functionalities to crete points of the elevation profile.

create_point_at_given_downrange(downrange)

Create and return a new ElevationProfile point.

The point is created through interpolation of elevation and pathlength along the sequence of downranges of the ElevationProfile. The caller will be in charge of inserting the ElevationProfilePoint here returned into the ElevationProfile.

Parameters

downrange (Quantity("length", float)) – the downrange at which interpolation is evaluated

Returns

the newly created point.

Return type

commons.ElevationProfilePoint

class business.commons.mixins.interpolation.ProfileInterpolationMixin

Bases: object

Mixin holding functionalities to interpolate a point of an ElevationProfile.

get_elevation_at_given_downrange(downrange)

Return the interpolated elevation at a given downrange.

Parameters

downrange (Quantity("length", float)) – the downrange at which the elevation must be evaluated

Returns

the interpolated elevation

Return type

Quantity(“length”, float)

get_interpolated_downrange_at_pathlength(pathlength)

Return the interpolated downrange at a given pathlength.

Parameters

pathlength (Quantity("length", float)) – the pathlength at which the downrange must be evaluated

Returns

the interpolated downrange

Return type

Quantity(“length”, float)

get_interpolated_elevation_at_pathlength(pathlength)

Return the interpolated elevation at a given pathlength.

Parameters

pathlength (Quantity("length", float)) – the pathlength at which the elevation must be evaluated

Returns

the interpolated elevation

Return type

Quantity(“length”, float)

get_interpolated_pathlength_at_downrange(downrange)

Return the interpolated pathlength at a given downrange.

Parameters

downrange (Quantity("length", float)) – the downrange at which the elevation must be evaluated

Returns

the interpolated pathlength

Return type

Quantity(“length”, float)

business.commons.mixins.linear module

Provide algorithms performing linear programming optimization.

class business.commons.mixins.linear.SingleLinprogStretchMixin

Bases: object

Algorithms for linear programming algorithms in use by BaseStretch.

linear_solver()

return the piped segments resulting from linear programming optimization

get_open_flow_pipe_segments()

return the single piped segment when ‘open flow’ conditions occour

property get_open_flow_pipe_segments

Return the single piped segment when ‘open flow’ conditions occour

This method is called when, in a **, the elevation prfile is so steep that the required water flow is carried ‘as in a canal’. Any commercial pipe from the catalog is fit and hence it must be chosen the one which costs less.

Returns

a one-element list; the element is a piped segment which extends for the whole length of the trunk, and whose pipe is the most economical picked from the catalog of available pipes.

Return type

List[PipedSegmentDesign]

property linear_solver

Return the piped segments resulting from linear programming optimization.

Functionality: Returns the sequence of piped segments which leads to the ‘least cost’ at the given _water_flow and at the given hydraulic energy at tail and head ends.

If linear programming detects that there is no solution, then an exception is raised and will be handled by the caller of this method.

Returns

list(helpers.definitions.PipedSegmentDesign): the list of piped segments resulting from successful implementation of the ‘simplex’ methodology (Dantzig theorem).

Return type

List[PipedSegmentDesign]