calculoAtenuadores.php 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936
  1. <?php
  2. /*
  3. 2019. Servicios Corporativos y Soluciones en CFDI S de RL de CV
  4. Versión 1.0
  5. Última Actualización: 27/05/2019
  6. Developer: Fernando A. Jacobo
  7. Tester: Fernando A. Jacobo
  8. IT Leader: Jorge H. Fierro
  9. Última modificación: Fernando A. Jacobo
  10. */
  11. require_once('shared/conexionBD.php');
  12. $idModulo = "CALC.ATEN";
  13. $arrErroresSistemaServ = array();
  14. $strMensaje = "";
  15. $mensajeError = 0;
  16. $arrVentiladores = array(); // Contiene Todos los modelos de ventiladores existentes
  17. $qryModelos = ' SELECT * FROM ITT_ASW_MODE ';
  18. $qryModelos = utf8_encode($qryModelos);
  19. $qrsModelos = mysqli_query($conexion, $qryModelos);
  20. if ( ( $qrsModelos !== false ) ) {
  21. if ( ( mysqli_num_rows( $qrsModelos ) > 0 ) ) {
  22. while ( $rowModelos = mysqli_fetch_assoc( $qrsModelos ) ) {
  23. $IDModelo = $rowModelos['IDMODELO'];
  24. $arrVentiladores[$IDModelo] = $rowModelos;
  25. }
  26. } else {
  27. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0002 - Ha ocurrido un error al consultar el Catálogo de Ventiladores del sistema. ';
  28. $strMensaje.= 'El catálago de Ventiladores debe de contener al menos un ventilador disponible.';
  29. $arrErroresSistemaServ[base64_encode('ITT_ASW_MODE-DATA')] = $strMensaje;
  30. $mensajeError ++;
  31. }
  32. } else {
  33. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0001 - Ha ocurrido un error al consultar El Catálogo de Ventiladores del Sistema. ';
  34. $strMensaje.= 'Notifique al Departamento de Sistemas con la siguiente descripción: ';
  35. $strMensaje.= base64_encode( ' Error: ' . base64_encode(mysqli_error($conBaseDatos)) . ' para la Consulta: ' . base64_encode(utf8_decode($qryModelos) ) );
  36. $arrErroresSistemaServ[base64_encode('ITT_ASW_MODE')] = $strMensaje;
  37. $mensajeError ++ ;
  38. }
  39. if ( !empty($arrVentiladores) ) {
  40. $arrVentiladoresJs = json_encode($arrVentiladores);
  41. $arrModelos = array();
  42. $arrTipos = array();
  43. foreach ( $arrVentiladores as $ventilador ) {
  44. $arrTipos[$ventilador['TIPO']] = $ventilador['TIPO'];
  45. if ( ( !empty($ventilador['PULGADAS']) ) && ( empty($ventilador['PRESION']) ) && ( !empty($ventilador['DESC']) ) ) {
  46. $arrModelos[$ventilador['TIPO']][$ventilador['IDMODELO']] = $ventilador['DESC'];
  47. } elseif ( ( empty($ventilador['PULGADAS']) ) && ( empty($ventilador['PRESION']) ) && ( !empty($ventilador['DESC']) ) ) {
  48. $arrModelos[$ventilador['TIPO']][$ventilador['IDMODELO']] = $ventilador['DESC'];
  49. } elseif ( ( empty($ventilador['PULGADAS']) ) && ( !empty($ventilador['PRESION']) ) && ( empty($ventilador['DESC']) ) ) {
  50. $arrModelos[$ventilador['TIPO']][$ventilador['IDMODELO']] = $ventilador['MODELO']." - Presión ".$ventilador['PRESION'];
  51. } elseif ( ( empty($ventilador['PULGADAS']) ) && ( !empty($ventilador['PRESION']) ) && ( !empty($ventilador['DESC']) ) ) {
  52. $arrModelos[$ventilador['TIPO']][$ventilador['IDMODELO']] = $ventilador['DESC']." - Presión ".$ventilador['PRESION'];
  53. } elseif ( ( empty($ventilador['PULGADAS']) ) && ( empty($ventilador['PRESION']) ) && ( empty($ventilador['DESC']) ) ) {
  54. $arrModelos[$ventilador['TIPO']][$ventilador['IDMODELO']] = $ventilador['MODELO'];
  55. }
  56. }
  57. $arrTipoVentiladorJs = json_encode($arrTipos);
  58. $arrModeloVentiladorJs = json_encode($arrModelos);
  59. } else {
  60. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0003 - Ha ocurrido un error al consultar el Catálogo de Ventiladores del sistema. ';
  61. $strMensaje.= 'La búsqueda de los Tipos y Modelos de los Ventiladores no se genero correctamente.';
  62. $arrErroresSistemaServ[base64_encode('ITT_ASW_MODE-SEARCH')] = $strMensaje;
  63. $mensajeError ++;
  64. }
  65. $arrAtenuacion = array(); // Contiene todos Los Atenuadores Existentes
  66. $qryAtenuacion = ' SELECT * FROM ITT_ASW_ATEN ';
  67. $qryAtenuacion = utf8_encode($qryAtenuacion);
  68. $qrsAtenuacion = mysqli_query($conexion, $qryAtenuacion);
  69. if ( ( $qrsAtenuacion !== false ) ) {
  70. if ( ( mysqli_num_rows( $qrsAtenuacion ) > 0 ) ) {
  71. while ( $rowAtenuacion = mysqli_fetch_assoc( $qrsAtenuacion ) ) {
  72. $IDAtenuacion = $rowAtenuacion['IDATENUACION'];
  73. $arrAtenuacion[$IDAtenuacion] = $rowAtenuacion;
  74. }
  75. $arrAtenuacionJs = json_encode($arrAtenuacion);
  76. } else {
  77. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0005 - Ha ocurrido un error al consultar el Catálogo de Atenuadores del sistema. ';
  78. $strMensaje.= 'El catálago de atenuadores debe de contener al menos un atenuador disponible.';
  79. $arrErroresSistemaServ[base64_encode('ITT_ASW_ATEN-DATA')] = $strMensaje;
  80. $mensajeError ++;
  81. }
  82. } else {
  83. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0004 - Ha ocurrido un error al consultar el Catálogo de Atenuadores del sistema. ';
  84. $strMensaje.= 'Notifique al Departamento de Sistemas con la siguiente descripción: ';
  85. $strMensaje.= base64_encode( ' Error: ' . base64_encode(mysqli_error($conBaseDatos)) . ' para la Consulta: ' . base64_encode(utf8_decode($qryAtenuacion) ) );
  86. $arrErroresSistemaServ[base64_encode('ITT_ASW_ATEN')] = $strMensaje;
  87. $mensajeError ++;
  88. }
  89. $arrPotenciaSonora = array(); // Contiene todos Las Potencias Sonoras Existentes
  90. $qryPotenciaS = ' SELECT * FROM ITT_ASW_POSO ';
  91. $qryPotenciaS = utf8_encode($qryPotenciaS);
  92. $qrsPotenciaS = mysqli_query($conexion, $qryPotenciaS);
  93. if ( ( $qrsPotenciaS !== false ) ) {
  94. if ( ( mysqli_num_rows( $qrsPotenciaS ) > 0 ) ) {
  95. while ( $rowPotenciaS = mysqli_fetch_assoc( $qrsPotenciaS ) ) {
  96. $IDAtenuacion = $rowPotenciaS['IDPOTSON'];
  97. $arrPotenciaSonora[$IDAtenuacion] = $rowPotenciaS;
  98. }
  99. $arrPotenciaSonoraJs = json_encode($arrPotenciaSonora);
  100. } else {
  101. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0007 - Ha ocurrido un error al consultar el Catálogo de Potencias Sonoras del sistema. ';
  102. $strMensaje.= 'El catálago de Potencias Sonoras debe de contener al menos un registro disponible.';
  103. $arrErroresSistemaServ[base64_encode('ITT_ASW_POSO-DATA')] = $strMensaje;
  104. $mensajeError ++;
  105. }
  106. } else {
  107. $strMensaje = 'SPSERV.( ' . $idModulo . ' ).0006 - Ha ocurrido un error al consultar el Catálogo de Potencias Sonoras del sistema. ';
  108. $strMensaje.= 'Notifique al Departamento de Sistemas con la siguiente descripción: ';
  109. $strMensaje.= base64_encode( ' Error: ' . base64_encode(mysqli_error($conBaseDatos)) . ' para la Consulta: ' . base64_encode(utf8_decode($qryPotenciaS) ) );
  110. $arrErroresSistemaServ[base64_encode('ITT_ASW_POSO')] = $strMensaje;
  111. $mensajeError ++;
  112. }
  113. if ( $mensajeError != 0 ) {
  114. }
  115. $arrUnidadMedidaCaudal = array( "M3/S"=>"M3/S", "M3/MIN"=>"M3/MIN", "M3/H"=>"M3/H", "L/S"=>"L/S", "L/MIN"=>"L/MIN", "L/H"=>"L/H", "CM3/S"=>"CM3/S", "CM3/MIN"=>"CM3/MIN", "CM3/H"=>"CM3/H", "GALON/S"=>"GALON/S", "GALON/MIN"=>"GALON/MIN", "GALON/H"=>"GALON/H", "CFM"=>"CFM" );
  116. $arrUnidadMedidaCaudalJs = json_encode($arrUnidadMedidaCaudal);
  117. $arrUnidadMedidaPresionE = array( "MPA"=>"MPA", "KPA"=>"KPA", "PA"=>"PA", "BAR"=>"BAR", "M CA"=>"M CA", "CM A"=>"CM A", "MM CA"=>"MM CA", "IN HG"=>"IN HG", "CM HG"=>"CM HG", "MM HG"=>"MM HG", "TORR"=>"TORR", "INWG"=>"INWG" );
  118. $arrUnidadMedidaPresionEJs = json_encode($arrUnidadMedidaPresionE);
  119. $arrUnidadMedidaPotenciaA = array( "HP"=>"HP", "J/S"=>"J/S", "KCAL/H"=>"KCAL/H", "KW"=>"KW", "WATT"=>"WATT", "PIE-LIBRA(S)"=>"PIE-LIBRA(S)", "PIE-LIBRA(M)"=>"PIE-LIBRA(M)", "BHP"=>"BHP" );
  120. $arrUnidadMedidaPotenciaAJs = json_encode($arrUnidadMedidaPotenciaA);
  121. $arrUnidadMedidaDiametro = array( "MM"=>"MM", "CM"=>"CM", "DM"=>"DM", "M"=>"M", "MI"=>"MI", "YARDA"=>"YARDA", "INCH"=>"INCH", "FT"=>"FT" );
  122. $arrUnidadMedidaDiametroJs = json_encode($arrUnidadMedidaDiametro);
  123. $arrCurvaNCS = array( "NC15"=>"NC15", "NC20"=>"NC20", "NC25"=>"NC25", "NC30"=>"NC30", "NC35"=>"NC35", "NC40"=>"NC40", "NC45"=>"NC45", "NC50"=>"NC50", "NC55"=>"NC55", "NC60"=>"NC60", "NC65"=>"NC65", "NC70"=>"NC70" );
  124. $arrCurvaNCSJs = json_encode($arrCurvaNCS);
  125. $arrFrecuencias = array( "63Hz", "125Hz", "250Hz", "500Hz", "1000Hz", "2000Hz", "4000Hz", "8000Hz");
  126. $strTablaResultados = "";
  127. if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
  128. $transaccionPDF = $_POST["TRANSPDF"];
  129. $arrDatosEntrada = json_decode($_POST["DATOSENTRADA"]);
  130. $arrConversiones = json_decode($_POST["CONVERSIONES"]);
  131. $arrLw = json_decode($_POST["LW"]);
  132. $arrKw = json_decode($_POST["KW"]);
  133. $arrLwAVentiladorS = json_decode($_POST["LWAV"]);
  134. $arrLwAVentilador = json_decode($_POST["LWAVA"]);
  135. $arrSonidoR = json_decode($_POST["SONIDOR"]);
  136. $arrCorreccion = json_decode($_POST["CORRECCION"]);
  137. $arrSonidoMasCorrecion = json_decode($_POST["SONMASCORR"]);
  138. $areaDeSalida = $_POST["AREASALIDA"];
  139. $velocidadDeFluido = $_POST["VFLUIDO"];
  140. $arrDatosLwFinal = json_decode($_POST["LWFINALDATOS"]);
  141. $sumaLogaritmicaLwFinal = $_POST["SUMALWFINAL"];
  142. $arrDatosLwA = json_decode($_POST["LWADATOS"]);
  143. $sumaLogaritmicaLwA = $_POST["SUMALWA"];
  144. $presionSonora = $_POST["PRESON"];
  145. $presionSonoraA = $_POST["PRESONA"];
  146. $arrDatosLwFinalVa = json_decode($_POST["LWFINALDATOSVA"]);
  147. $sumaLogaritmicaLwFinalVa = $_POST["SUMALWFINALVA"];
  148. $arrDatosLwAVa = json_decode($_POST["LWADATOSVA"]);
  149. $sumaLogaritmicaLwAVa = $_POST["SUMALWAVA"];
  150. $presionSonoraVa = $_POST["PRESONVA"];
  151. $presionSonoraAVa = $_POST["PRESONAVA"];
  152. $arrDatosAtenuador = json_decode($_POST["ATENUADOR"], true);
  153. require_once('shared/plantillasPDF/Seleccion_Atenuedores_General.php');
  154. $formatoPDF = new crearPDF('P', 'mm', 'Letter');
  155. $formatoPDF->tipoPDF = $transaccionPDF;
  156. $formatoPDF->datosEntrada = $arrDatosEntrada;
  157. $formatoPDF->conversiones = $arrConversiones;
  158. $formatoPDF->datosLw = $arrLw;
  159. $formatoPDF->datosKw = $arrKw;
  160. $formatoPDF->sonidoRegenerado = $arrSonidoR;
  161. $formatoPDF->correcionArea = $arrCorreccion;
  162. $formatoPDF->sonidoMasCorreccion = $arrSonidoMasCorrecion;
  163. $formatoPDF->LwAVentilador = $arrLwAVentiladorS;
  164. $formatoPDF->LwAVentiladorA = $arrLwAVentilador;
  165. $formatoPDF->areaDeSalida = $areaDeSalida;
  166. $formatoPDF->velocidadDeFluido = $velocidadDeFluido;
  167. $formatoPDF->datosLwFinal = $arrDatosLwFinal;
  168. $formatoPDF->sumaLogLwFinal = $sumaLogaritmicaLwFinal;
  169. $formatoPDF->datosLwA = $arrDatosLwA;
  170. $formatoPDF->sumaLogaritmicaLwA = $sumaLogaritmicaLwA;
  171. $formatoPDF->presionSonora = $presionSonora;
  172. $formatoPDF->presionSonoraA = $presionSonoraA;
  173. $formatoPDF->DatosLwFinalVa = $arrDatosLwFinalVa;
  174. $formatoPDF->sumaLogaritmicaLwFinalVa = $sumaLogaritmicaLwFinalVa;
  175. $formatoPDF->DatosLwAVa = $arrDatosLwAVa;
  176. $formatoPDF->sumaLogaritmicaLwAVa = $sumaLogaritmicaLwAVa;
  177. $formatoPDF->presionSonoraVa = $presionSonoraVa;
  178. $formatoPDF->presionSonoraAVa = $presionSonoraAVa;
  179. $formatoPDF->datosAtenuadores = $arrDatosAtenuador;
  180. $formatoPDF->p = 'I'; // I = Presenta en el navegador sin guardar; D = presenta opcion Guardar como; F = Guarda el documento sin abrirlo en el navegador
  181. $formatoPDF->narch = 'CalculosDeAtenuacion_'.$arrDatosAtenuador['MODELO'].'.pdf';
  182. $formatoPDF->genera_PDF();
  183. }
  184. ?>
  185. <!doctype html>
  186. <html lang="en">
  187. <head>
  188. <!-- Global site tag (gtag.js) - Google Analytics -->
  189. <!--Pruebas-->
  190. <!-- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-125019062-1"></script> -->
  191. <!--Producción-->
  192. <script async src="https://www.googletagmanager.com/gtag/js?id=UA-125019062-2"></script>
  193. <!--Pruebas-->
  194. <!-- <script>
  195. window.dataLayer = window.dataLayer || [];
  196. function gtag(){dataLayer.push(arguments);}
  197. gtag('js', new Date());
  198. gtag('config', 'UA-125019062-1');
  199. </script> -->
  200. <!--Producción-->
  201. <script>
  202. window.dataLayer = window.dataLayer || [];
  203. function gtag(){dataLayer.push(arguments);}
  204. gtag('js', new Date());
  205. gtag('config', 'UA-125019062-2');
  206. </script>
  207. <!-- End Global site tag (gtag.js) - Google Analytics -->
  208. <!-- Required meta tags -->
  209. <meta charset="utf-8">
  210. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  211. <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
  212. <link rel="stylesheet" type="text/css" href="css/style-table.css" media="all" />
  213. <link rel="stylesheet" type="text/css" href="css/style-css01.css" media="all" />
  214. <link rel="shortcut icon" href="https://statics.solerpalau.com/skin/frontend/solerpalau/default/favicon.ico" type="image/x-icon" />
  215. <script src="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/alertify.min.js"></script>
  216. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/alertify.min.css" />
  217. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/themes/default.min.css" />
  218. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/themes/semantic.min.css" />
  219. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.11.1/build/css/themes/bootstrap.min.css" />
  220. <link rel="stylesheet" type="text/css" href="css/style-table.css" media="all" />
  221. <title> Selector de Atenuador S&P </title>
  222. <script type="text/javascript" src="js/events.js"></script>
  223. <style type="text/css">
  224. .table thead td {
  225. font-size: 15px;
  226. font-weight: bold;
  227. text-align: center;
  228. color: #343434;
  229. }
  230. .table thead th {
  231. font-size: 15px;
  232. font-weight: bold;
  233. text-align: center;
  234. }
  235. .table tbody td {
  236. font-size: 12px;
  237. text-align: center;
  238. }
  239. .table tfoot td {
  240. font-size: 12px;
  241. text-align: center;
  242. }
  243. </style>
  244. </head>
  245. <body>
  246. <?php include 'header.php' ?>
  247. <script type="text/javascript">
  248. var $j = jQuery.noConflict();
  249. //<![CDATA[
  250. if (typeof HIB.menu == 'object' && typeof HIB.menu.init == 'function') {
  251. HIB.menu.init();
  252. }
  253. //]]>
  254. </script>
  255. <div class="main-container col1-layout">
  256. <div class="main">
  257. <div class="col-main">
  258. <main>
  259. <div id="overlaySearch" class="overlay">
  260. <div id="searchResults" class="overlay-content grid"></div>
  261. </div>
  262. <div class="page-title dark">
  263. <img alt="Producción,distribución y logística" src="media/home/categories_home/recursos/hojas-tecnicas.jpg" style="width: 100%"/>
  264. <div class="page-title-container">
  265. <div class="page-title-content container">
  266. </div>
  267. </div>
  268. <div class="clearfix">&nbsp;</div>
  269. </div>
  270. <form id="frm">
  271. <input type="hidden" name="recaptcha_response" id="recaptchaResponse">
  272. <div class="bar-title">
  273. <h2 class="h2">Cálculo de atenuadores</h2>
  274. <p class="container">
  275. Esta Herramienta te servirá para calcular la atenuación del ruido emitido por los equipos de
  276. <strong style="color: red; font-weight: bold;"> S&P</strong>, tomando como referencia las curvas NC.
  277. </p>
  278. <br/>
  279. <!-- Inicion Inputs -->
  280. <div class="container grid hcol-6-12">
  281. <div class="container hcol-12-12">
  282. <div class="form-group hcol-6-12">
  283. <label for="TIPOV"> Tipo de Ventilador *</label>
  284. <select class=" input-text validate-no-html-tags form-control" name="TIPOV" id="TIPOV" onchange="buscaModelo(this.value)" required="true" > </select>
  285. </div>
  286. <div class="form-group hcol-6-12">
  287. <label for="MODELOV"> Modelo de Ventilador *</label>
  288. <select class=" input-text validate-no-html-tags form-control" name="MODELOV" id="MODELOV" required="true"> </select>
  289. </div>
  290. </div>
  291. <div class="container hcol-12-12">
  292. <div class="form-group hcol-6-12">
  293. <label for="VCAUDAL"> Caudal (Q) *</label>
  294. <input type="text" class=" input-text validate-no-html-tags form-control" name="VCAUDAL" id="VCAUDAL" onblur="agregarDecimales(this.id)" required="true">
  295. </div>
  296. <div class="form-group hcol-6-12">
  297. <label for="#"> &nbsp; </label>
  298. <select class=" validate-no-html-tags form-control" name="UMCAU" id="UMCAU"> </select>
  299. </div>
  300. </div>
  301. <div class="container hcol-12-12">
  302. <div class="form-group hcol-6-12">
  303. <label for="VPREE"> Presión Estatíca (P) *</label>
  304. <input type="text" class=" input-text validate-no-html-tags form-control" name="VPREE" id="VPREE" onblur="agregarDecimales(this.id)" required="true">
  305. </div>
  306. <div class="form-group hcol-6-12">
  307. <label for="#"> &nbsp; </label>
  308. <select class=" input-text validate-no-html-tags form-control" name="UMPRE" id="UMPRE"> </select>
  309. </div>
  310. </div>
  311. <div class="container hcol-12-12">
  312. <div class="form-group hcol-6-12">
  313. <label for="VPOTE"> Potencias Absorbida (Bhp) *</label>
  314. <input type="text" class=" input-text validate-no-html-tags form-control" name="VPOTE" id="VPOTE" onblur="agregarDecimales(this.id)" required="true">
  315. </div>
  316. <div class="form-group hcol-6-12">
  317. <label for="#"> &nbsp; </label>
  318. <select class=" input-text validate-no-html-tags form-control" name="UMPOT" id="UMPOT"> </select>
  319. </div>
  320. </div>
  321. <div class="container hcol-12-12">
  322. <div class="form-group hcol-6-12">
  323. <label for="DIAME"> Diamtero del Ventilador *</label>
  324. <input type="text" class=" input-text validate-no-html-tags form-control" name="DIAME" id="DIAME" onblur="agregarDecimales(this.id)" required="true">
  325. </div>
  326. <div class="form-group hcol-6-12">
  327. <label for="#"> &nbsp; </label>
  328. <select class=" input-text validate-no-html-tags form-control" name="UMDIA" id="UMDIA"> </select>
  329. </div>
  330. </div>
  331. <div class="container hcol-12-12">
  332. <div class="form-group hcol-12-12">
  333. <label for="CURNC"> Curva NC *</label>
  334. <select class=" input-text validate-no-html-tags form-control" name="CURNC" id="CURNC"> </select>
  335. </div>
  336. </div>
  337. <div class="container hcol-12-12">
  338. <div class="form-group hcol-4-12">
  339. </div>
  340. <div class="form-group hcol-4-12">
  341. </div>
  342. <div class="form-group hcol-4-12" align="left">
  343. <button type="button" id="CALCULAR" name="CALCULAR" onclick="validaCampos()" class="btn small"> Calcular </button>
  344. <!-- <input type="button" id="CALCULAR" name="CALCULAR" onclick="validaCampos()" class="btn small" value="Calcular" > -->
  345. </div>
  346. </div>
  347. </div>
  348. <div class="container grid hcol-6-12">
  349. <div class="hcol-9-12" id="loading" style="display: none;">
  350. <img src="media/img/loader2.gif" width="41px" >
  351. </div>
  352. <!-- Tabla de Resultados -->
  353. <div id="tablaR" class="form-group hcol-12-12">
  354. <div id="tablaResultados" class="table-responsive">
  355. <?php echo $strTablaResultados; ?>
  356. </div>
  357. </div>
  358. </div>
  359. <div class="container grid">
  360. <div class="container">
  361. <div class="form-group hcol-6-6">
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. </form>
  367. <form id="frmPDFGeneral" method="POST" action="<?php echo($_SERVER['PHP_SELF']);?>" target="_blank">
  368. <input type="hidden" name="TRANSPDF" id="TRANSPDF" >
  369. <input type="hidden" name="DATOSENTRADA" id="DATOSENTRADA" >
  370. <input type="hidden" name="CONVERSIONES" id="CONVERSIONES" >
  371. <input type="hidden" name="AREASALIDA" id="AREASALIDA" >
  372. <input type="hidden" name="VFLUIDO" id="VFLUIDO" >
  373. <input type="hidden" name="LW" id="LW" >
  374. <input type="hidden" name="KW" id="KW" >
  375. <input type="hidden" name="LWAV" id="LWAV" >
  376. <input type="hidden" name="LWAVA" id="LWAVA" >
  377. <input type="hidden" name="SONIDOR" id="SONIDOR" >
  378. <input type="hidden" name="CORRECCION" id="CORRECCION" >
  379. <input type="hidden" name="SONMASCORR" id="SONMASCORR" >
  380. <input type="hidden" name="LWFINALDATOS" id="LWFINALDATOS" >
  381. <input type="hidden" name="SUMALWFINAL" id="SUMALWFINAL" >
  382. <input type="hidden" name="LWADATOS" id="LWADATOS" >
  383. <input type="hidden" name="SUMALWA" id="SUMALWA" >
  384. <input type="hidden" name="PRESON" id="PRESON" >
  385. <input type="hidden" name="PRESONA" id="PRESONA" >
  386. <input type="hidden" name="LWFINALDATOSVA" id="LWFINALDATOSVA" >
  387. <input type="hidden" name="SUMALWFINALVA" id="SUMALWFINALVA" >
  388. <input type="hidden" name="LWADATOSVA" id="LWADATOSVA" >
  389. <input type="hidden" name="SUMALWAVA" id="SUMALWAVA" >
  390. <input type="hidden" name="PRESONVA" id="PRESONVA" >
  391. <input type="hidden" name="PRESONAVA" id="PRESONAVA" >
  392. <input type="hidden" name="PRUEBA" id="PRUEBA" >
  393. <input type="hidden" name="ATENUADOR" id="ATENUADOR" >
  394. <input type="hidden" name="TRANS" id="TRANS" >
  395. </form>
  396. <div class="container-fluid">
  397. <div class="row">
  398. <div class="col-sm-12" id="tabla"></div>
  399. </div>
  400. </div>
  401. </main>
  402. </div>
  403. </div>
  404. </div>
  405. <?php include 'footer.php' ?>
  406. </body>
  407. <script src="https://ajax.googleapis.com/ajax/libs/dojo/1.10.0/dojo/dojo.js" data-dojo-config='parseOnLoad: true'></script>
  408. <script type="text/javascript">
  409. var idModulo = "CALC.ATEN"
  410. var mensajeError = 0;
  411. var arrErroresSistemaJs = new Array();
  412. var arrErroresSistemaCalc = new Array();
  413. <?php if ( isset($arrVentiladoresJs) ) { ?>
  414. var arrVentiladores = <?php echo $arrVentiladoresJs; ?>
  415. <?php } else { ?>
  416. document.getElementById("TIPOV").disabled = true;
  417. document.getElementById("MODELOV").disabled = true;
  418. var strMensaje = "";
  419. strMensaje += 'SPJS.( ' + idModulo + ' ).0001 - Ocurrio un error al cargar el <b> Catálogo de Ventiladores </b> de S&P </b>';
  420. arrErroresSistemaJs['0001'] = strMensaje;
  421. mensajeError ++ ;
  422. <?php } ?>
  423. var newOptionI = document.createElement("option");
  424. newOptionI.value = "";
  425. newOptionI.text = "Seleccione un Tipo de Ventilador...";
  426. document.getElementById("TIPOV").appendChild(newOptionI);
  427. <?php if ( isset($arrTipoVentiladorJs) ) { ?>
  428. var arrTiposVentiladores = <?php echo $arrTipoVentiladorJs; ?>;
  429. Object.keys(arrTiposVentiladores).forEach( function( key ) {
  430. var newOption = document.createElement("option");
  431. newOption.value = key;
  432. newOption.text = arrTiposVentiladores[key];
  433. document.getElementById("TIPOV").appendChild(newOption);
  434. });
  435. <?php } else { ?>
  436. document.getElementById("TIPOV").disabled = true;
  437. var strMensaje = "";
  438. strMensaje += 'SPJS.( ' + idModulo + ' ).0002 - Ocurrio un error al cargar los <b> Tipos de Ventiladores </b> de S&P';
  439. arrErroresSistemaJs['0002'] = strMensaje;
  440. mensajeError ++ ;
  441. <?php } ?>
  442. <?php if ( isset($arrModeloVentiladorJs) ) { ?>
  443. var arrModelosVentiladores = <?php echo $arrModeloVentiladorJs; ?>;
  444. <?php } else { ?>
  445. document.getElementById("MODELOV").disabled = true;
  446. var strMensaje = "";
  447. strMensaje += 'SPJS.( ' + idModulo + ' ).0003 - Ocurrio un error al cargar los <b> Modelos de los Ventiladores </b> de S&P';
  448. arrErroresSistemaJs['0003'] = strMensaje;
  449. mensajeError ++ ;
  450. <?php } ?>
  451. var arrModelosSeleccionados = {};
  452. var selectModelosVentiladores = document.getElementById("MODELOV");
  453. var newOptionII = document.createElement("option");
  454. newOptionII.value = "";
  455. newOptionII.text = "Seleccione un Modelo de Ventilador...";
  456. selectModelosVentiladores.appendChild(newOptionII);
  457. function buscaModelo( tipoVentilador ) {
  458. if ( selectModelosVentiladores.length > 0 ) {
  459. while (selectModelosVentiladores.firstChild) {
  460. selectModelosVentiladores.removeChild(selectModelosVentiladores.firstChild);
  461. }
  462. }
  463. Object.keys(arrModelosVentiladores).forEach( function( arrModelos ) {
  464. if ( arrModelos == tipoVentilador ) {
  465. Object.keys(arrModelosVentiladores[arrModelos]).forEach( function( key ) {
  466. var newOption = document.createElement("option");
  467. newOption.value = key;
  468. newOption.text = arrModelosVentiladores[arrModelos][key];
  469. selectModelosVentiladores.appendChild(newOption);
  470. });
  471. } else {
  472. }
  473. });
  474. }
  475. // Contiene las Unidades de Medida de la Caudal para Posibles conversiones
  476. var arrUnidadesCaudal = <?php echo $arrUnidadMedidaCaudalJs; ?>;
  477. Object.keys(arrUnidadesCaudal).forEach( function( key ) {
  478. var newOption = document.createElement("option");
  479. if ( key == "CFM" ) {
  480. newOption.selected = true;
  481. }
  482. newOption.value = key;
  483. newOption.text = arrUnidadesCaudal[key];
  484. document.getElementById("UMCAU").appendChild(newOption);
  485. });
  486. // Contiene las Unidades de Medida de la de la Presión Estatíca para Posibles conversiones
  487. var arrUnidadMedidaPresionE = <?php echo $arrUnidadMedidaPresionEJs; ?>;
  488. Object.keys(arrUnidadMedidaPresionE).forEach( function( key ) {
  489. var newOption = document.createElement("option");
  490. if ( key == "INWG" ) {
  491. newOption.selected = true;
  492. }
  493. newOption.value = key;
  494. newOption.text = arrUnidadMedidaPresionE[key];
  495. document.getElementById("UMPRE").appendChild(newOption);
  496. });
  497. // Contiene las Unidades de Medida de la de la Potencia Absorbida para Posibles conversiones
  498. var arrUnidadMedidaPotenciaA = <?php echo $arrUnidadMedidaPotenciaAJs; ?>;
  499. Object.keys(arrUnidadMedidaPotenciaA).forEach( function( key ) {
  500. var newOption = document.createElement("option");
  501. if ( key == "BHP" ) {
  502. newOption.selected = true;
  503. }
  504. newOption.value = key;
  505. newOption.text = arrUnidadMedidaPotenciaA[key];
  506. document.getElementById("UMPOT").appendChild(newOption);
  507. });
  508. // Contiene las Unidades de Medida del Diametro para Posibles conversiones
  509. var arrUnidadMedidaDiametro = <?php echo $arrUnidadMedidaDiametroJs; ?>;
  510. Object.keys(arrUnidadMedidaDiametro).forEach( function( key ) {
  511. var newOption = document.createElement("option");
  512. if ( key == "FT" ) {
  513. newOption.selected = true;
  514. }
  515. newOption.value = key;
  516. newOption.text = arrUnidadMedidaDiametro[key];
  517. document.getElementById("UMDIA").appendChild(newOption);
  518. });
  519. // Contiene las CurvasNC posibles
  520. var arrCurvaNC = <?php echo $arrCurvaNCSJs; ?>;
  521. Object.keys(arrCurvaNC).forEach( function( key ) {
  522. var newOption = document.createElement("option");
  523. newOption.value = key;
  524. newOption.text = arrCurvaNC[key];
  525. document.getElementById("CURNC").appendChild(newOption);
  526. });
  527. // Función para Precisar los decimales de cada Valor
  528. function agregarDecimales( idInput ) {
  529. var presicionDecimales = parseInt(8);
  530. var valorInput = document.getElementById(idInput).value;
  531. if ( valorInput.length > 0 ) {
  532. if ( /^\d*\.?\d*$/.test(valorInput) ) {
  533. var valorInput = parseFloat(valorInput);
  534. var valorInput = valorInput.toFixed(presicionDecimales);
  535. document.getElementById(idInput).value = valorInput;
  536. }
  537. }
  538. }
  539. function validaCampos() {
  540. var boolValido = "";
  541. var presicionDecimales = parseInt(8);
  542. var arrDatosCalculos = new Array();
  543. var tipoVentilador = document.getElementById('TIPOV').value;
  544. var modeloVentilador = document.getElementById('MODELOV').value;
  545. if ( tipoVentilador.length == 0 ) {
  546. alertify.confirm( 'Datos de Entrada Incompletos', 'Debe seleccionar un <b> Tipo de Ventilador </b> de la lista de Opciones.', function() { },
  547. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  548. document.getElementById('TIPOV').focus();
  549. boolValido = false;
  550. return;
  551. }
  552. if ( modeloVentilador.length == 0 ) {
  553. alertify.confirm( 'Datos de Entrada Incompletos', 'Debe seleccionar un <b> Modelo de Ventilador </b> de la lista de Opciones.', function() { },
  554. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  555. document.getElementById('MODELOV').focus();
  556. boolValido = false;
  557. return;
  558. }
  559. var inputsValores = document.querySelectorAll('#frm input[type="text"]');
  560. for ( index = 0; index < inputsValores.length; ++index ) {
  561. var idInput = inputsValores[index].getAttribute("name");
  562. if( idInput != null ) {
  563. var valorInput = document.getElementById(idInput).value;
  564. if ( valorInput.length > 0 ) {
  565. var vInput = parseFloat(valorInput);
  566. vInput = vInput.toFixed(presicionDecimales);
  567. if ( /^\d*\.?\d*$/.test(vInput) ) {
  568. if ( idInput == "VCAUDAL" ) {
  569. arrDatosCalculos[idInput] = vInput + "||" + document.getElementById('UMCAU').value + "||" + "CAUDAL";
  570. }
  571. if ( idInput == "VPREE" ) {
  572. arrDatosCalculos[idInput] = vInput + "||" + document.getElementById('UMPRE').value + "||" + "PRE";
  573. }
  574. if ( idInput == "VPOTE" ) {
  575. arrDatosCalculos[idInput] = vInput + "||" + document.getElementById('UMPOT').value + "||" + "POTE";
  576. }
  577. if ( idInput == "DIAME" ) {
  578. arrDatosCalculos[idInput] = vInput + "||" + document.getElementById('UMDIA').value + "||" + "DIAME";
  579. }
  580. boolValido = true;
  581. } else {
  582. var campo = "";
  583. if ( idInput == "VCAUDAL" ) {
  584. campo = "Caudal (Q)";
  585. }
  586. if ( idInput == "VPREE" ) {
  587. campo = "Presión Estatíca (P)";
  588. }
  589. if ( idInput == "VPOTE" ) {
  590. campo = "Potencia Absorbida (Bhp)";
  591. }
  592. if ( idInput == "DIAME" ) {
  593. campo = "Diametro del Ventilador";
  594. }
  595. alertify.confirm( 'Datos de Entrada Incompletos', 'El campo <b>' + campo + '</b> debe de contener solo números (enteros ó decimales). ', function() { },
  596. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  597. document.getElementById(idInput).focus();
  598. boolValido = false;
  599. return false;
  600. }
  601. } else {
  602. var campo = "";
  603. if ( idInput == "VCAUDAL" ) {
  604. campo = "Caudal (Q)";
  605. }
  606. if ( idInput == "VPREE" ) {
  607. campo = "Presión Estatíca (P)";
  608. }
  609. if ( idInput == "VPOTE" ) {
  610. campo = "Potencia Absorbida (Bhp)";
  611. }
  612. if ( idInput == "DIAME" ) {
  613. campo = "Diametro del Ventilador";
  614. }
  615. boolValido = false;
  616. alertify.confirm( 'Datos de Entrada Incompletos', 'El campo <b>' + campo + '</b> es un dato Requerido. ', function() { },
  617. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  618. document.getElementById(idInput).focus();
  619. return false;
  620. }
  621. }
  622. }
  623. var curvaNC = document.getElementById('CURNC').value;
  624. if ( curvaNC.length == 0 ) {
  625. alertify.confirm( 'Datos de Entrada Incompletos', 'Debe seleccionar una <b> Caudal </b> de la lista de Opciones', function() { },
  626. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  627. document.getElementById('CURNC').focus();
  628. boolValido = false;
  629. return false;
  630. }
  631. if ( boolValido == true ) {
  632. realizaCalculos( tipoVentilador, modeloVentilador, arrDatosCalculos, curvaNC );
  633. }
  634. }
  635. function precisarDecimales ( presicion, numero ) {
  636. valor = parseFloat(numero);
  637. valorD = valor.toFixed(presicion);
  638. return valorD;
  639. }
  640. <?php if ( isset($arrAtenuacionJs) ) { ?>
  641. var arrAtenuacion = <?php echo $arrAtenuacionJs; ?>
  642. <?php } else { ?>
  643. var strMensaje = "";
  644. strMensaje += 'SPJS.( ' + idModulo + ' ).0004 - Ocurrio un error al cargar el <b> Catálogo de Atenuadores </b> de S&P, ';
  645. arrErroresSistemaJs['0004'] = strMensaje;
  646. mensajeError ++ ;
  647. <?php } ?>
  648. <?php if ( isset($arrPotenciaSonoraJs) ) { ?>
  649. var arrPotenciaSonora = <?php echo $arrPotenciaSonoraJs; ?>
  650. <?php } else { ?>
  651. var strMensaje = "";
  652. strMensaje += 'SPJS.( ' + idModulo + ' ).0005 - Ocurrio un error al cargar las <b> Potencias Sonoras </b> requeridas para el calcúlo de atenuadores de S&P, ';
  653. arrErroresSistemaJs['0005'] = strMensaje;
  654. mensajeError ++ ;
  655. <?php } ?>
  656. if ( mensajeError > 0 ) {
  657. var strMensaje = "";
  658. strMensaje += 'SPJS.( ' + idModulo + ' ) - La calculadora de atenuadores no se encuentra funcionando correctamente en estos momentos, favor de intentarlo más tarde.';
  659. alertify.confirm( 'Error...', strMensaje, function() { location.reload(true); },
  660. function() { location.href = "atenuadores.php"; } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  661. function onKeyDownHandler(event) {
  662. var t1 = 1;
  663. var accion = "";
  664. var codigo = event.which || event.keyCode;
  665. if ( ( t1 == 1) && ( codigo == 76 ) ){
  666. var error = "";
  667. Object.keys(arrErroresSistemaJs).forEach( function( indice ) {
  668. error += arrErroresSistemaJs[indice] + "<br>";
  669. });
  670. alertify.confirm( 'Errores...', error, function() { },
  671. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  672. }
  673. }
  674. window.onkeydown = onKeyDownHandler;
  675. }
  676. function realizaCalculos ( tipo, modelo, datos, curva ) {
  677. var vCaudal = "";
  678. var vPresionE = "";
  679. var vPotenciaA = "";
  680. var vDiametro = "";
  681. var boolValido = true;
  682. var presicionDecimales = parseInt(8);
  683. var strMensaje = "";
  684. var mensajeErrorCalc = 0;
  685. var arrDatosDeEntrada = new Array();
  686. var arrConversiones = new Array();
  687. var arrCalculos = new Array();
  688. // Contiene los parametros de las Octavas de Banda Frecuencia - Hz
  689. var arrFrecuencias = [ "63Hz", "125Hz", "250Hz", "500Hz", "1000Hz", "2000Hz", "4000Hz", "8000Hz"];
  690. // Contiene los parametros de la Ponderancia A
  691. var arrPonderanciaA = [ -26.2, -16.1, -8.6, -3.2, 0.0, 1.2, 1.0, -1.1 ];
  692. arrDatosDeEntrada['TipoVentilador'] = tipo ;
  693. arrDatosDeEntrada['ModeloVentilador'] = modelo;
  694. Object.keys(arrVentiladores).forEach( function( key ) {
  695. Object.keys(arrVentiladores[key]).forEach( function( keyVentilador ) {
  696. if ( arrVentiladores[key]['IDMODELO'] == modelo ){
  697. arrDatosDeEntrada['ModeloVentilador'] = arrVentiladores[key]['MODELO'];
  698. }
  699. });
  700. });
  701. Object.keys(datos).forEach( function( key ) {
  702. var splitDatos = datos[key].split( "||" );
  703. var valorCampo = splitDatos[0];
  704. var unidadDeMedida = splitDatos[1];
  705. var campoDato = splitDatos[2];
  706. if ( campoDato == "CAUDAL" ) {
  707. arrDatosDeEntrada['Caudal'] = "" + valorCampo + " " + unidadDeMedida;
  708. switch ( unidadDeMedida ) { // Conversiones para la Caudal
  709. case 'M3/S':
  710. vCaudal = valorCampo / 0.0004719;
  711. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  712. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "0.028314 M3/S ) X 1 CFM = " + presicion + " CFM";
  713. break;
  714. case 'M3/MIN':
  715. vCaudal = valorCampo / 0.028314;
  716. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  717. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "0.028314 M3/MIN ) X 1 CFM = " + presicion + " CFM";
  718. break;
  719. case 'M3/H':
  720. vCaudal = valorCampo / 1.699011;
  721. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  722. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "0.699011 M3/H ) X 1 CFM = " + presicion + " CFM";
  723. break;
  724. case 'L/S':
  725. vCaudal = valorCampo * 2.119;
  726. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  727. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " X " + "2.119 L/S ) X 1 CFM = " + presicion + " CFM";
  728. break;
  729. case 'L/MIN':
  730. vCaudal = valorCampo / 28.32;
  731. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  732. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "28.32 L/MIN ) X 1 CFM = " + presicion + " CFM";
  733. break;
  734. case 'L/H':
  735. vCaudal = valorCampo / 1699;
  736. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  737. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "1699 L/H ) X 1 CFM = " + presicion + " CFM";
  738. break;
  739. case 'CM3/S':
  740. vCaudal = valorCampo / 471.9;
  741. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  742. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "471.9 CM3/S ) X 1 CFM = " + presicion + " CFM";
  743. arrConversiones[unidadDeMedida] = "" + valorCampo + " / " + "471.9 = " + vCaudal + "";
  744. break;
  745. case 'CM3/MIN':
  746. vCaudal = valorCampo / 28314;
  747. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  748. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "278314 CM3/MIN ) X 1 CFM = " + presicion + " CFM";
  749. break;
  750. case 'CM3/H':
  751. vCaudal = valorCampo / 1698840;
  752. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  753. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "1698840 CM3/H ) X 1 CFM = " + presicion + " CFM";
  754. break;
  755. case 'GALON/S':
  756. vCaudal = valorCampo / 0.12467532;
  757. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  758. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "0.12467532 GALON/S) X 1 CFM = " + presicion + " CFM";
  759. break;
  760. case 'GALON/MIN':
  761. vCaudal = valorCampo / 7.4805195566834;
  762. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  763. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "7.4805195566834 GALON/MIN ) X 1 CFM = " + presicion + " CFM";
  764. break;
  765. case 'GALON/H':
  766. vCaudal = valorCampo / 448.8311734;
  767. var presicion = precisarDecimales( presicionDecimales, vCaudal );
  768. arrConversiones['Caudal'] = "( " + valorCampo + " " + unidadDeMedida + " / " + "448.8311734 GALON/H ) X 1 CFM = " + presicion + " CFM";
  769. break;
  770. case 'CFM':
  771. vCaudal = valorCampo;
  772. break;
  773. }
  774. vCaudal = parseFloat(vCaudal);
  775. vCaudal = vCaudal.toFixed(presicionDecimales);
  776. }
  777. if ( campoDato == "PRE" ) {
  778. arrDatosDeEntrada['PresionEstatica'] = "" + valorCampo + " " + unidadDeMedida;
  779. switch ( unidadDeMedida ) { // Conversiones para la Presión Estatíca
  780. case 'MPA':
  781. vPresionE = valorCampo * 401.47;
  782. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  783. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "401.47 MPA ) X 1 INWG = " + presicion + " INWG";
  784. break;
  785. case 'KPA':
  786. vPresionE = valorCampo * 4.0147;
  787. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  788. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "4.0147 KPA ) X 1 INWG = " + presicion + " INWG";
  789. break;
  790. case 'PA':
  791. vPresionE = valorCampo * 0.0040147;
  792. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  793. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.0040147 PA ) X 1 INWG = " + presicion + " INWG";
  794. break;
  795. case 'BAR':
  796. vPresionE = valorCampo * 401.865;
  797. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  798. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "401.865 BAR ) X 1 INWG = " + presicion + " INWG";
  799. break;
  800. case 'M CA':
  801. vPresionE = valorCampo * 39.166667;
  802. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  803. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "39.166667 ) X 1 INWG = " + presicion + " INWG";
  804. break;
  805. case 'CM CA':
  806. vPresionE = valorCampo * 0.39166667;
  807. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  808. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.39166667 CM CA ) X 1 INWG = " + presicion + " INWG";
  809. break;
  810. case 'MM CA':
  811. vPresionE = valorCampo * 0.039166667;
  812. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  813. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.039166667 MM CA ) X 1 INWG = " + presicion + " INWG";
  814. break;
  815. case 'IN HG':
  816. vPresionE = valorCampo / 0.0735541043;
  817. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  818. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.0735541043 ) X 1 INWG = " + presicion + " INWG";
  819. break;
  820. case 'CM HG':
  821. vPresionE = valorCampo / 0.18682743044;
  822. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  823. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.18682743044 CM HG ) X 1 INWG = " + presicion + " INWG";
  824. break;
  825. case 'MM HG':
  826. vPresionE = valorCampo / 0.018682743044;
  827. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  828. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.018682743044 MM HG ) X 1 INWG = " + presicion + " INWG";
  829. break;
  830. case 'TORR':
  831. vPresionE = valorCampo * 0.5352533071;
  832. var presicion = precisarDecimales( presicionDecimales, vPresionE );
  833. arrConversiones['Presion Estatica'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.5352533071 TORR ) X 1 INWG = " + presicion + " INWG";
  834. break;
  835. case 'INWG':
  836. vPresionE = valorCampo;
  837. break;
  838. }
  839. vPresionE = parseFloat(vPresionE);
  840. vPresionE = vPresionE.toFixed(presicionDecimales);
  841. }
  842. if ( campoDato == "POTE" ) {
  843. arrDatosDeEntrada['PotenciaAbsorbida'] = " " + valorCampo + " " + unidadDeMedida;
  844. switch ( unidadDeMedida ) { // Conversiones para la Potencia Absorbida
  845. case 'HP':
  846. vPotenciaA = valorCampo / 13.1549;
  847. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  848. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "13.1549 HP ) X 1 BHP = " + presicion + " BHP";
  849. break;
  850. case 'J/S':
  851. vPotenciaA = valorCampo / 9809.5;
  852. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  853. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "9809.5 J/S ) X 1 BHP = " + presicion + " BHP";
  854. break;
  855. case 'KCAL/H':
  856. vPotenciaA = valorCampo / 8434.65;
  857. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  858. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "8434.65 KCAL ) X 1 BHP = " + presicion + " BHP";
  859. break;
  860. case 'KW':
  861. vPotenciaA = valorCampo / 9.8095;
  862. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  863. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "8434.65 KW ) X 1 BHP = " + presicion + " BHP";
  864. break;
  865. case 'WATT':
  866. vPotenciaA = valorCampo / 9809.5;
  867. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  868. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "8434.65 WATT ) X 1 BHP = " + presicion + " BHP";
  869. break;
  870. case 'PIE-LIBRA(S)':
  871. vPotenciaA = valorCampo / 7235.12;
  872. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  873. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "8434.65 PIE-LIBRA(S) ) X 1 BHP = " + presicion + " BHP";
  874. break;
  875. case 'PIE-LIBRA(M)':
  876. vPotenciaA = valorCampo / 434106.95;
  877. var presicion = precisarDecimales( presicionDecimales, vPotenciaA );
  878. arrConversiones['Potencia Absorbida'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "8434.65 PIE-LIBRA(M) ) X 1 BHP = " + presicion + " BHP";
  879. break;
  880. case 'BHP':
  881. vPotenciaA = valorCampo;
  882. break;
  883. }
  884. vPotenciaA = parseFloat(vPotenciaA);
  885. vPotenciaA = vPotenciaA.toFixed(presicionDecimales);
  886. }
  887. if ( campoDato == "DIAME" ) {
  888. arrDatosDeEntrada['Diametro'] = " " + valorCampo + " " + unidadDeMedida;
  889. switch ( unidadDeMedida ) { // Conversiones para el Diametro
  890. case 'MM':
  891. vDiametro = (valorCampo * 3.291) / 1000;
  892. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  893. arrConversiones['Diametro'] = "() (" + valorCampo + " " + unidadDeMedida + " X " + "3.291 MM ) / 1000 ) X 1 FT = " + presicion + " FT";
  894. break;
  895. case 'CM':
  896. vDiametro = (valorCampo * 3.291) / 100;
  897. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  898. arrConversiones['Diametro'] = "( (" + valorCampo + " " + unidadDeMedida + " X " + "3.291 CM ) / 100 ) X 1 FT = " + presicion + " FT";
  899. break;
  900. case 'DM':
  901. vDiametro = (valorCampo * 3.291) / 10;
  902. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  903. arrConversiones['Diametro'] = "( (" + valorCampo + " " + unidadDeMedida + " X " + "13.1549 DM ) / 10 ) X 1 FT = " + presicion + " FT";
  904. break;
  905. case 'M':
  906. vDiametro = valorCampo * 3.291;
  907. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  908. arrConversiones['Diametro'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "13.1549 M ) X 1 FT = " + presicion + " FT";
  909. arrConversiones[unidadDeMedida] = "" + valorCampo + " X " + "13.1549 = " + vDiametro + "";
  910. break;
  911. case 'MI':
  912. vDiametro = valorCampo * 5280;
  913. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  914. arrConversiones['Diametro'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "5280 MI ) X 1 FT = " + presicion + " FT";
  915. break;
  916. case 'YARDA':
  917. vDiametro = valorCampo / 3;
  918. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  919. arrConversiones['Diametro'] = "(" + valorCampo + " " + unidadDeMedida + " / " + "3 YARDA ) X 1 FT = " + presicion + " FT";
  920. break;
  921. case 'INCH':
  922. vDiametro = valorCampo * 0.083333;
  923. var presicion = precisarDecimales( presicionDecimales, vDiametro );
  924. arrConversiones['Diametro'] = "(" + valorCampo + " " + unidadDeMedida + " X " + "0.083333 MM ) X 1 FT = " + presicion + " FT";
  925. break;
  926. case 'FT':
  927. vDiametro = valorCampo;
  928. break;
  929. }
  930. vDiametro = parseFloat(vDiametro);
  931. vDiametro = vDiametro.toFixed(presicionDecimales);
  932. }
  933. });
  934. var arrDatosVentilador = new Array(); // Contiene los Datos del Ventilador Seleccionado
  935. Object.keys(arrVentiladores).forEach( function( keyVentiladores ) {
  936. var arrVentilador = arrVentiladores[keyVentiladores];
  937. Object.keys(arrVentilador).forEach( function( keyVentilador ) {
  938. if ( arrVentilador['TIPO'] == tipo ) {
  939. if ( (arrVentilador['DESC'] == modelo) || (arrVentilador['IDMODELO'] == modelo) ) {
  940. arrDatosVentilador[keyVentilador] = arrVentilador[keyVentilador];
  941. }
  942. }
  943. });
  944. });
  945. var arrCurvaNC = new Array(); // Contiene el valor de cada frecuencia dependiendo de la CurvaNC seleccionada
  946. switch( curva ) {
  947. case 'NC15':
  948. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 47, 36, 29, 22, 17, 14, 12, 11 ]";
  949. arrCurvaNC = [ 47, 36, 29, 22, 17, 14, 12, 11 ];
  950. break;
  951. case 'NC20':
  952. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 51, 40, 33, 26, 22, 19, 17, 16 ]";
  953. arrCurvaNC = [ 51, 40, 33, 26, 22, 19, 17, 16 ];
  954. break;
  955. case 'NC25':
  956. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 54, 44, 37, 31, 27, 24, 22, 21 ]";
  957. arrCurvaNC = [ 54, 44, 37, 31, 27, 24, 22, 21 ];
  958. break;
  959. case 'NC30':
  960. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 57, 48, 41, 35, 31, 29, 28, 27 ]";
  961. arrCurvaNC = [ 57, 48, 41, 35, 31, 29, 28, 27 ];
  962. break;
  963. case 'NC35':
  964. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 60, 52, 45, 40, 36, 34, 33, 32 ]";
  965. arrCurvaNC = [ 60, 52, 45, 40, 36, 34, 33, 32 ];
  966. break;
  967. case 'NC40':
  968. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 64, 56, 50, 45, 41, 39, 38, 37 ]";
  969. arrCurvaNC = [ 64, 56, 50, 45, 41, 39, 38, 37 ];
  970. break;
  971. case 'NC45':
  972. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 67, 60, 54, 49, 46, 44, 43, 42 ]";
  973. arrCurvaNC = [ 67, 60, 54, 49, 46, 44, 43, 42 ];
  974. break;
  975. case 'NC50':
  976. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 71, 64, 58, 54, 51, 49, 48, 47 ]";
  977. arrCurvaNC = [ 71, 64, 58, 54, 51, 49, 48, 47 ];
  978. break;
  979. case 'NC55':
  980. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 74, 67, 62, 58, 56, 54, 53, 52 ]";
  981. arrCurvaNC = [ 74, 67, 62, 58, 56, 54, 53, 52 ];
  982. break;
  983. case 'NC60':
  984. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 77, 71, 67, 63, 61, 59, 58, 57 ]";
  985. arrCurvaNC = [ 77, 71, 67, 63, 61, 59, 58, 57 ];
  986. break;
  987. case 'NC65':
  988. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 80, 75, 71, 68, 66, 64, 63, 62 ]";
  989. arrCurvaNC = [ 80, 75, 71, 68, 66, 64, 63, 62 ];
  990. break;
  991. case 'NC70':
  992. arrDatosDeEntrada['CurvaNC'] = "" + curva + "##" + "[ 84, 79, 75, 72, 71, 70, 68, 68 ]";
  993. arrCurvaNC = [ 84, 79, 75, 72, 71, 70, 68, 68 ];
  994. break;
  995. }
  996. var valorPi = Math.PI;
  997. var A = ( ( valorPi ) * ( Math.pow( vDiametro, 2 ) ) ) / 4 ;
  998. A = parseFloat(A);
  999. A = A.toFixed(presicionDecimales);
  1000. var V = vCaudal / A;
  1001. V = parseFloat(V);
  1002. V = V.toFixed(presicionDecimales);
  1003. var arrLw = new Array(); // Contiene los valores de Lw
  1004. var arrKw = new Array(); // Contiene los valores de Kw
  1005. if ( (typeof vCaudal != 'undefined') || (typeof vPresionE != 'undefined') ) {
  1006. if ( Object.keys(arrFrecuencias).length != 0 ) {
  1007. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1008. var frecuencia = arrFrecuencias[indice];
  1009. var kw = ( 10 * Math.log10(vCaudal) ) + ( 20 * Math.log10(vPresionE) );
  1010. var cadenaOperacion = "(10 x " + Math.log10(vCaudal) + ") + ( 20 x " + Math.log10(vPresionE) + ") = / " + kw +" /";
  1011. kw = parseFloat(kw);
  1012. kw = kw.toFixed(presicionDecimales);
  1013. arrLw[frecuencia] = arrDatosVentilador[frecuencia];
  1014. arrKw[frecuencia] = kw;
  1015. });
  1016. } else {
  1017. var strMensaje = "";
  1018. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0002 - Ocurrio un error al cargar los valores de las Frecuencias Hz.';
  1019. arrErroresSistemaCalc['0002'] = strMensaje;
  1020. mensajeErrorCalc ++ ;
  1021. }
  1022. } else {
  1023. var strMensaje = "";
  1024. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0001 - Los valores de la Cudal o de la Presión Estatíca no se definieron correctamente.';
  1025. arrErroresSistemaCalc['0001'] = strMensaje;
  1026. mensajeErrorCalc ++ ;
  1027. }
  1028. var arrLwFinal = new Array(); // Contiene los valores de LwFinal
  1029. if ( Object.keys(arrLw).length != 0 ) {
  1030. Object.keys(arrLw).forEach( function( indice ) {
  1031. var valorLw = arrLw[indice];
  1032. var valorKw = arrKw[indice];
  1033. var lwFinal = parseFloat(valorKw) + parseFloat(valorLw);
  1034. var cadenaOperacion = "" + valorKw + " + " + valorLw + " = / " + lwFinal +" /";
  1035. lwFinal = parseFloat(lwFinal);
  1036. lwFinal = lwFinal.toFixed(presicionDecimales);
  1037. arrLwFinal[indice] = lwFinal;
  1038. });
  1039. } else {
  1040. var strMensaje = "";
  1041. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0003 - Se Presento un Error a la hora de calcular los valores de LwFinal.';
  1042. arrErroresSistemaCalc['0003'] = strMensaje;
  1043. mensajeErrorCalc ++ ;
  1044. }
  1045. var arrLwA = new Array(); // Contiene los valores de LwA
  1046. if ( Object.keys(arrPonderanciaA).length != 0 ) {
  1047. Object.keys(arrPonderanciaA).forEach( function( indice ) {
  1048. var valorLwFinal = arrLwFinal[arrFrecuencias[indice]];
  1049. var valorPonderancia = arrPonderanciaA[indice];
  1050. if ( (typeof valorLwFinal != 'undefined') || (typeof valorPonderancia != 'undefined') ) {
  1051. var lwA = parseFloat(valorLwFinal) + (parseFloat(valorPonderancia));
  1052. var cadenaOperacion = "" + parseFloat(valorLwFinal) + " + " + (parseFloat(valorPonderancia)) + " = / " + lwA +" /";
  1053. lwA = parseFloat(lwA);
  1054. lwA = lwA.toFixed(presicionDecimales);
  1055. arrLwA[arrFrecuencias[indice]] = lwA;
  1056. } else {
  1057. var strMensaje = "";
  1058. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0005 - Los valores de LwFinal o de la Ponderancia A no se definieron correctamente.';
  1059. arrErroresSistemaCalc['0005'] = strMensaje;
  1060. mensajeErrorCalc ++ ;
  1061. }
  1062. });
  1063. } else {
  1064. var strMensaje = "";
  1065. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0004 - Se Presento un Error a la hora de cargar los valores de la Ponderancia A.';
  1066. arrErroresSistemaCalc['0004'] = strMensaje;
  1067. mensajeErrorCalc ++ ;
  1068. }
  1069. var arrLwAVentiladorSeleccionado = new Array(); // Contiene los valores de LwA del Ventilador Seleccionado
  1070. if ( Object.keys(arrCurvaNC).length != 0 ) {
  1071. Object.keys(arrCurvaNC).forEach( function( indice ) {
  1072. var valorLwFinal = arrLwFinal[arrFrecuencias[indice]];
  1073. var valorCurvaNC = arrCurvaNC[indice];
  1074. if ( (typeof valorLwFinal != 'undefined') || (typeof valorCurvaNC != 'undefined') ) {
  1075. var LwAVentilador = parseFloat(valorLwFinal) - parseFloat(valorCurvaNC);
  1076. var cadenaOperacion = "" + valorLwFinal + " - " + valorCurvaNC + " = / " + LwAVentilador +" /";
  1077. LwAVentilador = parseFloat(LwAVentilador);
  1078. LwAVentilador = LwAVentilador.toFixed(presicionDecimales);
  1079. arrLwAVentiladorSeleccionado[arrFrecuencias[indice]] = LwAVentilador;
  1080. } else {
  1081. var strMensaje = "";
  1082. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0007 - Los valores de LwFinal o de la curvaNC no se definieron correctamente.';
  1083. arrErroresSistemaCalc['0007'] = strMensaje;
  1084. mensajeErrorCalc ++ ;
  1085. }
  1086. });
  1087. } else {
  1088. var strMensaje = "";
  1089. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0006 - Se Presento un Error a la hora de cargar los valores de la Curva NC seleccionada.';
  1090. arrErroresSistemaCalc['0006'] = strMensaje;
  1091. mensajeErrorCalc ++ ;
  1092. }
  1093. if ( Object.keys(arrLwAVentiladorSeleccionado).length > 0 ) {
  1094. var vAtenuador100Hz = arrLwAVentiladorSeleccionado["1000Hz"]; // Valor 1000Hz para seleccionar el Atenuador Correcto
  1095. } else {
  1096. var strMensaje = "";
  1097. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0024 - Se Presento un Error a la hora de cargar los valores de LwA del Ventilador.';
  1098. arrErroresSistemaCalc['0024'] = strMensaje;
  1099. mensajeErrorCalc ++ ;
  1100. }
  1101. var diametroTmp = vDiametro * 304.8; // Se convierte el diametro a mm de Ft para Buscar el Atenuador Correcto
  1102. diametroTmp = parseFloat(diametroTmp);
  1103. diametroTmp = diametroTmp.toFixed(presicionDecimales);
  1104. if ( diametroTmp <= 425 ) {
  1105. diametroTmp = 400;
  1106. } else if ( (diametroTmp > 425) && (diametroTmp <= 475) ) {
  1107. diametroTmp = 450;
  1108. } else if ( (diametroTmp > 475) && (diametroTmp <= 525) ) {
  1109. diametroTmp = 500;
  1110. } else if ( (diametroTmp > 525) && (diametroTmp <= 575) ) {
  1111. diametroTmp = 560;
  1112. } else if ( (diametroTmp > 580) && (diametroTmp <= 615) ) {
  1113. diametroTmp = 600;
  1114. } else if ( (diametroTmp > 615) && (diametroTmp <= 655) ) {
  1115. diametroTmp = 630;
  1116. } else if ( (diametroTmp > 655) && (diametroTmp <= 695) ) {
  1117. diametroTmp = 675;
  1118. } else if ( (diametroTmp > 695) && (diametroTmp <= 730) ) {
  1119. diametroTmp = 710;
  1120. } else if ( (diametroTmp > 730) && (diametroTmp <= 775) ) {
  1121. diametroTmp = 750;
  1122. } else if ( (diametroTmp > 775) && (diametroTmp <= 820) ) {
  1123. diametroTmp = 800;
  1124. } else if ( (diametroTmp > 820) && (diametroTmp <= 870) ) {
  1125. diametroTmp = 840;
  1126. } else if ( (diametroTmp > 870) && (diametroTmp <= 920) ) {
  1127. diametroTmp = 900;
  1128. } else if ( (diametroTmp > 920) && (diametroTmp <= 970) ) {
  1129. diametroTmp = 945;
  1130. } else if ( (diametroTmp > 970) && (diametroTmp <= 1030) ) {
  1131. diametroTmp = 1000;
  1132. } else if ( (diametroTmp > 1030) && (diametroTmp <= 1090) ) {
  1133. diametroTmp = 1065;
  1134. } else if ( (diametroTmp > 1090) && (diametroTmp <= 1160) ) {
  1135. diametroTmp = 1120;
  1136. } else if ( (diametroTmp > 1160) && (diametroTmp <= 1225) ) {
  1137. diametroTmp = 1200;
  1138. } else if ( (diametroTmp > 1225) && (diametroTmp <= 1255) ) {
  1139. diametroTmp = 1250;
  1140. } else if ( (diametroTmp > 1255) && (diametroTmp <= 1305) ) {
  1141. diametroTmp = 1260;
  1142. } else if ( (diametroTmp > 1305) && (diametroTmp <= 1375) ) {
  1143. diametroTmp = 1350;
  1144. } else if ( (diametroTmp > 1375) && (diametroTmp <= 1410) ) {
  1145. diametroTmp = 1400;
  1146. } else if ( (diametroTmp > 1410) && (diametroTmp <= 1460) ) {
  1147. diametroTmp = 1420;
  1148. } else if ( (diametroTmp > 1460) && (diametroTmp <= 1550) ) {
  1149. diametroTmp = 1500;
  1150. } else if ( (diametroTmp > 1550) && (diametroTmp <= 1640) ) {
  1151. diametroTmp = 1600;
  1152. } else if ( (diametroTmp > 1640) && (diametroTmp <= 1740) ) {
  1153. diametroTmp = 1680;
  1154. } else if ( (diametroTmp > 1740) && (diametroTmp <= 1840) ) {
  1155. diametroTmp = 1800;
  1156. } else if ( (diametroTmp > 1840) && (diametroTmp <= 1885) ) {
  1157. diametroTmp = 1875;
  1158. } else if ( (diametroTmp > 1885) && (diametroTmp <= 2050) ) {
  1159. diametroTmp = 2000;
  1160. } else if ( (diametroTmp > 2050) && (diametroTmp <= 2170) ) {
  1161. diametroTmp = 2100;
  1162. } else if ( (diametroTmp > 2170) && (diametroTmp <= 2370) ) {
  1163. diametroTmp = 2240;
  1164. } else if ( (diametroTmp > 2370) && (diametroTmp <= 2750) ) {
  1165. diametroTmp = 2500;
  1166. } else if ( (diametroTmp > 2501) && (diametroTmp <= 3000) ) {
  1167. diametroTmp = 2800;
  1168. }
  1169. var arrAtenuador1000Hz = new Array(); // Contiene el valor de 1000Hz de los Posibles Atenuadores
  1170. Object.keys(arrAtenuacion).forEach( function( array ) {
  1171. var idAtenuador = arrAtenuacion[array]['IDATENUACION'];
  1172. var vDiametroAte = arrAtenuacion[array]['DIAMETRO'];
  1173. var vLongitudAte = arrAtenuacion[array]['LONGITUD'];
  1174. var v1000Hz = arrAtenuacion[array]['1000Hz'];
  1175. if ( (vDiametroAte == diametroTmp) ) {
  1176. arrAtenuador1000Hz[idAtenuador] = v1000Hz;
  1177. }
  1178. });
  1179. var arrDiferencia = new Array();
  1180. var arrDiferenciaSort = new Array();
  1181. if ( Object.keys(arrAtenuador1000Hz).length > 0 ) {
  1182. Object.keys(arrAtenuador1000Hz).forEach( function( indice ) {
  1183. var vAtenuadorSelect = arrAtenuador1000Hz[indice];
  1184. var diferencia = "";
  1185. if ( vAtenuador100Hz > vAtenuadorSelect ) {
  1186. diferencia = vAtenuador100Hz - vAtenuadorSelect;
  1187. } else {
  1188. diferencia = vAtenuadorSelect - vAtenuador100Hz;
  1189. }
  1190. diferencia = parseFloat(diferencia);
  1191. diferencia = diferencia.toFixed(presicionDecimales);
  1192. arrDiferencia[indice] = diferencia;
  1193. arrDiferenciaSort[indice] = diferencia;
  1194. });
  1195. arrDiferenciaSort.sort(deMenorAMayor);
  1196. function deMenorAMayor(elem1, elem2) {return elem1-elem2;}
  1197. var valMenorDif = arrDiferenciaSort[0];
  1198. var idAtenuadorSelect = arrDiferencia.indexOf(valMenorDif);
  1199. } else {
  1200. var strMensaje = "";
  1201. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0007 - Se Presento un Error a la hora de cargar los valores de los posibles atenuadores seleccionados.';
  1202. arrErroresSistemaCalc['0007'] = strMensaje;
  1203. mensajeErrorCalc ++ ;
  1204. }
  1205. var arrAtenuador = new Array(); // Contiene los Datos del Atenuador Seleccionado
  1206. Object.keys(arrAtenuacion).forEach( function( array ) {
  1207. var idAtenuador = arrAtenuacion[array]['IDATENUACION'];
  1208. if ( (typeof idAtenuadorSelect != 'undefined') ) {
  1209. if ( idAtenuador == idAtenuadorSelect ) {
  1210. arrAtenuador = arrAtenuacion[array];
  1211. }
  1212. } else {
  1213. var strMensaje = "";
  1214. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0008 - El valor del Atenuador Seleccionado no se definio correctamente.';
  1215. arrErroresSistemaCalc['0008'] = strMensaje;
  1216. mensajeErrorCalc ++ ;
  1217. }
  1218. });
  1219. var arrLwAVentilador = new Array(); // Contiene los valores de LwA Ventilador - Atenuacion
  1220. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1221. var frecuencia = arrFrecuencias[indice];
  1222. var vlwFinal = arrLwFinal[frecuencia];
  1223. var vAtenuador = arrAtenuador[frecuencia];
  1224. if ( (typeof vlwFinal != 'undefined') || (typeof vAtenuador != 'undefined') ) {
  1225. var LwAVentilador = parseFloat(vlwFinal) - parseFloat(vAtenuador);
  1226. var cadenaOperacion = " " + vlwFinal + " - " + vAtenuador + " = " + LwAVentilador + " ";
  1227. LwAVentilador = parseFloat(LwAVentilador);
  1228. LwAVentilador = LwAVentilador.toFixed(presicionDecimales);
  1229. arrLwAVentilador[frecuencia] = LwAVentilador;
  1230. } else {
  1231. var strMensaje = "";
  1232. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0009 - Los valores de LwFinal o deL Atenuador no se definieron correctamente.';
  1233. arrErroresSistemaCalc['0009'] = strMensaje;
  1234. mensajeErrorCalc ++ ;
  1235. }
  1236. });
  1237. // Determina el Rango de la Potencia Sonora para seleccionar la correcta
  1238. if ( (typeof V != 'undefined') ) {
  1239. if ( !isNaN(V) ) {
  1240. var tmpPotenciaSonora = V;
  1241. if ( tmpPotenciaSonora <= 1000 ) {
  1242. searchPotenciaSonora = "<1000";
  1243. } else if ( (tmpPotenciaSonora > 1000) && (tmpPotenciaSonora <= 1500) ) {
  1244. searchPotenciaSonora = ">1000";
  1245. } else if ( (tmpPotenciaSonora > 1500) && (tmpPotenciaSonora <= 2000) ) {
  1246. searchPotenciaSonora = "<2000";
  1247. } else if ( (tmpPotenciaSonora > 2000) && (tmpPotenciaSonora <= 2500) ) {
  1248. searchPotenciaSonora = ">2000";
  1249. } else if ( (tmpPotenciaSonora > 2500) && (tmpPotenciaSonora <= 3000) ) {
  1250. searchPotenciaSonora = "<3000";
  1251. } else if ( tmpPotenciaSonora > 3000 ) {
  1252. searchPotenciaSonora = ">3000";
  1253. }
  1254. }
  1255. } else {
  1256. var strMensaje = "";
  1257. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0010 - El valor de la Velocidad de Flujo no se definio correctamente.';
  1258. arrErroresSistemaCalc['0010'] = strMensaje;
  1259. mensajeErrorCalc ++ ;
  1260. }
  1261. var arrPotenciaSonoraSelect = new Array(); // Contiene los datos de la potencia sonora del atenuador seleccionado
  1262. Object.keys(arrPotenciaSonora).forEach( function( array ) {
  1263. var arrTmpPotencia = arrPotenciaSonora[array];
  1264. var idPotenciaSonora = arrPotenciaSonora[array]['IDPOTSON'];
  1265. var vFtMin = arrPotenciaSonora[array]['FTMIN'];
  1266. if ( (typeof searchPotenciaSonora != 'undefined') ) {
  1267. if ( vFtMin == searchPotenciaSonora ) {
  1268. Object.keys(arrTmpPotencia).forEach( function( indice ) {
  1269. var valPotSonora = arrTmpPotencia[indice];
  1270. arrPotenciaSonoraSelect[indice] = valPotSonora;
  1271. });
  1272. }
  1273. } else {
  1274. var strMensaje = "";
  1275. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0011 - El valor para la Busqueda de la Potencia Sonora no se definio correctamente.';
  1276. arrErroresSistemaCalc['0011'] = strMensaje;
  1277. mensajeErrorCalc ++ ;
  1278. }
  1279. });
  1280. var arrSonidoRegenerado = new Array(); // Contiene los parametros de las frecuencias del atenuador
  1281. if ( Object.keys(arrAtenuador1000Hz).length > 0 ) {
  1282. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1283. var frecuencia = arrFrecuencias[indice];
  1284. arrSonidoRegenerado[frecuencia] = arrPotenciaSonoraSelect[frecuencia];
  1285. });
  1286. } else {
  1287. var strMensaje = "";
  1288. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0012 - Los valores de las Frecuencias Hz del atenudor seleccionado, se no se cargaron correctamente.';
  1289. arrErroresSistemaCalc['0012'] = strMensaje;
  1290. mensajeErrorCalc ++ ;
  1291. }
  1292. var arrCorreccionArea = new Array(); // Contiene los datos de la correción del área
  1293. for ( var i = 0; i < arrFrecuencias.length; i ++ ) {
  1294. var frecuencia = arrFrecuencias[i];
  1295. if ( (typeof A != 'undefined') ) {
  1296. var correcionArea = ( 10 * Math.log10(A) ) - 4.8;
  1297. var cadenaOperacion = "(10 x " + Math.log10(A) + ") - 4.8 ";
  1298. correcionArea = parseFloat(correcionArea);
  1299. correcionArea = correcionArea.toFixed(presicionDecimales);
  1300. arrCorreccionArea[frecuencia] = correcionArea;
  1301. } else {
  1302. var strMensaje = "";
  1303. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0013 - El valor de la Área de Salida no se definio correctamente.';
  1304. arrErroresSistemaCalc['0013'] = strMensaje;
  1305. mensajeErrorCalc ++ ;
  1306. }
  1307. }
  1308. var arrSonidoMasCorrecion = new Array(); // Contiene los datos del Sonido más la correción del área
  1309. for ( var i = 0; i < arrFrecuencias.length; i ++ ) {
  1310. var frecuencia = arrFrecuencias[i];
  1311. var valPotencioSonora = arrPotenciaSonoraSelect[frecuencia];
  1312. var valCorrecionArea = arrCorreccionArea[frecuencia];
  1313. if ( (typeof valPotencioSonora != 'undefined') || (typeof valCorrecionArea != 'undefined') ) {
  1314. sonidoMasCorrecion = parseFloat(valPotencioSonora) + parseFloat(valCorrecionArea);
  1315. var cadenaOperacion = " " + valPotencioSonora + " + " + valCorrecionArea + " = " + sonidoMasCorrecion + " ";
  1316. sonidoMasCorrecion = parseFloat(sonidoMasCorrecion);
  1317. sonidoMasCorrecion = sonidoMasCorrecion.toFixed(presicionDecimales);
  1318. arrSonidoMasCorrecion[frecuencia] = sonidoMasCorrecion;
  1319. } else {
  1320. var strMensaje = "";
  1321. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0014 - El valor de la Potencia Sonora o de la Correción no se definieron correctamente.';
  1322. arrErroresSistemaCalc['0014'] = strMensaje;
  1323. mensajeErrorCalc ++ ;
  1324. }
  1325. }
  1326. var arrSumaLog = new Array(); // Contiene la suma logaritmica de los datos de LwA del ventilador y la Potencia Sonora del atenuador
  1327. for ( var i = 0; i < arrFrecuencias.length; i ++ ) {
  1328. if ( (Object.keys(arrLwAVentilador).length > 0) && (Object.keys(arrPotenciaSonoraSelect).length > 0) ) {
  1329. var frecuencia = arrFrecuencias[i];
  1330. var sumaLog = 10 * ( Math.log10( ( Math.pow( 10, (arrLwAVentilador[frecuencia]/10) ) ) + ( Math.pow( 10, (arrPotenciaSonoraSelect[frecuencia]/10) ) ) ) );
  1331. sumaLog = parseFloat(sumaLog);
  1332. sumaLog = sumaLog.toFixed(presicionDecimales);
  1333. arrSumaLog[frecuencia] = sumaLog;
  1334. } else {
  1335. var strMensaje = "";
  1336. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0015 - Los valores LwAVentilador y de la Potencia Sonora no se definieron correctamente.';
  1337. arrErroresSistemaCalc['0015'] = strMensaje;
  1338. mensajeErrorCalc ++ ;
  1339. }
  1340. }
  1341. var arrEspectroResultante = new Array(); // Contiene los valor del Espectro Resultante
  1342. for ( var i = 0; i < arrFrecuencias.length; i ++ ) {
  1343. var frecuencia = arrFrecuencias[i];
  1344. if ( (Object.keys(arrSumaLog).length > 0) && (Object.keys(arrPonderanciaA).length > 0) ) {
  1345. var espectroResultante = parseFloat(arrSumaLog[frecuencia]) + parseFloat(arrPonderanciaA[i]);
  1346. espectroResultante = parseFloat(espectroResultante);
  1347. espectroResultante = espectroResultante.toFixed(presicionDecimales);
  1348. arrEspectroResultante[frecuencia] = espectroResultante;
  1349. } else {
  1350. var strMensaje = "";
  1351. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0016 - Los valores de la Suma Logaritmica y los de la Ponderancia A no se definieron correctamente.';
  1352. arrErroresSistemaCalc['0016'] = strMensaje;
  1353. mensajeErrorCalc ++ ;
  1354. }
  1355. }
  1356. if ( (Object.keys(arrEspectroResultante).length > 0) ) {
  1357. var sumaLogaritmica = 10 * ( Math.log10( Math.pow( 10, (arrEspectroResultante["63Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["125Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["250Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["500Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["1000Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["2000Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["4000Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["8000Hz"]/10) ) ) );
  1358. sumaLogaritmica = parseFloat(sumaLogaritmica);
  1359. sumaLogaritmica = sumaLogaritmica.toFixed(presicionDecimales);
  1360. } else {
  1361. var strMensaje = "";
  1362. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0017 - A ocurrido un error al realizar el calcúlo del Espectro Resultante.';
  1363. arrErroresSistemaCalc['0017'] = strMensaje;
  1364. mensajeErrorCalc ++ ;
  1365. }
  1366. // Resultados
  1367. if ( (Object.keys(arrLwFinal).length > 0) ) {
  1368. var sumaLogaritmicaLwFinal = 10 * ( Math.log10( Math.pow( 10, (arrLwFinal["63Hz"]/10) ) + Math.pow( 10, (arrLwFinal["125Hz"]/10) ) + Math.pow( 10, (arrLwFinal["250Hz"]/10) ) + Math.pow( 10, (arrLwFinal["500Hz"]/10) ) + Math.pow( 10, (arrLwFinal["1000Hz"]/10) ) + Math.pow( 10, (arrLwFinal["2000Hz"]/10) ) + Math.pow( 10, (arrLwFinal["4000Hz"]/10) ) + Math.pow( 10, (arrLwFinal["8000Hz"]/10) ) ) );
  1369. sumaLogaritmicaLwFinal = parseFloat(sumaLogaritmicaLwFinal);
  1370. sumaLogaritmicaLwFinal = sumaLogaritmicaLwFinal.toFixed(presicionDecimales);
  1371. } else {
  1372. var strMensaje = "";
  1373. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0018 - Los valores de LwFinal no se cargaron de manera correcta.';
  1374. arrErroresSistemaCalc['0018'] = strMensaje;
  1375. mensajeErrorCalc ++ ;
  1376. }
  1377. if ( (Object.keys(arrLwA).length > 0) ) {
  1378. var sumaLogaritmicaLwA = 10 * ( Math.log10( Math.pow( 10, (arrLwA["63Hz"]/10) ) + Math.pow( 10, (arrLwA["125Hz"]/10) ) + Math.pow( 10, (arrLwA["250Hz"]/10) ) + Math.pow( 10, (arrLwA["500Hz"]/10) ) + Math.pow( 10, (arrLwA["1000Hz"]/10) ) + Math.pow( 10, (arrLwA["2000Hz"]/10) ) + Math.pow( 10, (arrLwA["4000Hz"]/10) ) + Math.pow( 10, (arrLwA["8000Hz"]/10) ) ) );
  1379. sumaLogaritmicaLwA = parseFloat(sumaLogaritmicaLwA);
  1380. sumaLogaritmicaLwA = sumaLogaritmicaLwA.toFixed(presicionDecimales);
  1381. } else {
  1382. var strMensaje = "";
  1383. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0019 - Los valores de LwA no se cargaron de manera correcta.';
  1384. arrErroresSistemaCalc['0019'] = strMensaje;
  1385. mensajeErrorCalc ++ ;
  1386. }
  1387. if ( (typeof sumaLogaritmicaLwFinal != 'undefined') && (typeof valorPi != 'undefined') ) {
  1388. var resultadoPresionSonora = sumaLogaritmicaLwFinal - ( 10 * Math.log10( (4 * valorPi) * ( Math.pow(1.5, 2) / 2 ) ) );
  1389. resultadoPresionSonora = parseFloat(resultadoPresionSonora);
  1390. resultadoPresionSonora = resultadoPresionSonora.toFixed(presicionDecimales);
  1391. } else {
  1392. var strMensaje = "";
  1393. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0020 - El valor de la sumaLogaritmicaLwFinal no se ddefinió correctamente.';
  1394. arrErroresSistemaCalc['0020'] = strMensaje;
  1395. mensajeErrorCalc ++ ;
  1396. }
  1397. if ( (typeof sumaLogaritmicaLwA != 'undefined') && (typeof valorPi != 'undefined') ) {
  1398. var resultadoPresionSonoraA = sumaLogaritmicaLwA - ( 10 * Math.log10( (4 * valorPi) * ( Math.pow(1.5, 2) / 2 ) ) );
  1399. resultadoPresionSonoraA = parseFloat(resultadoPresionSonoraA);
  1400. resultadoPresionSonoraA = resultadoPresionSonoraA.toFixed(presicionDecimales);
  1401. } else {
  1402. var strMensaje = "";
  1403. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0021 - El valor de la sumaLogaritmicaLwA no se definió correctamente.';
  1404. arrErroresSistemaCalc['0021'] = strMensaje;
  1405. mensajeErrorCalc ++ ;
  1406. }
  1407. if ( (Object.keys(arrSumaLog).length > 0) ) {
  1408. var sumaLogaritmicaLwAtenuado = 10 * ( Math.log10( Math.pow( 10, (arrSumaLog["63Hz"]/10) ) + Math.pow( 10, (arrSumaLog["125Hz"]/10) ) + Math.pow( 10, (arrSumaLog["250Hz"]/10) ) + Math.pow( 10, (arrSumaLog["500Hz"]/10) ) + Math.pow( 10, (arrSumaLog["1000Hz"]/10) ) + Math.pow( 10, (arrSumaLog["2000Hz"]/10) ) + Math.pow( 10, (arrSumaLog["4000Hz"]/10) ) + Math.pow( 10, (arrSumaLog["8000Hz"]/10) ) ) );
  1409. sumaLogaritmicaLwAtenuado = parseFloat(sumaLogaritmicaLwAtenuado);
  1410. sumaLogaritmicaLwAtenuado = sumaLogaritmicaLwAtenuado.toFixed(presicionDecimales);
  1411. } else {
  1412. var strMensaje = "";
  1413. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0022 - El valor de la suma logaritmica no se definió correctamente.';
  1414. arrErroresSistemaCalc['0022'] = strMensaje;
  1415. mensajeErrorCalc ++ ;
  1416. }
  1417. if ( (Object.keys(arrEspectroResultante).length > 0) ) {
  1418. var sumaLogaritmicaEspectroResultante= 10 * ( Math.log10( Math.pow( 10, (arrEspectroResultante["63Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["125Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["250Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["500Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["1000Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["2000Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["4000Hz"]/10) ) + Math.pow( 10, (arrEspectroResultante["8000Hz"]/10) ) ) );
  1419. sumaLogaritmicaEspectroResultante = parseFloat(sumaLogaritmicaEspectroResultante);
  1420. sumaLogaritmicaEspectroResultante = sumaLogaritmicaEspectroResultante.toFixed(presicionDecimales);
  1421. } else {
  1422. var strMensaje = "";
  1423. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0022 - Los valores del Espectro Resultante no se cargaron de manera correcta.';
  1424. arrErroresSistemaCalc['0022'] = strMensaje;
  1425. mensajeErrorCalc ++ ;
  1426. }
  1427. if ( (typeof sumaLogaritmicaLwAtenuado != 'undefined') && (typeof valorPi != 'undefined') ) {
  1428. var resultadoPresionSonoraAA = sumaLogaritmicaLwAtenuado - ( 10 * Math.log10( (4 * valorPi) * ( Math.pow(1.5, 2) / 2 ) ) ); // DATOS USUARIOS
  1429. resultadoPresionSonoraAA = parseFloat(resultadoPresionSonoraAA);
  1430. resultadoPresionSonoraAA = resultadoPresionSonoraAA.toFixed(presicionDecimales);
  1431. } else {
  1432. var strMensaje = "";
  1433. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0023 - El valor de la sumaLogaritmicaLwAtenuado no se definió correctamente.';
  1434. arrErroresSistemaCalc['0023'] = strMensaje;
  1435. mensajeErrorCalc ++ ;
  1436. }
  1437. if ( (typeof sumaLogaritmicaEspectroResultante != 'undefined') && (typeof valorPi != 'undefined') ) {
  1438. var resultadoPresionSonoraBB = sumaLogaritmicaEspectroResultante - ( 10 * Math.log10( (4 * valorPi) * ( Math.pow(1.5, 2) / 2 ) ) );
  1439. resultadoPresionSonoraBB = parseFloat(resultadoPresionSonoraBB);
  1440. resultadoPresionSonoraBB = resultadoPresionSonoraBB.toFixed(presicionDecimales);
  1441. } else {
  1442. var strMensaje = "";
  1443. strMensaje += 'SPJS.CALC.( ' + idModulo + ' ).0023 - El valor de la sumaLogaritmicaEspectroResultante no se definió correctamente.';
  1444. arrErroresSistemaCalc['0023'] = strMensaje;
  1445. mensajeErrorCalc ++ ;
  1446. }
  1447. if ( (boolValido == true) && (mensajeErrorCalc == 0) ) {
  1448. inputJson( arrDatosDeEntrada, "DATOSENTRADA" );
  1449. inputJson( arrConversiones, "CONVERSIONES" );
  1450. document.getElementById('AREASALIDA').value = A;
  1451. document.getElementById('VFLUIDO').value = V;
  1452. inputJson( arrLw, "LW" );
  1453. inputJson( arrKw, "KW" );
  1454. inputJson( arrSonidoRegenerado, "SONIDOR" );
  1455. inputJson( arrCorreccionArea, "CORRECCION" );
  1456. inputJson( arrSonidoMasCorrecion, "SONMASCORR" );
  1457. inputJson( arrLwAVentiladorSeleccionado, "LWAV" );
  1458. inputJson( arrLwAVentilador, "LWAVA" );
  1459. inputJson( arrLwFinal, "LWFINALDATOS" );
  1460. document.getElementById('SUMALWFINAL').value = sumaLogaritmicaLwFinal;
  1461. inputJson( arrLwA, "LWADATOS" );
  1462. document.getElementById('SUMALWA').value = sumaLogaritmicaLwA;
  1463. document.getElementById('PRESON').value = resultadoPresionSonora;
  1464. document.getElementById('PRESONA').value = resultadoPresionSonoraA;
  1465. inputJson( arrSumaLog, "LWFINALDATOSVA" );
  1466. document.getElementById('SUMALWFINALVA').value = sumaLogaritmicaLwAtenuado;
  1467. inputJson( arrEspectroResultante, "LWADATOSVA" );
  1468. document.getElementById('SUMALWAVA').value = sumaLogaritmicaEspectroResultante;
  1469. document.getElementById('PRESONVA').value = resultadoPresionSonoraAA;
  1470. document.getElementById('PRESONAVA').value = resultadoPresionSonoraBB;
  1471. inputJson( arrAtenuador, "ATENUADOR" );
  1472. document.getElementById("tablaResultados").innerHTML = " ";
  1473. document.getElementById("loading").style.display = 'block';
  1474. var strTablaResultados = '';
  1475. var decimales = parseInt(2);
  1476. strTablaResultados += '<table class="table table-bordered" >';
  1477. strTablaResultados += '<thead>';
  1478. strTablaResultados += '<tr>';
  1479. strTablaResultados += '<th scope="col" colspan="9">';
  1480. strTablaResultados += '<center> <label> Espectro de Potencia Sonora Ventilador Lw </label> </center>';
  1481. strTablaResultados += '</th>';
  1482. strTablaResultados += '</tr>';
  1483. strTablaResultados += '<tr>';
  1484. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1485. strTablaResultados += '<td scope="col">';
  1486. strTablaResultados += '<center>'+arrFrecuencias[indice]+'</center>';
  1487. strTablaResultados += '</td>';
  1488. });
  1489. strTablaResultados += '<td scope="col" colspan="8">';
  1490. strTablaResultados += '<center> <label> Lw (dB) </label> </center>';
  1491. strTablaResultados += '</td>';
  1492. strTablaResultados += '</tr>';
  1493. strTablaResultados += '</thead>';
  1494. strTablaResultados += '<tbody>';
  1495. strTablaResultados += '<tr>';
  1496. Object.keys(arrLwFinal).forEach( function( indice ) {
  1497. strTablaResultados += '<td scope="col">';
  1498. var lwFinal = arrLwFinal[indice];
  1499. lwFinal = parseFloat(lwFinal);
  1500. lwFinal = lwFinal.toFixed(decimales);
  1501. if ( isNaN(lwFinal) ) {
  1502. lwFinal = "0";
  1503. }
  1504. strTablaResultados += '<center>'+lwFinal+'</center>';
  1505. strTablaResultados += '</td>';
  1506. });
  1507. strTablaResultados += '<td scope="col">';
  1508. var sumaLogaritmicaLwFinal = sumaLogaritmicaLwFinal;
  1509. sumaLogaritmicaLwFinal = parseFloat(sumaLogaritmicaLwFinal);
  1510. sumaLogaritmicaLwFinal = sumaLogaritmicaLwFinal.toFixed(decimales);
  1511. if ( sumaLogaritmicaLwFinal == "NaN" ) {
  1512. sumaLogaritmicaLwFinal = "0";
  1513. }
  1514. strTablaResultados += '<center>'+sumaLogaritmicaLwFinal+'</center>';
  1515. strTablaResultados += '</td>';
  1516. strTablaResultados += '</tr>';
  1517. strTablaResultados += '</tbody>';
  1518. strTablaResultados += '<thead>';
  1519. strTablaResultados += '<tr>';
  1520. strTablaResultados += '<td scope="col" colspan="9">';
  1521. strTablaResultados += '<center> <label> Espectro de Potencia Sonora Ventilador Ponderación A Lw(A) </label> </center>';
  1522. strTablaResultados += '</td>';
  1523. strTablaResultados += '</tr>';
  1524. strTablaResultados += '<tr>';
  1525. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1526. strTablaResultados += '<td scope="col">';
  1527. strTablaResultados += '<center>'+arrFrecuencias[indice]+'</center>';
  1528. strTablaResultados += '</td>';
  1529. });
  1530. strTablaResultados += '<td scope="col" colspan="8">';
  1531. strTablaResultados += '<center> <label> Lw (dBA) </label> </center>';
  1532. strTablaResultados += '</td>';
  1533. strTablaResultados += '</tr>';
  1534. strTablaResultados += '</thead>';
  1535. strTablaResultados += '<tbody>';
  1536. strTablaResultados += '<tr>';
  1537. Object.keys(arrLwA).forEach( function( indice ) {
  1538. strTablaResultados += '<td scope="col">';
  1539. var LwA = arrLwA[indice];
  1540. LwA = parseFloat(LwA);
  1541. LwA = LwA.toFixed(decimales);
  1542. if ( isNaN(LwA) ) {
  1543. LwA = "0";
  1544. }
  1545. strTablaResultados += '<center>'+LwA+'</center>';
  1546. strTablaResultados += '</td>';
  1547. });
  1548. strTablaResultados += '<td scope="col">';
  1549. var sumaLogaritmicaLwA = sumaLogaritmicaLwA;
  1550. sumaLogaritmicaLwA = parseFloat(sumaLogaritmicaLwA);
  1551. sumaLogaritmicaLwA = sumaLogaritmicaLwA.toFixed(decimales);
  1552. if ( isNaN(sumaLogaritmicaLwA) ) {
  1553. sumaLogaritmicaLwA = "0";
  1554. }
  1555. strTablaResultados += '<center>'+sumaLogaritmicaLwA+'</center>';
  1556. strTablaResultados += '</td>';
  1557. strTablaResultados += '</tr>';
  1558. strTablaResultados += '</tbody>';
  1559. strTablaResultados += '<thead>';
  1560. strTablaResultados += '<tr>';
  1561. strTablaResultados += '<td scope="col" colspan="3">';
  1562. strTablaResultados += '<center> Presión Sonora </center>';
  1563. strTablaResultados += '</td>';
  1564. strTablaResultados += '<td scope="col" colspan="6">';
  1565. var presionSonora = resultadoPresionSonora;
  1566. presionSonora = parseFloat(presionSonora);
  1567. presionSonora = presionSonora.toFixed(decimales);
  1568. if ( isNaN(presionSonora) ) {
  1569. presionSonora = "0";
  1570. }
  1571. strTablaResultados += '<center>'+presionSonora+'</center>';
  1572. strTablaResultados += '</td>';
  1573. strTablaResultados += '</tr>';
  1574. strTablaResultados += '</thead>';
  1575. strTablaResultados += '<thead>';
  1576. strTablaResultados += '<tr>';
  1577. strTablaResultados += '<td scope="col" colspan="9">';
  1578. strTablaResultados += '<center> <label> Espectro de Potencia Sonora Ventilador con Atenuador Lw </label> </center>';
  1579. strTablaResultados += '</td>';
  1580. strTablaResultados += '</tr>';
  1581. strTablaResultados += '<tr>';
  1582. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1583. strTablaResultados += '<td scope="col">';
  1584. strTablaResultados += '<center>'+arrFrecuencias[indice]+'</center>';
  1585. strTablaResultados += '</td>';
  1586. });
  1587. strTablaResultados += '<td scope="col" colspan="8">';
  1588. strTablaResultados += '<center> <label> Lw (dBA) </label> </center>';
  1589. strTablaResultados += '</td>';
  1590. strTablaResultados += '</tr>';
  1591. strTablaResultados += '</thead>';
  1592. strTablaResultados += '<tbody>';
  1593. strTablaResultados += '<tr>';
  1594. Object.keys(arrSumaLog).forEach( function( indice ) {
  1595. strTablaResultados += '<td scope="col">';
  1596. var LwFinalVa = arrSumaLog[indice];
  1597. LwFinalVa = parseFloat(LwFinalVa);
  1598. LwFinalVa = LwFinalVa.toFixed(decimales);
  1599. if ( isNaN(LwFinalVa) ) {
  1600. LwFinalVa = "0";
  1601. }
  1602. strTablaResultados += '<center>'+LwFinalVa+'</center>';
  1603. strTablaResultados += '</td>';
  1604. });
  1605. strTablaResultados += '<td scope="col">';
  1606. var sumaLogaritmicaLwFinalVa = sumaLogaritmicaLwAtenuado;
  1607. sumaLogaritmicaLwFinalVa = parseFloat(sumaLogaritmicaLwFinalVa);
  1608. sumaLogaritmicaLwFinalVa = sumaLogaritmicaLwFinalVa.toFixed(decimales);
  1609. if ( sumaLogaritmicaLwFinalVa == "NaN" ) {
  1610. sumaLogaritmicaLwFinalVa = "0";
  1611. }
  1612. strTablaResultados += '<center>'+sumaLogaritmicaLwFinalVa+'</center>';
  1613. strTablaResultados += '</td>';
  1614. strTablaResultados += '</tr>';
  1615. strTablaResultados += '</tbody>';
  1616. strTablaResultados += '<thead>';
  1617. strTablaResultados += '<tr>';
  1618. strTablaResultados += '<td scope="col" colspan="9">';
  1619. strTablaResultados += '<center> <label> Espectro de Potencia Sonora Ventilador con Atenuador Lw(A) </label> </center>';
  1620. strTablaResultados += '</td>';
  1621. strTablaResultados += '</tr>';
  1622. strTablaResultados += '<tr>';
  1623. Object.keys(arrFrecuencias).forEach( function( indice ) {
  1624. strTablaResultados += '<td scope="col">';
  1625. strTablaResultados += '<center>'+arrFrecuencias[indice]+'</center>';
  1626. strTablaResultados += '</td>';
  1627. });
  1628. strTablaResultados += '<td scope="col" colspan="8">';
  1629. strTablaResultados += '<center> <label> Lw (dBA) </label> </center>';
  1630. strTablaResultados += '</td>';
  1631. strTablaResultados += '</tr>';
  1632. strTablaResultados += '</thead>';
  1633. strTablaResultados += '<tbody>';
  1634. strTablaResultados += '<tr>';
  1635. Object.keys(arrEspectroResultante).forEach( function( indice ) {
  1636. strTablaResultados += '<td scope="col">';
  1637. var LwAVa = arrEspectroResultante[indice];
  1638. LwAVa = parseFloat(LwAVa);
  1639. LwAVa = LwAVa.toFixed(decimales);
  1640. if ( isNaN(LwAVa) ) {
  1641. LwAVa = "0";
  1642. }
  1643. strTablaResultados += '<center>'+LwAVa+'</center>';
  1644. strTablaResultados += '</td>';
  1645. });
  1646. strTablaResultados += '<td scope="col">';
  1647. var sumaLogaritmicaLwAVa = sumaLogaritmicaEspectroResultante;
  1648. sumaLogaritmicaLwAVa = parseFloat(sumaLogaritmicaLwAVa);
  1649. sumaLogaritmicaLwAVa = sumaLogaritmicaLwAVa.toFixed(decimales);
  1650. if ( isNaN(sumaLogaritmicaLwAVa) ) {
  1651. sumaLogaritmicaLwAVa = "0";
  1652. }
  1653. strTablaResultados += '<center>'+sumaLogaritmicaLwAVa+'</center>';
  1654. strTablaResultados += '</td>';
  1655. strTablaResultados += '</tr>';
  1656. strTablaResultados += '</tbody>';
  1657. strTablaResultados += '<thead>';
  1658. strTablaResultados += '<tr>';
  1659. strTablaResultados += '<td scope="col" colspan="3">';
  1660. strTablaResultados += '<center> Presión Sonora </center>';
  1661. strTablaResultados += '</td>';
  1662. strTablaResultados += '<td scope="col" colspan="6">';
  1663. var presionSonoraVa = resultadoPresionSonoraAA;
  1664. presionSonoraVa = parseFloat(presionSonoraVa);
  1665. presionSonoraVa = presionSonoraVa.toFixed(decimales);
  1666. if ( isNaN(presionSonoraVa) ) {
  1667. presionSonoraVa = "0";
  1668. }
  1669. strTablaResultados += '<center>'+presionSonoraVa+'</center>';
  1670. strTablaResultados += '</td>';
  1671. strTablaResultados += '</tr>';
  1672. strTablaResultados += '</thead>';
  1673. strTablaResultados += '<tfoot>';
  1674. strTablaResultados += '<tr>';
  1675. strTablaResultados += '<td colspan="9">';
  1676. strTablaResultados += '<center> <label> Datos del Atenuador Seleccionado </label> </center>';
  1677. strTablaResultados += '</td>';
  1678. strTablaResultados += '</tr>';
  1679. strTablaResultados += '<tr>';
  1680. strTablaResultados += '<td scope="col" colspan="3">';
  1681. strTablaResultados += '<center> Modelo </center>';
  1682. strTablaResultados += '</td>';
  1683. strTablaResultados += '<td scope="col" colspan="2" >';
  1684. var modeloAtenuador = arrAtenuador['MODELO'];
  1685. strTablaResultados += '<center>'+modeloAtenuador+'</center>';
  1686. strTablaResultados += '</td>';
  1687. strTablaResultados += '<td scope="col" colspan="3">';
  1688. strTablaResultados += '<center> Longitud del Atenuador </center>';
  1689. strTablaResultados += '</td>';
  1690. strTablaResultados += '<td scope="col" >';
  1691. var longitudAtenuador = arrAtenuador['LONGITUD'];
  1692. strTablaResultados += '<center>'+longitudAtenuador+' </center>';
  1693. strTablaResultados += '</td>';
  1694. strTablaResultados += '</tr>';
  1695. strTablaResultados += '<tr>';
  1696. strTablaResultados += '<td colspan="9" style="text-align: right;">';
  1697. strTablaResultados += '<button type="button" id="generaPDF" name="generaPDF" class="btn small validation-passed" onclick="transaccionPDF(\'GRAL\')" /> Generar PDF </button>';
  1698. strTablaResultados += '</td>';
  1699. strTablaResultados += '</tr>';
  1700. strTablaResultados += '</tfoot>';
  1701. strTablaResultados += '</table>';
  1702. require(["dojo/dom-construct", "dojo/dom", "dojo/on", "dojo/domReady!"],
  1703. function(domConstruct, dom, on){
  1704. var row = domConstruct.toDom(strTablaResultados);
  1705. domConstruct.place(row, "tablaResultados");
  1706. document.getElementById("loading").style.display = 'none';
  1707. });
  1708. document.getElementById("TIPOV").focus();
  1709. function onKeyDownHandler(event) {
  1710. var t1 = 1;
  1711. var accion = "";
  1712. var codigo = event.which || event.keyCode;
  1713. if ( ( t1 == 1) && ( codigo == 68 ) ){
  1714. transaccionPDF( 'CALC' );
  1715. }
  1716. }
  1717. window.onkeydown = onKeyDownHandler;
  1718. } else {
  1719. var inputsValores = document.querySelectorAll('#frmPDFGeneral input[type="text"]');
  1720. for ( index = 0; index < inputsValores.length; ++index ) {
  1721. var idInput = inputsValores[index].getAttribute("name");
  1722. document.getElementById(idInput).value = "";
  1723. }
  1724. var strMensaje = "";
  1725. strMensaje += 'Los datos de entrada son incorrectos. En caso de dudas, contacte al Departamento Comercial de S&P.';
  1726. alertify.confirm( 'Error...', strMensaje, function() { },
  1727. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  1728. function onKeyDownHandler(event) {
  1729. var t1 = 1;
  1730. var accion = "";
  1731. var codigo = event.which || event.keyCode;
  1732. if ( ( t1 == 1) && ( codigo == 76 ) ){
  1733. var error = "";
  1734. Object.keys(arrErroresSistemaCalc).forEach( function( indice ) {
  1735. error += arrErroresSistemaCalc[indice] + "<br>";
  1736. });
  1737. alertify.confirm( 'Errores...', error, function() { },
  1738. function() { } ).set('labels', { ok: 'Continuar', cancel: 'Cancelar' } );
  1739. }
  1740. }
  1741. window.onkeydown = onKeyDownHandler;
  1742. }
  1743. }
  1744. function inputJson ( array, input ) { // Función para agregar JSON a los Input
  1745. var jObject = {};
  1746. for( i in array ){
  1747. jObject[i] = array[i];
  1748. }
  1749. jObject = JSON.stringify(jObject);
  1750. document.getElementById(input).value = jObject;
  1751. }
  1752. function transaccionPDF( tipoPDF ){ // Se Determina que PDF se va a descargar
  1753. document.getElementById('TRANSPDF').value = tipoPDF;
  1754. document.getElementById("frmPDFGeneral").submit();
  1755. }
  1756. </script>
  1757. </html>