Skip to content

Commit

Permalink
管道能耗代码提交
Browse files Browse the repository at this point in the history
管道能耗代码提交
  • Loading branch information
ChenHaoHu committed Aug 25, 2018
0 parents commit 089d072
Show file tree
Hide file tree
Showing 345 changed files with 28,333 additions and 0 deletions.
Binary file not shown.
Binary file added 管道能耗/.vs/管道能耗/v15/.suo
Binary file not shown.
Empty file.
Binary file not shown.
91 changes: 91 additions & 0 deletions 管道能耗/BLL/BLL.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8F0B87A9-AE30-4516-B2C1-C74F9EEC4A80}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BLL</RootNamespace>
<AssemblyName>BLL</AssemblyName>
<TargetFrameworkVersion>v4.5</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="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\管道能耗\bin\Debug\Microsoft.Office.Interop.Excel.dll</HintPath>
</Reference>
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CyclicnumAlgor.cs" />
<Compile Include="exportExcel.cs" />
<Compile Include="IsNumber.cs" />
<Compile Include="MixedOilQuantity.cs" />
<Compile Include="PipeWork.cs" />
<Compile Include="PowerCost.cs" />
<Compile Include="StationPumpPlan.cs" />
<Compile Include="Time.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WaterCharacteristics.cs" />
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Core">
<Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>8</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="VBIDE">
<Guid>{0002E157-0000-0000-C000-000000000046}</Guid>
<VersionMajor>5</VersionMajor>
<VersionMinor>3</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DAL\DAL.csproj">
<Project>{0897caf6-7037-4f18-9a4c-d154baa3718a}</Project>
<Name>DAL</Name>
<EmbedInteropTypes>False</EmbedInteropTypes>
</ProjectReference>
<ProjectReference Include="..\Model\Model.csproj">
<Project>{35d9ee48-d274-459e-b83c-8ee4f936bda0}</Project>
<Name>Model</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
173 changes: 173 additions & 0 deletions 管道能耗/BLL/CyclicnumAlgor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
//最优循环次数计算类
public class CyclicnumAlgor
{
//投资年回收系数
private double E;
//单位有效容积储罐的建设费用
private double JZ;
//单位有效容积储罐的经营费用
private double G;
//A油价格
private double aPrice;
//B油价格
private double bPrice;
//年管道输量
private double[] M;
//管道输量
private double Qm;
//储罐有效容积
private double v;
//A油品的密度
private double ρA;
//B油品的密度
private double ρB;
//B混油浓度
private double kAPB;
//A混油浓度
private double kBPA;
//混入A油罐中B体积量
private double vPB;
//混入B油罐中A体积量
private double vPA;
//管道长度
private double L;
//A油品运动粘度
private double Va;
//B油品运动粘度
private double Vb;
//管线内径
private double d;
//雷诺数
private double Re;
//输油管每年工作时间
private double D;

public CyclicnumAlgor(Oils oilA, Oils oilB, Pipe pipe, double A油品费用, double B油品费用, double 混入B油罐中A体积量, double 混入A油罐中B体积量, double 流速, double 年工作时间, double 单位有效容积储罐的经营费用, double 单位有效容积储罐的建设费用, double 投资年回收系数)
{
aPrice = A油品费用;
bPrice = B油品费用;
JZ = 单位有效容积储罐的建设费用;
E = 投资年回收系数;
G = 单位有效容积储罐的经营费用;
D = 年工作时间;
Qm = double.Parse(oilA.MasFlow) / D;
M = new double[]
{
double.Parse(oilA.OutputByYear),
double.Parse(oilB.OutputByYear)
};
v = 流速;
ρA = double.Parse(oilA.Density);
ρB = double.Parse(oilB.Density);
kAPB = double.Parse(oilB.Volume_concentration);
kBPA = double.Parse(oilA.Volume_concentration);
vPB = 混入A油罐中B体积量;
vPA = 混入B油罐中A体积量;
d = double.Parse(pipe.OuterDiameter) - 2 * double.Parse(pipe.WallThickness);
L = double.Parse(pipe.Length);

Va = double.Parse(oilA.Viscosity);
Vb = double.Parse(oilB.Viscosity);
Re = v * d / 1000 / ((Va + Vb) / 2);
}

/**
* 返回计算结果
* @return 结果
**/
public double getResult()
{
double result = 0;

//分子
double r1 = B() * (JZ * E + G);
//分母
double r2 = A() + (JZ * E + G) * vH_vS();
//结果
result = Math.Pow(r1 / r2, 0.5);

return Math.Ceiling(result);
}

/**
*计算B值
* @return B的计算值
**/
private double B()
{
double result = 0;

double q = 0, dp = 0;
q = (M[0] * 10000000 / 350 / 24 / 3600 / ρA) * 3600;
dp = M[0] / Qm;
result += (q * (D - dp)) * 2;

q = (M[1] * 10000000 / 350 / 24 / 3600 / ρB) * 3600;
dp = M[1] / Qm;
result += (q * (D - dp)) * 2;

return result;
}

/**
*计算A值
* @return A的计算值
**/
private double A()
{
double result = 0;

double detaS = aPrice - bPrice;
if (detaS < 0)
{
detaS = -detaS;
}
result = 2 * detaS * (ρB * kAPB * vPB / 1000 - ρA * kBPA * vPA / 1000);

return result;
}

/**
* 计算Vh-Vs的值
* @return 返回Vh-Vs的值
**/
private double vH_vS()
{
double result = 0;

result = 2.4 * C() * 3.14 * Math.Pow(d / 1000, 2) / 4;

return result;
}

/**
* 计算C值
* @return 返回C的计算值
**/
private double C()
{
double result = 0;

double Rej = 10000 * Math.Exp(2.72 * Math.Pow(d / 1000, 0.5));
if (Re > Rej)
{
result = 18384 * Math.Pow(d / 1000, 0.5) * Math.Pow(L * 1000, 0.5) * Math.Pow(Re, -0.9) * Math.Exp(2.18 * Math.Pow(d / 1000, 0.5));
}
else
{
result = 11.75 * Math.Pow(d / 1000, 0.5) * Math.Pow(L * 1000, 0.5) * Math.Pow(Re, -0.1);
}

return result;
}
}
}
20 changes: 20 additions & 0 deletions 管道能耗/BLL/IsNumber.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
public class IsNumber
{
public bool isNumber(string input)
{
Double d = 0;
if (double.TryParse(input, out d)) // TryParse返回true说明是数值
return true;
else // 不是数值
return false;
}
}
}
Loading

0 comments on commit 089d072

Please sign in to comment.