diff --git a/ClassLibrary1/Class1.cs b/ClassLibrary1/Class1.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4d41fc787ece3815d0d30d2add2c12dfcd7fce9a
--- /dev/null
+++ b/ClassLibrary1/Class1.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace ClassLibrary1
+{
+    public class Class1
+    {
+    }
+}
diff --git a/ClassLibrary1/ClassLibrary1.csproj b/ClassLibrary1/ClassLibrary1.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..641a600f52e1d547c4b1a2780c97b67d33f24730
--- /dev/null
+++ b/ClassLibrary1/ClassLibrary1.csproj
@@ -0,0 +1,54 @@
+<?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
diff --git a/ClassLibrary1/Properties/AssemblyInfo.cs b/ClassLibrary1/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ec7421af3d57dfc35bc13377487676af4cfac0e0
--- /dev/null
+++ b/ClassLibrary1/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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")]
diff --git a/ClassLibrary1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ClassLibrary1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000000000000000000000000000000000000..d34001c35816722e14be36cae09e2fa1f16df975
Binary files /dev/null and b/ClassLibrary1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/MES_Wind.sln b/MES_Wind.sln
index 4b5b5d8028083fefd773b6948d1280d59c2fb654..411c4638ff2b6b676979136975266046e9e1c1d3 100644
--- a/MES_Wind.sln
+++ b/MES_Wind.sln
@@ -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
diff --git a/MES_Wind.suo b/MES_Wind.suo
index 963ad17b0195b271a5473314469fe0a4f425d36b..75cc2721ac11130d32cc7585eb74f56338631cb5 100644
Binary files a/MES_Wind.suo and b/MES_Wind.suo differ
diff --git a/MES_Wind/MES_Wind.csproj b/MES_Wind/MES_Wind.csproj
index a5ce0cb1ad02c42c75157ac2b90cfd2f78a1142d..6dcf6610abaf9728abb86b648cc5ca7be92112ec 100644
--- a/MES_Wind/MES_Wind.csproj
+++ b/MES_Wind/MES_Wind.csproj
@@ -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.
diff --git a/MES_Wind/bin/Debug/MES_Wind.exe b/MES_Wind/bin/Debug/MES_Wind.exe
index e1e304d166e070462234a78bc400d3c20612af1d..a7963400861fbafd40af881b92908575887349d0 100644
Binary files a/MES_Wind/bin/Debug/MES_Wind.exe and b/MES_Wind/bin/Debug/MES_Wind.exe differ
diff --git a/MES_Wind/bin/Debug/MES_Wind.pdb b/MES_Wind/bin/Debug/MES_Wind.pdb
index 7da2754ece99210fdfa36277afacc654f932c8d8..4e07adf3b75636e0e087d217152c977a1006674e 100644
Binary files a/MES_Wind/bin/Debug/MES_Wind.pdb and b/MES_Wind/bin/Debug/MES_Wind.pdb differ
diff --git a/MES_Wind/bin/Debug/MES_Wind.vshost.exe b/MES_Wind/bin/Debug/MES_Wind.vshost.exe
index 8f90da475a8319aa76856e089ccc9e517eeb134a..6b241bcd65a4769673693b96129ef13ae25e17ec 100644
Binary files a/MES_Wind/bin/Debug/MES_Wind.vshost.exe and b/MES_Wind/bin/Debug/MES_Wind.vshost.exe differ
diff --git a/MES_Wind/bin/Debug/MES_Wind.vshost.exe.manifest b/MES_Wind/bin/Debug/MES_Wind.vshost.exe.manifest
deleted file mode 100644
index 061c9ca950d0e8bb952c52799fb401a6614ad640..0000000000000000000000000000000000000000
--- a/MES_Wind/bin/Debug/MES_Wind.vshost.exe.manifest
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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>
diff --git a/MES_Wind/bin/Debug/PRMLibrary.dll b/MES_Wind/bin/Debug/PRMLibrary.dll
new file mode 100644
index 0000000000000000000000000000000000000000..b38bcda0e7828ef5fbfeb94416c65af3dd8a0042
Binary files /dev/null and b/MES_Wind/bin/Debug/PRMLibrary.dll differ
diff --git a/MES_Wind/bin/Debug/PRMLibrary.pdb b/MES_Wind/bin/Debug/PRMLibrary.pdb
new file mode 100644
index 0000000000000000000000000000000000000000..33166b797f14ccbed1edfb7667d1b71dc292d0a8
Binary files /dev/null and b/MES_Wind/bin/Debug/PRMLibrary.pdb differ
diff --git a/MES_Wind/frmMain.cs b/MES_Wind/frmMain.cs
index 740490ec6ef605d4fb3e5ec074addbcb1ec4a503..d7e7aeaa05a146eb09122c97526d809c92380eb0 100644
--- a/MES_Wind/frmMain.cs
+++ b/MES_Wind/frmMain.cs
@@ -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;
diff --git a/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index 15af49b1dfb60189d9d6571b791bd6be84bdd821..4893b6d7a46dd648e1e820a13e7fa977bfde9239 100644
Binary files a/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/MES_Wind/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/MES_Wind/obj/Debug/MES_Wind.csproj.FileListAbsolute.txt b/MES_Wind/obj/Debug/MES_Wind.csproj.FileListAbsolute.txt
index 8a59effe28ee788161d819f34c3b802b85b6051a..cf9c8deb6cd874db2b2182b415615dba9e34e05c 100644
--- a/MES_Wind/obj/Debug/MES_Wind.csproj.FileListAbsolute.txt
+++ b/MES_Wind/obj/Debug/MES_Wind.csproj.FileListAbsolute.txt
@@ -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
diff --git a/MES_Wind/obj/Debug/MES_Wind.csproj.GenerateResource.Cache b/MES_Wind/obj/Debug/MES_Wind.csproj.GenerateResource.Cache
index c68480ca80cf3ae607999374b8a3ce6d1d4fe5c1..3f373bbace73c90f3ad31154deb02bff74781c87 100644
Binary files a/MES_Wind/obj/Debug/MES_Wind.csproj.GenerateResource.Cache and b/MES_Wind/obj/Debug/MES_Wind.csproj.GenerateResource.Cache differ
diff --git a/MES_Wind/obj/Debug/MES_Wind.csprojResolveAssemblyReference.cache b/MES_Wind/obj/Debug/MES_Wind.csprojResolveAssemblyReference.cache
index 1d0fb07dceec79f9379efd70c284457e0cda4277..92ad0c0ca9d7e6ef05d216e0c4b3a16b1cc71476 100644
Binary files a/MES_Wind/obj/Debug/MES_Wind.csprojResolveAssemblyReference.cache and b/MES_Wind/obj/Debug/MES_Wind.csprojResolveAssemblyReference.cache differ
diff --git a/MES_Wind/obj/Debug/MES_Wind.exe b/MES_Wind/obj/Debug/MES_Wind.exe
index e1e304d166e070462234a78bc400d3c20612af1d..a7963400861fbafd40af881b92908575887349d0 100644
Binary files a/MES_Wind/obj/Debug/MES_Wind.exe and b/MES_Wind/obj/Debug/MES_Wind.exe differ
diff --git a/MES_Wind/obj/Debug/MES_Wind.pdb b/MES_Wind/obj/Debug/MES_Wind.pdb
index 7da2754ece99210fdfa36277afacc654f932c8d8..4e07adf3b75636e0e087d217152c977a1006674e 100644
Binary files a/MES_Wind/obj/Debug/MES_Wind.pdb and b/MES_Wind/obj/Debug/MES_Wind.pdb differ
diff --git a/MES_Wind/PRM_wind.cs b/PRMLibrary/PRMLibrary.cs
similarity index 54%
rename from MES_Wind/PRM_wind.cs
rename to PRMLibrary/PRMLibrary.cs
index 9fd17e205b50a8dc4b579c3d95f8db75175460e3..aebeb3ea991bf9754faa02dbd3e15af2b3f51625 100644
--- a/MES_Wind/PRM_wind.cs
+++ b/PRMLibrary/PRMLibrary.cs
@@ -2,53 +2,52 @@
 using System.Collections.Generic;
 using System.Linq;
 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 Col;
