Skip to content
Snippets Groups Projects
Commit 9d57c4cf authored by Антон Кудряшов's avatar Антон Кудряшов
Browse files

- added solution for PRM Module

parent 6da733b7
No related branches found
No related tags found
No related merge requests found
...@@ -2,53 +2,52 @@ ...@@ -2,53 +2,52 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms;
namespace MES_Wind_prm namespace PRMLibrary
{ {
public class PRM_index public class Index
{ {
public int Row; public int Row;
public int Col; public int Col;
public PRM_index(int Row, int Col) public Index(int Row, int Col)
{ {
this.Row = Row; this.Row = Row;
this.Col = Col; this.Col = Col;
} }
public PRM_index() : this(0, 0) { } public Index() : this(0, 0) { }
} }
public class PRM_coordinate public class Coordinate
{ {
public double X; public double X;
public double Y; public double Y;
public PRM_coordinate(double X, double Y) public Coordinate(double X, double Y)
{ {
this.X = X; this.X = X;
this.Y = Y; this.Y = Y;
} }
public PRM_coordinate() : this(0, 0) { } public Coordinate() : this(0, 0) { }
} }
public class PRM_raster_cell_prognostic public class PrognosticCell
{ {
public double velocityX; public double velocityX;
public double velocityY; public double velocityY;
public PRM_coordinate coords; public Coordinate coords;
public PRM_raster_cell_prognostic(PRM_coordinate coord, double vX, double vY) public PrognosticCell(Coordinate coord, double vX, double vY)
{ {
this.coords = coord; this.coords = coord;
this.velocityX = vX; this.velocityX = vX;
this.velocityY = vY; this.velocityY = vY;
} }
} }
public class PRM_raster_cell_climate public class ClimateCell
{ {
public double wind5; public double wind5;
public double wind10; public double wind10;
public double wind15; public double wind15;
public PRM_coordinate coords; public Coordinate coords;
public PRM_raster_cell_climate(PRM_coordinate coord, double w5, double w10, double w15) public ClimateCell(Coordinate coord, double w5, double w10, double w15)
{ {
this.coords = coord; this.coords = coord;
this.wind5 = w5; this.wind5 = w5;
...@@ -56,31 +55,31 @@ namespace MES_Wind_prm ...@@ -56,31 +55,31 @@ namespace MES_Wind_prm
this.wind15 = w15; this.wind15 = w15;
} }
} }
public struct PRM_cell_size public struct CellSize
{ {
public double width; public double width;
public double height; public double height;
public PRM_cell_size(double wdh, double hgh) public CellSize(double wdh, double hgh)
{ {
this.width = wdh; this.width = wdh;
this.height = hgh; this.height = hgh;
} }
} }
public class PRM_Line public class Powerline
{ {
public int identifier { get; set; } public int identifier { get; set; }
public int year; public int year;
public double height; public double height;
public int power; public int power;
public List<PRM_coordinate> coords { get; set; } public List<Coordinate> coords { get; set; }
public int pointFromID; public int pointFromID;
public int pointToID; public int pointToID;
public bool isbroken; public bool isbroken;
public bool ison; public bool ison;
public PRM_Line(List<PRM_coordinate> coord, int id, int yer, double h, int pw, bool isbrkn, bool ison, int toID, int fromID) public Powerline(List<Coordinate> coord, int id, int yer, double h, int pw, bool isbrkn, bool ison, int toID, int fromID)
{ {
this.coords = coord; this.coords = coord;
this.identifier = id; this.identifier = id;
...@@ -92,19 +91,19 @@ namespace MES_Wind_prm ...@@ -92,19 +91,19 @@ namespace MES_Wind_prm
this.pointFromID = fromID; this.pointFromID = fromID;
this.pointToID = toID; this.pointToID = toID;
} }
public PRM_Line() : base() { } public Powerline() : base() { }
} }
public class PRM_Station public class PowerStation
{ {
public int identifier; public int identifier;
public PRM_coordinate coords; public Coordinate coords;
public string name; public string name;
public int power; public int power;
public string type; public string type;
public bool issource; public bool issource;
public bool ison; public bool ison;
public List<PRM_Line> linelist; public List<Powerline> linelist;
public PRM_Station(PRM_coordinate crds, int id,string stname, int stpower, string sttype, bool issource, bool ison) public PowerStation(Coordinate crds, int id, string stname, int stpower, string sttype, bool issource, bool ison)
{ {
this.coords = crds; this.coords = crds;
this.identifier = id; this.identifier = id;
...@@ -114,106 +113,105 @@ namespace MES_Wind_prm ...@@ -114,106 +113,105 @@ namespace MES_Wind_prm
this.issource = issource; this.issource = issource;
this.ison = ison; this.ison = ison;
} }
public PRM_Station() : base() { } public PowerStation() : base() { }
} }
enum PRMFunctionType enum FunctionType
{ {
PRMFunctionVelocityX = 0, FunctionVelocityX = 0,
PRMFunctionVelocityY = 1, FunctionVelocityY = 1,
PRMFunctionClimate5 = 2, FunctionClimate5 = 2,
PRMFunctionClimate10 = 3, FunctionClimate10 = 3,
PRMFunctionClimate15 = 4 FunctionClimate15 = 4
} }
public class PRM_wind public class Module
{ {
//prognistic raster info //prognistic raster info
public List<List<PRM_raster_cell_prognostic>> prognostic_cells; public List<List<PrognosticCell>> prognosticCells;
public PRM_cell_size prognostic_cellsize; public CellSize prognosticCellSize;
public double[] prognostic_AffineCoefficients; public double[] prognosticAffineCoefficients;
//climate raster info //climate raster info
public List<List<PRM_raster_cell_climate>> climate_cells; public List<List<ClimateCell>> climateCells;
public PRM_cell_size climate_cellsize; public CellSize climateCellSize;
public double[] climate_AffineCoefficients; public double[] climateAffineCoefficients;
//lines collection //lines collection
public List<PRM_Line> powerlines; public List<Powerline> powerLines;
//station collection //station collection
public List<PRM_Station> powerstations; public List<PowerStation> powerStations;
//broken stations and lines //broken stations and lines
public List<PRM_Station> disabledstations = new List<PRM_Station>(); public List<PowerStation> disabledStations = new List<PowerStation>();
public List<PRM_Line> disabledlines = new List<PRM_Line>(); public List<Powerline> disabledLines = new List<Powerline>();
#region "control parameters"
public double dist_threshold = 500; public double dist_threshold = 500;
#endregion
//Main function for power graph algorithm //Main function for power graph algorithm
public void mainpowercheck() public void checkPower()
{ {
//get the graph //get the graph
Powerprep(); PreparingPowerItems();
//start from source points //start from source points
foreach (PRM_Station pwstation in powerstations) foreach (PowerStation pwstation in powerStations)
{ {
if (pwstation.issource) { Chekpwpoints(pwstation); } if (pwstation.issource) {
CheckPowerPointsForStation(pwstation);
}
} }
foreach (PRM_Line lin in powerlines) foreach (Powerline line in powerLines)
{ {
if (lin.isbroken) { disabledlines.Add(lin); } if (line.isbroken) {
disabledLines.Add(line);
} }
foreach (PRM_Station pw in powerstations) }
foreach (PowerStation powerStation in powerStations)
{ {
if(!pw.ison && !(pw.type.ToUpperInvariant().Trim() == "POLE")) if (!powerStation.ison && !(powerStation.type.ToUpperInvariant().Trim() == "POLE")){
{ disabledstations.Add(pw); } disabledStations.Add(powerStation);
}
} }
return; return;
} }
//search function for power graph //search function for power graph
public void Chekpwpoints(PRM_Station sourcepoint) private void CheckPowerPointsForStation(PowerStation sourcepoint)
{ {
if (!sourcepoint.ison) if (!sourcepoint.ison)
{ {
MessageBox.Show("Checkpwpoints is called from disabled sourcepoint"); throw new Exception("CheckPowerPointsForStation is called from disabled sourcepoint");
return; return;
} }
// if the point is not a pole - i.e. we know // if the point is not a pole - i.e. we know
// it can redistribute power within connected lines // it can redistribute power within connected lines
// we turn it ON if any of the connected lines are powered // we turn it ON if any of the connected lines are powered
foreach (PRM_Line line in sourcepoint.linelist) foreach (Powerline line in sourcepoint.linelist)
{ {
if (!line.isbroken && !line.ison) if (!line.isbroken && !line.ison)
{ {
line.ison = true; line.ison = true;
foreach (PRM_Station pwst in powerstations) foreach (PowerStation powerStation in powerStations)
{
if (pwst.identifier != sourcepoint.identifier && (pwst.identifier == line.pointFromID || pwst.identifier == line.pointToID))
{ {
if (!(sourcepoint.type.Trim().ToUpperInvariant() == "POLE")) if (powerStation.identifier != sourcepoint.identifier && (powerStation.identifier == line.pointFromID || powerStation.identifier == line.pointToID))
{ {
pwst.ison = true; if (!(sourcepoint.type.Trim().ToUpperInvariant() == "POLE")) {
Chekpwpoints(pwst); powerStation.ison = true;
CheckPowerPointsForStation(powerStation);
} }
else else {
{
// if line is a pole we have to check if it's actually able to // if line is a pole we have to check if it's actually able to
// get electricity to other points i.e. no connected lines are broken // get electricity to other points i.e. no connected lines are broken
bool polcheck = false; bool powerLineCheck = false;
foreach (PRM_Line poline in pwst.linelist) foreach (Powerline powerline in powerStation.linelist)
{ {
if (poline.isbroken) { polcheck = true; } if (powerline.isbroken) {
powerLineCheck = true;
} }
if (!polcheck) }
if (!powerLineCheck)
{ {
pwst.ison = true; powerStation.ison = true;
Chekpwpoints(pwst); CheckPowerPointsForStation(powerStation);
} }
} }
} }
...@@ -224,38 +222,40 @@ namespace MES_Wind_prm ...@@ -224,38 +222,40 @@ namespace MES_Wind_prm
} }
//preparing powerstations and lists of lines for them to get a graph-like structure //preparing powerstations and lists of lines for them to get a graph-like structure
public void Powerprep() private void PreparingPowerItems()
{ {
//First we make sure that all the sources are ON //First we make sure that all the sources are ON
//and all non sources are OFF //and all non sources are OFF
foreach (PRM_Station pwstat in powerstations) foreach (PowerStation powerStation in powerStations)
{ {
if (pwstat.issource == true) if (powerStation.issource == true) {
{ pwstat.ison = true; } powerStation.ison = true;
else { pwstat.ison = false; } }
else {
powerStation.ison = false;
}
// for each power station we create a list of powerlines it is attached to // for each power station we create a list of powerlines it is attached to
List<PRM_Line> lines = new List<PRM_Line>(); List<Powerline> lines = new List<Powerline>();
foreach (PRM_Line line in powerlines) foreach (Powerline line in powerLines)
{ {
//we also switch OFF all lines //we also switch OFF all lines
line.ison = false; line.ison = false;
if (line.pointFromID == pwstat.identifier || line.pointToID == pwstat.identifier) if (line.pointFromID == powerStation.identifier || line.pointToID == powerStation.identifier) {
{
lines.Add(line); lines.Add(line);
} }
} }
pwstat.linelist = lines; powerStation.linelist = lines;
} }
} }
public List<PRM_Line> brokenPowerLinesAfterCheck() public List<Powerline> brokenPowerLinesAfterCheck()
{ {
List<PRM_Line> brklines = new List<PRM_Line>(); List<Powerline> brklines = new List<Powerline>();
foreach (PRM_Line curve in powerlines) // actually there are curves in powerLines
foreach (Powerline powerCurve in powerLines)
{ {
// get coordinates list // get coordinates list
List<PRM_coordinate> points = curve.coords; List<Coordinate> points = powerCurve.coords;
List<bool> checkList = new List<bool>(); List<bool> checkList = new List<bool>();
// cycle throw all points in line // cycle throw all points in line
...@@ -265,40 +265,38 @@ namespace MES_Wind_prm ...@@ -265,40 +265,38 @@ namespace MES_Wind_prm
double y1 = points[i - 1].Y; double y1 = points[i - 1].Y;
double x2 = points[i].X; double x2 = points[i].X;
double y2 = points[i].Y; double y2 = points[i].Y;
bool result = linearLineIsBroken(points[i - 1], points[i], curve.height, curve.power); bool result = linearLineIsBroken(points[i - 1], points[i], powerCurve.height, powerCurve.power);
checkList.Add(result); checkList.Add(result);
} }
foreach (bool chkpnt in checkList) foreach (bool chkpnt in checkList)
{ {
if (chkpnt == true) if (chkpnt == true)
{ {
curve.isbroken = true; powerCurve.isbroken = true;
} }
} }
if (curve.isbroken) if (powerCurve.isbroken)
{ {
brklines.Add(curve); brklines.Add(powerCurve);
} }
} }
return brklines; return brklines;
} }
bool linearLineIsBroken(PRM_coordinate coord1, PRM_coordinate coord2, double heightLine, int power) private bool linearLineIsBroken(Coordinate coord1, Coordinate coord2, double heightLine, int power)
{ {
double distance = Math.Sqrt((coord2.X - coord1.X) * (coord2.X - coord1.X) + (coord2.Y - coord1.Y) * (coord2.Y - coord1.Y)); double distance = Math.Sqrt((coord2.X - coord1.X) * (coord2.X - coord1.X) + (coord2.Y - coord1.Y) * (coord2.Y - coord1.Y));
double distpropD = distance / dist_threshold; double distpropD = distance / dist_threshold;
List<PRM_coordinate> pointlist = new List<PRM_coordinate>(); List<Coordinate> pointlist = new List<Coordinate>();
PRM_coordinate midpoint = new PRM_coordinate(); Coordinate midpoint = new Coordinate();
int distpropI = Convert.ToInt32(distpropD); int distpropI = Convert.ToInt32(distpropD);
if (distpropI > 1) if (distpropI > 1)
{ {
double constXdiff = (coord2.X - coord1.X) / distpropI; double constXdiff = (coord2.X - coord1.X) / distpropI;
double constYdiff = (coord2.Y - coord1.Y) / distpropI; double constYdiff = (coord2.Y - coord1.Y) / distpropI;
PRM_coordinate subCoord1 = new PRM_coordinate(coord1.X, coord1.Y); Coordinate subCoord1 = new Coordinate(coord1.X, coord1.Y);
PRM_coordinate subCoord2 = new PRM_coordinate(coord1.X + constXdiff, coord1.Y + constXdiff); Coordinate subCoord2 = new Coordinate(coord1.X + constXdiff, coord1.Y + constXdiff);
for (int j = 0; j < distpropI; j++) for (int j = 0; j < distpropI; j++)
{ {
if (j == 0) if (j == 0)
...@@ -326,23 +324,26 @@ namespace MES_Wind_prm ...@@ -326,23 +324,26 @@ namespace MES_Wind_prm
midpoint.Y = (coord1.Y + coord2.Y) / 2; midpoint.Y = (coord1.Y + coord2.Y) / 2;
pointlist.Add(midpoint); pointlist.Add(midpoint);
} }
PRMFunctionType climateType; FunctionType climateType;
//PRMFunctionType climateType = useClimate10 ? PRMFunctionType.PRMFunctionClimate10 : PRMFunctionType.PRMFunctionClimate5;
if (power > 5 && power < 330) if (power > 5 && power < 330)
{ {
climateType = PRMFunctionType.PRMFunctionClimate10; climateType = FunctionType.FunctionClimate10;
} }
else else
{ {
if (power <= 5) { climateType = PRMFunctionType.PRMFunctionClimate5; } if (power <= 5) {
else { climateType = PRMFunctionType.PRMFunctionClimate15; } climateType = FunctionType.FunctionClimate5;
}
else {
climateType = FunctionType.FunctionClimate15;
}
} }
List<bool> checkbool = new List<bool>(); List<bool> checkbool = new List<bool>();
foreach (PRM_coordinate coords in pointlist) foreach (Coordinate coords in pointlist)
{ {
bool res = false; bool res = false;
double uwind = interpol(coords, PRMFunctionType.PRMFunctionVelocityX); double uwind = interpol(coords, FunctionType.FunctionVelocityX);
double vwind = interpol(coords, PRMFunctionType.PRMFunctionVelocityY); double vwind = interpol(coords, FunctionType.FunctionVelocityY);
double climwind = interpol(coords, climateType); double climwind = interpol(coords, climateType);
double umod = Math.Sqrt(uwind * uwind + vwind * vwind); ; double umod = Math.Sqrt(uwind * uwind + vwind * vwind); ;
double angleline = Math.Atan2((coord2.Y - coord1.Y), (coord2.X - coord1.X)); double angleline = Math.Atan2((coord2.Y - coord1.Y), (coord2.X - coord1.X));
...@@ -380,20 +381,20 @@ namespace MES_Wind_prm ...@@ -380,20 +381,20 @@ namespace MES_Wind_prm
return result; return result;
} }
double[] affineCoefficients(PRMFunctionType functionType) double[] affineCoefficients(FunctionType functionType)
{ {
switch (functionType) switch (functionType)
{ {
case PRMFunctionType.PRMFunctionVelocityX: case FunctionType.FunctionVelocityX:
case PRMFunctionType.PRMFunctionVelocityY: case FunctionType.FunctionVelocityY:
{ {
return prognostic_AffineCoefficients; return prognosticAffineCoefficients;
} }
case PRMFunctionType.PRMFunctionClimate5: case FunctionType.FunctionClimate5:
case PRMFunctionType.PRMFunctionClimate10: case FunctionType.FunctionClimate10:
case PRMFunctionType.PRMFunctionClimate15: case FunctionType.FunctionClimate15:
{ {
return climate_AffineCoefficients; return climateAffineCoefficients;
} }
default: default:
break; break;
...@@ -403,7 +404,7 @@ namespace MES_Wind_prm ...@@ -403,7 +404,7 @@ namespace MES_Wind_prm
// Taken from DotSpatial https://github.com/ViceIce/DotSpatial/blob/22c156c7646b1595d88d2523c066a9c6ab4d3a53/DotSpatial.Data/RasterBoundsExt.cs // Taken from DotSpatial https://github.com/ViceIce/DotSpatial/blob/22c156c7646b1595d88d2523c066a9c6ab4d3a53/DotSpatial.Data/RasterBoundsExt.cs
// RasterBoundsExt.cs. Define AffineCoefficients like this. // RasterBoundsExt.cs. Define AffineCoefficients like this.
PRM_index projectionToCell(PRM_coordinate coordinate, PRMFunctionType functionType) Index projectionToCell(Coordinate coordinate, FunctionType functionType)
{ {
double[] c = affineCoefficients(functionType); double[] c = affineCoefficients(functionType);
double rw, cl; double rw, cl;
...@@ -432,24 +433,25 @@ namespace MES_Wind_prm ...@@ -432,24 +433,25 @@ namespace MES_Wind_prm
if (iRow < 0 || iCol < 0 || iRow >= countInList(functionType, true) || iCol >= countInList(functionType, false)) if (iRow < 0 || iCol < 0 || iRow >= countInList(functionType, true) || iCol >= countInList(functionType, false))
{ {
return new PRM_index(); return new Index();
} }
return new PRM_index(iRow, iCol); return new Index(iRow, iCol);
} }
PRM_coordinate cellToProjection(PRM_index index, PRMFunctionType functionType) Coordinate cellToProjection(Index index, FunctionType functionType)
{
switch (functionType)
{ {
switch (functionType) { case FunctionType.FunctionVelocityX:
case PRMFunctionType.PRMFunctionVelocityX: case FunctionType.FunctionVelocityY:
case PRMFunctionType.PRMFunctionVelocityY:
{ {
return prognostic_cells[index.Row][index.Col].coords; return prognosticCells[index.Row][index.Col].coords;
} }
case PRMFunctionType.PRMFunctionClimate5: case FunctionType.FunctionClimate5:
case PRMFunctionType.PRMFunctionClimate10: case FunctionType.FunctionClimate10:
case PRMFunctionType.PRMFunctionClimate15: case FunctionType.FunctionClimate15:
{ {
return climate_cells[index.Row][index.Col].coords; return climateCells[index.Row][index.Col].coords;
} }
default: default:
break; break;
...@@ -457,20 +459,20 @@ namespace MES_Wind_prm ...@@ -457,20 +459,20 @@ namespace MES_Wind_prm
return null; return null;
} }
int countInList(PRMFunctionType functionType, bool forRows) int countInList(FunctionType functionType, bool forRows)
{ {
switch (functionType) switch (functionType)
{ {
case PRMFunctionType.PRMFunctionVelocityX: case FunctionType.FunctionVelocityX:
case PRMFunctionType.PRMFunctionVelocityY: case FunctionType.FunctionVelocityY:
{ {
return forRows ? prognostic_cells.Count : prognostic_cells[0].Count; return forRows ? prognosticCells.Count : prognosticCells[0].Count;
} }
case PRMFunctionType.PRMFunctionClimate5: case FunctionType.FunctionClimate5:
case PRMFunctionType.PRMFunctionClimate10: case FunctionType.FunctionClimate10:
case PRMFunctionType.PRMFunctionClimate15: case FunctionType.FunctionClimate15:
{ {
return forRows ? climate_cells.Count : climate_cells[0].Count; return forRows ? climateCells.Count : climateCells[0].Count;
} }
default: default:
break; break;
...@@ -478,29 +480,29 @@ namespace MES_Wind_prm ...@@ -478,29 +480,29 @@ namespace MES_Wind_prm
return 0; return 0;
} }
double valueForFunction(PRMFunctionType functionType, PRM_index index) double valueForFunction(FunctionType functionType, Index index)
{ {
switch (functionType) switch (functionType)
{ {
case PRMFunctionType.PRMFunctionVelocityX: case FunctionType.FunctionVelocityX:
{ {
return prognostic_cells[index.Row][index.Col].velocityX; return prognosticCells[index.Row][index.Col].velocityX;
} }
case PRMFunctionType.PRMFunctionVelocityY: case FunctionType.FunctionVelocityY:
{ {
return prognostic_cells[index.Row][index.Col].velocityY; return prognosticCells[index.Row][index.Col].velocityY;
} }
case PRMFunctionType.PRMFunctionClimate5: case FunctionType.FunctionClimate5:
{ {
return climate_cells[index.Row][index.Col].wind5; return climateCells[index.Row][index.Col].wind5;
} }
case PRMFunctionType.PRMFunctionClimate10: case FunctionType.FunctionClimate10:
{ {
return climate_cells[index.Row][index.Col].wind10; return climateCells[index.Row][index.Col].wind10;
} }
case PRMFunctionType.PRMFunctionClimate15: case FunctionType.FunctionClimate15:
{ {
return climate_cells[index.Row][index.Col].wind15; return climateCells[index.Row][index.Col].wind15;
} }
default: default:
break; break;
...@@ -508,20 +510,20 @@ namespace MES_Wind_prm ...@@ -508,20 +510,20 @@ namespace MES_Wind_prm
return 0; return 0;
} }
PRM_cell_size cellSizeForFunction(PRMFunctionType functionType) CellSize cellSizeForFunction(FunctionType functionType)
{ {
switch (functionType) switch (functionType)
{ {
case PRMFunctionType.PRMFunctionVelocityX: case FunctionType.FunctionVelocityX:
case PRMFunctionType.PRMFunctionVelocityY: case FunctionType.FunctionVelocityY:
{ {
return prognostic_cellsize; return prognosticCellSize;
} }
case PRMFunctionType.PRMFunctionClimate5: case FunctionType.FunctionClimate5:
case PRMFunctionType.PRMFunctionClimate10: case FunctionType.FunctionClimate10:
case PRMFunctionType.PRMFunctionClimate15: case FunctionType.FunctionClimate15:
{ {
return climate_cellsize; return climateCellSize;
} }
default: default:
break; break;
...@@ -529,13 +531,13 @@ namespace MES_Wind_prm ...@@ -529,13 +531,13 @@ namespace MES_Wind_prm
throw new Exception("There is no cell size"); throw new Exception("There is no cell size");
} }
double interpol(PRM_coordinate coords, PRMFunctionType functionType) double interpol(Coordinate coords, FunctionType functionType)
{ {
// select directions for projections // select directions for projections
const bool normalX = true;// true - East, false West const bool normalX = true;// true - East, false West
const bool normalY = false;// true - North, false South const bool normalY = false;// true - North, false South
PRM_index rc = projectionToCell(coords, functionType); Index rc = projectionToCell(coords, functionType);
PRM_coordinate center = cellToProjection(rc, functionType); Coordinate center = cellToProjection(rc, functionType);
double xDiff = coords.X - center.X; double xDiff = coords.X - center.X;
double yDiff = coords.Y - center.Y; double yDiff = coords.Y - center.Y;
//calculate second index //calculate second index
...@@ -557,15 +559,15 @@ namespace MES_Wind_prm ...@@ -557,15 +559,15 @@ namespace MES_Wind_prm
col2 = rc.Col > 0 ? rc.Col - 1 : rc.Col + 1; col2 = rc.Col > 0 ? rc.Col - 1 : rc.Col + 1;
} }
// indexes and values at bounds // indexes and values at bounds
PRM_index rcBotLeft = new PRM_index(Math.Min(row2, rc.Row), Math.Min(col2, rc.Col)); Index rcBotLeft = new Index(Math.Min(row2, rc.Row), Math.Min(col2, rc.Col));
PRM_index rcBotRight = new PRM_index(Math.Max(row2, rc.Row), Math.Min(col2, rc.Col)); Index rcBotRight = new Index(Math.Max(row2, rc.Row), Math.Min(col2, rc.Col));
PRM_index rcTopLeft = new PRM_index(Math.Min(row2, rc.Row), Math.Max(col2, rc.Col)); Index rcTopLeft = new Index(Math.Min(row2, rc.Row), Math.Max(col2, rc.Col));
PRM_index rcTopRight = new PRM_index(Math.Max(row2, rc.Row), Math.Max(col2, rc.Col)); Index rcTopRight = new Index(Math.Max(row2, rc.Row), Math.Max(col2, rc.Col));
double valBotLeft = valueForFunction(functionType, rcBotLeft); double valBotLeft = valueForFunction(functionType, rcBotLeft);
double valBotRight = valueForFunction(functionType, rcBotRight); double valBotRight = valueForFunction(functionType, rcBotRight);
double valTopLeft = valueForFunction(functionType, rcTopLeft); double valTopLeft = valueForFunction(functionType, rcTopLeft);
double valTopRight = valueForFunction(functionType, rcTopRight); double valTopRight = valueForFunction(functionType, rcTopRight);
PRM_coordinate origin = cellToProjection(rcBotLeft, functionType); Coordinate origin = cellToProjection(rcBotLeft, functionType);
//PRM_coordinate last = cellToProjection(rcTopRight, functionType);//test only //PRM_coordinate last = cellToProjection(rcTopRight, functionType);//test only
// sizes for cell // sizes for cell
double hx = cellSizeForFunction(functionType).width; double hx = cellSizeForFunction(functionType).width;
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{599B5E9B-293A-4866-A50F-6BB7DC36A81C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PRMLibrary</RootNamespace>
<AssemblyName>PRMLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PRMLibrary.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("PRMLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PRMLibrary")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("1d3cf550-16e9-4c87-aad5-a435f0689f4c")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер построения
// Редакция
//
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
File added
File added
File added
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\PRMLibrary\bin\Debug\PRMLibrary.dll
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\PRMLibrary\bin\Debug\PRMLibrary.pdb
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\PRMLibrary\obj\Debug\PRMLibrary.dll
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\PRMLibrary\obj\Debug\PRMLibrary.pdb
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment