本文整理汇总了C#中System.Clock.Tick方法的典型用法代码示例。如果您正苦于以下问题:C# Clock.Tick方法的具体用法?C# Clock.Tick怎么用?C# Clock.Tick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Clock
的用法示例。
在下文中一共展示了Clock.Tick方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
// body chunk
Clock c = new Clock();
Console.WriteLine("Midnight " + c.GetTimeString());
c.SetTime(23, 58);
Console.WriteLine("Before midnight " + c.GetTimeString());
for (int i = 0; i < 4; i++) {
c.Tick ();
Console.WriteLine ("Tick " + c.GetTimeString());
}
}
示例2: Control_linear_mosquito_with_pid
public void Control_linear_mosquito_with_pid()
{
var receivedSeries = new List<Timestamped<double>>();
var t0 = 0.AsMinute();
var setpoint = 10.0.At(t0);//.Add(5.min()));
var pid = new PIDAlgorithm(0.5, 0.5, 0.5, 0.0);
var mosquito = new LinearMosquito(2.0.In(1.min()), t0);
var controlledMosqito = mosquito.ControlledBy(pid);
controlledMosqito.Receive += (t) => receivedSeries.Add(t);
controlledMosqito.Send(setpoint);
var clock = new Clock(t0);
clock.Subscribe(mosquito);
clock.Tick(5.min());
//while (true) clock.Tick(1.min());
Assert.AreEqual(setpoint, receivedSeries.Last());
}
示例3: Control_swarm_of_10_with_pid
public void Control_swarm_of_10_with_pid()
{
var receivedSeries = new List<Timestamped<double>>();
var t0 = 0.AsMinute();
var setpoint = 100.0.At(t0.Add(5.min()));
var swarm = Enumerable.Range(0, 10).Select(i => new LinearMosquito(2.0.In(1.min()), t0)).ToList();
// max.At(5.min)=10x10=100
var specifiedSwarm = swarm.Select(m => m.WithSpec(new Engine<double>()
{ Gradient = m.Gradient, Stages = new SortedSet<double>() {0.0, 100.0} }));
var swarmController = new SwarmController(
specifiedSwarm, new PowerBasedAllocator(), new PIDAlgorithm(0.5, 0.5, 0.5, 0.0));
swarmController.Receive += (t) => receivedSeries.Add(t);
swarmController.Send(setpoint);
var clock = new Clock(t0);
swarm.ForEach(m => clock.Subscribe(m));
clock.Tick(5.min());
Assert.AreEqual(setpoint, receivedSeries.Last());
}