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

- fixed minor issues

- deleted PRMLib obj,bin files
parent 18a59799
No related branches found
No related tags found
No related merge requests found
...@@ -228,17 +228,16 @@ namespace MES_Wind ...@@ -228,17 +228,16 @@ 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(); PRMLibrary.Module prmwind = new PRMLibrary.Module();
prmwind.input.powerLines = powerlinesToPRM; PRMLibrary.Input input = new PRMLibrary.Input();
prmwind.input.powerStations = powerpointsToPRM; input.powerLines = powerlinesToPRM;
prmwind.input.prognosticCells = prognosticWind; input.powerStations = powerpointsToPRM;
prmwind.input.prognosticCellSize = progcellsize; input.prognosticCells = prognosticWind;
prmwind.input.prognosticAffineCoefficients = prog_aff; input.prognosticCellSize = progcellsize;
prmwind.input.climateCells = climWind; input.prognosticAffineCoefficients = prog_aff;
prmwind.input.climateCellSize = climCellsize; input.climateCells = climWind;
prmwind.input.climateAffineCoefficients = climAffinecoeffs; input.climateCellSize = climCellsize;
//Calculate which lines are broken input.climateAffineCoefficients = climAffinecoeffs;
List<PRMLibrary.Powerline> prmBrokenLines = prmwind.brokenPowerLinesAfterCheck(); PRMLibrary.Output output = prmwind.CheckPower(input);
prmwind.CheckPower();
// 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;
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PRMLibrary namespace PRMLibrary
{ {
...@@ -295,60 +293,66 @@ namespace PRMLibrary ...@@ -295,60 +293,66 @@ namespace PRMLibrary
/// <summary> /// <summary>
/// DTO for input /// DTO for input
/// </summary> /// </summary>
public class InputDTO public class Input
{ {
/// <summary> /// <summary>
/// prognistic raster info /// prognistic raster info
/// </summary> /// </summary>
public List<List<PrognosticCell>> prognosticCells; public List<List<PrognosticCell>> prognosticCells {get; set;}
/// <summary> /// <summary>
/// prognostic raster cell info /// prognostic raster cell info
/// </summary> /// </summary>
public CellSize prognosticCellSize; public CellSize prognosticCellSize { get; set; }
/// <summary> /// <summary>
/// affine coefficients from prognostic raster projections /// affine coefficients from prognostic raster projections
/// </summary> /// </summary>
public double[] prognosticAffineCoefficients; public double[] prognosticAffineCoefficients { get; set; }
/// <summary> /// <summary>
/// climate raster array /// climate raster array
/// </summary> /// </summary>
public List<List<ClimateCell>> climateCells; public List<List<ClimateCell>> climateCells { get; set; }
/// <summary> /// <summary>
/// climate raster cell info /// climate raster cell info
/// </summary> /// </summary>
public CellSize climateCellSize; public CellSize climateCellSize { get; set; }
/// <summary> /// <summary>
/// affine coefficients from climate raster projection /// affine coefficients from climate raster projection
/// </summary> /// </summary>
public double[] climateAffineCoefficients; public double[] climateAffineCoefficients { get; set; }
/// <summary> /// <summary>
/// lines list /// lines list
/// </summary> /// </summary>
public List<Powerline> powerLines; public List<Powerline> powerLines { get; set; }
/// <summary> /// <summary>
/// stations/poles list /// stations/poles list
/// </summary> /// </summary>
public List<PowerStation> powerStations; public List<PowerStation> powerStations { get; set; }
/// <summary> /// <summary>
/// maximum distance for line segment /// maximum distance for line segment, meters
/// </summary> /// </summary>
public double dist_threshold = 500; public double dist_threshold
{
get
{
return 500;
}
}
} }
/// <summary> /// <summary>
/// Output DTO /// Output
/// </summary> /// </summary>
public class OutputDTO public class Output
{ {
/// <summary> /// <summary>
/// stations list without power /// stations list without power
/// </summary> /// </summary>
public List<PowerStation> disabledStations = new List<PowerStation>(); public List<PowerStation> disabledStations { get; set; }
/// <summary> /// <summary>
/// broken lines list /// broken lines list
/// </summary> /// </summary>
public List<Powerline> disabledLines = new List<Powerline>(); public List<Powerline> disabledLines { get; set; }
} }
/// <summary> /// <summary>
/// main calculations class /// main calculations class
...@@ -358,40 +362,45 @@ namespace PRMLibrary ...@@ -358,40 +362,45 @@ namespace PRMLibrary
/// <summary> /// <summary>
/// Input Data /// Input Data
/// </summary> /// </summary>
public InputDTO input; private Input input;
/// <summary>
/// Output Data
/// </summary>
public OutputDTO output;
/// <summary> /// <summary>
/// Main function for power graph algorithm /// Main function for power graph algorithm
/// </summary> /// </summary>
public void CheckPower() public Output CheckPower(Input input)
{ {
this.input = input;
//Calculate which lines are broken
List<PRMLibrary.Powerline> prmBrokenLines = brokenPowerLinesAfterCheck();
//get the graph //get the graph
PreparingPowerItems(); PreparingPowerItems();
//start from source points //start from source points
foreach (PowerStation pwstation in input.powerStations) foreach (PowerStation pwstation in input.powerStations)
{ {
if (pwstation.issource) { if (pwstation.issource)
{
CheckPowerPointsForStation(pwstation); CheckPowerPointsForStation(pwstation);
} }
} }
//fill output //fill output
Output output = new Output();
output.disabledStations = new List<PowerStation>();
output.disabledLines = new List<Powerline>();
foreach (Powerline line in input.powerLines) foreach (Powerline line in input.powerLines)
{ {
if (line.isbroken) { if (line.isbroken)
{
output.disabledLines.Add(line); output.disabledLines.Add(line);
} }
} }
foreach (PowerStation powerStation in input.powerStations) foreach (PowerStation powerStation in input.powerStations)
{ {
if (!powerStation.ison && !(powerStation.type.ToUpperInvariant().Trim() == "POLE")){ if (!powerStation.ison && !(powerStation.type.ToUpperInvariant().Trim() == "POLE"))
{
output.disabledStations.Add(powerStation); output.disabledStations.Add(powerStation);
} }
} }
return; return output;
} }
/// <summary> /// <summary>
/// recursive search function for power graph /// recursive search function for power graph
...@@ -475,7 +484,7 @@ namespace PRMLibrary ...@@ -475,7 +484,7 @@ namespace PRMLibrary
/// function to chec if powerline is broken by wind /// function to chec if powerline is broken by wind
/// </summary> /// </summary>
/// <returns>list of broken powerlines</returns> /// <returns>list of broken powerlines</returns>
public List<Powerline> brokenPowerLinesAfterCheck() private List<Powerline> brokenPowerLinesAfterCheck()
{ {
List<Powerline> brokenLines = new List<Powerline>(); List<Powerline> brokenLines = new List<Powerline>();
// actually there are curves in powerLines // actually there are curves in powerLines
...@@ -618,7 +627,7 @@ namespace PRMLibrary ...@@ -618,7 +627,7 @@ namespace PRMLibrary
return result; return result;
} }
double[] affineCoefficients(FunctionType functionType) private double[] affineCoefficients(FunctionType functionType)
{ {
switch (functionType) switch (functionType)
{ {
...@@ -641,7 +650,7 @@ namespace PRMLibrary ...@@ -641,7 +650,7 @@ namespace PRMLibrary
// 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.
Index projectionToCell(Coordinate coordinate, FunctionType functionType) private Index projectionToCell(Coordinate coordinate, FunctionType functionType)
{ {
double[] c = affineCoefficients(functionType); double[] c = affineCoefficients(functionType);
double rw, cl; double rw, cl;
...@@ -675,7 +684,7 @@ namespace PRMLibrary ...@@ -675,7 +684,7 @@ namespace PRMLibrary
return new Index(iRow, iCol); return new Index(iRow, iCol);
} }
Coordinate cellToProjection(Index index, FunctionType functionType) private Coordinate cellToProjection(Index index, FunctionType functionType)
{ {
switch (functionType) switch (functionType)
{ {
...@@ -717,7 +726,7 @@ namespace PRMLibrary ...@@ -717,7 +726,7 @@ namespace PRMLibrary
return 0; return 0;
} }
double valueForFunction(FunctionType functionType, Index index) private double valueForFunction(FunctionType functionType, Index index)
{ {
switch (functionType) switch (functionType)
{ {
...@@ -747,7 +756,7 @@ namespace PRMLibrary ...@@ -747,7 +756,7 @@ namespace PRMLibrary
return 0; return 0;
} }
CellSize cellSizeForFunction(FunctionType functionType) private CellSize cellSizeForFunction(FunctionType functionType)
{ {
switch (functionType) switch (functionType)
{ {
...@@ -768,7 +777,7 @@ namespace PRMLibrary ...@@ -768,7 +777,7 @@ namespace PRMLibrary
throw new Exception("There is no cell size"); throw new Exception("There is no cell size");
} }
double interpol(Coordinate coords, FunctionType functionType) private 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
......
...@@ -33,11 +33,9 @@ ...@@ -33,11 +33,9 @@
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="PRMLibrary.cs" /> <Compile Include="PRMLibrary.cs" />
......
File deleted
File deleted
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 deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment