Sub Project_13_EN(ByVal VecType, m, n, m1, n1 As Integer) ' 13_Cylindrical Symmetry_EN ' Updated: 27/03/24 ' Created by: Ariel R. Becerra (21/11/23) ' Modified by: _________________ ' This is the code of your new project. ' Steps to embed the code to ScienSolar: ' Note 1: The number 13 in the name of this function must match the one in the list of the CONFIG sheet for this project. If not, please correct it. ' Note 2: This code will be integrated into the main code to automate the download of the project. ' Note 3: The formulas and cell values generated here correspond only to the first 30 columns from INICIO to the right in the sheet. All your formulas and values are recommended to be written in these columns. ' Step 1. Go to the CONFIG sheet and add a short name and the number of your new project to the last row in the projects list. ' Step 2. Make sure that the list of projects in CONFIG sheet has the correct ascending numbering. ' Step 4. Open the VBA editor (Alt + F11 in Windows or Fn + Option + F11 in macOS). To avoid mistakes, make sure you only have one workbook open. ' Step 5. On the left, in the project explorer, select a non full module (or add a new one). ' Step 6. Select all the code in this file, copy and paste it at the end of the existing code in the module (or in the new one). ' Step 7. To load the project and to check it in a new sheet, go to the CONFIG sheet and click the New Sheet button, then select the project from the list and click the +Vector button. ' Step 8. Click any XYZ button to get the project in the coordinate system. Enjoy it! ' Visit www.sciensolar.com for news and updates of ? ScienSolar. Cells(m1 - 1, n1 + 2).FormulaR1C1 = "2" Cells(m1 + 0, n1 + 2).FormulaR1C1 = "=CONFIG!R3C4" Cells(m1 + 0, n1 + 3).FormulaR1C1 = "850" Cells(m1 + 0, n1 + 6).FormulaR1C1 = "=CONFIG!R3C8" Cells(m1 + 0, n1 + 7).FormulaR1C1 = "8" Cells(m1 + 0, n1 + 8).FormulaR1C1 = "Ariel R. Becerra (21/11/23)" Cells(m1 + 1, n1 + 2).FormulaR1C1 = "=CONFIG!R4C4" Cells(m1 + 1, n1 + 3).FormulaR1C1 = "400" Cells(m1 + 1, n1 + 4).FormulaR1C1 = "=CONFIG!R4C6" Cells(m1 + 1, n1 + 5).FormulaR1C1 = "0" Cells(m1 + 1, n1 + 6).FormulaR1C1 = "=CONFIG!R4C8" Cells(m1 + 1, n1 + 7).FormulaR1C1 = "45" Cells(m1 + 2, n1 + 2).FormulaR1C1 = "=CONFIG!R5C4" Cells(m1 + 2, n1 + 3).FormulaR1C1 = "1" Cells(m1 + 2, n1 + 4).FormulaR1C1 = "=CONFIG!R5C6" Cells(m1 + 2, n1 + 5).FormulaR1C1 = "15" Cells(m1 + 2, n1 + 6).FormulaR1C1 = "=CONFIG!R5C8" Cells(m1 + 2, n1 + 7).FormulaR1C1 = "0" Cells(m1 + 3, n1 + 0).FormulaR1C1 = "A" Cells(m1 + 3, n1 + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m1 + 3, n1 + 3).FormulaR1C1 = "250" Cells(m1 + 3, n1 + 4).FormulaR1C1 = "=CONFIG!R6C6" Cells(m1 + 3, n1 + 5).FormulaR1C1 = "15" Cells(m1, n1 + 9).FormulaR1C1 = "HELP" Dim HELPtxt As String HELPtxt = "CAMPO DE SIMETR" & ChrW(205) & "A CIL" & ChrW(205) & "NDRICA " & Chr(10) & _ " (See english version at the end)" & Chr(10) & _ " El modelo muestra la distribuci" & ChrW(243) & "n en el espacio de un campo de simetr" & ChrW(237) & "a cil" & ChrW(237) & "ndrica, espec" & ChrW(237) & "ficamente el campo vectorial A= (rho unitario)k/rho = A/(raiz((Ax)^2 + (Ay)^2))^2. A continuaci" & ChrW(243) & "n vemos las componentes del vector A en coordenadas cil" & ChrW(237) & "ndricas:" & Chr(10) & _ " A12 = k Ax/(raiz((Ax)^2 + (Ay)^2))^2 " & Chr(10) & _ " B12 = k Ay/(raiz((Ax)^2 + (Ay)^2))^2 " & Chr(10) & _ " C12 = k Az/(raiz((Ax)^2 + (Ay)^2))^2 " & Chr(10) & _ " En la celda C7 los par" & ChrW(225) & "metros de este campo pueden ser modificados de la siguiente manera: " & Chr(10) & _ " El primer par" & ChrW(233) & "ntesis cuadrado c[ ] indica el paso de incremento de la coordenada rho, y el segundo, es decir rho=[ ; ], el rango de visualizaci" & ChrW(243) & "n de rho. " & Chr(10) & _ " El tercer par" & ChrW(233) & "ntesis cuadrado c2[ ] indica el paso de incremento de la coordenada rho, y el cuarto, es decir phi=[ ; ], el rango de visualizaci" & ChrW(243) & "n de phi. " & Chr(10) & _ " El quinto par" & ChrW(233) & "ntesis cuadrado c3[ ] indica el paso de incremento de la coordenada z, y el sexto, es decir z=[ ; ], el rango de visualizaci" & ChrW(243) & "n de z. " & Chr(10) & _ " El par" & ChrW(225) & "metro color se utiliza para colorear el vector seg" & ChrW(250) & "n su longitud, el n" & ChrW(250) & "mero indica aproximadamente la longitud del vector m" & ChrW(225) & "s grande, el color se distribuye entre rojo (vector m" & ChrW(225) & "s peque" & ChrW(233) & "o) y violeta (vector m" & ChrW(225) & "s grande). El " & ChrW(250) & "ltimo par" & ChrW(233) & "ntesis [ ] indica el origen de las coordenadas, donde comienzan las distribuciones vectoriales. Encierre solo valores num" & ChrW(233) & "ricos entre punto y coma, no modifique la estructura de esta cadena, excepto si es un experto en MS Excel." & Chr(10) & _ " Puede modificar los valores entre los par" & ChrW(233) & "ntesis cuadrados y verificar los resultados, por ejemplo para un radio del cilindro igual a 5 y un recorrido del phi desde 90 a 270 modifique el valor rho=[5;5] y de phi=[90;270]. Oprima XYZ para ver los resultados. Oprima XY para ver desde arriba." & Chr(10) & _ " (ENGLISH)" & Chr(10) & _ " FIELD OF CYLINDRICAL SYMMETRY" & Chr(10) & _ " The model shows the distribution in space of a cylindrical symmetry field, specifically the vector field A= (unitary rho)k/rho = A/(root((Ax)^2 + (Ay)^2))^2. Next we see the components of vector A in cylindrical coordinates:" & Chr(10) & _ " A12 = k Ax/(root((Ax)^2 + (Ay)^2))^2" & Chr(10) & _ " B12 = k Ay/(root((Ax)^2 + (Ay)^2))^2" & Chr(10) & _ " C12 = k Az/(root((Ax)^2 + (Ay)^2))^2" & Chr(10) & _ " In cell C7 the parameters of this field can be modified as follows:" & Chr(10) & _ " The first square bracket c[ ] indicates the increment step of the rho coordinate, and the second, that is, rho=[ ; ], the display range of rho." & Chr(10) & _ " The third square bracket c2[ ] indicates the increment step of the rho coordinate, and the fourth, that is, phi=[ ; ], the display range of rho." & Chr(10) & _ " The fifth square bracket c3[ ] indicates the increment step of the z coordinate, and the sixth, that is, z=[ ; ], the display range of z." & Chr(10) & _ " The color parameter is used to color the vector according to its length, the number indicates approximately the length of the largest vector, the color is distributed between red (smallest vector) and purple (largest vector). The last parenthesis [ ] indicates the origin of the coordinates, where vector distributions begin. Enclose only numeric values " & ChrW(233) & "" & ChrW(233) & "between semicolons, do not modify the structure of this string, except if you are an expert in MS Excel." & Chr(10) & _ " You can modify the values " & ChrW(233) & "" & ChrW(233) & "between the square brackets and verify the results, for example for a radius of the cylinder equal to 5 and a range of phi from 90 to 270 modify the value rho=[5;5] and of phi=[90;270 ]. Press XYZ to see the results. Press XY to view from top." Cells(m1, n1 + 9).Comment.Text Text:=HELPtxt If m = m1 + 0 Then ' vector 1 Cells(m + 3, n + -1).FormulaR1C1 = "1" Cells(m + 3, n + 0).FormulaR1C1 = "A" Cells(m + 3, n + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m + 3, n + 3).FormulaR1C1 = "250" Cells(m + 3, n + 4).FormulaR1C1 = "=CONFIG!R6C6" Cells(m + 3, n + 5).FormulaR1C1 = "15" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 1).FormulaR1C1 = "=""c[""&R[3]C[4]&""]rho=[""&R[4]C[4]&"";""&R[5]C[4]&""]c2[""&R[8]C[4]&""]phi=[""&R[9]C[4]&"";""&R[10]C[4]&""]c3[""&R[13]C[4]&""]z=[""&R[14]C[4]&"";""&R[15]C[4]&""]color=[50]origin[cart.]=[0;0;0]tfactor=0,002647701s""" Cells(m + 4, n + 2).FormulaR1C1 = "Cylindrical Symmetry Field" Cells(m + 4, n + 12).FormulaR1C1 = "CYLINDRICAL SYMMETRY FIELD" Cells(m + 4, n + 24).FormulaR1C1 = "INSTRUCTIONS" Cells(m + 5, n + -1).FormulaR1C1 = "658" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0.3" Cells(m + 5, n + 4).FormulaR1C1 = "k =" Cells(m + 5, n + 5).FormulaR1C1 = "5000" Cells(m + 6, n + 4).FormulaR1C1 = "rho:" Cells(m + 7, n + -1).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[1]C" Cells(m + 7, n + 4).FormulaR1C1 = "Step:" Cells(m + 7, n + 5).FormulaR1C1 = "80" Cells(m + 8, n + -1).FormulaR1C1 = "240" Cells(m + 8, n + 0).FormulaR1C1 = "-5.8783046359073E-14" Cells(m + 8, n + 1).FormulaR1C1 = "40" Cells(m + 8, n + 2).FormulaR1C1 = " <-- Variable coordinates" Cells(m + 8, n + 4).FormulaR1C1 = "rho_initial:" Cells(m + 8, n + 5).FormulaR1C1 = "80" Cells(m + 8, n + 21).FormulaR1C1 = "The simulation shows the distribution of vectors in a certain region of space of a" Cells(m + 9, n + -1).FormulaR1C1 = "=(R[-4]C[6]*R[-1]C)/(R[-1]C^2+R[-1]C[1]^2)" Cells(m + 9, n + 0).FormulaR1C1 = "=(R[-4]C[5]*R[-1]C)/(R[-1]C[-1]^2+R[-1]C^2)" Cells(m + 9, n + 1).FormulaR1C1 = "0" Cells(m + 9, n + 2).FormulaR1C1 = "<< ---FIELD FORMULAS" Cells(m + 9, n + 4).FormulaR1C1 = "rho_final" Cells(m + 9, n + 5).FormulaR1C1 = "300" Cells(m + 9, n + 21).FormulaR1C1 = "vector field of cylindrical symmetry." Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + -1).FormulaR1C1 = "4" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "Phi:" Cells(m + 11, n + 21).FormulaR1C1 = "1. Modify the field display parameters in column G. The field formula is located in cells A12 " Cells(m + 3, n + 1).Interior.Color = "130835" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Cells(m1 + 2, n1 - 1).Value = 1 End If ' vector ends If m = m1 + 0 Then Cells(m + 12, n + 4).FormulaR1C1 = "Step:" Cells(m + 12, n + 5).FormulaR1C1 = "5" Cells(m + 12, n + 22).FormulaR1C1 = "and B12; Cells A11, B11 and C11 are taken as x, y and z coordinates respectively." Cells(m + 13, n + 4).FormulaR1C1 = "initial_phi:" Cells(m + 13, n + 5).FormulaR1C1 = "0" Cells(m + 13, n + 21).FormulaR1C1 = "2. The field shown in the simulation is E(rho) = k/rho =krho/rho^2 = (kx/rho^2, ky/rho^2)." Cells(m + 14, n + 4).FormulaR1C1 = "phi_final" Cells(m + 14, n + 5).FormulaR1C1 = "360" Cells(m + 14, n + 21).FormulaR1C1 = "3. Try to modify the field formula, for example simulate the field E(rho) = k/rho^2, where" Cells(m + 15, n + 22).FormulaR1C1 = "rho = root(x^2+y^2)." Cells(m + 16, n + 4).FormulaR1C1 = "Z:" Cells(m + 16, n + 21).FormulaR1C1 = "4. Press XY to view the symmetry from above." Cells(m + 17, n + 4).FormulaR1C1 = "Step:" Cells(m + 17, n + 5).FormulaR1C1 = "20" Cells(m + 18, n + 4).FormulaR1C1 = "z_initial:" Cells(m + 18, n + 5).FormulaR1C1 = "0" Cells(m + 19, n + 4).FormulaR1C1 = "z_final" Cells(m + 19, n + 5).FormulaR1C1 = "50" Cells(m + 19, n + 21).FormulaR1C1 = "Note: When exporting code with the Code button some operating systems have problems" Cells(m + 20, n + 21).FormulaR1C1 = "when the file name is indicated with special characters (such as accents or others). To avoid these " Cells(m + 21, n + 21).FormulaR1C1 = "problems, indicate the file name without accents or special characters." Call BlackWhiteDesk Call PutEqBut End If ' actualizar hoja End Sub