-        public PRM_index(int Row, int Col)
+        public Index(int Row, int Col)
         {
             this.Row = Row;
             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 Y;
-        
-        public PRM_coordinate(double X, double Y)
+
+        public Coordinate(double X, double Y)
         {
             this.X = X;
             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 velocityY;
-        public PRM_coordinate coords;
-        public PRM_raster_cell_prognostic(PRM_coordinate coord, double vX, double vY)
+        public Coordinate coords;
+        public PrognosticCell(Coordinate coord, double vX, double vY)
         {
             this.coords = coord;
             this.velocityX = vX;
             this.velocityY = vY;
         }
     }
-    public class PRM_raster_cell_climate
+    public class ClimateCell
     {
         public double wind5;
         public double wind10;
         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.wind5 = w5;
@@ -56,31 +55,31 @@ namespace MES_Wind_prm
             this.wind15 = w15;
         }
     }
-    public struct PRM_cell_size
+    public struct CellSize
     {
         public double width;
         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;
         }
 
     }
-    public class PRM_Line
+    public class Powerline
     {
         public int identifier { get; set; }
         public int year;
         public double height;
         public int power;
-        public List<PRM_coordinate> coords { get; set; }
+        public List<Coordinate> coords { get; set; }
         public int pointFromID;
         public int pointToID;
         public bool isbroken;
         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.identifier = id;
@@ -92,19 +91,19 @@ namespace MES_Wind_prm
             this.pointFromID = fromID;
             this.pointToID = toID;
         }
