public JTransport(Bank _bank, SignalListDef _SL, cIW _IW) { bank = _bank; SL = _SL; DimensionsPars Pars = ParAll.ST.Dimensions; if (_IW.Thick) { LTE.Add(new TESignal(SL.iCONTROL1, true, Pars.Stand1)); } LTE.Add(teCONTROL2On = new TESignal(SL.iCONTROL2, true, Pars.Stand2)); LTE.Add(teCONTROL3On = new TESignal(SL.iCONTROL3, true, Pars.Stand3)); LTE.Add(teSGInOn = new TESignal(SL.iSGIN, true, Pars.SGIn)); LTE.Add(teSGOutOn = new TESignal(SL.iSGOUT, true, Pars.SGOut)); if (_IW.Thick) { LTE.Add(new TESignal(SL.iCONTROL1, false, Pars.Stand2)); } LTE.Add(teCONTROL2Off = new TESignal(SL.iCONTROL2, false, Pars.Stand3)); LTE.Add(new TESignal(SL.iCONTROL3, false, Pars.Stand4)); LTE.Add(new TESignal(SL.iSGIN, false, Pars.SGIn)); LTE.Add(new TESignal(SL.iSGOUT, false, Pars.SGOut)); SL.CatchClear(); SL.CatchAdd(SL.iCONTROL1); SL.CatchAdd(SL.iCONTROL2); SL.CatchAdd(SL.iCONTROL3); SL.CatchAdd(SL.iSGIN); SL.CatchAdd(SL.iSGOUT); new ExecSQL("update ThickWork set TubeLength = null"); new ExecSQL("delete from TickPositions"); }
public JTransportStrobe(Bank _bank, SignalListDef _SL, cIW _IW) { bank = _bank; SL = _SL; DimensionsPars Pars = ParAll.ST.Dimensions; if (_IW.Thick) { teOn = new TESignal(SL.iCONTROL1, true, Pars.Stand1); teOff0 = new TESignal(SL.iCONTROL1, false, Pars.Stand2); } else if (_IW.Cross) { teOn = new TESignal(SL.iCONTROL2, true, Pars.Stand2); teOff0 = new TESignal(SL.iCONTROL2, false, Pars.Stand3); } else if (_IW.Line) { teOn = new TESignal(SL.iCONTROL3, true, Pars.Stand3); teOff0 = new TESignal(SL.iCONTROL3, false, Pars.Stand4); } teStrobe = new TEStrobe(SL.iSTROBE, true, teOn.Position, ParAll.ST.ZoneSize); SL.CatchClear(); SL.CatchAdd(SL.iCONTROL1); SL.CatchAdd(SL.iCONTROL2); SL.CatchAdd(SL.iCONTROL3); SL.CatchAdd(SL.iSTROBE); new ExecSQL("update ThickWork set TubeLength = null"); new ExecSQL("delete from TickPositions"); }
public void Exec(int _tick) { if (!started) { return; } if (complete) { return; } for (; ;) { SignalEvent se = SL.CatchNext(); if (se == null) { break; } pr(se.ToString()); TESignal te = LTE[0]; if (!te.Check(se)) { continue; } pr(te.ToString()); if (te.need) { L.Add(new TickPosition(te.Tick, te.Position)); } else { if (TubeLength == null) { TubeLength = CalcTubeLength(te); CalcTubeLength2(te); new ExecSQL("update ThickWork set TubeLength = " + TubeLength.Value.ToString()); bank.TubeLength = TubeLength; } L.Add(new TickPosition(te.Tick, te.Position + TubeLength.Value)); } LTE.RemoveAt(0); if (LTE.Count == 0) { complete = true; break; } foreach (TickPosition tp in L) { pr(tp.ToString()); bank.AddTickPosition(tp); ExecSQL E = new ExecSQL(string.Format("insert into TickPositions values({0},{1},{2})", tp_index++.ToString(), tp.tick.ToString(), tp.position.ToString())); } L.Clear(); } }
int?CalcTubeLength(TESignal _teSignal) { if (Speed == null) { return(null); } double T = _teSignal.Tick - teSGOutOn.Tick; double S = Speed.Value * T; int delta = Convert.ToInt32(Math.Round(S)); int tubeLength = teSGOutOn.Position - _teSignal.Position + delta; pr("T=" + T.ToString()); pr("S=" + S.ToString()); pr("delta=" + delta.ToString()); pr("tubeLength=" + tubeLength.ToString()); return(tubeLength); }
int CalcTubeLength(TESignal _teSignal) { double Sv = teSGOutOn.Position - teSGInOn.Position; double Tv = teSGOutOn.Tick - teSGInOn.Tick; double V = Sv / Tv; double T = _teSignal.Tick - teSGOutOn.Tick; double S = V * T; int delta = Convert.ToInt32(Math.Round(S)); int tubeLength = teSGOutOn.Position - _teSignal.Position + delta; pr("Sv=" + Sv.ToString()); pr("Tv=" + Tv.ToString()); pr("V=" + V.ToString()); pr("T=" + T.ToString()); pr("S=" + S.ToString()); pr("delta=" + delta.ToString()); pr("tubeLength=" + tubeLength.ToString()); return(tubeLength); }