fconcrete.StructuralConcrete.Analysis module

class fconcrete.StructuralConcrete.Analysis.Analysis[source]

Bases: object

Methods

getBestSolution(concrete_beam_function[, …]) Returns a report with all materials and cost.
create_samples  
static create_samples(kwargs, sort_by_multiplication, must_test_for_each)[source]
static getBestSolution(concrete_beam_function, max_steps_without_decrease=inf, avoid_estimate=False, show_progress=True, sort_by_multiplication=False, must_test_for_each=[], **kwargs)[source]

Returns a report with all materials and cost.

Call signatures:

fc.Analysis.getBestSolution(concrete_beam_function, … max_steps_without_decrease = float(“inf”), … avoid_estimate=False, … show_progress=True, … sort_by_multiplication=False, … **kwargs)
>>> def concrete_beam_function(width, height, length):
...        slab_area = 5*5
...        kn_per_m2 = 5
...        distributed_load = -slab_area*kn_per_m2/500
...        pp = fc.Load.UniformDistributedLoad(-width*height*25/1000000, x_begin=0, x_end=length)
...        n1 = fc.Node.SimpleSupport(x=0, length=20)
...        n2 = fc.Node.SimpleSupport(x=400, length=20)
...        f1 = fc.Load.UniformDistributedLoad(-0.01, x_begin=0, x_end=1)
...        beam = fc.ConcreteBeam(
...            loads = [f1, pp],
...            nodes = [n1, n2],
...            section = fc.Rectangle(width, height),
...            division = 200
...        )
...        return beam
>>> full_report, solution_report, best_solution = fc.Analysis.getBestSolution(concrete_beam_function,
...                                     max_steps_without_decrease=15,
...                                     sort_by_multiplication=True,
...                                     avoid_estimate=True,
...                                     show_progress=False,
...                                     width=[15],
...                                     height=(30, 34, 2),
...                                     length=[150])
>>> # Table is sorted by cost ascending, so the first one is the most economic solution.
>>> # Alternative way to look to the best solution
>> print(best_solution)
{'width': 15.0, 'height': 30.0, 'length': 150.0, 'cost': 126.2650347902965, 'error': '', 'Concrete': 63.59, 'Longitudinal bar': 35.31, 'Transversal bar': 27.36}
Parameters:
concrete_beam_function

Define the function that is going to create the beam given the parameters.

max_steps_without_decrease : python:int, optional

If the cost has not decrescead after max_steps_without_decrease steps, the loop breaks. Only use it in case your parameter combination has a logical order. Default inf.

show_progress : bool, optional

Estimate time using the last combination. If a exception is found, 80s per loop is set and a message about the not precision is shown. Also show progress bar in percentage. Default True.

sort_by_multiplication : bool, optional

Sort combinations by the multiplication os all parameter. Useful to use with max_steps_without_decrease when the is a logical order. Default False.

must_test_for_each: list, optional

From the kwargs parameters, define the ones that must be tested for all their values. Useful, for example, when you want to test for all possible lengths, but not all height and width.

kwargs

Possible arguments for the concrete_beam_function. If a set of 3 elements is given, np.arange(*kwarg_value) will be called. The kwargs must have the same name that the concrete_beam_function expects as arguments. The combination is made with np.meshgrid.