aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/embeddedparametersbuild.cs
blob: 3b2ff042b4dce36dd04ef2760d71f57b1c7c95a3 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic }
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;
using Google.Protobuf;
using Tango.PMR.EmbeddedParameters;
using System.IO;
using Tango.PMR.IO;


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 = 10;
configurationParameters.OpenValveTimeout = 10;

//backlash after filling - target pressure, timoeout, time staps (speed will be added in general parameters)
configurationParameters.InitialDispenserPressure = 0.25; 
configurationParameters.InitialDispenserTimeout = 60000; //20 seconds
configurationParameters.InitialDispenserTimeLag = 100;

//job prepare - build pressure in dispensers - target pressure, timoeout, time staps, speed
configurationParameters.DispenserBuildPressureSpeed = 950; //no more than 1000
configurationParameters.DispenserBuildPressureLimit = 1.2; 
configurationParameters.DispenserBuildPressureTimeout = 80000;
configurationParameters.DispenserBuildPressureLag = 50;

//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 = 30000;

//flag: start heaters according to saved process parameters upon init?
configurationParameters.StartHeatingOnInitSequence = false;

// current test for the heaters - alarm thresholds
configurationParameters.CurrentAlarmLowLimit = 0
n class="n">configurationParameters.IDSSegmentRefillTimeout = 5000; configurationParameters.IDSPreSegmentBuildupTime = 5000; //cleaning!!!!!!!!!! configurationParameters.IDSCleaningSpeed = 800; configurationParameters.IDSCleaningStopBeforeSegmentTime = 3000; configurationParameters.IDSCleaningStartSprayPreSegmentTime = 1000; configurationParameters.IDSLeftCleaningMotorSpeed = 30; configurationParameters.IDSRightCleaningMotorSpeed = 23; configurationParameters.SwitchToIdleTimeinSeconds = 3600; configurationParameters.IdleDrierTemperature = 80; configurationParameters.IdleHeadTemperature = 80; configurationParameters.IdleMixerTemperature = 0; configurationParameters.PowerOffTemperatureLimit = 50; //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 = 800.0; configurationParameters.GeneralParameters.Add(WinderBackToBaseTime); /*6*/ Double DispenserInitialPressureSpeed = new Double(); DispenserInitialPressureSpeed = 800.0; configurationParameters.GeneralParameters.Add(DispenserInitialPressureSpeed); /*7*/ Double SetDiagnosticMode = new Double(); SetDiagnosticMode = 1.0; configurationParameters.GeneralParameters.Add(SetDiagnosticMode); /*8*/ Double SetAutoFill = new Double(); SetAutoFill = 0.0; configurationParameters.GeneralParameters.Add(SetAutoFill); 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); /* 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 } */ }