aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Indentation/DefaultIndentationStrategy.cs
blob: b5a1f0c2c867f6f1ab2ce461759765242f2c2bbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)

using Tango.Scripting.Editors.Utils;
using System;
using Tango.Scripting.Editors.Document;

namespace Tango.Scripting.Editors.Indentation
{
	/// <summary>
	/// Handles indentation by copying the indentation from the previous line.
	/// Does not support indenting multiple lines.
	/// </summary>
	public class DefaultIndentationStrategy : IIndentationStrategy
	{
		/// <inheritdoc/>
		public virtual void IndentLine(TextDocument document, DocumentLine line)
		{
			if (document == null)
				throw new ArgumentNullException("document");
			if (line == null)
				throw new ArgumentNullException("line");
			DocumentLine previousLine = line.PreviousLine;
			if (previousLine != null) {
				ISegment indentationSegment = TextUtilities.GetWhitespaceAfter(document, previousLine.Offset);
				string indentation = document.GetText(indentationSegment);
				// copy indentation to line
				indentationSegment = TextUtilities.GetWhitespaceAfter(document, line.Offset);
				document.Replace(indentationSegment, indentation);
			}
		}
		
		/// <summary>
		/// Does nothing: indenting multiple lines is useless without a smart indentation strategy.
		/// </summary>
		public virtual void IndentLines(TextDocument document, int beginLine, int endLine)
		{
		}
	}
}
an> public void OnExecute(StubManager stubManager) { ConfigurationParameters configurationParameters = new ConfigurationParameters(); configurationParameters.BreakSensorLimit = 10; //how many samples to collect in diagnostics before sending configurationParameters.DiagnosticCollectionLimit = 1; //how many consecutive readout before declaring DC over/underheat alarm configurationParameters.OverHeatCountLimit = 3; configurationParameters.UnderHeatCountLimit = 3; // time of motor activity before opening the valve or after closing the valve, in milliseconds configurationParameters.CloseValveTimeout = 20; configurationParameters.OpenValveTimeout = 20; //backlash after filling - target pressure, timoeout, time staps (speed will be added in general parameters) configurationParameters.InitialDispenserPressure = 3.85; //used for initial pre-run maximal pressure configurationParameters.InitialDispenserTimeout = 120000; ////used for initial pre-run target number of steps configurationParameters.InitialDispenserTimeLag = 100; //job prepare - build pressure in dispensers - target pressure, timoeout, time staps, speed configurationParameters.DispenserBuildPressureSpeed = 950; //no more than 1000 configurationParameters.DispenserBuildPressureLimit = 0.85; configurationParameters.DispenserBuildPressureTimeout = 420000; // 7 minutes - long prepare for 5 cycles build configurationParameters.DispenserBuildPressureLag = 100; //temperature band 1000 = 100% - thresholds for job start around target temprature - AC configurationParameters.ACHeatersLowerOperationLimit = 995; configurationParameters.ACHeatersUpperOperationLimit = 1005; //temperature band 1000 = 100% - thresholds for job start around target temprature - DC configurationParameters.DCHeatersLowerOperationLimit = 978; configurationParameters.DCHeatersUpperOperationLimit = 1005; // mid tank reading offset to add to the readout (OBSOLETE!) configurationParameters.MidTankPressureCorrection = 0.0; //waste factor for intersegment pressure building configurationParameters.DispenserPresegmentWFCF = 40; //how much time to start the WFCF process (pressure buildup) before segment start configurationParameters.IDSPreSegmentWFCFTimeBeforeSegment = 12000; //flag: start heaters according to saved process parameters upon init? configurationParameters.StartHeatingOnInitSequence = true; // current test for the heaters - alarm thresholds configurationParameters.CurrentAlarmLowLimit = 0.78; configurationParameters.CurrentAlarmHighLimit = 1.07; //currently not in use configurationParameters.IDSSegmentRefillTimeout = 5000; configurationParameters.IDSPreSegmentBuildupTime = 5000; //cleaning!!!!!!!!!! configurationParameters.IDSCleaningSpeed = 800; configurationParameters.IDSCleaningStopBeforeSegmentTime = 10000; //end of presegemnt configurationParameters.IDSCleaningStartSprayPreSegmentTime =2000; //beginning of presegment int Tup = 10,Tdelay1 = 98,Tdelay2 = 198; //350nsec up, 1 second delay, 2 seconds before up again // Tup = LeftRockerSpeed/100; // Tdelay1 = LeftRockerSpeed%100; // Tdelay2 = RightRockerSpeed; int LeftRockerSpeed = Tup*100+Tdelay1; int RightRockerSpeed = Tdelay2; configurationParameters.IDSLeftCleaningMotorSpeed = LeftRockerSpeed; configurationParameters.IDSRightCleaningMotorSpeed = RightRockerSpeed; configurationParameters.SwitchToIdleTimeinSeconds = 3600; configurationParameters.IdleDrierTemperature = 80; configurationParameters.IdleHeadTemperature = 80; configurationParameters.IdleMixerTemperature = 0; configurationParameters.PowerOffTemperatureLimit = 60; //general parameters, ORDER MUST BE PRESERVED!!!! //check the dispensers hard limit alarms /*1*/ Double checkHardLimitAlarms = new Double(); checkHardLimitAlarms = 1.0; configurationParameters.GeneralParameters.Add(checkHardLimitAlarms); /*2*/ Double checkCurrentAlarms = new Double(); checkCurrentAlarms = 1.0; configurationParameters.GeneralParameters.Add(checkCurrentAlarms); //check the tamper alarms /*3*/ Double checkTamperAlarms = new Double(); checkTamperAlarms = 0.0; configurationParameters.GeneralParameters.Add(checkTamperAlarms); /*4*/ Double checkMotorAlarms = new Double(); checkMotorAlarms = 1.0; configurationParameters.GeneralParameters.Add(checkMotorAlarms); /*5*/ Double WinderBackToBaseTime = new Double(); WinderBackToBaseTime = 820.0; configurationParameters.GeneralParameters.Add(WinderBackToBaseTime); /*6*/ Double DispenserInitialPressureSpeed = new Double(); DispenserInitialPressureSpeed = 1050.0; configurationParameters.GeneralParameters.Add(DispenserInitialPressureSpeed); /*7*/ Double SetDiagnosticMode = new Double(); SetDiagnosticMode = 3.0; configurationParameters.GeneralParameters.Add(SetDiagnosticMode); /*8*/ Double SetAutoFill = new Double(); SetAutoFill = 3.0; configurationParameters.GeneralParameters.Add(SetAutoFill); double PowerOffDisableCleaning = new Double(); PowerOffDisableCleaning = 0.0; configurationParameters.GeneralParameters.Add(PowerOffDisableCleaning); double SublimationBlowTime = new Double(); SublimationBlowTime = 30.0; configurationParameters.GeneralParameters.Add(SublimationBlowTime); double AllowedRangeForHeadBlowerDeviation = new Double(); AllowedRangeForHeadBlowerDeviation = 7; configurationParameters.GeneralParameters.Add(AllowedRangeForHeadBlowerDeviation); double AllowedRangeForWasteBlowerDeviation = new Double(); AllowedRangeForWasteBlowerDeviation = 20; configurationParameters.GeneralParameters.Add(AllowedRangeForWasteBlowerDeviation); double Voltage_Hysteresis = new Double(); Voltage_Hysteresis = 4; configurationParameters.GeneralParameters.Add(Voltage_Hysteresis); File.WriteAllBytes("C:/temp/EmbParam.cfg",configurationParameters.ToBytes()); byte[] fileBytes = File.ReadAllBytes("C:/temp/EmbParam.cfg"); var config = ConfigurationParameters.Parser.ParseFrom(fileBytes); stubManager.Write( config); Thread.Sleep(1000); stubManager.Write("\n\n Deleting old file"); DeleteRequest deleteRequest = new DeleteRequest(); deleteRequest.Path = "SYSINFO//EmbParam.cfg"; deleteRequest.Attribute = Tango.PMR.IO.FileAttribute.Unspecified; DeleteResponse response5 = stubManager.Run<DeleteResponse>(deleteRequest); Thread.Sleep(1000); stubManager.Write("\n\n Loading new file file"); FileUploadRequest fileUploadRequest = new FileUploadRequest(); fileUploadRequest.Path = "SYSINFO//EmbParam.cfg"; fileUploadRequest.Length = (int)fileBytes.Length; FileUploadResponse response2 = stubManager.Run<FileUploadResponse>(fileUploadRequest); Thread.Sleep(1000); long chunk_size = response2.MaxChunkLength; FileStream fs = new FileStream("C:/temp/EmbParam.cfg",FileMode.Open); while (fs.Position < fs.Length) { stubManager.Write("Position "+ fs.Position+ " Length "+ fs.Length +"\n\n"); FileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest(); fileChunkUploadRequest.UploadID = response2.UploadID; byte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)]; fs.Read(chunk,0,chunk.Length); fileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk); var response3 = stubManager.Run<FileChunkUploadResponse>(fileChunkUploadRequest); Thread.Sleep(2000); } // activating the new file ProgressRequest progressRequest = new ProgressRequest(); progressRequest.Amount = 0xCD; progressRequest.Delay = 0xCD; var response1 = stubManager.Run<ProgressResponse>(progressRequest); /* 13:46:42.38: Executing script 'embeddedparametersbuild.cs'... { "BreakSensorLimit": 10, "DiagnosticCollectionLimit": 1, "OverHeatCountLimit": 3, "UnderHeatCountLimit": 3, "CloseValveTimeout": 255, "OpenValveTimeout": 255, "InitialDispenserPressure": 1.5, "InitialDispenserTimeout": 60000, "InitialDispenserTimeLag": 100, "DispenserBuildPressureSpeed": 800, "DispenserBuildPressureLimit": 0.9, "DispenserBuildPressureTimeout": 80000, "DispenserBuildPressureLag": 50, "ACHeatersLowerOperationLimit": 995, "ACHeatersUpperOperationLimit": 1005, "DCHeatersLowerOperationLimit": 978, "DCHeatersUpperOperationLimit": 1005, "DispenserPresegmentWFCF": 80, "StartHeatingOnInitSequence": true, "GeneralParameters": [ 1, 1, 1, 1, 800, 1000 ], "CurrentAlarmLowLimit": 0.8, "CurrentAlarmHighLimit": 1.07, "IDSSegmentRefillTimeout": 5000, "IDSPreSegmentBuildupTime": 5000, "IDSCleaningSpeed": 50, "IDSCleaningStopBeforeSegmentTime": 3000, "IDSCleaningStartSprayPreSegmentTime": 1000, "IDSLeftCleaningMotorSpeed": 30, "IDSRightCleaningMotorSpeed": 23, "SwitchToIdleTimeinSeconds": 3600, "IdleDrierTemperature": 80, "IdleHeadTemperature": 80, "PowerOffTemperatureLimit": 50, "IDSPreSegmentWFCFTimeBeforeSegment": 1500 } */ }