# Quick Calculation of Magnetic Flux Density in Electrical Facilities
## 3 Materials and Methods  
### CRMag(r)Software for the Calculation of MFDs Produced by Electric Currents  
The CRMag(r)software is a calculation tool developed with MATLAB at the University Research Institute for Energy Engineering (IUIIE) of the Universitat Politecnica de Valencia, which was registered at the Research and Development Management Service of the aforementioned university, with registration number R-19161-2017--CRMag(r). The purpose of this software is to calculate and represent the MFD produced by the circulation of currents in electrical facilities, using Equations (1)-(5), both in the premises where these installations are located and in their surroundings. In order to do this, the different conductor straight sections are substituted by a discrete set of little linear elements. A grid of calculation points is defined by the user. For every calculation point in the selected grid, a numerical integration of Equation (4) is solved using the rectangle method for every conductor of every phase. For each phase, this integration is solved in the three Cartesian axes (X,Y,Z). After completing the integration of all the little elements, the phasor magnitudes B\({}_{X}\) calculated for every phase are temporally composed. The same applies to B\({}_{Y}\) and B\({}_{Z}\). Finally, the root mean square value of B is computed. As the rectangle method for numerical integration is not exact, the error will depend on the number of discrete little elements used for every conductor section. This can be adjusted by the user, thus increasing the accuracy of the calculations. When the MFD is calculated far from the wires, this error is negligible if the distance to them is much greater than the size of the selected elements. CRMag(r)has been specifically designed to study typical installations. For more complex situations there are other programs (such as CDEGS or XGSLab(tm)) that are more complex and powerful. The program has two calculation modes. In the main mode, also called installations mode, the MFD produced by the electric currents in electrical facilities such as DTSs or electrical substations can be studied. In this mode, electrical conductors are represented by straight sections, considering the electrical shield if it is included (like in insulated cables). In the second mode, also called lines mode, the MFD produced by high-voltage overhead lines, considering the catenaries adopted by conductors and the currents that can be induced in earth wires, can be calculated and represented. The main screen of the installations mode is shown in Figure 1.  
To calculate the MFD produced by electric currents in a facility, the user must enter the geometric arrangement with the coordinates of every conductor section and their currents. The program can simulate both single-phase and three-phase installations with or without a neutral conductor. The geometry of the defined installation and premises can be displayed to verify that everything is correct and proceed to calculate the MFD. The MFD is always calculated in a horizontal plane at the desired height above the coordinate z=0, for example, 1 m. In that plane, a grid of equidistant points is drawn in which the MFD produced by all the currents of the installation is calculated. The results can be represented as a three-dimensional surface or as two-dimensional curves produced by cutting the surface by fixing the value of coordinates x or y. The Z axis of the three-dimensional graphs corresponds to the calculated magnitude of B (in \(\mu\)T). This magnitude can be displayed using  
Figure 1: Main screen of the CRMag® software. a scale different from those of the X and Y axes, which represent coordinates in m. The representation of B can be limited to a maximum value. This allows us to create graphs in which the part of the surface that exceeds a certain value is shown in a uniform color and a flat shape fixed to the maximum value to be represented. In this way, the contours of this area form an \"isoflux\" curve (a curve where the MFD has a determined constant value).