public override void UpdateMemoryBlocks() { /*Output.Count = GetInputSize(0); * Output.ColumnHint = Input != null ? Input.ColumnHint : 1;*/ if (Input != null && Input.Dims != null) { Output.Dims = Input.Dims; } else { Output.Count = 1; } if (!SignalName.Equals("<none>")) { ProxySignal.Source = MySignal.CreateSignalByDefaultName(SignalName); if (ProxySignal.Source != null) { ProxySignal.Source.Owner = this; ProxySignal.Source.Name = MyProject.RemovePostfix(ProxySignal.Source.DefaultName, "Signal"); } } else { ProxySignal.Source = null; } }
public ISignal ResolveSignal(SignalName signalName) { if (!this.ContainsKey(signalName.baseName)) { Console.Error.WriteLine("invalid signal: " + signalName.baseName); return(new StdLogic(signalName)); } if (this[signalName] is StdLogic) { return(this[signalName]); } else if (this[signalName] is StdLogicVector) { if (signalName.stIndex == null && signalName.edIndex == null) { return(this[signalName]); } else if (signalName.edIndex == null) { return(((StdLogicVector)this[signalName]).GetLogic((int)signalName.stIndex)); } else { return(new StdLogicVector(new SignalName(signalName.baseName), (int)signalName.stIndex, (int)signalName.edIndex, this[signalName].mode)); } } return(null); }
private void ClearValues() { SignalName.Text = String.Empty; SignalHz.Text = String.Empty; SignalAmplitude.Text = "1.0"; SignalName.Focus(); }
public SignalName getSignalName() { var tempSignal = new SignalName(".tmp_signal" + ++signalCount); tempSignal.SetTemp(); return(tempSignal); }
public ISignal this[SignalName signalName] { get { return(this[signalName.baseName]); } set { this[signalName.baseName] = value; } }
public override void UpdateMemoryBlocks() { Output.Dims = new TensorDimensions(1); if (!SignalName.Equals("<none>")) { ProxySignal.Source = MySignal.CreateSignalByDefaultName(SignalName); if (ProxySignal.Source != null) { ProxySignal.Source.Owner = this; ProxySignal.Source.Name = MyProject.RemovePostfix(ProxySignal.Source.DefaultName, "Signal"); } } else { ProxySignal.Source = null; } }
public static string Relay(RelayName channel, SignalName sensor) { var rv = sensor.ToString(); switch (sensor) { case SignalName.Feedback: { switch (channel) { case RelayName.Kv1: rv = "k3"; break; case RelayName.Kv2: rv = "k2"; break; case RelayName.Kv8: rv = "k4"; break; case RelayName.Kv9: rv = "k6"; break; case RelayName.Kv10: //rv = "k6"; rv = "k5"; break; case RelayName.Kv11: rv = "k1"; break; } } break; } const string kParent = "relay"; return((sensor == SignalName.Empty ? string.Format("{0}.{1}", kParent, channel) : string.Format("{0}.{1}.{2}", kParent, channel, rv)).ToLower()); }
public override string ToString() { if (SignalName.StartsWith("$USS_")) { return(BaseUtils.FieldBuilder.Build("", USSTypeLocalised, "Threat Level:".T(EDTx.FSSSignal_ThreatLevel), ThreatLevel, "Faction:".T(EDTx.FSSSignal_Faction), SpawingFaction_Localised, ";Station".T(EDTx.FSSSignal_StationBool), IsStation, "State:".T(EDTx.FSSSignal_State), SpawingState_Localised )); } else { return(BaseUtils.FieldBuilder.Build("", SignalName_Localised, "USS Type:".T(EDTx.FSSSignal_USSType), USSTypeLocalised, "Threat Level:".T(EDTx.FSSSignal_ThreatLevel), ThreatLevel, "Faction:".T(EDTx.FSSSignal_Faction), SpawingFaction_Localised, ";Station".T(EDTx.FSSSignal_StationBool), IsStation, "State:".T(EDTx.FSSSignal_State), SpawingState_Localised )); } }
public static string Derivative(SystemName system, int channel, SignalName sensor) { const string kParent = "derivative"; return(string.Format("{0}.{1}.{2}.{3}", kParent, system, channel, sensor).ToLower()); }
public static string Rectifier(SignalName sensor) { return(Invertor(0, sensor)); }
public static string Tank(SignalName sensor) { const string kParent = "local.tank"; return(string.Format("{0}.{1}", kParent, sensor).ToLower()); }
public static string ConvMode(byte channel, SignalName sensor) { const string kParent = "convmode"; return(string.Format("{0}.{1}.{2}", kParent, channel, sensor).ToLower()); }
public static string Wago493(byte channel, SignalName sensor) { const string kParent = "wago493"; return(string.Format("{0}.{1}.{2}", kParent, channel, sensor).ToLower()); }
public bool IsSame(FSSSignal other) // is this signal the same as the other one { return(SignalName.Equals(other.SignalName) && SpawningFaction.Equals(other.SpawningFaction) && SpawningState.Equals(other.SpawningState) && USSType.Equals(other.USSType) && ThreatLevel == other.ThreatLevel && ClassOfSignal == other.ClassOfSignal && (ClassOfSignal == Classification.Carrier || ExpiryUTC == other.ExpiryUTC)); // note carriers have our own expiry on it, so we don't }
public static string Minutes(SignalName sensor) { const string kParent = "local.minutes"; return(string.Format("{0}", kParent, sensor).ToLower()); }
/**********************************************************/ override public void addToDictionary(Dictionary <string, OadrSignal> signals) { signals.Add(SignalName.ToString(), this); signals.Add(SignalNameEnumeratedType.simple.ToString(), this); }
public static string EngineerEnterMenu(SignalName sensor) { const string kParent = "local.ServiceEnter"; return(string.Format("{0}", kParent, sensor).ToLower()); }
public static string KilowatH(SignalName sensor) { const string kParent = "local.KilowatHours"; return(string.Format("{0}", kParent, sensor).ToLower()); }
public static string OilPump(SignalName sensor) { const string kParent = "local.OilRefresh"; return(string.Format("{0}", kParent, sensor).ToLower()); }
public static void IdentifySignal(SignalName ____name) => QSBEventManager.FireEvent(EventNames.QSBIdentifySignal, ____name);
public static GateChipDefinition ImportFromFile(string fileName) { var portNameMappings = new List <Dictionary <ISignal, ISignal> >(); var constAssignMapping = new Dictionary <ISignal, SignalName>(); var objects = (new Parser.MyParser()).Parse(fileName); if (objects.components.Count > 0 || objects.componentDeclarations.Count > 1 || objects.logicGates.Count == 0) { return(null); } string chipName = objects.entityPrototype.name; // チップの入力信号 var inPortSet = new HashSet <ISignal>(objects.signalTable.Values.Where( x => x.mode == SignalMode.IN && x.GetType() == typeof(StdLogic))); // チップの出力信号 var outPortSet = new HashSet <ISignal>(objects.signalTable.Values.Where( x => x.mode == SignalMode.OUT && x.GetType() == typeof(StdLogic))); // チップの出力信号に直結した信号 var outPortAssignment = new Dictionary <ISignal, ISignal>(); foreach (var pair in objects.assignments.Where( x => x.Key.mode == SignalMode.OUT && x.Key.GetType() == typeof(StdLogic))) { outPortAssignment.Add(pair.Value, pair.Key); } // ポートの対応関係を作成 GateType gateType = objects.logicGates[0].gateType; int gateWidth = objects.logicGates[0].inputSignals.Count; foreach (var logicGate in objects.logicGates) { if (logicGate.gateType != gateType || logicGate.inputSignals.Count != gateWidth) { throw new ChipDefinitionException(fileName, string.Format(@"Gate chip ""{0}{1}"" has another gate ""{2}{3}""", gateType, gateWidth, logicGate.gateType, logicGate.inputSignals.Count)); } var portNameMap = new Dictionary <ISignal, ISignal>(); for (int i = 0; i < logicGate.inputSignals.Count; ++i) { if (!inPortSet.Contains(logicGate.inputSignals[i])) { throw new ChipDefinitionException(fileName, string.Format("The input signal of the gate must be connected directly to the input port of the chip")); } inPortSet.Remove(logicGate.inputSignals[i]); portNameMap.Add(new StdLogic(new SignalName(".in" + i)), logicGate.inputSignals[i]); } if (!outPortAssignment.ContainsKey(logicGate.outputSignal) || !outPortSet.Contains(outPortAssignment[logicGate.outputSignal])) { throw new ChipDefinitionException(fileName, string.Format("The output signal of the gate must be connected directly to the output port of the chip")); } var outPort = outPortAssignment[logicGate.outputSignal]; outPortSet.Remove(outPort); portNameMap.Add(new StdLogic(new SignalName(".out")), outPort); portNameMappings.Add(portNameMap); } // チップの入力でゲートの入力以外に接続するもの foreach (var inPort in inPortSet) { if (inPort.attribute.ContainsKey("const_assign")) { var constValue = inPort.attribute["const_assign"]; if (constValue is string) { constAssignMapping[inPort] = SignalName.Parse((string)constValue); } } } return(new GateChipDefinition(chipName, gateType, gateWidth, portNameMappings.ToArray(), constAssignMapping, objects.entityAttribute)); }
public static string Drive(SignalName sensor) { const string kParent = "drive"; return(string.Format("{0}.{1}", kParent, sensor).ToLower()); }
public static ComponentChipDefinition ImportFromFile(string fileName) { var portNameMappings = new List <Dictionary <ISignal, ISignal> >(); var constAssignMapping = new Dictionary <ISignal, SignalName>(); var objects = (new Parser.MyParser()).Parse(fileName); if (objects.components.Count == 0 || objects.componentDeclarations.Count == 1 || objects.logicGates.Count > 0) { return(null); } string chipName = objects.entityPrototype.name; // チップの入出力信号 var portSet = new HashSet <ISignal>(objects.signalTable.Values.Where( x => (x.mode == SignalMode.IN || x.mode == SignalMode.OUT || x.mode == SignalMode.INOUT) && x.GetType() == typeof(StdLogic))); // ポートの対応関係を作成 ComponentPrototype componentPrototype = objects.components[0].prototype; foreach (var component in objects.components) { if (component.prototype != componentPrototype) { throw new ChipDefinitionException(fileName, string.Format(@"Component chip ""{0}"" has another component ""{1}""", componentPrototype.name, component.prototype.name)); } var portNameMap = new Dictionary <ISignal, ISignal>(); foreach (var componentSignal in component.portMap.Keys) { if (componentSignal.mode == SignalMode.IN || componentSignal.mode == SignalMode.OUT || componentSignal.mode == SignalMode.INOUT) { if (!portSet.Contains(component.portMap[componentSignal])) { throw new ChipDefinitionException(fileName, string.Format("The port signal of the component must be connected directly to the port of the component")); } portSet.Remove(component.portMap[componentSignal]); portNameMap.Add(componentSignal, component.portMap[componentSignal]); } } portNameMappings.Add(portNameMap); } // チップの入力でコンポネントの入出力以外に接続するもの foreach (var port in objects.signalTable.Values) { if ((port.mode == SignalMode.IN || port.mode == SignalMode.INOUT) && portSet.Contains(port) && /* まだ接続されていない */ port.attribute.ContainsKey("const_assign")) { var constValue = port.attribute["const_assign"]; if (constValue is string) { constAssignMapping[port] = SignalName.Parse((string)constValue); } } } return(new ComponentChipDefinition(chipName, componentPrototype, portNameMappings.ToArray(), constAssignMapping, objects.entityAttribute)); }
public static string Invertor(byte channel, SignalName sensor) { const string kParent = "uz"; return((sensor == SignalName.Empty ? string.Format("{0}.{1}", kParent, channel + 1) : string.Format("{0}.{1}.{2}", kParent, channel + 1, sensor)).ToLower()); }
public static string Hour(SignalName sensor) { const string kParent = "local.hour"; return(string.Format("{0}", kParent, sensor).ToLower()); }
const int CarrierExpiryTime = 10 * (60 * 60 * 24); // days till we consider the carrier signal expired.. public FSSSignal(JObject evt, System.DateTime EventTimeUTC) { SignalName = evt["SignalName"].Str(); string loc = evt["SignalName_Localised"].Str(); // not present for stations/installations SignalName_Localised = loc.Alt(SignalName); // don't mangle if no localisation, its prob not there because its a proper name SpawningState = evt["SpawningState"].Str(); // USS only, checked SpawningState_Localised = JournalFieldNaming.CheckLocalisation(evt["SpawningState_Localised"].Str(), SpawningState); SpawningFaction = evt["SpawningFaction"].Str(); // USS only, checked SpawningFaction_Localised = JournalFieldNaming.CheckLocalisation(evt["SpawningFaction_Localised"].Str(), SpawningFaction); USSType = evt["USSType"].Str(); // USS Only, checked USSTypeLocalised = JournalFieldNaming.CheckLocalisation(evt["USSType_Localised"].Str(), USSType); ThreatLevel = evt["ThreatLevel"].IntNull(); // USS only, checked TimeRemaining = evt["TimeRemaining"].DoubleNull(); // USS only, checked SystemAddress = evt["SystemAddress"].LongNull(); bool?isstation = evt["IsStation"].BoolNull(); if (isstation == true) // station flag { int dash = SignalName.LastIndexOf('-'); if (SignalName.Length >= 5 && dash == SignalName.Length - 4 && char.IsLetterOrDigit(SignalName[dash + 1]) && char.IsLetterOrDigit(SignalName[dash - 1])) { ClassOfSignal = Classification.Carrier; TimeRemaining = CarrierExpiryTime; } else { ClassOfSignal = Classification.Station; } } else if (loc.Length == 0) // other types, and old station entries, don't have localisation, so its an installation { ClassOfSignal = Classification.Installation; } else if (SignalName.StartsWith("$USS", StringComparison.InvariantCultureIgnoreCase) || SignalName.StartsWith("$RANDOM", StringComparison.InvariantCultureIgnoreCase)) { ClassOfSignal = Classification.USS; } else if (SignalName.StartsWith("$Warzone", StringComparison.InvariantCultureIgnoreCase)) { ClassOfSignal = Classification.ConflictZone; } else if (SignalName.StartsWith("$Fixed_Event_Life", StringComparison.InvariantCultureIgnoreCase)) { ClassOfSignal = Classification.NotableStellarPhenomena; } else if (SignalName.StartsWith("$MULTIPLAYER_SCENARIO14", StringComparison.InvariantCultureIgnoreCase) || SignalName.StartsWith("$MULTIPLAYER_SCENARIO7", StringComparison.InvariantCultureIgnoreCase)) { ClassOfSignal = Classification.ResourceExtraction; } else { ClassOfSignal = Classification.Other; } RecordedUTC = EventTimeUTC; if (TimeRemaining != null) { ExpiryUTC = EventTimeUTC.AddSeconds(TimeRemaining.Value); ExpiryLocal = ExpiryUTC.ToLocalTime(); } }