Sub Project_14_ES(ByVal VecType, m, n, m1, n1 As Integer) ' 14_Simetria esferica_ES ' 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 14 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 = "=CONFIG!R3C9" 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 = "=CONFIG!R4C9" 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 = "=CONFIG!R5C9" Cells(m1 + 3, n1 + 0).FormulaR1C1 = "A" Cells(m1 + 3, n1 + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m1 + 3, n1 + 3).FormulaR1C1 = "=CONFIG!R6C5" 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 ESF" & ChrW(201) & "RICA" & 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 esf" & ChrW(233) & "rica, espec" & ChrW(237) & "ficamente el campo A = 1/r^2 = A/(raiz((Ax)^2 + (Ay)^2+(Az)^2 ))^3 que puede ser el campo de una carga puntual. A continuaci" & ChrW(243) & "n vemos las componentes del vector A en coordenadas esf" & ChrW(233) & "ricas:" & Chr(10) & _ " A12 = k Ax/(raiz((Ax)^2 + (Ay)^2) + (Az)^2)^3 " & Chr(10) & _ " B12 = k Ay/(raiz((Ax)^2 + (Ay)^2) + (Az)^2 )^3 " & Chr(10) & _ " C12 = k Az/(raiz((Ax)^2 + (Ay)^2) + (Az)^2 )^3," & Chr(10) & _ " en donde k es una constante que en este caso es negativa simulando el campo de una carga puntual negativa localizada en el centro de la esfera. 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 s[ ] indica el paso de incremento de la coordenada r, y el segundo, es decir r=[ ; ], el rango de visualizaci" & ChrW(243) & "n de r. " & Chr(10) & _ " El tercer par" & ChrW(233) & "ntesis cuadrado s2[ ] indica el paso de incremento de la coordenada phi, y el cuarto, es decir phi=[ ; ], el rango de visualizaci" & ChrW(243) & "n de phi. " & Chr(10) & _ " El quinto par" & ChrW(233) & "ntesis cuadrado s3[ ] indica el paso de incremento de la coordenada theta, y el sexto, es decir theta=[ ; ], el rango de visualizaci" & ChrW(243) & "n de theta. " & 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 eejmplo para un radio de la esfera igual a 10 y un recorrido de phi desde 90 a 180 en pasos de 5 modifique de la siguiente manera: s[5]r=[5;5]s2[5]phi=[90;180]s3[5]theta=[0;180]" & Chr(10) & _ " (ENGLISH)" & Chr(10) & _ " FIELD OF SPHERICAL SYMMETRY" & Chr(10) & _ " The model shows the distribution in space of a field of spherical symmetry, specifically the field A = 1/r^2 = A/(root((Ax)^2 + (Ay)^2+(Az)^2 ) ) ^ 3 which can be the field of a point charge. Next we see the components of vector A in spherical coordinates:" & Chr(10) & _ " A12 = k Ax/(root((Ax)^2 + (Ay)^2) + (Az)^2)^3" & Chr(10) & _ " B12 = k Ay/(root ((Ax)^2 + (Ay)^2) + (Az)^2 )^3" & Chr(10) & _ " C12 = k Az/(root((Ax)^2 + (Ay)^2) + (Az)^2 )^3," & Chr(10) & _ " where k is a constant that in this case is negative simulating the field of a negative point charge located in the center of the sphere. In cell C7 you can modify the parameters of this field as follows:" & Chr(10) & _ " The first bracket s[ ] indicates the increment step of the coordinate r, and the second, that is, r=[ ; ], the display range of r." & Chr(10) & _ " The third bracket s2[ ] indicates the increment step of the phi coordinate, and the fourth, that is, phi=[ ; ], the display range of phi." & Chr(10) & _ " The fifth bracket s3[ ] indicates the increment step of the theta coordinate, and the sixth, that is, theta=[ ; ], the display range of theta." & 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 square brackets and check the results, for example for a radius of the sphere equal to 10 and a range of phi from 90 to 180 in steps of 5 modify as follows: s[5]r= [ 5; 5]s2[5]phi=[90;180]s3[5]theta=[0;180]" 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 = "=CONFIG!R6C5" 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 = "=""s[""&R[3]C[4]&""]r=[""&R[4]C[4]&"";""&R[5]C[4]&""]s2[""&R[8]C[4]&""]phi=[""&R[9]C[4]&"";""&R[10]C[4]&""]s3[""&R[13]C[4]&""]theta=[""&R[14]C[4]&"";""&R[15]C[4]&""]color=[50]origin[cart.]=[""&R[19]C[4]&"";""&R[20]C[4]&"";""&R[21]C[4]&""]tfactor=0,002446619s""" Cells(m + 4, n + 2).FormulaR1C1 = "Campo de simetr" & ChrW(237) & "a esf" & ChrW(233) & "rica" Cells(m + 4, n + 12).FormulaR1C1 = "CAMPO DE SIMETR" & ChrW(205) & "A ESF" & ChrW(201) & "RICA" Cells(m + 4, n + 23).FormulaR1C1 = "INSTRUCCIONES" Cells(m + 5, n + -1).FormulaR1C1 = "562" 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 = "-800000" Cells(m + 6, n + 4).FormulaR1C1 = "r:" 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 = "Paso:" Cells(m + 7, n + 5).FormulaR1C1 = "80" Cells(m + 7, n + 21).FormulaR1C1 = "La simulaci" & ChrW(243) & "n muestra la distribuci" & ChrW(243) & "n de vectores en una determinada regi" & ChrW(243) & "n del espacio de un " Cells(m + 8, n + -1).FormulaR1C1 = "9.67086519515441" Cells(m + 8, n + 0).FormulaR1C1 = "-1.35915146682131" Cells(m + 8, n + 1).FormulaR1C1 = "-139.658967036375" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Coordenadas variables"","""")" Cells(m + 8, n + 4).FormulaR1C1 = "r_inicial:" Cells(m + 8, n + 5).FormulaR1C1 = "140" Cells(m + 8, n + 21).FormulaR1C1 = "campo vectorial de simetr" & ChrW(237) & "a esf" & ChrW(233) & "rica." Cells(m + 9, n + -1).FormulaR1C1 = "=R[-1]C*R[-4]C[6]/POWER(R[-1]C^2+R[-1]C[1]^2+R[-1]C[2]^2,3/2)" Cells(m + 9, n + 0).FormulaR1C1 = "=R[-1]C*R[-4]C[5]/POWER(R[-1]C[-1]^2+R[-1]C^2+R[-1]C[1]^2,3/2)" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-1]C*R[-4]C[4]/POWER(R[-1]C[-2]^2+R[-1]C[-1]^2+R[-1]C^2,3/2)" Cells(m + 9, n + 2).FormulaR1C1 = "<< ---F" & ChrW(211) & "RMULA DEL CAMPO" Cells(m + 9, n + 4).FormulaR1C1 = "r_final" Cells(m + 9, n + 5).FormulaR1C1 = "140" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 10, n + 21).FormulaR1C1 = "1. Modifique en la columna G los par" & ChrW(225) & "metros de visualizaci" & ChrW(243) & "n del campo." 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 = "2. El campo que se muestra en la simulaci" & ChrW(243) & "n es E(r) = k/r^2 = (kx/r^3, ky/r^3,kz/r^3). La f" & ChrW(243) & "rmula del " Cells(m + 3, n + 1).Interior.Color = "16777075" 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 = "Paso:" Cells(m + 12, n + 5).FormulaR1C1 = "10" Cells(m + 12, n + 22).FormulaR1C1 = "campo se encuentra en las celdas A12=E_x, B12=E_y y C12=E_z." Cells(m + 13, n + 4).FormulaR1C1 = "phi_inicial:" Cells(m + 13, n + 5).FormulaR1C1 = "0" Cells(m + 13, n + 21).FormulaR1C1 = "3. El signo menos de la constante k indica la direcci" & ChrW(243) & "n del campo hacia el centro." Cells(m + 14, n + 4).FormulaR1C1 = "phi_final" Cells(m + 14, n + 5).FormulaR1C1 = "360" Cells(m + 14, n + 21).FormulaR1C1 = "4. En las celdas G26, G27 y G28 se puede desplazar el origen del sistema de coordenadas esf" & ChrW(233) & "rico, " Cells(m + 15, n + 22).FormulaR1C1 = "sin embargo esto no desplaza el origen de la fuente de campo, el cual se encuentra " Cells(m + 16, n + 4).FormulaR1C1 = "theta:" Cells(m + 16, n + 22).FormulaR1C1 = "en el origen de coordenadas (por ejemplo una carga puntual negativa). " Cells(m + 17, n + 4).FormulaR1C1 = "Paso:" Cells(m + 17, n + 5).FormulaR1C1 = "10" Cells(m + 17, n + 21).FormulaR1C1 = "5. Intente desplazar el origen del sistema de coordenadas esf" & ChrW(233) & "rico hacia la derecha, por ejemplo" Cells(m + 18, n + 4).FormulaR1C1 = "theta_inicial:" Cells(m + 18, n + 5).FormulaR1C1 = "0" Cells(m + 18, n + 22).FormulaR1C1 = "colocando G27=100. En este caso se podr" & ChrW(225) & " notar que aunque el campo seguir" & ChrW(225) & "" Cells(m + 19, n + 4).FormulaR1C1 = "theta_final" Cells(m + 19, n + 5).FormulaR1C1 = "180" Cells(m + 19, n + 22).FormulaR1C1 = " teniendo simetr" & ChrW(237) & "a esf" & ChrW(233) & "rica con respecto al origen cartesiano, esta simetr" & ChrW(237) & "a no se " Cells(m + 20, n + 22).FormulaR1C1 = "podr" & ChrW(225) & " observar si el origen de coordenadas esf" & ChrW(233) & "ricas no coincide con la posici" & ChrW(243) & "n " Cells(m + 21, n + 4).FormulaR1C1 = "DESPLAZAMIENTO DEL" Cells(m + 21, n + 22).FormulaR1C1 = "de la fuente de campo. La posici" & ChrW(243) & "n de la fuente de campo se modifica en la misma " Cells(m + 22, n + 4).FormulaR1C1 = "ORIGEN:" Cells(m + 22, n + 22).FormulaR1C1 = "f" & ChrW(243) & "rmula del campo, es decir en las celdas A12, B12 y C12. Pruebe adivinar c" & ChrW(243) & "mo ser" & ChrW(237) & "a la" Cells(m + 23, n + 4).FormulaR1C1 = "x_0" Cells(m + 23, n + 5).FormulaR1C1 = "0" Cells(m + 23, n + 22).FormulaR1C1 = "f" & ChrW(243) & "rmula para que la carga puntual se desplace tambien 100 unidades a la derecha y " Cells(m + 24, n + 4).FormulaR1C1 = "y_0" Cells(m + 24, n + 5).FormulaR1C1 = "0" Cells(m + 24, n + 22).FormulaR1C1 = "modifique respectivamente la f" & ChrW(243) & "rmula. Recuerde que para actualizar sus cambios" Cells(m + 25, n + 4).FormulaR1C1 = "z_0" Cells(m + 25, n + 5).FormulaR1C1 = "0" Cells(m + 25, n + 22).FormulaR1C1 = "debe oprimir XYZ u otro bot" & ChrW(243) & "n de actualizaci" & ChrW(243) & "n." Cells(m + 27, n + 21).FormulaR1C1 = "Nota: al exportar c" & ChrW(243) & "digo con el bot" & ChrW(243) & "n C" & ChrW(243) & "digo, algunos sistemas operativos presentan problemas" Cells(m + 28, n + 22).FormulaR1C1 = "cuando se indica el nombre del archivo con caracteres especiales (como tildes u otros)." Cells(m + 29, n + 22).FormulaR1C1 = " Para evitar esos problemas indique el nombre del archivo sin tildes ni caracteres " Cells(m + 30, n + 22).FormulaR1C1 = "especiales. " Call BlackWhiteDesk Call PutEqBut End If ' actualizar hoja End Sub