# Path: src/view.py

# 
# Path: model/material/concrete.py
# class Concrete:
#     def __init__(self):
#     def Gc(self, fc=None, Ec=None, concrete_poisson_ratio=0.2):
#     def Mn(self, fyr, fc, height, width, n, diameter, cover):
#     def As(self, n, diameter):
#     def a(self, As, fyr, fc, width):
#     def jd(self, d, a):
#     def beta1(self, fc):
#     def rho_balance(self, fc, fyr):
#     def rho(self, n, diameter, width, height):
#     def rho_max(self, fc, fyr):
#     def As_max(self, fc, fyr, height, width):
#     def As_min(self, fc, fyr, height, width, cover):
#     def eps_s(self, d, As, fc, fyr, width, eps_cu=0.003):
#     def neutral_axis_balance(self, eps_cu, eps_y, d):
#     def neutral_axis_balance2(self, As, fyr, fc, width):
#     def phi(self, eps_s):
#         A = As*fyr  # N
#         B = 0.85*fc*width  # N/mm
# 
# Path: model/structure/concrete_slab.py
# class Slab:
#     def __init__(self):
#     def marcus_method(self, ly, lx, t, dl, ll,
#                  include_self_weight, kdl, kll,
#                  conc_unit_weight, fc, fus, slab_type,
#                  diameter, dy, dx):
#     def error(self, Mlx, Mly, Mtx, Mty, error):
#         X = float(ly/lx)


from src import view
from model.material import concrete
from model.structure import concrete_slab
import cherrypy

        As = model.As(n, diameter)
        As_max = model.As_max(fc, fyr, height, width)
        As_min = model.As_min(fc, fyr, height, width, cover)
        eps_s = model.eps_s(height-cover, As, fc, fyr, width)
        phi = model.phi(eps_s)

        # Prepare data to view
        data = {
            'fyr': fyr,  #MPa
            'fc': fc,  #MPa
            'width': width,  #mm
            'height': height,  #mm
            'cover': cover,  #mm
            'n': n,  #number
            'diameter': diameter,  #mm
            'mn': float('{0:.2f}'.format(mn/1E6)),
            'rho': float('{0:.5f}'.format(rho)),
            'rho_max': float('{0:.5f}'.format(rho_max)),
            'As': float('{0:.2f}'.format(As)),
            'As_max': float('{0:.2f}'.format(As_max)),
            'As_min': float('{0:.2f}'.format(As_min)),
            'eps_s': float('{0:.4f}'.format(eps_s)),
            'phi': float('{0:.2f}'.format(phi)),
        }

        return template.render(**data)

    def slab_two_ways_design(self, **var):
        # Prepare view & model object
        template = view.lookup.get_template('structure/concrete_slab.mako')

# Path: src/view.py

# 
# Path: model/material/concrete.py
# class Concrete:
#     def __init__(self):
#     def Gc(self, fc=None, Ec=None, concrete_poisson_ratio=0.2):
#     def Mn(self, fyr, fc, height, width, n, diameter, cover):
#     def As(self, n, diameter):
#     def a(self, As, fyr, fc, width):
#     def jd(self, d, a):
#     def beta1(self, fc):
#     def rho_balance(self, fc, fyr):
#     def rho(self, n, diameter, width, height):
#     def rho_max(self, fc, fyr):
#     def As_max(self, fc, fyr, height, width):
#     def As_min(self, fc, fyr, height, width, cover):
#     def eps_s(self, d, As, fc, fyr, width, eps_cu=0.003):
#     def neutral_axis_balance(self, eps_cu, eps_y, d):
#     def neutral_axis_balance2(self, As, fyr, fc, width):
#     def phi(self, eps_s):
#         A = As*fyr  # N
#         B = 0.85*fc*width  # N/mm
# 
# Path: model/structure/concrete_slab.py
# class Slab:
#     def __init__(self):
#     def marcus_method(self, ly, lx, t, dl, ll,
#                  include_self_weight, kdl, kll,
#                  conc_unit_weight, fc, fus, slab_type,
#                  diameter, dy, dx):
#     def error(self, Mlx, Mly, Mtx, Mty, error):
#         X = float(ly/lx)


# Path: controller/structure/concrete.py
from src import view
from model.material import concrete
from model.structure import concrete_slab
import cherrypy

        As = model.As(n, diameter)
        As_max = model.As_max(fc, fyr, height, width)
        As_min = model.As_min(fc, fyr, height, width, cover)
        eps_s = model.eps_s(height-cover, As, fc, fyr, width)
        phi = model.phi(eps_s)

        # Prepare data to view
        data = {
            'fyr': fyr,  #MPa
            'fc': fc,  #MPa
            'width': width,  #mm
            'height': height,  #mm
            'cover': cover,  #mm
            'n': n,  #number
            'diameter': diameter,  #mm
            'mn': float('{0:.2f}'.format(mn/1E6)),
            'rho': float('{0:.5f}'.format(rho)),
            'rho_max': float('{0:.5f}'.format(rho_max)),
            'As': float('{0:.2f}'.format(As)),
            'As_max': float('{0:.2f}'.format(As_max)),
            'As_min': float('{0:.2f}'.format(As_min)),
            'eps_s': float('{0:.4f}'.format(eps_s)),
            'phi': float('{0:.2f}'.format(phi)),
        }

        return template.render(**data)

    def slab_two_ways_design(self, **var):
        # Prepare view & model object
        template = view.lookup.get_template('structure/concrete_slab.mako')

        model = concrete_slab.Slab()
