J
Javier Waldo
Guest
Hi,
I am making a complex program that needs to be ran in pararell to get lower excecution time. The problem is that the variables of the class "Tracker" (that is used in all the program) are being shared between threads and so I get problems with the results.
I am new on threading and I am not sure about how can I avoid these variables to be shared, could you help me?
I show the class:
class Tracker
{
//Tracker class
//Basic characteristics
public double[] northPost { get; set; } = new double[3]; //x,y,z coordinates of north post of the tracker
public double[] southPost { get; set; } = new double[3]; //x,y,z coordinates of south post of the tracker
public double A { get; set; } //tracker width
public double R { get; set; } //tracker pitch
public double maxTilt { get; set; } //tilt limit
public int Nx { get; set; } //cell divisions horizontal
public int Ny { get; set; }//cell divisions vertical
public List<double> azimut { get; set; }
public List<double> elevation { get; set; }
public List<double> SHFdirect { get; set; } //shadow factor on direct irradiance
public List<double> SHFdiff { get; set; } //shadow factor on diffuse irradiance
public List<double> SHFalb { get; set; } //shadow factor on albedo
//Coordinates of tracker points (are going to be erased when not used)
public double[,] cornerCoordinates; //corners coordintaes
public double[,,] trackerCells; //each cell division coordinate (a cell is a division on the tacker to perform calculations)
public double tilt; //tilt
public double[] normal; //normal vector of tracker plane
Continue reading...
I am making a complex program that needs to be ran in pararell to get lower excecution time. The problem is that the variables of the class "Tracker" (that is used in all the program) are being shared between threads and so I get problems with the results.
I am new on threading and I am not sure about how can I avoid these variables to be shared, could you help me?
I show the class:
class Tracker
{
//Tracker class
//Basic characteristics
public double[] northPost { get; set; } = new double[3]; //x,y,z coordinates of north post of the tracker
public double[] southPost { get; set; } = new double[3]; //x,y,z coordinates of south post of the tracker
public double A { get; set; } //tracker width
public double R { get; set; } //tracker pitch
public double maxTilt { get; set; } //tilt limit
public int Nx { get; set; } //cell divisions horizontal
public int Ny { get; set; }//cell divisions vertical
public List<double> azimut { get; set; }
public List<double> elevation { get; set; }
public List<double> SHFdirect { get; set; } //shadow factor on direct irradiance
public List<double> SHFdiff { get; set; } //shadow factor on diffuse irradiance
public List<double> SHFalb { get; set; } //shadow factor on albedo
//Coordinates of tracker points (are going to be erased when not used)
public double[,] cornerCoordinates; //corners coordintaes
public double[,,] trackerCells; //each cell division coordinate (a cell is a division on the tacker to perform calculations)
public double tilt; //tilt
public double[] normal; //normal vector of tracker plane
Continue reading...