本文整理汇总了C#中Model.MoveInTime方法的典型用法代码示例。如果您正苦于以下问题:C# Model.MoveInTime方法的具体用法?C# Model.MoveInTime怎么用?C# Model.MoveInTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model.MoveInTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TracerTest
public void TracerTest()
{
int count = 3;
double length = 10870;
DateTime Start= new DateTime(2000,1,1);
List<Lake> lakes = NetworkBuilder.CreateConnectedLakes(count);
foreach (Lake L in lakes)
{
L.SurfaceArea = XYPolygon.GetSquare(length / count);
L.Depth = 1;
L.SetState("Initial",Start, new WaterPacket(L.Volume));
}
Chemical c = ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl);
SinkSourceBoundary fb = new SinkSourceBoundary(10870.0 / (8.49 * 3600));
fb.WaterSample = new WaterPacket(1);
lakes.First().Sources.Add(fb);
WaterPacket plug = new WaterPacket(1);
plug.AddChemical(c, 10000);
lakes.First().AddWaterPacket(Start, Start.AddHours(1), plug.DeepClone());
lakes.First().Output.LogChemicalConcentration(c);
lakes.Last().Output.LogChemicalConcentration(c);
Stream us = new Stream("us",1, 1, 1);
us.Sources.Add(fb);
Stream s = new Stream("s",1000, 1, 1);
Lake L2 = new Lake("L2",870);
Stream s1 = new Stream("s1", 9000, 1, 1);
s.AddWaterPacket(Start, Start.AddSeconds(1), plug.DeepClone());
s1.Output.LogChemicalConcentration(c);
us.AddDownStreamWaterBody(s);
s.AddDownStreamWaterBody(L2);
L2.AddDownStreamWaterBody(s1);
Model m = new Model();
m._waterBodies.AddRange(lakes.Cast<IWaterBody>());
m._waterBodies.Add((IWaterBody)us);
m._waterBodies.Add((IWaterBody)s);
m._waterBodies.Add((IWaterBody)L2);
m._waterBodies.Add((IWaterBody)s1);
m.SetState("Initial", Start, new WaterPacket(1));
m.MoveInTime(Start.AddHours(15), TimeSpan.FromMinutes(1));
lakes.Last().Output.Save(@"C:\temp\LastLake.xts");
s1.Output.Save(@"C:\temp\Stream.xts");
int n = 15;
List<IWaterBody> wbs = NetworkBuilder.CreateCombo(n, 10870 / n/2.0);
foreach (IWaterBody wb in wbs)
{
wb.SetState("Initial", Start, new WaterPacket(wb.Volume));
}
wbs.First().AddWaterPacket(Start, Start.AddHours(1), plug.DeepClone());
us.AddDownStreamWaterBody(wbs.First());
us.RestoreState("Initial");
m._waterBodies.Clear();
m._waterBodies.Add(us);
m._waterBodies.AddRange(wbs);
m.SetState("Initial", Start, new WaterPacket(1));
((Stream)wbs.Last()).Output.LogChemicalConcentration(c);
m.MoveInTime(Start.AddHours(15), TimeSpan.FromMinutes(1));
((Stream)wbs.Last()).Output.Save(@"C:\temp\Stream.xts");
}
示例2: GroundWaterTest
public void GroundWaterTest()
{
WaterPacket GroundWater = new WaterPacket(1);
// GroundWater.AddChemical(ChemicalFactory.Instance.GetChemical(ChemicalNames.Radon), 0.01);
GroundWater.IDForComposition = 4;
Lake Vedsted= LakeFactory.GetLake("Vedsted Sø");
Vedsted.Depth = 5;
Vedsted.WaterLevel = 45.7;
//Create and add a discharge boundary
TimestampSeries Discharge = new TimestampSeries();
Discharge.AddSiValue(new DateTime(2007, 3, 12), 6986 / TimeSpan.FromDays(365).TotalSeconds);
Discharge.AddSiValue(new DateTime(2007, 4, 3), 5894 / TimeSpan.FromDays(365).TotalSeconds);
Discharge.AddSiValue(new DateTime(2007, 4, 25), 1205 / TimeSpan.FromDays(365).TotalSeconds);
Discharge.RelaxationFactor = 1;
Discharge.AllowExtrapolation = true;
Assert.AreEqual(Discharge.GetValue(new DateTime(2007, 4, 25)), Discharge.GetValue(new DateTime(2007, 6, 25)), 0.0000001);
SinkSourceBoundary Kilde = new SinkSourceBoundary(Discharge);
Kilde.Name = "Small spring";
Kilde.ID = 3;
Kilde.WaterSample.IDForComposition = 3;
Vedsted.Sources.Add(Kilde);
Vedsted.Output.LogAllChemicals = true;
Vedsted.Output.LogComposition = true;
//Add to an engine
Model Engine = new Model();
Engine.Name = "Vedsted-opsætning";
Engine._waterBodies.Add(Vedsted);
//Set initial state
WaterPacket InitialStateWater = new WaterPacket(1);
InitialStateWater.IDForComposition = 1;
DateTime Start = new DateTime(2007, 1, 1);
DateTime End = new DateTime(2007, 12, 31);
Engine.SetState("Initial", Start, InitialStateWater);
Engine.SimulationEndTime = End;
Engine.TimeStep = TimeSpan.FromDays(30);
Engine.MoveInTime(End, TimeSpan.FromDays(30));
Vedsted.Name = "Vedsted step 1";
Engine.Save(testDataPath + Vedsted.Name + ".xml");
Engine.RestoreState("Initial");
//Create and add precipitation boundary
TimespanSeries Precipitation = new TimespanSeries();
Precipitation.ExtrapolationMethod = ExtrapolationMethods.RecycleYear;
Precipitation.AllowExtrapolation = true;
double[] values = new double[] { 108, 83, 73, 52, 61, 86, 99, 101, 75, 108, 85, 101 };
AddMonthlyValues(Precipitation, 2007, values);
SinkSourceBoundary Precip = new SinkSourceBoundary(Precipitation);
Precip.ContactGeometry = Vedsted.SurfaceArea;
Precip.Name = "Precipitation";
Precip.ID = 2;
Precip.WaterSample.IDForComposition = 2;
Vedsted.Precipitation.Add(Precip);
//Create and add evaporation boundary
TimespanSeries Evaporation = new TimespanSeries();
Evaporation.AllowExtrapolation = true;
Evaporation.ExtrapolationMethod = ExtrapolationMethods.RecycleYear;
double[] values2 = new double[] {4,11,34,66,110,118,122,103,61,26,7,1 };
AddMonthlyValues(Evaporation, 2007, values2);
EvaporationRateBoundary eva = new EvaporationRateBoundary(Evaporation);
eva.ContactGeometry = Vedsted.SurfaceArea;
eva.Name = "Evapo";
Vedsted.EvaporationBoundaries.Add(eva);
Engine.MoveInTime(End, TimeSpan.FromDays(30));
Vedsted.Name = "Vedsted step 2";
Engine.Save(testDataPath + Vedsted.Name + ".xml");
Engine.RestoreState("Initial");
//To be used by other tests
Engine.Save(testDataPath + "VedstedNoGroundwater.xml");
XYPolygon ContactArea = XYPolygon.GetSquare(Vedsted.Area/10);
#region Groundwater boundaries
//Add groundwater boundaries
GroundWaterBoundary B1 = new GroundWaterBoundary(Vedsted, 1.3e-4, 1, 45.47, ContactArea);
B1.Name = "B1";
B1.ID = 4;
B1.WaterSample = GroundWater;
Vedsted.GroundwaterBoundaries.Add(B1);
GroundWaterBoundary B2 = new GroundWaterBoundary(Vedsted, 1e-6, 1, 44.96, ContactArea);
B2.Name = "B2";
B2.ID = 5;
B2.WaterSample = GroundWater;
Vedsted.GroundwaterBoundaries.Add(B2);
GroundWaterBoundary B3 = new GroundWaterBoundary(Vedsted, 2e-6, 1, 44.63, ContactArea);
B3.Name = "B3";
B3.ID = 6;
//.........这里部分代码省略.........
示例3: TestMethod1
public void TestMethod1()
{
Model M = new Model();
M.Name = "Cook";
WaterPacket HyporhericWater = new WaterPacket(1);
HyporhericWater.AddChemical(ChemicalFactory.Instance.GetChemical(ChemicalNames.Radon), 0.6 / HyporhericWater.Volume);
for (int i = 0; i < 10; i++)
{
Lake s1 = new Lake("s" + i, XYPolygon.GetSquare(50 * 2));
s1.Depth = 0.3;
StagnantExchangeBoundary seb = new StagnantExchangeBoundary(s1.Volume / 20000);
seb.WaterSample = HyporhericWater.DeepClone(s1.Area * 0.2 * 0.4);
seb.Output.LogAllChemicals = true;
s1.Output.LogAllChemicals = true;
s1.Sinks.Add(seb);
s1.Sources.Add(seb);
if (i > 0)
M._waterBodies[i - 1].AddDownStreamWaterBody(s1);
M._waterBodies.Add(s1);
}
//Bromide injection
TimespanSeries ts = new TimespanSeries();
ts.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 18, 12, 0, 0), 0);
ts.AddSiValue(new DateTime(2005, 10, 18, 12, 0, 0), new DateTime(2005, 10, 18, 12, 40, 0), 0.001 * 60);
ts.AddSiValue(new DateTime(2005, 10, 18, 12, 40, 0), DateTime.MaxValue, 0);
SinkSourceBoundary Bromide = new SinkSourceBoundary(ts);
WaterPacket P = new WaterPacket(1);
P.AddChemical(new Chemical("Bromide", 1), 1.13);
Bromide.WaterSample = P;
//SF6 injection
TimespanSeries ts2 = new TimespanSeries();
ts2.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 15, 12, 0, 0), 0);
ts2.AddSiValue(new DateTime(2005, 10, 15, 12, 0, 0), new DateTime(2005, 10, 19, 12, 0, 0), 1e-6);
ts2.AddSiValue(new DateTime(2005, 10, 19, 12, 0, 0), DateTime.MaxValue, 0);
SinkSourceBoundary SF6 = new SinkSourceBoundary(ts2);
WaterPacket SF6w = new WaterPacket(1);
SF6w.AddChemical(new Chemical("SF6", 1), 1.13);
SF6.WaterSample = SF6w;
M._waterBodies.First().Sources.Add(Bromide);
M._waterBodies.First().Sources.Add(SF6);
M._waterBodies.First().Sources.Add(new SinkSourceBoundary(0.2));
DateTime Start = new DateTime(2005, 10, 13);
DateTime End = new DateTime(2005, 10, 19);
M.SetState("Initial", Start, new WaterPacket(1));
M.MoveInTime(new DateTime(2005, 10, 18, 12, 0, 0), TimeSpan.FromHours(2));
M.MoveInTime(new DateTime(2005, 10, 18, 13, 0, 0), TimeSpan.FromHours(0.02));
M.MoveInTime(End, TimeSpan.FromHours(2));
M.Save(@"..\..\..\TestData\CookEtAl.xml");
M.RestoreState("Initial");
TimespanSeries ts3 = new TimespanSeries();
ts3.AddSiValue(DateTime.MinValue, new DateTime(2005, 10, 16, 12, 0, 0), 0);
ts3.AddSiValue(new DateTime(2005, 10, 16, 12, 0, 0), new DateTime(2005, 10, 17, 0, 0, 0), 0.4);
ts3.AddSiValue(new DateTime(2005, 10, 17, 0, 0, 0), DateTime.MaxValue, 0);
M._waterBodies.First().Sources.Add(new SinkSourceBoundary(ts3));
M.MoveInTime(new DateTime(2005, 10, 18, 12, 0, 0), TimeSpan.FromHours(2));
M.MoveInTime(new DateTime(2005, 10, 18, 13, 0, 0), TimeSpan.FromHours(0.02));
M.MoveInTime(End, TimeSpan.FromHours(2));
M.Save(@"..\..\..\TestData\CookEtAl2.xml");
}
示例4: TestMethod1
public void TestMethod1()
{
Lake L = new Lake("Deep lake", XYPolygon.GetSquare(10000));
L.Depth = 4;
L.Output.LogAllChemicals = true;
Lake L2 = new Lake("Shallow lake", XYPolygon.GetSquare(40000));
L2.Depth = 1;
L2.Output.LogAllChemicals = true;
SinkSourceBoundary flow = new SinkSourceBoundary(L.Volume / (15.0 * 86400.0));
L.Sources.Add(flow);
L2.Sources.Add(flow);
Chemical rn = ChemicalFactory.Instance.GetChemical(ChemicalNames.Radon);
Chemical cl = ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl);
WaterPacket groundwater = new WaterPacket(1);
groundwater.SetConcentration(rn, 200);
groundwater.SetConcentration(cl, 200);
SinkSourceBoundary gwflow = new SinkSourceBoundary(L.Volume / (15.0 * 86400.0));
gwflow.WaterSample = groundwater;
L.Sources.Add(gwflow);
L2.Sources.Add(gwflow);
Model M = new Model();
M.WaterBodies.Add(L);
M.WaterBodies.Add(L2);
DateTime start = new DateTime(2010,1,1);
M.SetState("Initial", start, new WaterPacket(1));
M.MoveInTime(new DateTime(2010, 12, 31), TimeSpan.FromDays(5));
M.Save(@"..\..\..\TestData\Radon.xml");
}