<Servers>
	<Server>
		<Name>Server1</Name>
		<Port>501</Port>
		<Desc>
		</Desc>
		<Mode>true</Mode>
		<BAUD>9600</BAUD>
		<PARITY>0</PARITY>
		<STOPS>0</STOPS>
		<BITS>8</BITS>
		<INTERVAL>40</INTERVAL>
		<COMMPORT>COM1</COMMPORT>
		<Device>
			<Name>Unit1</Name>
			<Number>1</Number>
			<Description>
			</Description>
			<NoReply>false</NoReply>
			<ReplyTimeout>0</ReplyTimeout>
			<ReplyTimeoutTo>0</ReplyTimeoutTo>
			<BitsMerge>false</BitsMerge>
			<RegsMerge>false</RegsMerge>
			<ProgID>
			</ProgID>
			<EnabelRepeat>false</EnabelRepeat>
			<SendTrash>false</SendTrash>
			<InvalidLength>false</InvalidLength>
			<Groups>
				<Items>
					<Name>MainGroup</Name>
				</Items>
			</Groups>
			<Register>
				<Name>ID</Name>
				<Addr>0</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>Сигнатура идентификации версии прибора = 0x0404 (АВ-СВ)</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.ID</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>1028</Value>
				<DefValue>1028</DefValue>
			</Register>
			<Register>
				<Name>Command</Name>
				<Addr>1</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>50</Period>
				<RegFullName>Server1.Unit1.Command</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>1</Value>
				<DefValue>1</DefValue>
			</Register>
			<Register>
				<Name>StateMachine</Name>
				<Addr>3</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.StateMachine</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>49154</Value>
				<DefValue>1</DefValue>
			</Register>
			<Register>
				<Name>TimeStamp</Name>
				<Addr>4</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<IncDec>1</IncDec>
				<WorkType>0</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>1000</Period>
				<RegFullName>Server1.Unit1.TimeStamp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>182</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WorkState</Name>
				<Addr>6</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>100</Period>
				<RegFullName>Server1.Unit1.WorkState</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>10</Value>
				<DefValue>10</DefValue>
			</Register>
			<Register>
				<Name>Alarms</Name>
				<Addr>7</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.Alarms</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>CritAlarms</Name>
				<Addr>8</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.CritAlarms</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>AssignWeight</Name>
				<Addr>25</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.AssignWeight</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>758875</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>AssignDose</Name>
				<Addr>27</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.AssignDose</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>10000</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>AssignID</Name>
				<Addr>29</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.AssignID</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>3188</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightShipped</Name>
				<Addr>9</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightShipped</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>8800</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightSum</Name>
				<Addr>11</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightSum</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>758875</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>NumOfWeighings</Name>
				<Addr>13</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.NumOfWeighings</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightCurr</Name>
				<Addr>15</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<Script>
					<Line>//Скрипт на исполнение</Line>
					<Line>var</Line>
					<Line>  varWeightShipped: Integer;</Line>
					<Line>  varCnt: Integer;</Line>
					<Line>begin</Line>
					<Line>  { Набор веса }</Line>
					<Line>  if (StateMachine = $0004) then  { 0000 0000 0000 0100 } { для эмулятора }</Line>
					<Line>  { if ((StateMachine and $0004) = $0004) then }  { для реала (14-й бит (и, соответственно, WeightShipped) должен висеть до Выгрузки )}</Line>
					<Line>  begin</Line>
					<Line>    Inc(self, 125);</Line>
					<Line>    if (self &gt;= AssignDose) then</Line>
					<Line>    begin</Line>
					<Line>      { уст. Выгрузка }</Line>
					<Line>      StateMachine := $0010;      { уст. 0000 0000 0001 0000 }</Line>
					<Line>      PauseBreakState := StateMachine;</Line>
					<Line>      { уст. задвижки НЗ-ПО}</Line>
					<Line>      WorkState := WorkState and $FFF0;</Line>
					<Line>      WorkState := WorkState or  $0006;</Line>
					<Line>      { Вес набран, но пока не отдан }</Line>
					<Line>      WeightShipped := self;</Line>
					<Line>      WeightShippedTemp := self;</Line>
					<Line>      Inc(WeightSum, self);</Line>
					<Line>    end</Line>
					<Line>  end</Line>
					<Line>  else</Line>
					<Line>    { Выгрузка }</Line>
					<Line>    if (StateMachine = $0010) then { 0000 0000 0001 0000 }</Line>
					<Line>    begin</Line>
					<Line>      if (varCnt &lt; 50) then</Line>
					<Line>      begin</Line>
					<Line>        if (WeightShipped &lt;&gt; 0) then</Line>
					<Line>          WeightShipped := 0;</Line>
					<Line>        self := self - Int(self / (50 - varCnt));</Line>
					<Line>        Inc(varCnt, 1);</Line>
					<Line>      end</Line>
					<Line>      else</Line>
					<Line>      begin</Line>
					<Line>        WeightShipped := WeightShippedTemp;</Line>
					<Line>        self := 0;</Line>
					<Line>        varCnt := 0;</Line>
					<Line>        if (WeightSum &gt;= AssignWeight) then {</Line>
					<Line>          { отвес завершен, задание завершено, можно забирать WeightShipped, машина остановлена }</Line>
					<Line>          StateMachine := $C002 { уст. 1100 0000 0000 0010 } {не снимать до следующего нажатия Пуск}</Line>
					<Line>        else</Line>
					<Line>        begin</Line>
					<Line>          { отвес завершен, задание НЕ завершено, можно забирать WeightShipped, набор веса }</Line>
					<Line>          StateMachine := $4100; { уст. 0100 0001 0000 0000 } { := $4004 } { уст. 0100 0000 0000 0100 }</Line>
					<Line>          PauseBreakState := StateMachine;</Line>
					<Line>        end;</Line>
					<Line>        { уст. задвижки НЗ-ПЗ}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        WorkState := WorkState or  $000A;</Line>
					<Line>      end</Line>
					<Line>    end</Line>
					<Line>    else</Line>
					<Line>      { Эта ветка - только для эмулятора }</Line>
					<Line>      if (StateMachine = $4100) then</Line>
					<Line>      begin</Line>
					<Line>        if (varCnt &lt; 10) then           { 2.5 сек }</Line>
					<Line>          Inc(varCnt, 1)</Line>
					<Line>        else</Line>
					<Line>        begin</Line>
					<Line>          varCnt := 0;</Line>
					<Line>          { для эмулятора убираем 14-й бит }</Line>
					<Line>          StateMachine := $0004; { уст. 0000 0000 0000 0100 }</Line>
					<Line>          PauseBreakState := StateMachine;</Line>
					<Line>          { уст. задвижки НО-ПЗ}</Line>
					<Line>          WorkState := WorkState and $FFF0;</Line>
					<Line>          WorkState := WorkState or  $0009;</Line>
					<Line>        end</Line>
					<Line>      end</Line>
					<Line>{      else</Line>
					<Line>      if (StateMachine = $C002) then</Line>
					<Line>      begin</Line>
					<Line>        if (Cnt &lt; 10) then           { 2.5 сек</Line>
					<Line>          Inc(Cnt, 1)</Line>
					<Line>        else</Line>
					<Line>        begin</Line>
					<Line>          Cnt := 0;</Line>
					<Line>          { машина остановлена</Line>
					<Line>          StateMachine := $0001; { уст. 0000 0000 0000 0001</Line>
					<Line>        end</Line>
					<Line>      end}</Line>
					<Line>end;</Line>
				</Script>
				<ScriptStart>
					<Line>//Скрипт на запуск</Line>
					<Line>begin</Line>
					<Line>end;</Line>
				</ScriptStart>
				<ScriptStop>
					<Line>//Скрипт на останов</Line>
					<Line>begin</Line>
					<Line>end;</Line>
				</ScriptStop>
				<RegVals>
					<RegVal>
						<RegFullName>Server1.Unit1.AssignWeight</RegFullName>
						<ValName>AssignWeight</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.AssignDose</RegFullName>
						<ValName>AssignDose</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.StateMachine</RegFullName>
						<ValName>StateMachine</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WorkState</RegFullName>
						<ValName>WorkState</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.Cnt2</RegFullName>
						<ValName>Cnt</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightShipped</RegFullName>
						<ValName>WeightShipped</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightSum</RegFullName>
						<ValName>WeightSum</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.PauseBreakState</RegFullName>
						<ValName>PauseBreakState</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightShippedTemp</RegFullName>
						<ValName>WeightShippedTemp</ValName>
					</RegVal>
				</RegVals>
				<WorkType>5</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightCurr</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightCurrTS1</Name>
				<Addr>17</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightCurrTS1</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightCurrTS2</Name>
				<Addr>19</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightCurrTS2</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightCurrTS3</Name>
				<Addr>21</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightCurrTS3</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightCurrTS4</Name>
				<Addr>23</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightCurrTS4</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>Cnt2</Name>
				<Addr>65</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.Cnt2</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>CommandEngine</Name>
				<Addr>52</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<Script>
					<Line>begin</Line>
					<Line>  case Command of</Line>
					<Line>    { Команда Стоп }</Line>
					<Line>//    $8001:</Line>
					<Line>    $8004:</Line>
					<Line>    begin</Line>
					<Line>      if ((StateMachine and $0002) &lt;&gt; $0002) then</Line>
					<Line>      begin</Line>
					<Line>{       if (((StateMachine and $0004) = $0004) or</Line>
					<Line>            (((StateMachine and $0008) = $0008) and ((PauseBreakState and $0004) = $0004))) then  { если не разгрузка</Line>
					<Line>          WeightShippedTemp := WeightCurr;}</Line>
					<Line>        if ((StateMachine and $0004) = $0004) then</Line>
					<Line>        begin</Line>
					<Line>          WeightShippedTemp := WeightCurr;</Line>
					<Line>          StateMachine := StateMachine and $C000;</Line>
					<Line>          StateMachine := StateMachine or $0008;</Line>
					<Line>        end</Line>
					<Line>        else</Line>
					<Line>          if ((StateMachine and $0010) = $0010) then</Line>
					<Line>          begin</Line>
					<Line>            WeightShipped := WeightShippedTemp - WeightCurr;</Line>
					<Line>            WeightShippedTemp := WeightCurr;</Line>
					<Line>            StateMachine := StateMachine and $C000;</Line>
					<Line>            StateMachine := StateMachine or $4008;</Line>
					<Line>          end;</Line>
					<Line>        {сбр. команды Стоп}</Line>
					<Line>        Command := Command and $7FFF;</Line>
					<Line>        { уст. Стоп }</Line>
					<Line>{        StateMachine := StateMachine and $C000;</Line>
					<Line>        StateMachine := StateMachine or $0008;   }</Line>
					<Line>        { уст. задвижки НЗ-ПЗ}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        WorkState := WorkState or $000A;</Line>
					<Line>      end</Line>
					<Line>    end;</Line>
					<Line>    {Команда Пуск}</Line>
					<Line>    $8002:</Line>
					<Line>    begin</Line>
					<Line>      if ((StateMachine and $3FFF) &lt;&gt; $0008) then { если не Пауза }</Line>
					<Line>      begin</Line>
					<Line>        WeightCurr := 0;</Line>
					<Line>        WeightShipped := 0;</Line>
					<Line>        WeightSum := 0;</Line>
					<Line>        AssBreak := 0;</Line>
					<Line>        { уст. Набор веса }</Line>
					<Line>        StateMachine := $0004; { 0000 0000 0000 0100 }</Line>
					<Line>        PauseBreakState := StateMachine;</Line>
					<Line>        { уст. задвижки НО-ПЗ}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        WorkState := WorkState or $0009;</Line>
					<Line>      end</Line>
					<Line>      else</Line>
					<Line>      begin</Line>
					<Line>//        StateMachine := PauseBreakState;</Line>
					<Line>        StateMachine := $0004;</Line>
					<Line>        { уст. задвижки НО-ПЗ}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        if ((StateMachine and $3FFF) = $0004) then</Line>
					<Line>        begin</Line>
					<Line>          WorkState := WorkState or $0009;</Line>
					<Line>        end</Line>
					<Line>        else</Line>
					<Line>        begin</Line>
					<Line>          WorkState := WorkState or $0006;</Line>
					<Line>        end</Line>
					<Line>      end;</Line>
					<Line>      {сбр. команды Пуск}</Line>
					<Line>      Command := Command and $7FFF;</Line>
					<Line>    end;</Line>
					<Line>    {Команда Пуск}</Line>
					<Line>    $800A:</Line>
					<Line>    begin</Line>
					<Line>      if ((StateMachine and $3FFF) &lt;&gt; $0008) then { если не Пауза }</Line>
					<Line>      begin</Line>
					<Line>        WeightCurr := 0;</Line>
					<Line>        WeightShipped := 0;</Line>
					<Line>        WeightSum := 0;</Line>
					<Line>        { уст. Набор веса }</Line>
					<Line>        StateMachine := $0004; { 0000 0000 0000 0100 }</Line>
					<Line>        PauseBreakState := StateMachine;</Line>
					<Line>        { уст. задвижки НО-ПЗ}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        WorkState := WorkState or $0009;</Line>
					<Line>      end</Line>
					<Line>      else</Line>
					<Line>      begin</Line>
					<Line>        StateMachine := PauseBreakState;</Line>
					<Line>        { уст. задвижки НО-ПЗ}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        if ((StateMachine and $3FFF) = $0004) then</Line>
					<Line>        begin</Line>
					<Line>          WorkState := WorkState or $0009;</Line>
					<Line>        end</Line>
					<Line>        else</Line>
					<Line>        begin</Line>
					<Line>          WorkState := WorkState or $0006;</Line>
					<Line>        end</Line>
					<Line>      end;</Line>
					<Line>      {сбр. команды Пуск}</Line>
					<Line>      Command := Command and $7FFF;</Line>
					<Line>    end;</Line>
					<Line>    { Выгрузка }</Line>
					<Line>    $8003:</Line>
					<Line>    begin</Line>
					<Line>      if (((StateMachine and $0002) = $0002) or     { Выгрузка мб из останова или паузы }</Line>
					<Line>          ((StateMachine and $0008) = $0008)) then</Line>
					<Line>      begin</Line>
					<Line>        { сбр. команды Стоп }</Line>
					<Line>        Command := Command and $7FFF;</Line>
					<Line>        StateMachine := $0010;      { уст. 0000 0000 0001 0000 }</Line>
					<Line>        PauseBreakState := StateMachine;</Line>
					<Line>        { уст. задвижки НЗ-ПО}</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        WorkState := WorkState or  $0006;</Line>
					<Line>        { Вес набран, но пока не отдан }</Line>
					<Line>        WeightShipped := WeightCurr;</Line>
					<Line>        if ((AssBreak = 1) or (AssignWeight = AssignDose)) then</Line>
					<Line>          WeightSum := AssignWeight;</Line>
					<Line>      end</Line>
					<Line>    end;</Line>
					<Line>    { Пауза }</Line>
					<Line>//    $8004:</Line>
					<Line>{    $8001:</Line>
					<Line>    begin</Line>
					<Line>      if ((StateMachine and $0002) &lt;&gt; $0002) then</Line>
					<Line>      begin</Line>
					<Line>        {сбр. команды Пауза</Line>
					<Line>        Command := Command and $7FFF;</Line>
					<Line>        { уст. Пауза</Line>
					<Line>        StateMachine := StateMachine and $C000;</Line>
					<Line>        StateMachine := StateMachine or $0008; { 0000 0000 0000 1000</Line>
					<Line>        { уст. задвижки НЗ-ПЗ</Line>
					<Line>        WorkState := WorkState and $FFF0;</Line>
					<Line>        WorkState := WorkState or $000A;</Line>
					<Line>      end</Line>
					<Line>    end; }</Line>
					<Line>    $8001:</Line>
					<Line>    begin</Line>
					<Line>      { сбр. команды Стоп }</Line>
					<Line>      Command := Command and $7FFF;</Line>
					<Line>      //</Line>
					<Line>      AssBreak := 1;</Line>
					<Line>    end;</Line>
					<Line>    $8081:</Line>
					<Line>    begin</Line>
					<Line>      {сбр. команды Разрешить Автономную работа терминала}</Line>
					<Line>      Command := Command and $7FFF;</Line>
					<Line>      { }</Line>
					<Line>      WorkState := WorkState and $7FFF;</Line>
					<Line>      WorkState := WorkState or $8000;</Line>
					<Line>    end;</Line>
					<Line>    $8082:</Line>
					<Line>    begin</Line>
					<Line>      {сбр. команды Запретить Автономную работа терминала}</Line>
					<Line>      Command := Command and $7FFF;</Line>
					<Line>      { }</Line>
					<Line>      WorkState := WorkState and $7FFF;</Line>
					<Line>    end</Line>
					<Line>  end</Line>
					<Line>end;</Line>
				</Script>
				<ScriptStart>
					<Line>//Скрипт на запуск</Line>
					<Line>begin</Line>
					<Line>end;</Line>
				</ScriptStart>
				<ScriptStop>
					<Line>//Скрипт на останов</Line>
					<Line>begin</Line>
					<Line>end;</Line>
				</ScriptStop>
				<RegVals>
					<RegVal>
						<RegFullName>Server1.Unit1.Command</RegFullName>
						<ValName>Command</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightCurr</RegFullName>
						<ValName>WeightCurr</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightShipped</RegFullName>
						<ValName>WeightShipped</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WorkState</RegFullName>
						<ValName>WorkState</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.StateMachine</RegFullName>
						<ValName>StateMachine</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightSum</RegFullName>
						<ValName>WeightSum</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.PauseBreakState</RegFullName>
						<ValName>PauseBreakState</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightShippedTemp</RegFullName>
						<ValName>WeightShippedTemp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.AssignWeight</RegFullName>
						<ValName>AssignWeight</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.AssBreak</RegFullName>
						<ValName>AssBreak</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.AssignDose</RegFullName>
						<ValName>AssignDose</ValName>
					</RegVal>
				</RegVals>
				<WorkType>5</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>50</Period>
				<RegFullName>Server1.Unit1.CommandEngine</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>PauseBreakState</Name>
				<Addr>66</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.PauseBreakState</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>16</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightShippedTemp</Name>
				<Addr>67</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>100</Period>
				<RegFullName>Server1.Unit1.WeightShippedTemp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>8800</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightShippedTempPerc</Name>
				<Addr>69</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>100</Period>
				<RegFullName>Server1.Unit1.WeightShippedTempPerc</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>MistakeWeight</Name>
				<Addr>31</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.MistakeWeight</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>RangeBeginTime_ArchResp</Name>
				<Addr>32</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.RangeBeginTime_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightNum_ArchResp</Name>
				<Addr>34</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightNum_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightsQnt_ArchResp</Name>
				<Addr>36</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightsQnt_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>20</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightTaskID_ArchResp</Name>
				<Addr>38</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightTaskID_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>879</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightEndTime_ArchResp</Name>
				<Addr>40</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightEndTime_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>Weight_ArchResp</Name>
				<Addr>42</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.Weight_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>RangeBeginTime_ArchAsk</Name>
				<Addr>46</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.RangeBeginTime_ArchAsk</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>RangeEndTime_ArchAsk</Name>
				<Addr>48</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.RangeEndTime_ArchAsk</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>WeightNum_ArchAsk</Name>
				<Addr>50</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.WeightNum_ArchAsk</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>ArchiveEngine</Name>
				<Addr>53</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<Script>
					<Line>//Скрипт на исполнение</Line>
					<Line>begin</Line>
					<Line>  RangeBeginTime_ArchResp := RangeBeginTime_ArchAsk;</Line>
					<Line>  WeightNum_ArchResp := WeightNum_ArchAsk;</Line>
					<Line>  WeightsQnt_ArchResp := 20;</Line>
					<Line>{  if WeightNum_ArchResp &lt;= 10 then</Line>
					<Line>    WeightTaskID_ArchResp := 877</Line>
					<Line>  else</Line>
					<Line>    WeightTaskID_ArchResp := 878;}</Line>
					<Line>  WeightTaskID_ArchResp := 879;</Line>
					<Line>  WeightEndTime_ArchResp := RangeBeginTime_ArchAsk + WeightNum_ArchAsk * 30;</Line>
					<Line>  Weight_ArchResp := WeightNum_ArchAsk * 100;</Line>
					<Line>  Dose_ArchResp :=  WeightNum_ArchAsk * 50;</Line>
					<Line>end;</Line>
				</Script>
				<ScriptStart>
					<Line>//Скрипт на запуск</Line>
					<Line>begin</Line>
					<Line>end;</Line>
				</ScriptStart>
				<ScriptStop>
					<Line>//Скрипт на останов</Line>
					<Line>begin</Line>
					<Line>end;</Line>
				</ScriptStop>
				<RegVals>
					<RegVal>
						<RegFullName>Server1.Unit1.RangeBeginTime_ArchResp</RegFullName>
						<ValName>RangeBeginTime_ArchResp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightNum_ArchResp</RegFullName>
						<ValName>WeightNum_ArchResp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightsQnt_ArchResp</RegFullName>
						<ValName>WeightsQnt_ArchResp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightTaskID_ArchResp</RegFullName>
						<ValName>WeightTaskID_ArchResp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightEndTime_ArchResp</RegFullName>
						<ValName>WeightEndTime_ArchResp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.Weight_ArchResp</RegFullName>
						<ValName>Weight_ArchResp</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.RangeBeginTime_ArchAsk</RegFullName>
						<ValName>RangeBeginTime_ArchAsk</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.RangeEndTime_ArchAsk</RegFullName>
						<ValName>RangeEndTime_ArchAsk</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.WeightNum_ArchAsk</RegFullName>
						<ValName>WeightNum_ArchAsk</ValName>
					</RegVal>
					<RegVal>
						<RegFullName>Server1.Unit1.Dose_ArchResp</RegFullName>
						<ValName>Dose_ArchResp</ValName>
					</RegVal>
				</RegVals>
				<WorkType>5</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>1000</Period>
				<RegFullName>Server1.Unit1.ArchiveEngine</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>Dose_ArchResp</Name>
				<Addr>44</Addr>
				<BitAddr>0</BitAddr>
				<vType>19</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>4</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.Dose_ArchResp</RegFullName>
				<RegsCount>2</RegsCount>
				<Value>0</Value>
				<DefValue>0</DefValue>
			</Register>
			<Register>
				<Name>AssBreak</Name>
				<Addr>71</Addr>
				<BitAddr>0</BitAddr>
				<vType>18</vType>
				<Description>
				</Description>
				<mSpace>0</mSpace>
				<ConstGroupName>
				</ConstGroupName>
				<Group>
				</Group>
				<WorkType>2</WorkType>
				<DataFormat>2</DataFormat>
				<Percent>0</Percent>
				<Period>250</Period>
				<RegFullName>Server1.Unit1.AssBreak</RegFullName>
				<RegsCount>1</RegsCount>
				<Value>1</Value>
				<DefValue>0</DefValue>
			</Register>
		</Device>
	</Server>
	<CONSTGROUPS/>
	<FUNCTIONS/>
</Servers>