-        public PRM_Line() : base() { }
+        public Powerline() : base() { }
     }
-    public class PRM_Station
+    public class PowerStation
     {
         public int identifier;
-        public PRM_coordinate coords;
+        public Coordinate coords;
         public string name;
         public int power;
         public string type;
         public bool issource;
         public bool ison;
-        public List<PRM_Line> linelist;
-        public PRM_Station(PRM_coordinate crds, int id,string stname, int stpower, string sttype, bool issource, bool ison)
+        public List<Powerline> linelist;
+        public PowerStation(Coordinate crds, int id, string stname, int stpower, string sttype, bool issource, bool ison)
         {
             this.coords = crds;
             this.identifier = id;
@@ -114,148 +113,149 @@ namespace MES_Wind_prm
             this.issource = issource;
             this.ison = ison;
         }
-        public PRM_Station() : base() { }
-        
+        public PowerStation() : base() { }
     }
 
-    enum PRMFunctionType
-    { 
-        PRMFunctionVelocityX = 0,
-        PRMFunctionVelocityY = 1,
-        PRMFunctionClimate5 = 2,
-        PRMFunctionClimate10 = 3,
-        PRMFunctionClimate15 = 4
+    enum FunctionType
+    {
+        FunctionVelocityX = 0,
+        FunctionVelocityY = 1,
+        FunctionClimate5 = 2,
+        FunctionClimate10 = 3,
+        FunctionClimate15 = 4
     }
 
-   public class PRM_wind
+    public class Module
     {
         //prognistic raster info
-        public List<List<PRM_raster_cell_prognostic>> prognostic_cells;
-        public PRM_cell_size prognostic_cellsize;
-        public double[] prognostic_AffineCoefficients;
+        public List<List<PrognosticCell>> prognosticCells;
+        public CellSize prognosticCellSize;
+        public double[] prognosticAffineCoefficients;
 
         //climate raster info
-        public List<List<PRM_raster_cell_climate>> climate_cells;
-        public PRM_cell_size climate_cellsize;
-        public double[] climate_AffineCoefficients;
+        public List<List<ClimateCell>> climateCells;
+        public CellSize climateCellSize;
+        public double[] climateAffineCoefficients;
 
         //lines collection
-        public List<PRM_Line> powerlines;
+        public List<Powerline> powerLines;
         //station collection
-        public List<PRM_Station> powerstations;
+        public List<PowerStation> powerStations;
         //broken stations and lines
-        public List<PRM_Station> disabledstations = new List<PRM_Station>();
-        public List<PRM_Line> disabledlines = new List<PRM_Line>();
-        #region "control parameters"
-        public double dist_threshold=500;
-        #endregion
+        public List<PowerStation> disabledStations = new List<PowerStation>();
+        public List<Powerline> disabledLines = new List<Powerline>();
+       
+        public double dist_threshold = 500;
 
         //Main function for power graph algorithm
-        public void mainpowercheck()
+        public void checkPower()
         {
             //get the graph
-            Powerprep();
+            PreparingPowerItems();
             //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"))
-                { disabledstations.Add(pw); }
+                if (!powerStation.ison && !(powerStation.type.ToUpperInvariant().Trim() == "POLE")){
+                    disabledStations.Add(powerStation);
+                }
             }
             return;
         }
         //search function for power graph
-        public void Chekpwpoints(PRM_Station sourcepoint)
+        private void CheckPowerPointsForStation(PowerStation sourcepoint)
         {
             if (!sourcepoint.ison)
             {
-                MessageBox.Show("Checkpwpoints is called from disabled sourcepoint");
+                throw new Exception("CheckPowerPointsForStation is called from disabled sourcepoint");
                 return;
             }
- 
-
-            
-                // if the point is not a pole  - i.e. we know 
-                // it can redistribute power within connected lines
-                // we turn it ON if any of the  connected lines are powered
-                foreach (PRM_Line line in sourcepoint.linelist)
+            // if the point is not a pole  - i.e. we know 
+            // it can redistribute power within connected lines
+            // we turn it ON if any of the  connected lines are powered
+            foreach (Powerline line in sourcepoint.linelist)
+            {
+                if (!line.isbroken && !line.ison)
                 {
-                    if (!line.isbroken && !line.ison)
+                    line.ison = true;
+                    foreach (PowerStation powerStation in powerStations)
                     {
-                        line.ison = true;
-                        foreach (PRM_Station pwst in powerstations)
+                        if (powerStation.identifier != sourcepoint.identifier && (powerStation.identifier == line.pointFromID || powerStation.identifier == line.pointToID))
                         {
-                            if (pwst.identifier != sourcepoint.identifier && (pwst.identifier == line.pointFromID || pwst.identifier == line.pointToID))
-                            {
-                            if (!(sourcepoint.type.Trim().ToUpperInvariant() == "POLE"))
-                            {
-                                pwst.ison = true;
-                                Chekpwpoints(pwst);
+                            if (!(sourcepoint.type.Trim().ToUpperInvariant() == "POLE")) {
+                                powerStation.ison = true;
+                                CheckPowerPointsForStation(powerStation);
                             }
-                            else
-                            {
+                            else {
                                 // 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
-                                bool polcheck = false;
-                                foreach (PRM_Line poline in pwst.linelist)
+                                bool powerLineCheck = false;
+                                foreach (Powerline powerline in powerStation.linelist)
                                 {
-                                    if (poline.isbroken) { polcheck = true; }
-
+                                    if (powerline.isbroken) {
+                                        powerLineCheck = true; 
+                                    }
                                 }
-                                if (!polcheck)
+                                if (!powerLineCheck)
                                 {
-                                    pwst.ison = true;
-                                    Chekpwpoints(pwst);
+                                    powerStation.ison = true;
+                                    CheckPowerPointsForStation(powerStation);
                                 }
                             }
-                            }
                         }
                     }
-                    //else we have broken line or already switched ON powerpoint
                 }
-            
+                //else we have broken line or already switched ON powerpoint
+            }
+
         }
-        //preparing powerstations  and lists of lines for them to get a graph-like structure
-        public void Powerprep()
+        //preparing powerstations and lists of lines for them to get a graph-like structure
+        private void PreparingPowerItems()
         {
             //First we make sure that all the sources are ON
             //and all non sources are OFF
-            foreach (PRM_Station pwstat in powerstations)
+            foreach (PowerStation powerStation in powerStations)
             {
-                if (pwstat.issource == true)
-                { pwstat.ison = true; }
-                else { pwstat.ison = false; }
+                if (powerStation.issource == true) {
+                    powerStation.ison = true; 
+                }
+                else {
+                    powerStation.ison = false; 
+                }
                 // for each power station we create a list of powerlines it is attached to
-                List<PRM_Line> lines = new List<PRM_Line>();
-                
-                foreach (PRM_Line line in powerlines)
+                List<Powerline> lines = new List<Powerline>();
+
+                foreach (Powerline line in powerLines)
                 {
-                    
                     //we also switch OFF all lines
                     line.ison = false;
-                    if (line.pointFromID == pwstat.identifier || line.pointToID == pwstat.identifier)
-                    {
+                    if (line.pointFromID == powerStation.identifier || line.pointToID == powerStation.identifier) {
                         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>();
-            foreach (PRM_Line curve in powerlines)
+            List<Powerline> brklines = new List<Powerline>();
+            // actually there are curves in powerLines
+            foreach (Powerline powerCurve in powerLines)
             {
                 // get coordinates list
-                List<PRM_coordinate> points = curve.coords;
+                List<Coordinate> points = powerCurve.coords;
 
                 List<bool> checkList = new List<bool>();
                 // cycle throw all points in line
@@ -265,40 +265,38 @@ namespace MES_Wind_prm
                     double y1 = points[i - 1].Y;
                     double x2 = points[i].X;
                     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);
                 }
                 foreach (bool chkpnt in checkList)
                 {
                     if (chkpnt == true)
                     {
-                        curve.isbroken = true;
+                        powerCurve.isbroken = true;
                     }
                 }
-                if (curve.isbroken)
+                if (powerCurve.isbroken)
                 {
-                    brklines.Add(curve);
+                    brklines.Add(powerCurve);
                 }
             }
 
             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 distpropD = distance / dist_threshold;
-            List<PRM_coordinate> pointlist = new List<PRM_coordinate>();
-            PRM_coordinate midpoint = new PRM_coordinate();
+            List<Coordinate> pointlist = new List<Coordinate>();
+            Coordinate midpoint = new Coordinate();
             int distpropI = Convert.ToInt32(distpropD);
             if (distpropI > 1)
             {
                 double constXdiff = (coord2.X - coord1.X) / distpropI;
                 double constYdiff = (coord2.Y - coord1.Y) / distpropI;
-                PRM_coordinate subCoord1 = new PRM_coordinate(coord1.X, coord1.Y);
-                PRM_coordinate subCoord2 = new PRM_coordinate(coord1.X + constXdiff, coord1.Y + constXdiff);
-
-
+                Coordinate subCoord1 = new Coordinate(coord1.X, coord1.Y);
+                Coordinate subCoord2 = new Coordinate(coord1.X + constXdiff, coord1.Y + constXdiff);
                 for (int j = 0; j < distpropI; j++)
                 {
                     if (j == 0)
@@ -322,27 +320,30 @@ namespace MES_Wind_prm
             }
             else
             {
-                midpoint.X = (coord1.X + coord2.X)/2;
-                midpoint.Y = (coord1.Y + coord2.Y)/2;
+                midpoint.X = (coord1.X + coord2.X) / 2;
+                midpoint.Y = (coord1.Y + coord2.Y) / 2;
                 pointlist.Add(midpoint);
             }
-                PRMFunctionType climateType;
-                //PRMFunctionType climateType = useClimate10 ? PRMFunctionType.PRMFunctionClimate10 : PRMFunctionType.PRMFunctionClimate5;
-                if (power > 5 && power < 330)
-                {
-                    climateType = PRMFunctionType.PRMFunctionClimate10;
+            FunctionType climateType;
+            if (power > 5 && power < 330)
+            {
+                climateType = FunctionType.FunctionClimate10;
+            }
+            else
+            {
+                if (power <= 5) { 
+                    climateType = FunctionType.FunctionClimate5; 
                 }
-                else
-                {
-                    if (power <= 5) { climateType = PRMFunctionType.PRMFunctionClimate5; }
-                    else { climateType = PRMFunctionType.PRMFunctionClimate15; }
+                else { 
+                    climateType = FunctionType.FunctionClimate15;
                 }
+            }
             List<bool> checkbool = new List<bool>();
-            foreach (PRM_coordinate coords in pointlist)
+            foreach (Coordinate coords in pointlist)
             {
                 bool res = false;
-                double uwind = interpol(coords, PRMFunctionType.PRMFunctionVelocityX);
-                double vwind = interpol(coords, PRMFunctionType.PRMFunctionVelocityY);
+                double uwind = interpol(coords, FunctionType.FunctionVelocityX);
+                double vwind = interpol(coords, FunctionType.FunctionVelocityY);
                 double climwind = interpol(coords, climateType);
                 double umod = Math.Sqrt(uwind * uwind + vwind * vwind); ;
                 double angleline = Math.Atan2((coord2.Y - coord1.Y), (coord2.X - coord1.X));
@@ -366,9 +367,9 @@ namespace MES_Wind_prm
                     if (Ppr >= Pcl)
                     {
                         // here line is broken
-                        res=true;
+                        res = true;
                     }
-                    
+
                 }
                 checkbool.Add(res);
             }
@@ -380,20 +381,20 @@ namespace MES_Wind_prm
             return result;
         }
 
-        double[] affineCoefficients(PRMFunctionType functionType)
+        double[] affineCoefficients(FunctionType functionType)
         {
             switch (functionType)
             {
-                case PRMFunctionType.PRMFunctionVelocityX:
-                case PRMFunctionType.PRMFunctionVelocityY:
+                case FunctionType.FunctionVelocityX:
+                case FunctionType.FunctionVelocityY:
                     {
-                        return prognostic_AffineCoefficients;
+                        return prognosticAffineCoefficients;
                     }
-                case PRMFunctionType.PRMFunctionClimate5:
-                case PRMFunctionType.PRMFunctionClimate10:
-                case PRMFunctionType.PRMFunctionClimate15:
+                case FunctionType.FunctionClimate5:
+                case FunctionType.FunctionClimate10:
+                case FunctionType.FunctionClimate15:
                     {
-                        return climate_AffineCoefficients;
+                        return climateAffineCoefficients;
                     }
                 default:
                     break;
@@ -403,7 +404,7 @@ namespace MES_Wind_prm
 
         // Taken from DotSpatial https://github.com/ViceIce/DotSpatial/blob/22c156c7646b1595d88d2523c066a9c6ab4d3a53/DotSpatial.Data/RasterBoundsExt.cs
         // 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 rw, cl;
@@ -432,24 +433,25 @@ namespace MES_Wind_prm
 
             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) {
-                case PRMFunctionType.PRMFunctionVelocityX:
-                case PRMFunctionType.PRMFunctionVelocityY:
+            switch (functionType)
+            {
+                case FunctionType.FunctionVelocityX:
+                case FunctionType.FunctionVelocityY:
                     {
-                        return prognostic_cells[index.Row][index.Col].coords;
+                        return prognosticCells[index.Row][index.Col].coords;
                     }
-                case PRMFunctionType.PRMFunctionClimate5:
-                case PRMFunctionType.PRMFunctionClimate10:
-                case PRMFunctionType.PRMFunctionClimate15:
+                case FunctionType.FunctionClimate5:
+                case FunctionType.FunctionClimate10:
+                case FunctionType.FunctionClimate15:
                     {
-                        return climate_cells[index.Row][index.Col].coords;
+                        return climateCells[index.Row][index.Col].coords;
                     }
                 default:
                     break;
@@ -457,20 +459,20 @@ namespace MES_Wind_prm
             return null;
         }
 
-        int countInList(PRMFunctionType functionType, bool forRows) 
+        int countInList(FunctionType functionType, bool forRows)
         {
             switch (functionType)
             {
-                case PRMFunctionType.PRMFunctionVelocityX:
-                case PRMFunctionType.PRMFunctionVelocityY:
+                case FunctionType.FunctionVelocityX:
+                case FunctionType.FunctionVelocityY:
                     {
-                        return forRows ? prognostic_cells.Count : prognostic_cells[0].Count;
+                        return forRows ? prognosticCells.Count : prognosticCells[0].Count;
                     }
-                case PRMFunctionType.PRMFunctionClimate5:
-                case PRMFunctionType.PRMFunctionClimate10:
-                case PRMFunctionType.PRMFunctionClimate15:
+                case FunctionType.FunctionClimate5:
+                case FunctionType.FunctionClimate10:
+                case FunctionType.FunctionClimate15:
                     {
-                        return forRows ? climate_cells.Count : climate_cells[0].Count;
+                        return forRows ? climateCells.Count : climateCells[0].Count;
                     }
                 default:
                     break;
@@ -478,29 +480,29 @@ namespace MES_Wind_prm
             return 0;
         }
 
-        double valueForFunction(PRMFunctionType functionType, PRM_index index)
+        double valueForFunction(FunctionType functionType, Index index)
         {
             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:
                     break;
@@ -508,20 +510,20 @@ namespace MES_Wind_prm
             return 0;
         }
 
-        PRM_cell_size cellSizeForFunction(PRMFunctionType functionType) 
+        CellSize cellSizeForFunction(FunctionType functionType)
         {
             switch (functionType)
             {
-                case PRMFunctionType.PRMFunctionVelocityX:
-                case PRMFunctionType.PRMFunctionVelocityY:
+                case FunctionType.FunctionVelocityX:
+                case FunctionType.FunctionVelocityY:
                     {
-                        return prognostic_cellsize;
+                        return prognosticCellSize;
                     }
-                case PRMFunctionType.PRMFunctionClimate5:
-                case PRMFunctionType.PRMFunctionClimate10:
-                case PRMFunctionType.PRMFunctionClimate15:
+                case FunctionType.FunctionClimate5:
+                case FunctionType.FunctionClimate10:
+                case FunctionType.FunctionClimate15:
                     {
-                        return climate_cellsize;
+                        return climateCellSize;
                     }
                 default:
                     break;
@@ -529,13 +531,13 @@ namespace MES_Wind_prm
             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
             const bool normalX = true;// true - East, false West
             const bool normalY = false;// true - North, false South
-            PRM_index rc = projectionToCell(coords, functionType);
-            PRM_coordinate center = cellToProjection(rc, functionType);
+            Index rc = projectionToCell(coords, functionType);
+            Coordinate center = cellToProjection(rc, functionType);
             double xDiff = coords.X - center.X;
             double yDiff = coords.Y - center.Y;
             //calculate second index
@@ -557,15 +559,15 @@ namespace MES_Wind_prm
                 col2 = rc.Col > 0 ? rc.Col - 1 : rc.Col + 1;
             }
             // indexes and values at bounds
-            PRM_index rcBotLeft = new PRM_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));
-            PRM_index rcTopLeft = new PRM_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 rcBotLeft = new Index(Math.Min(row2, rc.Row), Math.Min(col2, rc.Col));
+            Index rcBotRight = new Index(Math.Max(row2, rc.Row), Math.Min(col2, rc.Col));
+            Index rcTopLeft = new Index(Math.Min(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 valBotRight = valueForFunction(functionType, rcBotRight);
             double valTopLeft = valueForFunction(functionType, rcTopLeft);
             double valTopRight = valueForFunction(functionType, rcTopRight);
-            PRM_coordinate origin = cellToProjection(rcBotLeft, functionType);
+            Coordinate origin = cellToProjection(rcBotLeft, functionType);
             //PRM_coordinate last = cellToProjection(rcTopRight, functionType);//test only
             // sizes for cell
             double hx = cellSizeForFunction(functionType).width;
diff --git a/PRMLibrary/PRMLibrary.csproj b/PRMLibrary/PRMLibrary.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..46e93d18572e399ca4cb33ef65de4adbbaf88f3c
--- /dev/null
+++ b/PRMLibrary/PRMLibrary.csproj
@@ -0,0 +1,54 @@
+<?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
diff --git a/PRMLibrary/Properties/AssemblyInfo.cs b/PRMLibrary/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d224a2babbb2da611a6db6e04e268524b89f5d54
--- /dev/null
+++ b/PRMLibrary/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+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")]
diff --git a/PRMLibrary/bin/Debug/PRMLibrary.dll b/PRMLibrary/bin/Debug/PRMLibrary.dll
new file mode 100644
index 0000000000000000000000000000000000000000..b38bcda0e7828ef5fbfeb94416c65af3dd8a0042
Binary files /dev/null and b/PRMLibrary/bin/Debug/PRMLibrary.dll differ
diff --git a/PRMLibrary/bin/Debug/PRMLibrary.pdb b/PRMLibrary/bin/Debug/PRMLibrary.pdb
new file mode 100644
index 0000000000000000000000000000000000000000..33166b797f14ccbed1edfb7667d1b71dc292d0a8
Binary files /dev/null and b/PRMLibrary/bin/Debug/PRMLibrary.pdb differ
diff --git a/PRMLibrary/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/PRMLibrary/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000000000000000000000000000000000000..a8396ac748a0cfb53f7f341086dd6c68daf79c83
Binary files /dev/null and b/PRMLibrary/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/PRMLibrary/obj/Debug/PRMLibrary.csproj.FileListAbsolute.txt b/PRMLibrary/obj/Debug/PRMLibrary.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000000000000000000000000000000000000..590309a5408cd344c37c367c691ea99f63c802ee
--- /dev/null
+++ b/PRMLibrary/obj/Debug/PRMLibrary.csproj.FileListAbsolute.txt
@@ -0,0 +1,4 @@
+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
diff --git a/PRMLibrary/obj/Debug/PRMLibrary.dll b/PRMLibrary/obj/Debug/PRMLibrary.dll
new file mode 100644
index 0000000000000000000000000000000000000000..b38bcda0e7828ef5fbfeb94416c65af3dd8a0042
Binary files /dev/null and b/PRMLibrary/obj/Debug/PRMLibrary.dll differ
diff --git a/PRMLibrary/obj/Debug/PRMLibrary.pdb b/PRMLibrary/obj/Debug/PRMLibrary.pdb
new file mode 100644
index 0000000000000000000000000000000000000000..33166b797f14ccbed1edfb7667d1b71dc292d0a8
Binary files /dev/null and b/PRMLibrary/obj/Debug/PRMLibrary.pdb differ