public ShellOperation( IActionCenter actionCenter, IAudio audio, INotificationInfo aboutInfo, INotificationController aboutController, ClientContext context, IKeyboard keyboard, ILogger logger, INotificationInfo logInfo, INotificationController logController, IPowerSupply powerSupply, ISystemInfo systemInfo, ITaskbar taskbar, ITaskview taskview, IText text, IUserInterfaceFactory uiFactory, IWirelessAdapter wirelessAdapter) : base(context) { this.aboutInfo = aboutInfo; this.aboutController = aboutController; this.actionCenter = actionCenter; this.audio = audio; this.keyboard = keyboard; this.logger = logger; this.logInfo = logInfo; this.logController = logController; this.powerSupply = powerSupply; this.systemInfo = systemInfo; this.text = text; this.taskbar = taskbar; this.taskview = taskview; this.uiFactory = uiFactory; this.wirelessAdapter = wirelessAdapter; }
public void Copy(IPowerSupply other) { if (other is ScriptedPassengerCarPowerSupply scriptedOther) { Copy(scriptedOther); } }
internal PowerSupplyControl(IPowerSupply powerSupply, IText text) { this.powerSupply = powerSupply; this.text = text; InitializeComponent(); InitializePowerSupplyControl(); }
public ActionCenterPowerSupplyControl(IPowerSupply powerSupply, IText text) { this.powerSupply = powerSupply; this.text = text; InitializeComponent(); InitializePowerSupplyControl(); }
public override void Copy(IPowerSupply other) { base.Copy(other); if (other is ScriptedElectricPowerSupply scriptedOther) { CircuitBreaker.Copy(scriptedOther.CircuitBreaker); } }
public override void Copy(IPowerSupply other) { base.Copy(other); if (other is ScriptedDieselPowerSupply scriptedOther) { TractionCutOffRelay.Copy(scriptedOther.TractionCutOffRelay); } }
public override void Copy(IPowerSupply other) { base.Copy(other); if (other is ScriptedDualModePowerSupply scriptedOther) { CircuitBreaker.Copy(scriptedOther.CircuitBreaker); TractionCutOffRelay.Copy(scriptedOther.TractionCutOffRelay); } }
public ISystemControl CreatePowerSupplyControl(IPowerSupply powerSupply, Location location) { if (location == Location.ActionCenter) { return(new ActionCenterPowerSupplyControl(powerSupply, text)); } else { return(new TaskbarPowerSupplyControl(powerSupply, text)); } }
public static void RefreshVisualization(this IPowerSupply s) { //when faulted, have the mask show 0 units if (s.FaultedPercentage > 0f) { s.PowerViz.PowerMask.transform.localScale = ElectricityConstants._BackingScale + Vector3.forward * 10f; } else { s.PowerViz.PowerMask.transform.localScale = ElectricityConstants._BackingScale + Vector3.forward * (10 - s.GenerationInPowerUnits()); } }
public virtual void Copy(IPowerSupply other) { if (other is ScriptedLocomotivePowerSupply scriptedOther) { BatterySwitch.Copy(scriptedOther.BatterySwitch); MasterKey.Copy(scriptedOther.MasterKey); ElectricTrainSupplySwitch.Copy(scriptedOther.ElectricTrainSupplySwitch); ScriptName = scriptedOther.ScriptName; PowerOnDelayS = scriptedOther.PowerOnDelayS; AuxPowerOnDelayS = scriptedOther.AuxPowerOnDelayS; } }
public ServerProxy( AppConfig appConfig, ILogger logger, IPowerSupply powerSupply = default(IPowerSupply), IWirelessAdapter wirelessAdapter = default(IWirelessAdapter)) { this.api = new ApiVersion1(); this.appConfig = appConfig; this.cancellationTokenSource = new CancellationTokenSource(); this.httpClient = new HttpClient(); this.logContent = new ConcurrentQueue <ILogContent>(); this.logger = logger; this.powerSupply = powerSupply; this.timer = new Timer(); this.wirelessAdapter = wirelessAdapter; }
public static void Sample3() { IPowerSupply powerSupply = PowerSupplyFactory.BKPrecisionComPort(); //Connect some other power supply (e.g. a Sorensen XG 1500) to COM port powerSupply.DisableOutputs(); //Disable outputs string actualVoltage = powerSupply.ReadActualVoltage(); //Read voltage if (actualVoltage == "") //it is expected that it is impossible to read the voltage { Console.WriteLine("Power Supply over Com port works correctly."); } else { Console.WriteLine("After disabling it's possible read out the outputs."); } powerSupply.Disconnect(); //Disconect from COM port }
public ServerProxy( AppConfig appConfig, ILogger logger, IPowerSupply powerSupply = default(IPowerSupply), IWirelessAdapter wirelessAdapter = default(IWirelessAdapter)) { this.api = new ApiVersion1(); this.appConfig = appConfig; this.cancellationTokenSource = new CancellationTokenSource(); this.fileSystem = new FileSystem(appConfig, logger); this.httpClient = new HttpClient(); this.instructionConfirmations = new ConcurrentQueue <string>(); this.logger = logger; this.logContent = new ConcurrentQueue <ILogContent>(); this.parser = new Parser(logger); this.powerSupply = powerSupply; this.timer = new Timer(); this.wirelessAdapter = wirelessAdapter; }
public static void Sample2() { var current = 1; IPowerSupply powerSupply = PowerSupplyFactory.BKPrecision9206ComPort(); //Connect BK Precision 9206 to COM port powerSupply.EnableOutputs(); //Enable outputs powerSupply.SetCurrentOutput(current); //Set Current string actualCurrent = powerSupply.ReadCurrentValue(); //Read Current if ((actualCurrent != "") && (current == Convert.ToInt32(actualCurrent))) //Compare currents { Console.WriteLine("Power Supply BKPrecision 9206 over Com port works correctly."); } else { Console.WriteLine("The set and actual current is not equal."); } powerSupply.Disconnect(); //Disconect from COM port }
public static void Sample1() { var voltage = 20; IPowerSupply powerSupply = PowerSupplyFactory.BKPrecision9132BComPort(); //Connect BK Precision 9132B to COM port powerSupply.EnableOutputs(); //Enable outputs powerSupply.SetVoltage(voltage); //Set voltage string actualVoltage = powerSupply.ReadActualVoltage(); //Read voltage if ((actualVoltage != "") && (voltage == Convert.ToInt32(actualVoltage))) //Compare voltages { Console.WriteLine("Power Supply BKPrecision 9132B over Com port works correctly."); } else { Console.WriteLine("The set and actual voltage is not equal."); } powerSupply.Disconnect(); //Disconect from COM port }
public ShellOperation( IActionCenter actionCenter, IEnumerable <IActionCenterActivator> activators, ActionCenterSettings actionCenterSettings, IAudio audio, INotificationInfo aboutInfo, INotificationController aboutController, IKeyboard keyboard, ILogger logger, INotificationInfo logInfo, INotificationController logController, IPowerSupply powerSupply, ISystemInfo systemInfo, ITaskbar taskbar, TaskbarSettings taskbarSettings, ITerminationActivator terminationActivator, IText text, IUserInterfaceFactory uiFactory, IWirelessAdapter wirelessAdapter) { this.aboutInfo = aboutInfo; this.aboutController = aboutController; this.actionCenter = actionCenter; this.activators = activators; this.actionCenterSettings = actionCenterSettings; this.audio = audio; this.keyboard = keyboard; this.logger = logger; this.logInfo = logInfo; this.logController = logController; this.powerSupply = powerSupply; this.systemInfo = systemInfo; this.taskbarSettings = taskbarSettings; this.terminationActivator = terminationActivator; this.text = text; this.taskbar = taskbar; this.uiFactory = uiFactory; this.wirelessAdapter = wirelessAdapter; }
public DeskFan(IPowerSupply powerSupply) { _powerSupply = powerSupply; }
public ComputerBoxZalmanZ11(IMotherboard motherboard, IFan computerBoxFan, IPowerSupply powerSupply) { Motherboard = motherboard; ComputerBoxFan = computerBoxFan; PowerSupply = powerSupply; }
public DeskFan(IPowerSupply ps) { _powerSupply = ps; }
public override void OnStart(PartModule.StartState state) { powerSupply = part.FindModuleImplementing <IPowerSupply>(); if (powerSupply != null) { powerSupply.DisplayName = Localizer.Format("#LOC_KSPIE_Refinery_started");//"started" } if (state == StartState.Editor) { return; } // load stored overflow setting overflowAllowed = lastOverflowSettings; _window_ID = new System.Random(part.GetInstanceID()).Next(int.MinValue, int.MaxValue); _refinery_activities = part.FindModulesImplementing <IRefineryActivity>(); if (_refinery_activities == null || _refinery_activities.Count == 0) { var unsortedList = new List <IRefineryActivity>(); unsortedList.Add(new AnthraquinoneProcessor()); unsortedList.Add(new NuclearFuelReprocessor()); unsortedList.Add(new AluminiumElectrolyser()); unsortedList.Add(new SabatierReactor()); unsortedList.Add(new WaterElectroliser()); unsortedList.Add(new HeavyWaterElectroliser()); unsortedList.Add(new PeroxideProcess()); unsortedList.Add(new UF4Ammonolysiser()); unsortedList.Add(new HaberProcess()); unsortedList.Add(new AmmoniaElectrolyzer()); unsortedList.Add(new CarbonDioxideElectroliser()); unsortedList.Add(new WaterGasShift()); unsortedList.Add(new ReverseWaterGasShift()); unsortedList.Add(new PartialOxidationMethane()); unsortedList.Add(new SolarWindProcessor()); unsortedList.Add(new RegolithProcessor()); unsortedList.Add(new AtmosphericExtractor()); unsortedList.Add(new SeawaterExtractor()); _refinery_activities = unsortedList.Where(m => ((int)m.RefineryType & this.refineryType) == (int)m.RefineryType).OrderBy(a => a.ActivityName).ToList(); } _refinery_activities.ForEach(m => m.Initialize(this.part)); // load same if (refinery_is_enabled && !string.IsNullOrEmpty(lastActivityName)) { Debug.Log("[KSPI]: ISRU Refinery looking to restart " + lastActivityName); _current_activity = _refinery_activities.FirstOrDefault(a => a.ActivityName == lastActivityName); if (_current_activity == null) { Debug.Log("[KSPI]: ISRU Refinery looking to restart " + lastClassName); _current_activity = _refinery_activities.FirstOrDefault(a => a.GetType().Name == lastClassName); } } if (_current_activity != null) { bool hasRequirement = _current_activity.HasActivityRequirements(); lastActivityName = _current_activity.ActivityName; Debug.Log("[KSPI]: ISRU Refinery initializing " + lastActivityName + " for which hasRequirement: " + hasRequirement); var productionModifier = productionMult * baseProduction; var timeDifference = (Planetarium.GetUniversalTime() - lastActiveTime); if (timeDifference > 0.01) { string message = Localizer.Format("#LOC_KSPIE_Refinery_Postmsg1", lastActivityName, timeDifference.ToString("0"));//"IRSU performed " + + " for " + + " seconds" Debug.Log("[KSPI]: " + message); ScreenMessages.PostScreenMessage(message, 20, ScreenMessageStyle.LOWER_CENTER); } if (lastActivityName == "Atmospheric Extraction") { ((AtmosphericExtractor)_current_activity).ExtractAir(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } else if (lastActivityName == "Seawater Extraction") { ((SeawaterExtractor)_current_activity).ExtractSeawater(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } else { _current_activity.UpdateFrame(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } } }
internal void BuildObjectGraph(Action shutdown) { ValidateCommandLineArguments(); InitializeLogging(); InitializeText(); context = new ClientContext(); uiFactory = BuildUserInterfaceFactory(); actionCenter = uiFactory.CreateActionCenter(); messageBox = BuildMessageBox(); nativeMethods = new NativeMethods(); powerSupply = new PowerSupply(ModuleLogger(nameof(PowerSupply))); runtimeProxy = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client); systemInfo = new SystemInfo(); taskbar = uiFactory.CreateTaskbar(ModuleLogger("Taskbar")); taskview = uiFactory.CreateTaskview(); wirelessAdapter = new WirelessAdapter(ModuleLogger(nameof(WirelessAdapter))); var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory))); var applicationMonitor = new ApplicationMonitor(TWO_SECONDS, ModuleLogger(nameof(ApplicationMonitor)), nativeMethods, processFactory); var applicationFactory = new ApplicationFactory(applicationMonitor, ModuleLogger(nameof(ApplicationFactory)), nativeMethods, processFactory); var displayMonitor = new DisplayMonitor(ModuleLogger(nameof(DisplayMonitor)), nativeMethods, systemInfo); var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods); var fileSystemDialog = BuildFileSystemDialog(); var hashAlgorithm = new HashAlgorithm(); var splashScreen = uiFactory.CreateSplashScreen(); var systemMonitor = new SystemMonitor(ModuleLogger(nameof(SystemMonitor))); var operations = new Queue <IOperation>(); operations.Enqueue(new I18nOperation(logger, text)); operations.Enqueue(new RuntimeConnectionOperation(context, logger, runtimeProxy, authenticationToken)); operations.Enqueue(new ConfigurationOperation(context, logger, runtimeProxy)); operations.Enqueue(new DelegateOperation(UpdateAppConfig)); operations.Enqueue(new LazyInitializationOperation(BuildClientHostOperation)); operations.Enqueue(new ClientHostDisconnectionOperation(context, logger, FIVE_SECONDS)); operations.Enqueue(new LazyInitializationOperation(BuildKeyboardInterceptorOperation)); operations.Enqueue(new LazyInitializationOperation(BuildMouseInterceptorOperation)); operations.Enqueue(new ApplicationOperation(context, applicationFactory, applicationMonitor, logger, text)); operations.Enqueue(new DisplayMonitorOperation(context, displayMonitor, logger, taskbar)); operations.Enqueue(new SystemMonitorOperation(context, systemMonitor, logger)); operations.Enqueue(new LazyInitializationOperation(BuildShellOperation)); operations.Enqueue(new LazyInitializationOperation(BuildBrowserOperation)); operations.Enqueue(new LazyInitializationOperation(BuildServerOperation)); operations.Enqueue(new LazyInitializationOperation(BuildProctoringOperation)); operations.Enqueue(new ClipboardOperation(context, logger, nativeMethods)); var sequence = new OperationSequence(logger, operations); ClientController = new ClientController( actionCenter, applicationMonitor, context, displayMonitor, explorerShell, fileSystemDialog, hashAlgorithm, logger, messageBox, sequence, runtimeProxy, shutdown, splashScreen, systemMonitor, taskbar, text, uiFactory); }
public override void OnStart(PartModule.StartState state) { powerSupply = part.FindModuleImplementing <IPowerSupply>(); if (powerSupply != null) { powerSupply.DisplayName = "started"; } if (state == StartState.Editor) { return; } // load stored overflow setting overflowAllowed = lastOverflowSettings; _window_ID = new System.Random(part.GetInstanceID()).Next(int.MinValue, int.MaxValue); var unsortedList = new List <IRefineryActivity>(); try { unsortedList.Add(new AnthraquinoneProcessor(this.part)); unsortedList.Add(new NuclearFuelReprocessor(this.part)); unsortedList.Add(new AluminiumElectrolyser(this.part)); unsortedList.Add(new SabatierReactor(this.part)); unsortedList.Add(new WaterElectroliser(this.part)); unsortedList.Add(new HeavyWaterElectroliser(this.part)); unsortedList.Add(new PeroxideProcess(this.part)); unsortedList.Add(new UF4Ammonolysiser(this.part)); unsortedList.Add(new HaberProcess(this.part)); unsortedList.Add(new AmmoniaElectrolyzer(this.part)); unsortedList.Add(new CarbonDioxideElectroliser(this.part)); unsortedList.Add(new WaterGasShift(this.part)); unsortedList.Add(new ReverseWaterGasShift(this.part)); unsortedList.Add(new PartialOxidationMethane(this.part)); unsortedList.Add(new SolarWindProcessor(this.part)); unsortedList.Add(new RegolithProcessor(this.part)); unsortedList.Add(new AtmosphericExtractor(this.part)); unsortedList.Add(new SeawaterExtractor(this.part)); } catch (Exception e) { Debug.LogException(e, new UnityEngine.Object() { name = "ISRU Refinery" }); Debug.LogWarning("[KSPI] - ISRU Refinery Exception " + e.Message); } _refinery_activities = unsortedList.Where(m => ((int)m.RefineryType & this.refineryType) == (int)m.RefineryType).OrderBy(a => a.ActivityName).ToList(); // load same if (refinery_is_enabled && !string.IsNullOrEmpty(lastActivityName)) { _current_activity = _refinery_activities.FirstOrDefault(a => a.ActivityName == lastActivityName); } if (_current_activity != null) { var productionRate = lastPowerRatio * productionMult * baseProduction; var timeDifference = (Planetarium.GetUniversalTime() - lastActiveTime); //string message = "[KSPI] - IRSU performed " + lastActivityName + " for " + timeDifference.ToString("0.0") + " seconds with production rate " + productionRate.ToString("0.0"); //Debug.Log(message); //ScreenMessages.PostScreenMessage(message, 60.0f, ScreenMessageStyle.LOWER_CENTER); if (lastActivityName == "Atmospheric Extraction") { ((AtmosphericExtractor)_current_activity).ExtractAir(productionRate, lastPowerRatio, productionMult * baseProduction, lastOverflowSettings, timeDifference, true); } else if (lastActivityName == "Seawater Extraction") { ((SeawaterExtractor)_current_activity).ExtractSeawater(productionRate, lastPowerRatio, productionMult * baseProduction, lastOverflowSettings, timeDifference, true); } else { _current_activity.UpdateFrame(productionRate, lastPowerRatio, productionMult * baseProduction, lastOverflowSettings, timeDifference); } } }
private IPowerSupply _powerSupply;//紧耦合 public DeskFan(IPowerSupply powerSupply) { //构造器ctor+tab+tab _powerSupply = powerSupply; }
public override void OnStart(StartState state) { powerSupply = part.FindModuleImplementing <IPowerSupply>(); if (powerSupply != null) { powerSupply.DisplayName = Localizer.Format("#LOC_KSPIE_Refinery_started"); //"started" } if (state == StartState.Editor) { return; } // load stored overflow setting _overflowAllowed = lastOverflowSettings; _windowId = new System.Random(part.GetInstanceID()).Next(int.MinValue, int.MaxValue); var refineriesList = part.FindModulesImplementing <IRefineryActivity>().ToList(); if (refineryType > 0) { AddIfMissing(refineriesList, new AluminiumElectrolyzer()); AddIfMissing(refineriesList, new AmmoniaElectrolyzer()); AddIfMissing(refineriesList, new AnthraquinoneProcessor()); AddIfMissing(refineriesList, new AtmosphereProcessor()); AddIfMissing(refineriesList, new CarbonDioxideElectrolyzer()); AddIfMissing(refineriesList, new HaberProcess()); AddIfMissing(refineriesList, new HeavyWaterElectrolyzer()); AddIfMissing(refineriesList, new PartialMethaneOxidation()); AddIfMissing(refineriesList, new PeroxideProcess()); AddIfMissing(refineriesList, new UF4Ammonolysiser()); AddIfMissing(refineriesList, new RegolithProcessor()); AddIfMissing(refineriesList, new ReverseWaterGasShift()); AddIfMissing(refineriesList, new NuclearFuelReprocessor()); AddIfMissing(refineriesList, new SabatierReactor()); AddIfMissing(refineriesList, new OceanProcessor()); AddIfMissing(refineriesList, new SolarWindProcessor()); AddIfMissing(refineriesList, new WaterElectrolyzer()); AddIfMissing(refineriesList, new WaterGasShift()); availableRefineries = refineriesList .Where(m => ((int)m.RefineryType & refineryType) == (int)m.RefineryType) .OrderBy(a => a.ActivityName).ToList(); } else { availableRefineries = refineriesList.OrderBy(a => a.ActivityName).ToList(); } // initialize refineries foreach (var availableRefinery in availableRefineries) { try { availableRefinery.Initialize(part, this); } catch (Exception e) { Debug.LogError("[KSPI]: Failed to initialize " + availableRefinery.ActivityName + " with exception: " + e.Message); } } // load same if (refinery_is_enabled && !string.IsNullOrEmpty(lastActivityName)) { Debug.Log("[KSPI]: ISRU Refinery looking to restart " + lastActivityName); currentActivity = availableRefineries.FirstOrDefault(a => a.ActivityName == lastActivityName); if (currentActivity == null) { Debug.Log("[KSPI]: ISRU Refinery looking to restart " + lastClassName); currentActivity = availableRefineries.FirstOrDefault(a => a.GetType().Name == lastClassName); } } if (currentActivity != null) { bool hasRequirement = currentActivity.HasActivityRequirements(); lastActivityName = currentActivity.ActivityName; Debug.Log("[KSPI]: ISRU Refinery initializing " + lastActivityName + " for which hasRequirement: " + hasRequirement); var timeDifference = (Planetarium.GetUniversalTime() - lastActiveTime); if (timeDifference > 0.01) { string message = Localizer.Format("#LOC_KSPIE_Refinery_Postmsg1", lastActivityName, timeDifference.ToString("0")); //"IRSU performed " + + " for " + + " seconds" Debug.Log("[KSPI]: " + message); ScreenMessages.PostScreenMessage(message, 20, ScreenMessageStyle.LOWER_CENTER); } var productionModifier = productionMult * baseProduction; if (lastActivityName == "Atmospheric Extraction") { ((AtmosphereProcessor)currentActivity).ExtractAir(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } else if (lastActivityName == "Seawater Extraction") { ((OceanProcessor)currentActivity).ExtractSeawater(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } else { currentActivity.UpdateFrame(lastPowerRatio * productionModifier, lastPowerRatio, productionModifier, lastOverflowSettings, timeDifference, true); } } }
public static int GenerationInPowerUnits(this IPowerSupply c) { return(Math.Max(0, Mathf.RoundToInt(c.WattsGenerated / ElectricityConstants.WattsPerBlock))); }
public Deskfan(IPowerSupply powerSupply) { this._powerSupply = powerSupply; }
public Fan(IPowerSupply powerSupply) { this._powerSupply = powerSupply; }
public ISystemControl CreatePowerSupplyControl(IPowerSupply powerSupply, Location location) { return(new Controls.Taskbar.PowerSupplyControl(powerSupply, text)); }
public DeskFan(IPowerSupply power) { _powersupply = power; }