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

- added solution for PRM Module

parent 6da733b7
Branches
No related tags found
No related merge requests found
Showing
with 151 additions and 49 deletions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassLibrary1
{
public class Class1
{
}
}
<?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>{CB94E8FC-2BCD-4115-9CF0-CF1DC028BFF4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ClassLibrary1</RootNamespace>
<AssemblyName>ClassLibrary1</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="Class1.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("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("4648c999-b08c-40ac-bc08-4118f810bbe5")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер построения
// Редакция
//
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
File added
......@@ -2,9 +2,14 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MES_Wind", "MES_Wind\MES_Wind.csproj", "{A303A9F5-8181-46B5-876C-D1BC99C3FFFD}"
ProjectSection(ProjectDependencies) = postProject
{599B5E9B-293A-4866-A50F-6BB7DC36A81C} = {599B5E9B-293A-4866-A50F-6BB7DC36A81C}
EndProjectSection
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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -15,8 +20,15 @@ Global
{A303A9F5-8181-46B5-876C-D1BC99C3FFFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A303A9F5-8181-46B5-876C-D1BC99C3FFFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A303A9F5-8181-46B5-876C-D1BC99C3FFFD}.Release|Any CPU.Build.0 = Release|Any CPU
{599B5E9B-293A-4866-A50F-6BB7DC36A81C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{599B5E9B-293A-4866-A50F-6BB7DC36A81C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{599B5E9B-293A-4866-A50F-6BB7DC36A81C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{599B5E9B-293A-4866-A50F-6BB7DC36A81C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{599B5E9B-293A-4866-A50F-6BB7DC36A81C} = {3BFCE63D-6DC2-4DC4-AAB9-72ECF2AC2EB5}
EndGlobalSection
EndGlobal
No preview for this file type
......@@ -111,7 +111,6 @@
<Compile Include="frmMain.Designer.cs">
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="PRM_wind.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmGraph.resx">
......@@ -140,6 +139,12 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PRMLibrary\PRMLibrary.csproj">
<Project>{599B5E9B-293A-4866-A50F-6BB7DC36A81C}</Project>
<Name>PRMLibrary</Name>
</ProjectReference>
</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.
......
No preview for this file type
No preview for this file type
No preview for this file type
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
File added
File added
......@@ -12,15 +12,11 @@ using DotSpatial.Topology;
using DotSpatial.Serialization;
using DotSpatial.Data;
using DotSpatial.Symbology;
using MES_Wind_prm;
namespace MES_Wind
{
public partial class frmMain : Form
{
[Export("Shell", typeof(ContainerControl))]
private static ContainerControl Shell;
#region "Control variables"
......@@ -51,20 +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<PRM_coordinate> DotspLinestringToPrm(LineString dtlinestr)
List<PRMLibrary.Coordinate> DotspLinestringToPrm(LineString dtlinestr)
{
List<PRM_coordinate> prmlinestring = new List<PRM_coordinate>();
List<PRMLibrary.Coordinate> prmlinestring = new List<PRMLibrary.Coordinate>();
IList<Coordinate> linepoints = dtlinestr.Coordinates;
foreach(Coordinate linepoint in linepoints)
{
PRM_coordinate point = new PRM_coordinate(linepoint.X,linepoint.Y);
PRMLibrary.Coordinate point = new PRMLibrary.Coordinate(linepoint.X, linepoint.Y);
prmlinestring.Add(point);
}
return prmlinestring;
}
PRM_coordinate DotspPointToPRM(IPoint ftpoint)
PRMLibrary.Coordinate DotspPointToPRM(IPoint ftpoint)
{
PRM_coordinate prpoint = new PRM_coordinate();
PRMLibrary.Coordinate prpoint = new PRMLibrary.Coordinate();
prpoint.X = ftpoint.X;
prpoint.Y = ftpoint.Y;
return prpoint;
......@@ -397,19 +393,18 @@ namespace MES_Wind
IFeatureSet pwpointsSet = pwstLayer.DataSet;
//Start to cast raster to PRM classes
// prognostic wind massives first
List<List<PRM_raster_cell_prognostic>> prog_wind= new List<List<PRM_raster_cell_prognostic>>();
PRM_coordinate dummy_coord = new PRM_coordinate();
List<List<PRMLibrary.PrognosticCell>> prog_wind = new List<List<PRMLibrary.PrognosticCell>>();
PRMLibrary.Coordinate dummy_coord = new PRMLibrary.Coordinate();
Coordinate dummy_rcoord = new Coordinate();
PRM_raster_cell_prognostic dummy_prognostic = new PRM_raster_cell_prognostic(dummy_coord,0,0);
PRMLibrary.PrognosticCell dummy_prognostic = new PRMLibrary.PrognosticCell(dummy_coord, 0, 0);
int rcount_prog = u_rasterLayer.DataSet.NumRows;
int ccount_prog = u_rasterLayer.DataSet.NumColumns;
for (int i =0; i< ccount_prog; i++)
{
List<PRM_raster_cell_prognostic> prog_wind_row = new List<PRM_raster_cell_prognostic>();
List<PRMLibrary.PrognosticCell> prog_wind_row = new List<PRMLibrary.PrognosticCell>();
for (int j =0; j< rcount_prog; j++ )
{
dummy_prognostic.velocityX = u_rasterLayer.DataSet.Value[j, i];
dummy_prognostic.velocityY = v_rasterLayer.DataSet.Value[j, i];
dummy_rcoord = u_rasterLayer.Bounds.CellCenter_ToProj(j,i);
......@@ -422,16 +417,16 @@ namespace MES_Wind
//prog_wind_row.Clear();
}
//Get cell info and Affine transform coefficients from prognostic wind rasters
PRM_cell_size prog_cell = new PRM_cell_size(u_rasterLayer.DataSet.CellWidth, u_rasterLayer.DataSet.CellHeight);
PRMLibrary.CellSize prog_cell = new PRMLibrary.CellSize(u_rasterLayer.DataSet.CellWidth, u_rasterLayer.DataSet.CellHeight);
double[] prog_aff = u_rasterLayer.Bounds.AffineCoefficients;
//Now we create climate raster class
List<List<PRM_raster_cell_climate>> clim_wind = new List<List<PRM_raster_cell_climate>>();
PRM_raster_cell_climate dummy_clim = new PRM_raster_cell_climate(dummy_coord, 0, 0, 0);
List<List<PRMLibrary.ClimateCell>> clim_wind = new List<List<PRMLibrary.ClimateCell>>();
PRMLibrary.ClimateCell dummy_clim = new PRMLibrary.ClimateCell(dummy_coord, 0, 0, 0);
int rcount_clim = clim5_rasterLayer.DataSet.NumRows;
int ccount_clim = clim5_rasterLayer.DataSet.NumColumns;
for (int i = 0; i < ccount_clim; i++)
{
List<PRM_raster_cell_climate> clim_wind_row = new List<PRM_raster_cell_climate>();
List<PRMLibrary.ClimateCell> clim_wind_row = new List<PRMLibrary.ClimateCell>();
for (int j = 0; j < rcount_clim; j++)
{
dummy_clim.wind5 = clim5_rasterLayer.DataSet.Value[j, i];
......@@ -447,13 +442,13 @@ namespace MES_Wind
//clim_wind_row.Clear();
}
//Get cell info and affine transform coeff from climate rasters
PRM_cell_size clim_cell = new PRM_cell_size(clim5_rasterLayer.DataSet.CellWidth, clim5_rasterLayer.DataSet.CellHeight);
PRMLibrary.CellSize clim_cell = new PRMLibrary.CellSize(clim5_rasterLayer.DataSet.CellWidth, clim5_rasterLayer.DataSet.CellHeight);
double[] clim_aff = clim5_rasterLayer.Bounds.AffineCoefficients;
// create PRM_line list to pass to PRM_wind from loaded line layer
List<PRM_Line> powerlinesToPRM = new List<PRM_Line>();
List<PRMLibrary.Powerline> powerlinesToPRM = new List<PRMLibrary.Powerline>();
foreach (IFeature feature in pwlineSet.Features)
{
PRM_Line dummyline = new PRM_Line();
PRMLibrary.Powerline dummyline = new PRMLibrary.Powerline();
DataRow featureData = feature.DataRow;
dummyline.identifier = feature.Fid;
dummyline.year = int.Parse(featureData["Year"].ToString());
......@@ -466,10 +461,10 @@ namespace MES_Wind
powerlinesToPRM.Add(dummyline);
}
//create PRM_station list to pass to PRM_wind from loaded point layer
List<PRM_Station> powerpointsToPRM = new List<PRM_Station>();
List<PRMLibrary.PowerStation> powerpointsToPRM = new List<PRMLibrary.PowerStation>();
foreach (IFeature ftpoint in pwpointsSet.Features)
{
PRM_Station dummystation = new PRM_Station();
PRMLibrary.PowerStation dummystation = new PRMLibrary.PowerStation();
DataRow featureData = ftpoint.DataRow;
dummystation.identifier = ftpoint.Fid;
dummystation.name = featureData["Name"].ToString();
......@@ -497,20 +492,18 @@ namespace MES_Wind
}
//Create a PRM_wind class and add all the properties from above
PRM_wind prmwind = new PRM_wind();
prmwind.powerlines = powerlinesToPRM;
prmwind.powerstations = powerpointsToPRM;
prmwind.prognostic_cells = prog_wind;
prmwind.prognostic_cellsize = prog_cell;
prmwind.prognostic_AffineCoefficients = prog_aff;
prmwind.climate_cells = clim_wind;
prmwind.climate_cellsize = clim_cell;
prmwind.climate_AffineCoefficients = clim_aff;
PRMLibrary.Module prmwind = new PRMLibrary.Module();
prmwind.powerLines = powerlinesToPRM;
prmwind.powerStations = powerpointsToPRM;
prmwind.prognosticCells = prog_wind;
prmwind.prognosticCellSize = prog_cell;
prmwind.prognosticAffineCoefficients = prog_aff;
prmwind.climateCells = clim_wind;
prmwind.climateCellSize = clim_cell;
prmwind.climateAffineCoefficients = clim_aff;
//Calculate which lines are broken
List<PRM_Line> prmBrokenLines = prmwind.brokenPowerLinesAfterCheck();
prmwind.mainpowercheck();
List<PRMLibrary.Powerline> prmBrokenLines = prmwind.brokenPowerLinesAfterCheck();
prmwind.checkPower();
// new FeatureSet for resulting broken powerlines
//IFeatureSet brklineSet = new FeatureSet(FeatureType.Line);
//DataTable dt = pwlineSet.DataTable;
......
No preview for this file type
......@@ -215,3 +215,5 @@ C:\gitlab_wind\MES_Wind\obj\Debug\MES_Wind.frmGraph.resources
C:\gitlab_wind\MES_Wind\obj\Debug\MES_Wind.frmMain.resources
C:\gitlab_wind\MES_Wind\obj\Debug\MES_Wind.Properties.Resources.resources
C:\gitlab_wind\MES_Wind\obj\Debug\MES_Wind.csproj.GenerateResource.Cache
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\MES_Wind\bin\Debug\PRMLibrary.dll
C:\Users\Geophyslab-laptop\Documents\MES_Wind2\MES_Wind\bin\Debug\PRMLibrary.pdb
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment