Thread Content
ENA Version 2: https://qzs.qzone.qq.com/ac/b.gif ENA is a Chinese programming script software that I have developed over the past two years. I have been working in the chemical industry for ten years; initially I was involved in PDMS management and process piping, and later I shifted to working on process systems and project management. The development of software was done out of pure hobbyism, without any expectation of reward. At the beginning of my career, I developed a CAD piping assistance tool; it was uploaded to Haichuan in 2009, and there were still replies to it by 2017. It was likely the most popular post on Haichuan, with over a thousand replies and more than 50,000 views. Subsequently, the PDMS support and hanger software SSP was developed; it was my first commercial software, and several design institutes in China have purchased and used it. Due to a busy schedule, the development of ENA took two years. It is a pseudo-programming language that supports Chinese and Greek letters; it is simple and elegant for engineering development, and almost anyone can use it. For example, the simplest “Hello, world!” ” Below is the formula for calculating frictional resistance, based on SH3035. Here, ‘d’ is in units of meters and ‘ε’ is also in meters. The function computes λ(Re,d,ε). If Re >= 4000 && Re <= 0.0001, then λ = λ0; otherwise, var2 = (-2)*lg(ε/d/3.7 + 2.51/Re/λ^0.5), and λ0 = (1/var2)^2. A loop is then executed until the condition is met. If Re >= var1, then λ = 0.5 and λ0 = 0.015; again, a loop is used until |λ – λ0| < 0.0001, during which λ is updated to λ0 and var2 is recalculated as (-2)*lg(ε/d/3.7), with λ0 being updated as (1/var2)^2. Finally, the value of λ is returned. The code is very simple and well-structured; importantly, there is no need to use English words or Chinese pinyin to represent Greek letters. It contains four conditional statements and two loops – conditional statements are expressed using ‘if’ and ‘endif’, while loops are expressed using ‘do’ and ‘loop’. It’s only slightly more complex than programming in Excel tables. Please see the pipeline pressure drop calculation. The interface is as follows: it includes elements such as input fields and image insertion functions. Now let’s analyze the code directly. import("General Definitions\Main Window Definitions”) The main window displays “The following is the calculation of the Reynolds number”, “N/A”. Fluid density is entered via the main window: (“Fluid density, kg/m3”, 800). Fluid viscosity is also entered through the main window: (“Fluid viscosity, mPas”, 2). Fluid velocity is entered there as well: (“Fluid velocity, m/s”, 8.61). Diameter is entered via the main window: (“Diameter, mm”, 100). ρ = fluid density; μ = fluid viscosity; u = fluid velocity; d = diameter. import("Chemical Engineering\Reynolds Number Calculation”) Reynolds number = Re. The main window displays “The calculated value of the Reynolds number”, Reynolds number. It then displays “The following is the calculation of the friction coefficient”, “N/A”. It shows “The formula is taken from SH3035, page 9, formulas 16–19”, “N/A”. It also states “In the text, the unit for absolute roughness is incorrectly given as m; it should be mm”, “N/A”. The main window displays “Chemical Engineering\Absolute Roughness Table.bmp” as a PICTURE. It also displays “Chemical Engineering\Friction Coefficient Calculation Formula.bmp” as a PICTURE. Absolute roughness is entered via the main window: (“Absolute roughness, mm”, 0.3). ε = absolute roughness. import("Chemical Engineering\Friction Coefficient Calculation”) d = d/1000; ε = ε/1000; λ = value obtained from λ(Re, d, ε). The main window displays “The calculated value of λ”, λ. It then displays “The following is the calculation of the pressure drop”, “N/A”. Equivalent length is entered via the main window: (“Equivalent length, m”, 100). l = equivalent length. ΔP = λ * (l/d) * (ρ*u*u)/2. ΔP = ΔP/1000. The main window displays “ΔP per 100 meters, kPa”, ΔP. That’s all in brief. Of course, ENA can also be used in numerous other calculations across engineering industries. In the future, I will continue to add features such as toxicity calculations and property lookups for GB5044 and GBZ230; I hope those who are interested can join in. ENA is free! The following post provides software downloads: http://bbs.hcbbs.com/thread-1805707-1-1.html
"The unit of d is m, and the unit of ε is m”. The function computes λ(Re,d,ε) as follows: if Re ≥ 4000 and Re ≥ 0.0001, then λ = λ0; var2 = (-2)*lg(ε/d/3.7 + 2.51/Re/λ^0.5), and λ0 = (1/var2)^2. A loop is then executed. If Re ≥ var1, then λ = 0.5 and λ0 = 0.015; a loop is executed as long as |λ – λ0| > 0.0001, during which λ is updated to λ0 and var2 is recalculated as (-2)*lg(ε/d/3.7); again, λ0 is set to (1/var2)^2. Finally, the value of λ is returned. If this code still seems complicated, you can use the following alternative method to determine λ(Re,d,ε): if Re ≥ 4000 and Re ≥ 0.0001, then λ = λ0; var2 = (-2)*lg(ε/d/3.7), and λ0 = (1/var2)^2. A loop is then executed. If Re>=var1, λ=0.5 and λ0=0.015, then execute the check abs(λ-λ0)>0.0001; if this condition is met, set λ=λ0. Otherwise, calculate var2=(-2)*lg(ε/d/3.7), and set λ0=(1/var2)^2, then repeat the cycle. Return λ end