|
@@ -0,0 +1,495 @@
|
|
|
|
|
+import os
|
|
|
|
|
+import sys
|
|
|
|
|
+import comtypes.client
|
|
|
|
|
+import pandas as pd
|
|
|
|
|
+import itertools
|
|
|
|
|
+import tkinter as tk
|
|
|
|
|
+from tkinter import *
|
|
|
|
|
+from tkinter.filedialog import askopenfilename
|
|
|
|
|
+import math
|
|
|
|
|
+import numpy as np
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#diccionario donde se encuentran todos los coef de comb acciones de las normas
|
|
|
|
|
+normas = {
|
|
|
|
|
+ "IAPF" : {
|
|
|
|
|
+ "CoefVar" : {
|
|
|
|
|
+ "Trafico" : {
|
|
|
|
|
+ "psi0" : 0.8,
|
|
|
|
|
+ "psi1" : {
|
|
|
|
|
+ "1" : 0.8,
|
|
|
|
|
+ "2" : 0.6,
|
|
|
|
|
+ "3" : 0.4
|
|
|
|
|
+ },
|
|
|
|
|
+ "psi2" : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "Resto" : {
|
|
|
|
|
+ "psi0" : 0.6,
|
|
|
|
|
+ "psi1" : 0.5,
|
|
|
|
|
+ "psi2" : 0.2
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "ELU" : {
|
|
|
|
|
+ "Favorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "Accidental" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 0,
|
|
|
|
|
+ "Accidental" : 1
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "Desfavorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1.35,
|
|
|
|
|
+ "NoCte" : 1.5,
|
|
|
|
|
+ "Variable" : 1.5
|
|
|
|
|
+ },
|
|
|
|
|
+ "Accidental" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 1,
|
|
|
|
|
+ "Accidental" : 1
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "ELS" : {
|
|
|
|
|
+ "Favorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "Desfavorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 1
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "IAP" : {
|
|
|
|
|
+ "CoefVar" : {
|
|
|
|
|
+ "SCUso" : {
|
|
|
|
|
+ "CVerticales" : {
|
|
|
|
|
+ "psi0" : 0.4, #cuidado que para vehiculos pesados es 0.75
|
|
|
|
|
+ "psi1" : 0.4, #cuidado que para vehiculos pesados es 0.75
|
|
|
|
|
+ "psi2" : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "CHorizontales" : {
|
|
|
|
|
+ "psi0" : 0,
|
|
|
|
|
+ "psi1" : 0,
|
|
|
|
|
+ "psi2" : 0
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ "SCConstruccion" : {
|
|
|
|
|
+ "psi0" : 1,
|
|
|
|
|
+ "psi1" : 0,
|
|
|
|
|
+ "psi2" : 1
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ "ELU" : {
|
|
|
|
|
+ "Favorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "Desfavorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1.35,
|
|
|
|
|
+ "NoCte" : 1.5,
|
|
|
|
|
+ "Variable" : 1.5
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "ELS" : {
|
|
|
|
|
+ "Favorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ "Desfavorable" : {
|
|
|
|
|
+ "Persistente" : {
|
|
|
|
|
+ "Cte" : 1,
|
|
|
|
|
+ "NoCte" : 1,
|
|
|
|
|
+ "Variable" : 1
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#Conexion con SAP2000
|
|
|
|
|
+
|
|
|
|
|
+helper = comtypes.client.CreateObject('SAP2000v1.Helper')
|
|
|
|
|
+helper = helper.QueryInterface(comtypes.gen.SAP2000v1.cHelper)
|
|
|
|
|
+mySapObject = helper.GetObject("CSI.SAP2000.API.SapObject")
|
|
|
|
|
+SapModel = mySapObject.SapModel
|
|
|
|
|
+SapModel.SetModelisLocked(False)
|
|
|
|
|
+
|
|
|
|
|
+#se pregunta si se desea borrar todo lo que hay en el SAP
|
|
|
|
|
+
|
|
|
|
|
+def borrar_combos_existentes():
|
|
|
|
|
+ comboNames = SapModel.RespCombo.GetNameList()
|
|
|
|
|
+ if comboNames[0] > 0:
|
|
|
|
|
+ for name in comboNames[1]:
|
|
|
|
|
+ ret = SapModel.RespCombo.Delete(name)
|
|
|
|
|
+ print(f"Se han eliminado {comboNames[0]} combinaciones de respuesta.")
|
|
|
|
|
+
|
|
|
|
|
+def borrar_load_cases():
|
|
|
|
|
+ case_names = SapModel.LoadCases.GetNameList()
|
|
|
|
|
+ if case_names[0] > 0:
|
|
|
|
|
+ for name in case_names[1]:
|
|
|
|
|
+ ret = SapModel.LoadCases.Delete(name)
|
|
|
|
|
+ print(f"Se han eliminado {case_names[0]} casos de carga.")
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def borrar_patrones_carga():
|
|
|
|
|
+ patternNames = SapModel.LoadPatterns.GetNameList()
|
|
|
|
|
+ if patternNames[0] > 0:
|
|
|
|
|
+ for name in patternNames[1]:
|
|
|
|
|
+ ret = SapModel.LoadPatterns.Delete(name)
|
|
|
|
|
+ print(f"Se han eliminado {patternNames[0]} patrones de carga.")
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+respuesta = input("¿Deseas borrar todos las combinaciones existentes? (Y/n): ")
|
|
|
|
|
+if respuesta.lower() == 'y' or len(respuesta) == 0:
|
|
|
|
|
+ borrar_combos_existentes()
|
|
|
|
|
+
|
|
|
|
|
+respuesta = input("¿Deseas borrar todos las cargas existentes? (Y/n): ")
|
|
|
|
|
+if respuesta.lower() == 'y' or len(respuesta) == 0:
|
|
|
|
|
+ borrar_load_cases()
|
|
|
|
|
+ borrar_patrones_carga()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#se selecciona la norma a utilizar para la comb acciones
|
|
|
|
|
+respuesta = input("¿La norma a seguir es la IAPF - 07? (Y / n [IAP - 11]): ")
|
|
|
|
|
+if respuesta.lower() == 'y' or len(respuesta) == 0:
|
|
|
|
|
+ norma_proyecto = "IAPF"
|
|
|
|
|
+ vias_cargadas = input("¿Cuantas vias hay cargadas a la vez 1, 2 o 3 (o más)?")
|
|
|
|
|
+
|
|
|
|
|
+else: "IAP"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#Extraccion de datos del excel
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+tk.Tk().withdraw()
|
|
|
|
|
+ruta_excel = askopenfilename()
|
|
|
|
|
+
|
|
|
|
|
+#ruta_excel = "C:/Users/Daniel.p/Documents/14. Ay-A 0042 Foso ataque empuje tubos y cimentaciones grua ( PALENCIA)/1. MEMORIA/Comb_acciones.xlsx"
|
|
|
|
|
+
|
|
|
|
|
+compatibilidades_df = pd.read_excel(ruta_excel,
|
|
|
|
|
+ sheet_name='Compatibilidades')
|
|
|
|
|
+
|
|
|
|
|
+restricciones_df = pd.read_excel(ruta_excel,
|
|
|
|
|
+ sheet_name='Restricciones')
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#Limpieza de filas vacias
|
|
|
|
|
+
|
|
|
|
|
+x, y = compatibilidades_df.shape
|
|
|
|
|
+
|
|
|
|
|
+for i in range(x):
|
|
|
|
|
+ if (compatibilidades_df.loc[i, compatibilidades_df.columns.values[0]] == 0):
|
|
|
|
|
+ compatibilidades_df=compatibilidades_df.drop(i)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+for i in range(y-1, 0, -1):
|
|
|
|
|
+ col_name = compatibilidades_df.columns.values[i]
|
|
|
|
|
+ if (isinstance(compatibilidades_df[col_name].name, int)):
|
|
|
|
|
+ compatibilidades_df = compatibilidades_df.drop(col_name, axis=1)
|
|
|
|
|
+ elif isinstance(col_name, str) and col_name.startswith("0"):
|
|
|
|
|
+ compatibilidades_df = compatibilidades_df.drop(col_name, axis=1)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+x, y = compatibilidades_df.shape
|
|
|
|
|
+
|
|
|
|
|
+for i in range(1, x+1):
|
|
|
|
|
+ for j in range(i-1):
|
|
|
|
|
+ if not isinstance(compatibilidades_df.loc[j, compatibilidades_df.columns.values[i]], str):
|
|
|
|
|
+ if math.isnan(compatibilidades_df.loc[j, compatibilidades_df.columns.values[i]]):
|
|
|
|
|
+ compatibilidades_df.loc[j, compatibilidades_df.columns.values[i]] = 'r'
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#cambio de los valores Nan por 0
|
|
|
|
|
+compatibilidades_df = compatibilidades_df.fillna(0)
|
|
|
|
|
+print(compatibilidades_df)
|
|
|
|
|
+
|
|
|
|
|
+restricciones_df = restricciones_df.fillna(0)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#creacion de load patterns
|
|
|
|
|
+
|
|
|
|
|
+for i in restricciones_df.loc[:, "Definición de 'Load Cases'"]:
|
|
|
|
|
+ ret = SapModel.LoadPatterns.Add(i, 3) #el numero indica el tipo de carga: 1 dead, 3 live ..
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#Se almacena en esta variable un diccionario indicando los estado en los que se puede encontrar la carga
|
|
|
|
|
+
|
|
|
|
|
+valores_por_patron = {}
|
|
|
|
|
+for index, row in restricciones_df.iterrows():
|
|
|
|
|
+ patron = restricciones_df.loc[:,restricciones_df.columns[0]]
|
|
|
|
|
+
|
|
|
|
|
+ valores = [0, 1]
|
|
|
|
|
+
|
|
|
|
|
+ if row["Bidireccional?"]:
|
|
|
|
|
+ valores.append(-1)
|
|
|
|
|
+
|
|
|
|
|
+ valores_por_patron[patron[index]] = list(set(valores))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#creacion del array donde se almancenan los nombres de las cargas
|
|
|
|
|
+patrones = list(valores_por_patron.keys())
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#se hace con itertools todas las combinaciones de carga posibles sin ninguna restriccion
|
|
|
|
|
+todas_combinaciones = list(itertools.product(*[valores_por_patron[pat] for pat in patrones]))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#funcion para comprobar que la combiacion de cargas es posible debido a las restricciones
|
|
|
|
|
+
|
|
|
|
|
+def validar_combinacion(comb, patrones, compatibilidad_df, restricciones_df):
|
|
|
|
|
+ #se comprueba la matriz de compatibilidad buscando por cada caga que este activa en este combo
|
|
|
|
|
+ #otra targa que este activa y se comprueba en la matriz buscando una 'r'
|
|
|
|
|
+ for i in range(len(patrones)):
|
|
|
|
|
+ if comb[i]:
|
|
|
|
|
+ for j in range(i+1, len(patrones)):
|
|
|
|
|
+ if comb[j]:
|
|
|
|
|
+ if compatibilidad_df.iloc[i,j+1] == 'r':
|
|
|
|
|
+ return False
|
|
|
|
|
+ #se comprueba que la carga que esta activa esta con otra carga especificada como condicional
|
|
|
|
|
+ #para que la primera exista
|
|
|
|
|
+ restriccion = restricciones_df.loc[:,"Si y solo si"]
|
|
|
|
|
+ for iter, res in enumerate(restriccion):
|
|
|
|
|
+ if res:
|
|
|
|
|
+ if comb[iter]:
|
|
|
|
|
+ idx = patrones.index(res)
|
|
|
|
|
+ if not(comb[idx]):
|
|
|
|
|
+ return False
|
|
|
|
|
+ #comprueba que las cargas especificadas como permanentes se encuentran en este caso de carga
|
|
|
|
|
+ permanentes = restricciones_df.loc[:,"Permanentes"]
|
|
|
|
|
+ for iter, per in enumerate(permanentes):
|
|
|
|
|
+ if per != 0:
|
|
|
|
|
+ if not(per=='x' and comb[iter]):
|
|
|
|
|
+ return False
|
|
|
|
|
+ #si no cumple ninguna de las restricciones se considera válida la combinacion
|
|
|
|
|
+ return True
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#comprobacion de la validez de las combinaciones
|
|
|
|
|
+combinaciones_validas = []
|
|
|
|
|
+for comb in todas_combinaciones:
|
|
|
|
|
+ if validar_combinacion(comb, patrones, compatibilidades_df, restricciones_df):
|
|
|
|
|
+ combinaciones_validas.append(comb)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#funcion para hacer la suma en valor absoluto de un array
|
|
|
|
|
+def suma_abs(lista):
|
|
|
|
|
+
|
|
|
|
|
+ for _ in range(len(lista)): total += abs(lista[_])
|
|
|
|
|
+
|
|
|
|
|
+ return total
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#se obtiene el numero de cargas que son permanentes
|
|
|
|
|
+for iter, per in enumerate(restricciones_df.loc[:,"Permanentes"]):
|
|
|
|
|
+ if per == 'x' : num_permanentes += 1
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def CrearCombo(nombre, numero, combo, coef):
|
|
|
|
|
+
|
|
|
|
|
+ global SapModel
|
|
|
|
|
+ global patrones
|
|
|
|
|
+
|
|
|
|
|
+ nombre_combo = nombre + "{:04}".format(numero)
|
|
|
|
|
+
|
|
|
|
|
+ ret = SapModel.RespCombo.Add(nombre_combo, 0)
|
|
|
|
|
+
|
|
|
|
|
+ for idx, patron in enumerate(patrones):
|
|
|
|
|
+ coeficiente = combo[idx]
|
|
|
|
|
+ if coeficiente != 0:
|
|
|
|
|
+ ret = SapModel.RespCombo.SetCaseList(nombre_combo, 0, patron, coeficiente*coef[idx])
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+for combo in combinaciones_validas:
|
|
|
|
|
+
|
|
|
|
|
+ coeficientes_ELUP = np.zeros(len(patrones))
|
|
|
|
|
+ coeficientes_ELUA = np.zeros(len(patrones))
|
|
|
|
|
+ coeficientes_ELUS = np.zeros(len(patrones))
|
|
|
|
|
+ coeficientes_ELSC = np.zeros(len(patrones))
|
|
|
|
|
+ coeficientes_ELSF = np.zeros(len(patrones))
|
|
|
|
|
+ coeficientes_ELSCP = np.zeros(len(patrones))
|
|
|
|
|
+ n_var = 0
|
|
|
|
|
+
|
|
|
|
|
+ for i in range(combo):
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if norma_proyecto == "IAPF":
|
|
|
|
|
+ #primero se comprueba si la carga es permanente o no
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Permanentes"]:
|
|
|
|
|
+ #luego constante o no
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Tipo"] == "Constante":
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Direccion"] == "Desfavorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["Cte"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["Cte"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ coeficientes_ELSF[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ coeficientes_ELSCP[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Direccion"] == "Favorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = normas["IAPF"]["ELU"]["Favorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["Cte"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["Cte"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ coeficientes_ELSF[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ coeficientes_ELSCP[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["Cte"]
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Tipo"] == "No Constante":
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Direccion"] == "Desfavorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["NoCte"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELSF[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELSCP[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Direccion"] == "Favorable":
|
|
|
|
|
+ coeficientes_ELUP[i] = normas["IAPF"]["ELU"]["Favorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["NoCte"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELSF[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ coeficientes_ELSCP[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["NoCte"]
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Tipo"] == "Accidental":
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Direccion"] == "Desfavorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = 0
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["Accidental"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["Accidental"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = 0
|
|
|
|
|
+ coeficientes_ELSF[i] = 0
|
|
|
|
|
+ coeficientes_ELSCP[i] = 0
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Direccion"] == "Favorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = 0
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["Accidental"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["Accidental"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = 0
|
|
|
|
|
+ coeficientes_ELSF[i] = 0
|
|
|
|
|
+ coeficientes_ELSCP[i] = 0
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Tipo"] == "Variable":
|
|
|
|
|
+ n_var += 1
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Direccion"] == "Desfavorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["Variable"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Desfavorable"]["Accidental"]["Variable"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ coeficientes_ELSF[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ coeficientes_ELSCP[i] = normas["IAPF"]["ELS"]["Desfavorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ elif restricciones_df.loc[i+1,"Direccion"] == "Favorable":
|
|
|
|
|
+ #ELU
|
|
|
|
|
+ coeficientes_ELUP[i] = normas["IAPF"]["ELU"]["Favorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ coeficientes_ELUA[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["Variable"]
|
|
|
|
|
+ coeficientes_ELUS[i] = normas["IAPF"]["ELU"]["Favorable"]["Accidental"]["Variable"]
|
|
|
|
|
+ #ELS
|
|
|
|
|
+ coeficientes_ELSC[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ coeficientes_ELSF[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ coeficientes_ELSCP[i] = normas["IAPF"]["ELS"]["Favorable"]["Persistente"]["Variable"]
|
|
|
|
|
+ elif norma_proyecto == "IAP":
|
|
|
|
|
+ pass
|
|
|
|
|
+
|
|
|
|
|
+ if n_var :
|
|
|
|
|
+ while n_var:
|
|
|
|
|
+ n_var -= 1
|
|
|
|
|
+ #se busca la primera variable en el combo y se asigna el coeficiente
|
|
|
|
|
+ for i in range(len(combo)):
|
|
|
|
|
+ if restricciones_df.loc[i+1,"Tipo"] == "Variable":
|
|
|
|
|
+ for j in range(len(combo)):
|
|
|
|
|
+ if (restricciones_df.loc[j+1,"Tipo"] == "Variable") and (j != i):
|
|
|
|
|
+ #se asigna el coeficiente de la variable al resto de variables
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#ahora hay que buscar en el combo cual es la primera variable y asignar al resto el coeficiente y luego pasar a la siguiente variable y hacer lo mismo con todas y con la antigua
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ pass
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+'''
|
|
|
|
|
+
|
|
|
|
|
+combo_num = 1
|
|
|
|
|
+
|
|
|
|
|
+coeficiente_EL = restricciones_df.loc[:, "Coeficiente"]
|
|
|
|
|
+
|
|
|
|
|
+for combo in combinaciones_validas:
|
|
|
|
|
+ combo_name = "Combo {:03d}".format(combo_num)
|
|
|
|
|
+ ret = SapModel.RespCombo.Add(combo_name, 0)
|
|
|
|
|
+ for idx, patron in enumerate(patrones):
|
|
|
|
|
+ coeficiente = combo[idx]
|
|
|
|
|
+ if coeficiente != 0:
|
|
|
|
|
+ ret = SapModel.RespCombo.SetCaseList(combo_name, 0, patron, coeficiente*coeficiente_EL[idx])
|
|
|
|
|
+ combo_num += 1
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#creacion del combo envolvente
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+combo_name = "Combo ENV"
|
|
|
|
|
+ret = SapModel.RespCombo.Add(combo_name, 1)
|
|
|
|
|
+comboNames = SapModel.RespCombo.GetNameList()
|
|
|
|
|
+patron = []
|
|
|
|
|
+for i in range(comboNames[0]):
|
|
|
|
|
+ patron.append(1)
|
|
|
|
|
+for idx, name in enumerate(comboNames[1]):
|
|
|
|
|
+ ret = SapModel.RespCombo.SetCaseList(combo_name, 1, comboNames[1][idx], 1)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+'''
|
|
|
|
|
+
|