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
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3BFCE63D-6DC2-4DC4-AAB9-72ECF2AC2EB5}"
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
......@@ -127,9 +127,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PRMLibrary\PRMLibrary.csproj">
<ProjectReference Include="..\WindStressPRM\WindStressPRM.csproj">
<Project>{599B5E9B-293A-4866-A50F-6BB7DC36A81C}</Project>
<Name>PRMLibrary</Name>
<Name>WindStressPRM</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -47,22 +47,20 @@ namespace MES_Wind
/// <returns>List of booleans with coordinates if any of them are true, line is broken</returns>
/// <remarks></remarks>
#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;
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);
}
return prmlinestring;
}
PRMLibrary.Coordinate DotspPointToPRM(IPoint ftpoint)
WindStressPRM.Coordinate DotspPointToPRM(IPoint ftpoint)
{
PRMLibrary.Coordinate prpoint = new PRMLibrary.Coordinate();
prpoint.X = ftpoint.X;
prpoint.Y = ftpoint.Y;
WindStressPRM.Coordinate prpoint = new WindStressPRM.Coordinate(ftpoint.X, ftpoint.Y);
return prpoint;
}
......@@ -133,57 +131,50 @@ namespace MES_Wind
IFeatureSet pwpointsSet = pwstLayer.DataSet;
//Start to cast raster to PRM classes
// 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 ccountPrognostic = uRasterLayer.DataSet.NumColumns;
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++ )
{
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);
PRMLibrary.Coordinate cellCoords =new PRMLibrary.Coordinate(dummyRCoords.X,dummyRCoords.Y);
dummyPrognosticCell.coords = cellCoords;
Coordinate dummyRCoords = uRasterLayer.Bounds.CellCenter_ToProj(j,i);
WindStressPRM.Coordinate cellCoords =new WindStressPRM.Coordinate(dummyRCoords.X,dummyRCoords.Y);
WindStressPRM.PrognosticCell dummyPrognosticCell = new WindStressPRM.PrognosticCell(cellCoords, uRasterLayer.DataSet.Value[j, i], vRasterLayer.DataSet.Value[j, i]);
progWindRow.Add(dummyPrognosticCell);
}
prognosticWind.Add(progWindRow);
//prog_wind_row.Clear();
}
//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;
//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 columnCountClim = clim5RasterLayer.DataSet.NumColumns;
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++)
{
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);
PRMLibrary.Coordinate dummyClimCoords = new PRMLibrary.Coordinate(dummyCellCoords.X,dummyCellCoords.Y);
dummyClim.coords = dummyClimCoords;
WindStressPRM.Coordinate dummyClimCoords = new WindStressPRM.Coordinate(dummyCellCoords.X,dummyCellCoords.Y);
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);
}
climWind.Add(climWindRow);
//clim_wind_row.Clear();
}
//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;
// 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)
{
PRMLibrary.Powerline dummyline = new PRMLibrary.Powerline();
WindStressPRM.Powerline dummyline = new WindStressPRM.Powerline();
DataRow featureData = feature.DataRow;
dummyline.identifier = feature.Fid;
dummyline.year = int.Parse(featureData["Year"].ToString());
......@@ -196,10 +187,10 @@ namespace MES_Wind
powerlinesToPRM.Add(dummyline);
}
//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)
{
PRMLibrary.PowerStation dummystation = new PRMLibrary.PowerStation();
WindStressPRM.PowerStation dummystation = new WindStressPRM.PowerStation();
DataRow featureData = featurepoint.DataRow;
dummystation.identifier = featurepoint.Fid;
dummystation.name = featureData["Name"].ToString();
......@@ -227,8 +218,8 @@ namespace MES_Wind
}
//Create a PRM_wind class and add all the properties from above
PRMLibrary.Module prmwind = new PRMLibrary.Module();
PRMLibrary.Input input = new PRMLibrary.Input();
WindStressPRM.StressPowerChecker prmwind = new WindStressPRM.StressPowerChecker();
WindStressPRM.Input input = new WindStressPRM.Input();
input.powerLines = powerlinesToPRM;
input.powerStations = powerpointsToPRM;
input.prognosticCells = prognosticWind;
......@@ -237,7 +228,7 @@ namespace MES_Wind
input.climateCells = climWind;
input.climateCellSize = climCellsize;
input.climateAffineCoefficients = climAffinecoeffs;
PRMLibrary.Output output = prmwind.CheckPower(input);
WindStressPRM.Output output = prmwind.CheckPower(input);
// new FeatureSet for resulting broken powerlines
//IFeatureSet brklineSet = new FeatureSet(FeatureType.Line);
//DataTable dt = pwlineSet.DataTable;
......
......@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("PRMLibrary")]
[assembly: AssemblyTitle("WindStressPRM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PRMLibrary")]
[assembly: AssemblyProduct("WindStressPRM")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
using System;
using System.Collections.Generic;
namespace PRMLibrary
namespace WindStressPRM
{
/// <summary>
/// Index class for raster lists in list
......@@ -29,10 +29,6 @@ namespace PRMLibrary
this.Row = Row;
this.Col = Col;
}
/// <summary>
/// default constructor
/// </summary>
public Index() : this(0, 0) { }
}
/// <summary>
/// Coordinate pair
......@@ -57,10 +53,6 @@ namespace PRMLibrary
this.X = X;
this.Y = Y;
}
/// <summary>
/// default constructor
/// </summary>
public Coordinate() : this(0, 0) { }
}
/// <summary>
/// Cell obj for regular prognostic wind field
......@@ -91,10 +83,6 @@ namespace PRMLibrary
this.velocityX = vX;
this.velocityY = vY;
}
/// <summary>
/// default constructor
/// </summary>
public PrognosticCell() : this(new Coordinate(), 0, 0) { }
}
/// <summary>
/// Cell obj for climate wind regular data
......@@ -131,10 +119,6 @@ namespace PRMLibrary
this.wind10 = w10;
this.wind15 = w15;
}
/// <summary>
/// default constructor
/// </summary>
public ClimateCell() : this(new Coordinate(), 0, 0, 0) { }
}
/// <summary>
/// Cell Size parameters
......@@ -282,7 +266,7 @@ namespace PRMLibrary
/// <summary>
/// default constructor
/// </summary>
public PowerStation() : this(new Coordinate(), -1, "", 0, "", false) { }
public PowerStation() : this(new Coordinate(0, 0), -1, "", 0, "", false) { }
}
enum FunctionType
......@@ -360,7 +344,7 @@ namespace PRMLibrary
/// <summary>
/// main calculations class
/// </summary>
public class Module
public class StressPowerChecker
{
/// <summary>
/// Input Data
......@@ -374,7 +358,7 @@ namespace PRMLibrary
{
this.input = input;
//Calculate which lines are broken
List<PRMLibrary.Powerline> prmBrokenLines = brokenPowerLinesAfterCheck();
List<WindStressPRM.Powerline> prmBrokenLines = brokenPowerLinesAfterCheck();
//get the graph
PreparingPowerItems();
//start from source points
......@@ -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 distpropD = distance / input.dist_threshold;
List<Coordinate> pointlist = new List<Coordinate>();
Coordinate midpoint = new Coordinate();
Coordinate midpoint = new Coordinate(0, 0);
int distpropI = Convert.ToInt32(distpropD);
if (distpropI > 1)
{
......@@ -682,9 +666,8 @@ namespace PRMLibrary
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);
}
private Coordinate cellToProjection(Index index, FunctionType functionType)
......
......@@ -35,7 +35,7 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="PRMLibrary.cs" />
<Compile Include="WindStressPRM.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<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.
Finish editing this message first!
Please register or to comment