本文整理汇总了C#中Stats.ComputeTimeStepDeltaV方法的典型用法代码示例。如果您正苦于以下问题:C# Stats.ComputeTimeStepDeltaV方法的具体用法?C# Stats.ComputeTimeStepDeltaV怎么用?C# Stats.ComputeTimeStepDeltaV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats.ComputeTimeStepDeltaV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimulateTimeStep
//Simulate a single time step, and return stats for the time step.
// - desiredDt is the requested time step size. Often the actual time step size
// with be less than this. The actual step size is reported in dt.
public Stats SimulateTimeStep(float desiredDt, float throttle, float atmospheres, out float dt)
{
Stats stats = new Stats();
foreach (FuelNode n in nodes) n.ResetDrainRates();
foreach (FuelNode n in nodes) n.SetConsumptionRates(throttle, atmospheres);
stats.startMass = VesselMass();
stats.startThrust = VesselThrust(throttle);
List<FuelNode> engines = FindActiveEngines();
if (engines.Count > 0)
{
foreach (FuelNode n in engines) n.AssignResourceDrainRates(nodes);
//foreach (FuelNode n in nodes) n.DebugDrainRates();
float maxDt = nodes.Min(n => n.MaxTimeStep());
dt = Mathf.Min(desiredDt, maxDt);
//Debug.Log("Simulating time step of " + dt);
foreach (FuelNode n in nodes) n.DrainResources(dt);
}
else
{
dt = 0;
}
stats.deltaTime = dt;
stats.endMass = VesselMass();
stats.maxAccel = stats.startThrust / stats.endMass;
stats.ComputeTimeStepDeltaV();
t += dt;
return stats;
}
示例2: SimulateTimeStep
//Simulate a single time step, and return stats for the time step.
// - desiredDt is the requested time step size. Often the actual time step size
// with be less than this. The actual step size is reported in dt.
public Stats SimulateTimeStep(float desiredDt, float throttle, double staticPressure, double atmDensity, double machNumber, out float dt)
{
Stats stats = new Stats();
for (int i = 0; i < nodes.Count; i++)
{
nodes[i].ResetDrainRates();
}
for (int i = 0; i < nodes.Count; i++)
{
nodes[i].SetConsumptionRates(throttle, atmDensity, machNumber);
}
stats.startMass = VesselMass(simStage);
stats.startThrust = VesselThrust(throttle, staticPressure, atmDensity, machNumber); // NK
List<FuelNode> engines = FindActiveEngines();
if (engines.Count > 0)
{
for (int i = 0; i < engines.Count; i++)
{
engines[i].AssignResourceDrainRates(nodes);
}
//foreach (FuelNode n in nodes) n.DebugDrainRates();
float maxDt = nodes.Min(n => n.MaxTimeStep());
dt = Mathf.Min(desiredDt, maxDt);
//print("Simulating time step of " + dt);
for (int i = 0; i < nodes.Count; i++)
{
nodes[i].DrainResources(dt);
}
}
else
{
dt = 0;
}
stats.deltaTime = dt;
stats.endMass = VesselMass(simStage);
stats.resourceMass = stats.startMass - stats.endMass;
stats.maxAccel = stats.endMass > 0 ? stats.startThrust / stats.endMass : 0;
stats.ComputeTimeStepDeltaV();
stats.isp = stats.startMass > stats.endMass ? stats.deltaV / (9.80665f * Mathf.Log(stats.startMass / stats.endMass)) : 0;
t += dt;
return stats;
}