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

- renamed lib spacename to WindStressPRM

- renamed Module to StressPowerChecker
- removed default constructors for Index, Coordinates, Cells
parent d62ae138
No related branches found
No related tags found
No related merge requests found
Showing with 47 additions and 61 deletions
...@@ -8,7 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MES_Wind", "MES_Wind\MES_Wi ...@@ -8,7 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MES_Wind", "MES_Wind\MES_Wi
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3BFCE63D-6DC2-4DC4-AAB9-72ECF2AC2EB5}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3BFCE63D-6DC2-4DC4-AAB9-72ECF2AC2EB5}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PRMLibrary", "PRMLibrary\PRMLibrary.csproj", "{599B5E9B-293A-4866-A50F-6BB7DC36A81C}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindStressPRM", "WindStressPRM\WindStressPRM.csproj", "{599B5E9B-293A-4866-A50F-6BB7DC36A81C}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
...@@ -127,9 +127,9 @@ ...@@ -127,9 +127,9 @@
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PRMLibrary\PRMLibrary.csproj"> <ProjectReference Include="..\WindStressPRM\WindStressPRM.csproj">
<Project>{599B5E9B-293A-4866-A50F-6BB7DC36A81C}</Project> <Project>{599B5E9B-293A-4866-A50F-6BB7DC36A81C}</Project>
<Name>PRMLibrary</Name> <Name>WindStressPRM</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
...@@ -47,22 +47,20 @@ namespace MES_Wind ...@@ -47,22 +47,20 @@ namespace MES_Wind
/// <returns>List of booleans with coordinates if any of them are true, line is broken</returns> /// <returns>List of booleans with coordinates if any of them are true, line is broken</returns>
/// <remarks></remarks> /// <remarks></remarks>
#endregion #endregion
List<PRMLibrary.Coordinate> DotspLinestringToPrm(LineString dtlinestr) List<WindStressPRM.Coordinate> DotspLinestringToPrm(LineString dtlinestr)
{ {
List<PRMLibrary.Coordinate> prmlinestring = new List<PRMLibrary.Coordinate>(); List<WindStressPRM.Coordinate> prmlinestring = new List<WindStressPRM.Coordinate>();
IList<Coordinate> linepoints = dtlinestr.Coordinates; IList<Coordinate> linepoints = dtlinestr.Coordinates;
foreach(Coordinate linepoint in linepoints) foreach(Coordinate linepoint in linepoints)
{ {
PRMLibrary.Coordinate point = new PRMLibrary.Coordinate(linepoint.X, linepoint.Y); WindStressPRM.Coordinate point = new WindStressPRM.Coordinate(linepoint.X, linepoint.Y);
prmlinestring.Add(point); prmlinestring.Add(point);
} }
return prmlinestring; return prmlinestring;
} }
PRMLibrary.Coordinate DotspPointToPRM(IPoint ftpoint) WindStressPRM.Coordinate DotspPointToPRM(IPoint ftpoint)
{ {
PRMLibrary.Coordinate prpoint = new PRMLibrary.Coordinate(); WindStressPRM.Coordinate prpoint = new WindStressPRM.Coordinate(ftpoint.X, ftpoint.Y);
prpoint.X = ftpoint.X;
prpoint.Y = ftpoint.Y;
return prpoint; return prpoint;
} }
...@@ -133,57 +131,50 @@ namespace MES_Wind ...@@ -133,57 +131,50 @@ namespace MES_Wind
IFeatureSet pwpointsSet = pwstLayer.DataSet; IFeatureSet pwpointsSet = pwstLayer.DataSet;
//Start to cast raster to PRM classes //Start to cast raster to PRM classes
// prognostic wind massives first // prognostic wind massives first
List<List<PRMLibrary.PrognosticCell>> prognosticWind = new List<List<PRMLibrary.PrognosticCell>>(); List<List<WindStressPRM.PrognosticCell>> prognosticWind = new List<List<WindStressPRM.PrognosticCell>>();
int rcountPrognostic = uRasterLayer.DataSet.NumRows; int rcountPrognostic = uRasterLayer.DataSet.NumRows;
int ccountPrognostic = uRasterLayer.DataSet.NumColumns; int ccountPrognostic = uRasterLayer.DataSet.NumColumns;
for (int i =0; i< rcountPrognostic; i++) for (int i =0; i< rcountPrognostic; i++)
{ {
List<PRMLibrary.PrognosticCell> progWindRow = new List<PRMLibrary.PrognosticCell>(); List<WindStressPRM.PrognosticCell> progWindRow = new List<WindStressPRM.PrognosticCell>();
for (int j =0; j< ccountPrognostic; j++ ) for (int j =0; j< ccountPrognostic; j++ )
{ {
PRMLibrary.PrognosticCell dummyPrognosticCell = new PRMLibrary.PrognosticCell();
dummyPrognosticCell.velocityX = uRasterLayer.DataSet.Value[j, i];
dummyPrognosticCell.velocityY = vRasterLayer.DataSet.Value[j, i];
Coordinate dummyRCoords = uRasterLayer.Bounds.CellCenter_ToProj(j,i); Coordinate dummyRCoords = uRasterLayer.Bounds.CellCenter_ToProj(j,i);
PRMLibrary.Coordinate cellCoords =new PRMLibrary.Coordinate(dummyRCoords.X,dummyRCoords.Y); WindStressPRM.Coordinate cellCoords =new WindStressPRM.Coordinate(dummyRCoords.X,dummyRCoords.Y);
dummyPrognosticCell.coords = cellCoords; WindStressPRM.PrognosticCell dummyPrognosticCell = new WindStressPRM.PrognosticCell(cellCoords, uRasterLayer.DataSet.Value[j, i], vRasterLayer.DataSet.Value[j, i]);
progWindRow.Add(dummyPrognosticCell); progWindRow.Add(dummyPrognosticCell);
} }
prognosticWind.Add(progWindRow); prognosticWind.Add(progWindRow);
//prog_wind_row.Clear(); //prog_wind_row.Clear();
} }
//Get cell info and Affine transform coefficients from prognostic wind rasters //Get cell info and Affine transform coefficients from prognostic wind rasters
PRMLibrary.CellSize progcellsize = new PRMLibrary.CellSize(uRasterLayer.DataSet.CellWidth, uRasterLayer.DataSet.CellHeight); WindStressPRM.CellSize progcellsize = new WindStressPRM.CellSize(uRasterLayer.DataSet.CellWidth, uRasterLayer.DataSet.CellHeight);
double[] prog_aff = uRasterLayer.Bounds.AffineCoefficients; double[] prog_aff = uRasterLayer.Bounds.AffineCoefficients;
//Now we create climate raster class //Now we create climate raster class
List<List<PRMLibrary.ClimateCell>> climWind = new List<List<PRMLibrary.ClimateCell>>(); List<List<WindStressPRM.ClimateCell>> climWind = new List<List<WindStressPRM.ClimateCell>>();
int rowCountClim = clim5RasterLayer.DataSet.NumRows; int rowCountClim = clim5RasterLayer.DataSet.NumRows;
int columnCountClim = clim5RasterLayer.DataSet.NumColumns; int columnCountClim = clim5RasterLayer.DataSet.NumColumns;
for (int i = 0; i < rowCountClim; i++) for (int i = 0; i < rowCountClim; i++)
{ {
List<PRMLibrary.ClimateCell> climWindRow = new List<PRMLibrary.ClimateCell>(); List<WindStressPRM.ClimateCell> climWindRow = new List<WindStressPRM.ClimateCell>();
for (int j = 0; j < columnCountClim; j++) for (int j = 0; j < columnCountClim; j++)
{ {
PRMLibrary.ClimateCell dummyClim = new PRMLibrary.ClimateCell();
dummyClim.wind5 = clim5RasterLayer.DataSet.Value[j, i];
dummyClim.wind10 = clim10RasterLayer.DataSet.Value[j, i] ; // Important: substract 3 to this to get powerlines broken
dummyClim.wind15 = clim15RasterLayer.DataSet.Value[j, i];
Coordinate dummyCellCoords = clim15RasterLayer.Bounds.CellCenter_ToProj(j,i); Coordinate dummyCellCoords = clim15RasterLayer.Bounds.CellCenter_ToProj(j,i);
PRMLibrary.Coordinate dummyClimCoords = new PRMLibrary.Coordinate(dummyCellCoords.X,dummyCellCoords.Y); WindStressPRM.Coordinate dummyClimCoords = new WindStressPRM.Coordinate(dummyCellCoords.X,dummyCellCoords.Y);
dummyClim.coords = dummyClimCoords; WindStressPRM.ClimateCell dummyClim = new WindStressPRM.ClimateCell(dummyClimCoords, clim5RasterLayer.DataSet.Value[j, i], clim10RasterLayer.DataSet.Value[j, i], clim15RasterLayer.DataSet.Value[j, i]);
climWindRow.Add(dummyClim); climWindRow.Add(dummyClim);
} }
climWind.Add(climWindRow); climWind.Add(climWindRow);
//clim_wind_row.Clear(); //clim_wind_row.Clear();
} }
//Get cell info and affine transform coeff from climate rasters //Get cell info and affine transform coeff from climate rasters
PRMLibrary.CellSize climCellsize = new PRMLibrary.CellSize(clim5RasterLayer.DataSet.CellWidth, clim5RasterLayer.DataSet.CellHeight); WindStressPRM.CellSize climCellsize = new WindStressPRM.CellSize(clim5RasterLayer.DataSet.CellWidth, clim5RasterLayer.DataSet.CellHeight);
double[] climAffinecoeffs = clim5RasterLayer.Bounds.AffineCoefficients; double[] climAffinecoeffs = clim5RasterLayer.Bounds.AffineCoefficients;
// create PRM_line list to pass to PRM_wind from loaded line layer // create PRM_line list to pass to PRM_wind from loaded line layer
List<PRMLibrary.Powerline> powerlinesToPRM = new List<PRMLibrary.Powerline>(); List<WindStressPRM.Powerline> powerlinesToPRM = new List<WindStressPRM.Powerline>();
foreach (IFeature feature in pwlineSet.Features) foreach (IFeature feature in pwlineSet.Features)
{ {
PRMLibrary.Powerline dummyline = new PRMLibrary.Powerline(); WindStressPRM.Powerline dummyline = new WindStressPRM.Powerline();
DataRow featureData = feature.DataRow; DataRow featureData = feature.DataRow;
dummyline.identifier = feature.Fid; dummyline.identifier = feature.Fid;
dummyline.year = int.Parse(featureData["Year"].ToString()); dummyline.year = int.Parse(featureData["Year"].ToString());
...@@ -196,10 +187,10 @@ namespace MES_Wind ...@@ -196,10 +187,10 @@ namespace MES_Wind
powerlinesToPRM.Add(dummyline); powerlinesToPRM.Add(dummyline);
} }
//create PRM_station list to pass to PRM_wind from loaded point layer //create PRM_station list to pass to PRM_wind from loaded point layer
List<PRMLibrary.PowerStation> powerpointsToPRM = new List<PRMLibrary.PowerStation>(); List<WindStressPRM.PowerStation> powerpointsToPRM = new List<WindStressPRM.PowerStation>();
foreach (IFeature featurepoint in pwpointsSet.Features) foreach (IFeature featurepoint in pwpointsSet.Features)
{ {
PRMLibrary.PowerStation dummystation = new PRMLibrary.PowerStation(); WindStressPRM.PowerStation dummystation = new WindStressPRM.PowerStation();
DataRow featureData = featurepoint.DataRow; DataRow featureData = featurepoint.DataRow;
dummystation.identifier = featurepoint.Fid; dummystation.identifier = featurepoint.Fid;
dummystation.name = featureData["Name"].ToString(); dummystation.name = featureData["Name"].ToString();
...@@ -227,8 +218,8 @@ namespace MES_Wind ...@@ -227,8 +218,8 @@ namespace MES_Wind
} }
//Create a PRM_wind class and add all the properties from above //Create a PRM_wind class and add all the properties from above
PRMLibrary.Module prmwind = new PRMLibrary.Module(); WindStressPRM.StressPowerChecker prmwind = new WindStressPRM.StressPowerChecker();
PRMLibrary.Input input = new PRMLibrary.Input(); WindStressPRM.Input input = new WindStressPRM.Input();
input.powerLines = powerlinesToPRM; input.powerLines = powerlinesToPRM;
input.powerStations = powerpointsToPRM; input.powerStations = powerpointsToPRM;
input.prognosticCells = prognosticWind; input.prognosticCells = prognosticWind;
...@@ -237,7 +228,7 @@ namespace MES_Wind ...@@ -237,7 +228,7 @@ namespace MES_Wind
input.climateCells = climWind; input.climateCells = climWind;
input.climateCellSize = climCellsize; input.climateCellSize = climCellsize;
input.climateAffineCoefficients = climAffinecoeffs; input.climateAffineCoefficients = climAffinecoeffs;
PRMLibrary.Output output = prmwind.CheckPower(input); WindStressPRM.Output output = prmwind.CheckPower(input);
// new FeatureSet for resulting broken powerlines // new FeatureSet for resulting broken powerlines
//IFeatureSet brklineSet = new FeatureSet(FeatureType.Line); //IFeatureSet brklineSet = new FeatureSet(FeatureType.Line);
//DataTable dt = pwlineSet.DataTable; //DataTable dt = pwlineSet.DataTable;
......
...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices; ...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью // Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой. // связанные со сборкой.
[assembly: AssemblyTitle("PRMLibrary")] [assembly: AssemblyTitle("WindStressPRM")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PRMLibrary")] [assembly: AssemblyProduct("WindStressPRM")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace PRMLibrary namespace WindStressPRM
{ {
/// <summary> /// <summary>
/// Index class for raster lists in list /// Index class for raster lists in list
...@@ -29,10 +29,6 @@ namespace PRMLibrary ...@@ -29,10 +29,6 @@ namespace PRMLibrary
this.Row = Row; this.Row = Row;
this.Col = Col; this.Col = Col;
} }
/// <summary>
/// default constructor
/// </summary>
public Index() : this(0, 0) { }
} }
/// <summary> /// <summary>
/// Coordinate pair /// Coordinate pair
...@@ -57,10 +53,6 @@ namespace PRMLibrary ...@@ -57,10 +53,6 @@ namespace PRMLibrary
this.X = X; this.X = X;
this.Y = Y; this.Y = Y;
} }
/// <summary>
/// default constructor
/// </summary>
public Coordinate() : this(0, 0) { }
} }
/// <summary> /// <summary>
/// Cell obj for regular prognostic wind field /// Cell obj for regular prognostic wind field
...@@ -91,10 +83,6 @@ namespace PRMLibrary ...@@ -91,10 +83,6 @@ namespace PRMLibrary
this.velocityX = vX; this.velocityX = vX;
this.velocityY = vY; this.velocityY = vY;
} }
/// <summary>
/// default constructor
/// </summary>
public PrognosticCell() : this(new Coordinate(), 0, 0) { }
} }
/// <summary> /// <summary>
/// Cell obj for climate wind regular data /// Cell obj for climate wind regular data
...@@ -131,10 +119,6 @@ namespace PRMLibrary ...@@ -131,10 +119,6 @@ namespace PRMLibrary
this.wind10 = w10; this.wind10 = w10;
this.wind15 = w15; this.wind15 = w15;
} }
/// <summary>
/// default constructor
/// </summary>
public ClimateCell() : this(new Coordinate(), 0, 0, 0) { }
} }
/// <summary> /// <summary>
/// Cell Size parameters /// Cell Size parameters
...@@ -282,7 +266,7 @@ namespace PRMLibrary ...@@ -282,7 +266,7 @@ namespace PRMLibrary
/// <summary> /// <summary>
/// default constructor /// default constructor
/// </summary> /// </summary>
public PowerStation() : this(new Coordinate(), -1, "", 0, "", false) { } public PowerStation() : this(new Coordinate(0, 0), -1, "", 0, "", false) { }
} }
enum FunctionType enum FunctionType
...@@ -360,7 +344,7 @@ namespace PRMLibrary ...@@ -360,7 +344,7 @@ namespace PRMLibrary
/// <summary> /// <summary>
/// main calculations class /// main calculations class
/// </summary> /// </summary>
public class Module public class StressPowerChecker
{ {
/// <summary> /// <summary>
/// Input Data /// Input Data
...@@ -374,7 +358,7 @@ namespace PRMLibrary ...@@ -374,7 +358,7 @@ namespace PRMLibrary
{ {
this.input = input; this.input = input;
//Calculate which lines are broken //Calculate which lines are broken
List<PRMLibrary.Powerline> prmBrokenLines = brokenPowerLinesAfterCheck(); List<WindStressPRM.Powerline> prmBrokenLines = brokenPowerLinesAfterCheck();
//get the graph //get the graph
PreparingPowerItems(); PreparingPowerItems();
//start from source points //start from source points
...@@ -538,7 +522,7 @@ namespace PRMLibrary ...@@ -538,7 +522,7 @@ namespace PRMLibrary
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 / input.dist_threshold; double distpropD = distance / input.dist_threshold;
List<Coordinate> pointlist = new List<Coordinate>(); List<Coordinate> pointlist = new List<Coordinate>();
Coordinate midpoint = new Coordinate(); Coordinate midpoint = new Coordinate(0, 0);
int distpropI = Convert.ToInt32(distpropD); int distpropI = Convert.ToInt32(distpropD);
if (distpropI > 1) if (distpropI > 1)
{ {
...@@ -682,9 +666,8 @@ namespace PRMLibrary ...@@ -682,9 +666,8 @@ namespace PRMLibrary
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 Index(); throw new Exception("projectionToCell method trying to find uncorrect index");
} }
return new Index(iRow, iCol); return new Index(iRow, iCol);
} }
private Coordinate cellToProjection(Index index, FunctionType functionType) private Coordinate cellToProjection(Index index, FunctionType functionType)
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="PRMLibrary.cs" /> <Compile Include="WindStressPRM.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
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
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
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\WindStressPRM\obj\Debug\PRMLibrary.dll
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\WindStressPRM\bin\Debug\PRMLibrary.dll
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\WindStressPRM\bin\Debug\PRMLibrary.pdb
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\WindStressPRM\obj\Debug\PRMLibrary.pdb
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment