예제 #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        float x = FuelHeat * MaxFuelPerSec * BurnRate;

        x -= Qremove;
        x  = boilerDelay.Next(x);
        x  = boilerHeat.Next(x);
        //Tank.Mix.Heat = x;

        x /= CMboiler;

        // x is boiler temperature
        Tboiler       = x;
        Tank.Mix.Temp = x;

        x -= Tremove;
        x *= Csteam;
        if (x > 0)
        {
            x = Mathf.Min(x, Msteam * Csteam);
        }
        else
        {
            x = 0;
        }
        Qremove = x;
        x      /= Csteam;

        // x is a mass of steam produced
        Tank.Mix.AddFraction(new ChemFraction(SteamElement, x));

        x       = Tank.Mix.Mass * Constants.R * Tboiler / Tank.Volume;
        x      *= 1e-6f;
        Tremove = 179.47f * (Mathf.Pow(x, 0.2391f)) + 273f;
    }
예제 #2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        float x = SteamIn.Pressure - SteamOut.Pressure;

        x *= steamToMass;
        if (x > 0)
        {
            SteamOut.Mix.AddMix(SteamIn.Mix.TakeMix(x * plant.PlantDeltaTime));
        }
        else
        {
            SteamIn.Mix.AddMix(SteamOut.Mix.TakeMix(-x * plant.PlantDeltaTime));
        }

        x           = turbineInertia.Next(x);
        x          *= MassToRpmGain;
        CurrentRevs = x;
        float flow = turbine.CalculateFlow(GasOut.Pressure, x);

        if (flow < 0)
        {
            flow = 0;
        }

        // flow in kg per minute
        float kgPerSec = plant.PlantDeltaTime * flow * IdealDensity / 60f;

        LastFlow = flow;
        if (kgPerSec != 0)
        {
            GasOut.Mix.AddMix(GasIn.Mix.TakeMix(kgPerSec));
        }
        RevolutionRegulator();
    }
예제 #3
0
    void RevolutionRegulator()
    {
        float x = TargetRevs - CurrentRevs;



        x = revRegIntegrator.Next(x);
        x = revRegDelay.Next(x);

        x *= revRegulatorGain;

        x = Mathf.Clamp01(x);
        SteamValve.GateGap = x;
    }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        StatusText.text = Input.location.status.ToString();
        if (Input.location.status != LocationServiceStatus.Running)
        {
            return;
        }
        var curLocation = GetAccurate(Input.location.lastData);


        float direction = DegreeBearing(curLocation.lat, curLocation.lon, trackedLocation.lat,
                                        trackedLocation.lon);

        float compass        = compassFiltered.Next(Input.compass.trueHeading, Time.deltaTime);
        float localDirection = compass - direction;

        transform.rotation = Quaternion.Euler(0, 0, localDirection);


        InfoText.text = string.Format("cur: {0:#.0000000}, {1:#.0000000}\ntar: {2:#.0000000}, {3:#.0000000}\n compass: {4:000.0}, absDir: {5:000.0}\n localdir: {6:000.0}",
                                      curLocation.lat, curLocation.lon, trackedLocation.lat,
                                      trackedLocation.lon, compass, direction, localDirection);
    }