public OpcSim(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name) { Context = context; Simulator.Instance().Register(this); //LoadChildren(simChildren, Context); //RegisterChildren(); }
public OpcStatusCollection DeleteHistory( OpcContext context, OpcHistoryModificationInfo modificationInfo, IEnumerable <DateTime> times) { var results = OpcStatusCollection.Create(OpcStatusCode.Good, times.Count()); lock (this.syncRoot) { int index = 0; foreach (var time in times) { var result = results[index++]; if (this.History.Contains(time)) { var value = this.History[time]; this.History.RemoveAt(time); var modifiedValue = value.CreateModified(modificationInfo); this.ModifiedHistory.Add(modifiedValue); } else { result.Update(OpcStatusCode.BadNoEntryExists); } } } return(results); }
public ManualControl(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _start = new OpcDataVariableNode <bool>(this, "Ein"); _start.AccessLevel = OpcAccessLevel.CurrentRead; _manualActive = new OpcDataVariableNode <bool>(this, "Erlaubt"); _manualActive.AccessLevel = OpcAccessLevel.CurrentRead; }
public LevelSensor(OpcSimModule parent, OpcName name, OpcContext context, double maxLevel) : base(parent, name, context) { _maxLevelKg = new OpcAnalogItemNode <double>(this, "MaxLevelKg", maxLevel); _maxLevelKg.AccessLevel = OpcAccessLevel.CurrentRead; _levelKg = new OpcAnalogItemNode <double>(this, "LevelKg"); _levelKg.InstrumentRange = new OpcValueRange(MaxLevelKg, 0); _levelKg.EngineeringUnit = new OpcEngineeringUnitInfo(4933453, "Kg", "Kilogramm"); _levelKg.EngineeringUnitRange = new OpcValueRange(MaxLevelKg, 0); _levelKg.Description = "Füllstand in Kilogramm"; _levelKg.BeforeApplyChanges += _levelKg_BeforeApplyChanges; _levelPercent = new OpcDataVariableNode <double>(this, "LevelPercent"); _levelPercent.Description = "Füllstand in Prozent"; _levelPercent.AccessLevel = OpcAccessLevel.CurrentRead; _alarmLevelHeigh = new OpcDataVariableNode <bool>(this, "AlarmFüllstandHoch"); _alarmLevelHeigh.Description = "Füllstand > 95%"; _warningLevelHeigh = new OpcDataVariableNode <bool>(this, "WarnungFüllstandHoch"); _warningLevelHeigh.Description = "Füllstand > 80%"; //Random r = new Random(); //LevelKg = r.NextDouble() * 5000.0; }
public OpcStatusCollection DeleteHistory( OpcContext context, OpcHistoryModificationInfo modificationInfo, OpcValueCollection values) { var results = OpcStatusCollection.Create(OpcStatusCode.Good, values.Count); lock (this.syncRoot) { for (int index = 0; index < values.Count; index++) { var timestamp = OpcHistoryValue.Create(values[index]).Timestamp; var result = results[index]; if (this.History.Contains(timestamp)) { var value = this.History[timestamp]; this.History.RemoveAt(timestamp); var modifiedValue = value.CreateModified(modificationInfo); this.ModifiedHistory.Add(modifiedValue); } else { result.Update(OpcStatusCode.BadNoEntryExists); } } } return(results); }
public OpcStatusCollection DeleteHistory( OpcContext context, OpcHistoryModificationInfo modificationInfo, DateTime?startTime, DateTime?endTime, OpcDeleteHistoryOptions options) { var results = new OpcStatusCollection(); lock (this.syncRoot) { if (options.HasFlag(OpcDeleteHistoryOptions.Modified)) { this.ModifiedHistory.RemoveRange(startTime, endTime); } else { var values = this.History.Enumerate(startTime, endTime).ToArray(); this.History.RemoveRange(startTime, endTime); for (int index = 0; index < values.Length; index++) { var value = values[index]; this.ModifiedHistory.Add(value.CreateModified(modificationInfo)); results.Add(OpcStatusCode.Good); } } } return(results); }
public Zyklon(IOpcNode parent, OpcName name, OpcContext context, Drehrohrofen ofen) : base(parent, name, context) { Ofen = ofen; tempSensors.Add(new TemperaturSensor(this, "Temperatur_1,", Context) { UpperLimit = Ofen.MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_2,", Context) { UpperLimit = Ofen.MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_3,", Context) { UpperLimit = Ofen.MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_4,", Context) { UpperLimit = Ofen.MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_5,", Context) { UpperLimit = Ofen.MaxTemp }); tempSensors.ForEach(s => s.TempPt1.TimeConstant = 8000); exhaustHeat = new OpcDataVariableNode <bool>(this, "AbwärmeOk", false); exhaustHeat.AccessLevel = OpcAccessLevel.CurrentRead; tempSensors.ForEach(s => RegisterComponent(s)); }
public OpcSimOperation(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _operationState = new OpcDataVariableNode <OperationState>(this, "State"); _operationState.BeforeApplyChanges += _operationState_BeforeApplyChanges; _operationState.AccessLevel = OpcAccessLevel.CurrentRead; _operationMode = new OpcDataVariableNode <OperationMode>(this, "Mode"); _operationMode.BeforeApplyChanges += _operationMode_BeforeApplyChanges; }
public MotorDelayLane(IOpcNode parent, OpcName name, OpcContext context, int numerOfMotors) : base(parent, name, context) { for (int i = 0; i < numerOfMotors; i++) { motors.Add(new Motor(this, "Motor" + i, Context)); } motors.ForEach(m => RegisterComponent(m)); }
public Silo(IOpcNode parent, OpcName name, OpcContext context, double capacity) : base(parent, name, context) { Level = new LevelSensor(this, "LevelSensor", Context, capacity); Motor = new Motor(this, "Fördermotor", Context); Outlet = new Valve(this, "Ausgangsventil", Context); RegisterComponent(Motor); RegisterComponent(Level); RegisterComponent(Outlet); }
public OpcSimComponent(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _warningActive = new OpcDataVariableNode <bool>(this, "WarnungAktiv"); _errorActive = new OpcDataVariableNode <bool>(this, "ErrorAktiv"); _simError = new OpcDataVariableNode <bool>(this, "SimStörung"); _simError.BeforeApplyChanges += _simError_BeforeApplyChanges; _simWarning = new OpcDataVariableNode <bool>(this, "SimWarnung"); _simWarning.BeforeApplyChanges += _simWarning_BeforeApplyChanges; }
public Absackung(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { Abfüllung = new Motor(this, "Abfüllung", context); _numberOfBags = new OpcDataVariableNode <int>(this, "AnzahlSäcke", 0); _numberOfBags.AccessLevel = OpcAccessLevel.CurrentRead; _resetBags = new OpcDataVariableNode <bool>(this, "ResetAnzahl"); _resetBags.BeforeApplyChanges += _resetBags_BeforeApplyChanges; RegisterComponent(Abfüllung); }
public TemperaturSensor(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _unit = new OpcDataVariableNode <string>(this, "Unit", "°C"); _range = new OpcDataVariableNode <string>(this, "Range", "0..0"); _maxValue = new OpcDataVariableNode <double>(this, "MaxValue"); _tempValue = new OpcDataVariableNode <double>(this, "Value"); _upperLimit = new OpcDataVariableNode <double>(this, "UpperLimit", 100.0); _upperLimit.AccessLevel = OpcAccessLevel.CurrentRead; _overtemp = new OpcDataVariableNode <bool>(this, "AlarmÜbertemperatur"); CreatePT1(); }
public Kuehler(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { Ventilators.Add(new Motor(this, "Ventilator1", Context)); Ventilators.Add(new Motor(this, "Ventilator2", Context)); Ventilators.Add(new Motor(this, "Ventilator3", Context)); Ventilators.ForEach(v => RegisterComponent(v)); tempSensor = new TemperaturSensor(this, "Temperatur", context); tempSensor.UpperLimit = 120.0; RegisterComponent(tempSensor); }
protected override OpcNodeId Create( OpcContext context, OpcNamespace nodeNamespace, IOpcNodeInfo node, OpcName nodeName) { if (!OpcName.IsNullOrEmpty(nodeName)) { nodeName = nodeName.Namespace.GetName("\"" + nodeName.Value + "\""); } return(base.Create(context, nodeNamespace, node, nodeName)); }
public Drehrohrofen(IOpcNode parent, OpcName name, OpcContext context, Brennstoffzufuhr bsz) : base(parent, name, context) { Brennstoffzufuhr = bsz; _heatOk = new OpcDataVariableNode <bool>(this, "TemperaturOk"); _delayLengthMs = new OpcDataVariableNode <int>(this, "SimDelayLength", 10000); _delayLengthMs.Description = "Simulierte Verzögerung von Einlauf zum Auslauf von Material"; Brenner = new Brenner(this, "Brenner", Context); Motor = new Motor(this, "Hauptmotor", Context); ValveWasteHeate = new Valve(this, "VentilAbwärme", Context); tempSensors.Add(new TemperaturSensor(this, "Temperatur_1,", Context) { UpperLimit = MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_2,", Context) { UpperLimit = MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_3,", Context) { UpperLimit = MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_4,", Context) { UpperLimit = MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_5,", Context) { UpperLimit = MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_4,", Context) { UpperLimit = MaxTemp }); tempSensors.Add(new TemperaturSensor(this, "Temperatur_5,", Context) { UpperLimit = MaxTemp }); tempSensors.ForEach(s => s.TempPt1.TimeConstant = 14000); RegisterComponent(Brenner); RegisterComponent(Motor); RegisterComponent(ValveWasteHeate); tempSensors.ForEach(s => RegisterComponent(s)); }
protected override void AddNode( OpcContext context, IOpcNode node, IEnumerable <IOpcNodeReferenceAware> references) { base.AddNode(context, node, references); // "Catch" nodes added by the client and "schedule" job nodes. if (node.Parent == this.jobsNode) { if (node is OpcDataVariableNode jobNode) { this.jobs.Enqueue(jobNode); } } }
public Valve(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _maxFlow = new OpcAnalogItemNode <double>(this, "MaxDurchfluss", 600.0); _maxFlow.BeforeApplyChanges += _maxFlow_BeforeApplyChanges; _flow = new OpcAnalogItemNode <double>(this, "Durchfluss"); _flow.InstrumentRange = new OpcValueRange(400.0, 0); _flow.EngineeringUnit = new OpcEngineeringUnitInfo(4666675, "m3/min", "Kubikmeter pro Minute"); _flow.EngineeringUnitRange = new OpcValueRange(400.0, 0); _flow.Description = "Kubikmeter pro Minute"; _open = new OpcDataVariableNode <bool>(this, "Offen"); _open.Description = "True = offen, False = zu"; _movementAlarm = new OpcDataVariableNode <bool>(this, "AlarmPosition"); ManualControl = new ManualControl(this, "Handbetrieb", Context); }
public OpcStatusCollection UpdateHistory( OpcContext context, OpcHistoryModificationInfo modificationInfo, OpcValueCollection values) { var results = OpcStatusCollection.Create(OpcStatusCode.Good, values.Count); lock (this.syncRoot) { var expectedDataTypeId = this.Node.DataTypeId; for (int index = 0; index < values.Count; index++) { var result = results[index]; var value = OpcHistoryValue.Create(values[index]); if (value.DataTypeId == expectedDataTypeId) { if (this.History.Contains(value.Timestamp)) { var oldValue = this.History[value.Timestamp]; this.History.Replace(value); var modifiedValue = oldValue.CreateModified(modificationInfo); this.ModifiedHistory.Add(modifiedValue); result.Update(OpcStatusCode.GoodEntryReplaced); } else { this.History.Add(value); var modifiedValue = value.CreateModified(modificationInfo); this.ModifiedHistory.Add(modifiedValue); result.Update(OpcStatusCode.GoodEntryInserted); } } else { result.Update(OpcStatusCode.BadTypeMismatch); } } } return(results); }
public Motor(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { tempSensor = new TemperaturSensor(this, "Temperatur", context); tempSensor.AlarmEventChanged += TempSensor_AlarmEventChanged; tempSensor.UpperLimit = 70.0; _speed = new OpcDataVariableNode <double>(this, "Speed"); _current = new OpcDataVariableNode <double>(this, "Current"); _power = new OpcDataVariableNode <double>(this, "Power"); _running = new OpcDataVariableNode <bool>(this, "Running"); _overcurrent = new OpcDataVariableNode <bool>(this, "AlarmÜberlast"); ManualControl = new ManualControl(this, "Handbetrieb", Context); CreateSpeedPt1(); PowerPt1 = new PT1_Floating(5000); CurrentPt1 = new PT1_Floating(12.5); CurrentPt1.TimeConstant = 200; }
public IEnumerable <OpcHistoryValue> ReadHistory( OpcContext context, DateTime?startTime, DateTime?endTime, OpcReadHistoryOptions options) { lock (this.syncRoot) { if (options.HasFlag(OpcReadHistoryOptions.Modified)) { return(this.ModifiedHistory .Enumerate(startTime, endTime) .Cast <OpcHistoryValue>() .ToArray()); } return(this.History .Enumerate(startTime, endTime) .ToArray()); } }
public RohMaterialGewinnung(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _truckReadyToUnload = new OpcDataVariableNode <bool>(this, "TruckBereitZumAbladen"); _truckReadyToUnload.Description = "Truck is ready to unload."; _truckReadyToUnload.AccessLevel = OpcAccessLevel.CurrentRead; _unloadingActive = new OpcDataVariableNode <bool>(this, "TruckAbladenAktiv"); _unloadingActive.Description = "Truck is ready to unload."; _unloadingActive.AccessLevel = OpcAccessLevel.CurrentRead; _timeUnloading = new OpcDataVariableNode <int>(this, "ZeitAbladen"); _timeUnloading.Description = "Zeit des Abladevorgangs"; _timeWaitTruck = new OpcDataVariableNode <int>(this, "ZeitWartenAufTruck"); _timeWaitTruck.Description = "Wartezeit nächster Truck"; _simTruckIntervalMs = new OpcDataVariableNode <int>(this, "Z_SimTruckIntervallMs", 10000); _simTruckLoadCapacity = new OpcDataVariableNode <double>(this, "Z_SimTruckKapazität", 10000.0); _simTruckUnloadTimeMs = new OpcDataVariableNode <int>(this, "Z_SimTruckAbladeZeitMs", 8000); }
protected override void AddNode( OpcContext context, IOpcNode node, IEnumerable <IOpcNodeReferenceAware> references) { base.AddNode(context, node, references); // "Catch" nodes added by the client and "attach" the on-demand timestamp determination // (see HandleWriteVariableValue) and a simple in-memory historian which shall // automatically fill its historical values whenever a node value is written. if (node is OpcVariableNode variableNode && variableNode.AccessLevel.HasFlag(OpcAccessLevel.HistoryRead)) { variableNode.WriteVariableValueCallback = this.HandleWriteVariableValue; variableNode.IsHistorizing = true; var historian = new OpcNodeHistorian(this, variableNode); historian.AutoUpdateHistory = true; this.historians.Add(node, historian); } }
public OpcSimModule(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _start = new OpcDataVariableNode <bool>(this, "Start"); _start.Description = "Eine steigende Flanke startet die Anlage."; _stop = new OpcDataVariableNode <bool>(this, "Stop"); _stop.Description = "Eine steigende Flanke stoppt die Anlage."; _warningPending = new OpcDataVariableNode <bool>(this, "WarnungAktiv"); _warningPending.Description = "Zeigt eine anstehende Warnung."; _warningPending.AccessLevel = OpcAccessLevel.CurrentRead; _acknowledge = new OpcDataVariableNode <bool>(this, "Quittieren"); _acknowledge.Description = "Eine steigende Flanke quittiert die Anlage."; _stop.BeforeApplyChanges += _stop_BeforeApplyChanges; _start.BeforeApplyChanges += _start_BeforeApplyChanges; _acknowledge.BeforeApplyChanges += _acknowledge_BeforeApplyChanges; _receiverReady = new OpcDataVariableNode <bool>(this, "EmpfangenBereit"); _receiverReady.AccessLevel = OpcAccessLevel.CurrentRead; }
public bool CanUserExecute(OpcContext context) { return(true); }
public Brecher(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { motors.ForEach(m => RegisterComponent(m)); }
public OpcSimComponentControl(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { }
public Brenner(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _fuelMissing = new OpcDataVariableNode <bool>(this, "AlarmBrennstoffFehlt"); }
public Brennstoffzufuhr(IOpcNode parent, OpcName name, OpcContext context) : base(parent, name, context) { _gasLevel = new OpcDataVariableNode <int>(this, "GasVorrat", 35); _coleLevel = new OpcDataVariableNode <int>(this, "KohleVorrat", 75); }