<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE eds SYSTEM "DTDFILE_FULLPATH">
<schematic version="1.2.0" sx="700" sy="600" aliasingInShapes="true" aliasingInUnitSymbols="true" connector-status="allshowed" >

	<grid enabled="false" snap="false" hspacing="16" vspacing="16" colorMain="230,230,230" colorSecondary="243,243,243" numberCells="5" />

	<layers>
			<layer id="1" name="Layer_1" isVisible="true" isActive="true" elPosition="1" />
	</layers>
	
	<rect id="Rectangle_1" cx="353.851" cy="256.609" sx="602.357" sy="421.38" dx="2.70115" dy="8.10346" layer="1"  />

	<line id="Line_1" points="584.42,161.143 665.834,66.1782" lineColor="255,0,0" lineType="1"  layer="1"  />

	<line id="Line_2" points="516.102,121.043 661.782,66.1782" lineColor="255,0,0" lineType="1"  layer="1"  />

	<line id="Line_3" points="479.454,81.0346 729.226,46.7833" dx="-65.3481" dy="19.3074" lineColor="255,0,0" lineType="1"  layer="1"  />

	<line id="Line_4" points="288.235,94.2306 667.185,66.1782" lineColor="255,0,0" lineType="1"  layer="1"  />

	<line id="Line_5" points="615.103,253.852 661.751,226.731" lineColor="0,0,255" lineType="1"  layer="1"  />

	<line id="Line_6" points="579.821,358.937 579.821,326.306 633.787,325.051 635.042,254.77 661.751,227.816" lineColor="0,0,255" lineType="1"  layer="1"  />

	<line id="Line_7" points="472.702,333.592 471.889,283.635 582.098,280.92" lineType="1"  layer="1"  />

	<line id="Line_8" points="282.38,125.502 282.38,258.535 218.793,257.96" lineType="1"  layer="1"  />

	<component id="IdMeasured" library="CONTROL" type="AnalogSource" layer="1" elPosition="5" >
	
		<symbol cx="114" cy="104" sx="69" sy="49" dx="109.224" dy="166.522" onLabel="true" />
	
		<label cx="37.5" cy="12" dx="180.724" dy="292.523" />
	
		<instanceData>
			<datum id="Amp" value="Id" />
		</instanceData>
	
	</component>

	<component id="Id_Set" library="CONTROL" type="AnalogSource" layer="1" elPosition="6" >
	
		<symbol cx="114" cy="104" sx="69" sy="49" dx="111.611" dy="242.395" onLabel="true" />
	
		<label cx="22.5" cy="12" dx="200.611" dy="368.395" />
	
		<instanceData>
			<datum id="Amp" value="IdSet" />
		</instanceData>
	
	</component>

	<component id="ItthPID" library="CONTROL" type="Cntrl_PID" layer="1" elPosition="7" >
	
		<symbol cx="120" cy="96" sx="89" sy="74" dx="208.165" dy="238.064" onLabel="true" />
	
		<label cx="23.5" cy="12" dx="302.665" dy="368.564" />
	
		<instanceData>
			<datum id="k" value="-1" />
			<datum id="u_max" value="VectorIttmax" />
			<datum id="end_pos" value="end_PI" />
			<datum id="Ti" value="10" />
		</instanceData>
	
	</component>

	<component id="OutItth" library="CONTROL" type="Gain" layer="1" elPosition="8" >
	
		<symbol cx="120" cy="79.9736" sx="89" sy="48.9472" dx="312.442" dy="253.979" onLabel="true" />
	
		<label cx="23.5" cy="12" dx="407.442" dy="355.927" />
	
	</component>

	<component id="Rinput" library="ELECTRICAL" type="Resistor" layer="1" elPosition="9" >
	
		<symbol cx="112" cy="77.5532" sx="73" sy="22.1064" dx="8.38673" dy="158.877" rotation="90" onLabel="true" />
	
		<label cx="22.5" cy="12" dx="92.3867" dy="244.983" />
	
		<instanceData>
			<datum id="R" value="1.66" />
		</instanceData>
	
	</component>

	<port id="e_p" library="PORTS_LIB" type="elec" layer="1" direction="IN" elPosition="0" >
	
		<symbol dx="50.1881" dy="205.268" onLabel="true" />
	
		<label cx="14.5" cy="12" dx="34.1881" dy="207.268" />
	
	</port>

	<port id="TcTm" library="EP" type="TCTM" layer="1" direction="IN" elPosition="2" >
	
		<symbol dx="77.1964" dy="46.6548" onLabel="true" />
	
		<label cx="19" cy="12" dx="54.1962" dy="48.6548" />
	
	</port>

	<port id="Thr" library="EP" type="ThrusterHV" layer="1" direction="OUT" elPosition="3" >
	
		<symbol dx="665.432" dy="67.0292" onLabel="true" />
	
		<label cx="13" cy="12" dx="651.432" dy="69.0292" />
	
	</port>

	<port id="Xfc" library="EP" type="ThrusterLV" layer="1" direction="OUT" elPosition="4" >
	
		<symbol dx="665.29" dy="227.686" onLabel="true" />
	
		<label cx="12.5" cy="12" dx="651.79" dy="229.686" />
	
	</port>

	<connector id="Connector_1" sShape="IdMeasured" sPort="s_out" eShape="ItthPID" ePort="s_var" elPosition="0" lineColor="255,85,0"   />

	<connector id="Connector_2" sShape="Id_Set" sPort="s_out" eShape="ItthPID" ePort="s_set" elPosition="1" lineColor="255,85,0"   />

	<connector id="Connector_3" sShape="ItthPID" sPort="s_out" eShape="OutItth" ePort="s_in" elPosition="2" lineColor="255,85,0"   />

	<connector id="Connector_4" sPort="e_p" eShape="Rinput" ePort="e_p" elPosition="3" lineColor="0,170,0"   />

	<component id="Thermothrottle" library="ELECTRICAL" type="CurrentConstant" layer="1" elPosition="15" >
	
		<symbol cx="79.8232" cy="103" sx="33.0607" sy="59" dx="500.902" dy="173.791" onLabel="true" />
	
		<label cx="45.5" cy="12" dx="547.775" dy="231.017" />
	
		<instanceData>
			<datum id="I" value="Itt" />
		</instanceData>
	
	</component>

	<component id="G" library="ELECTRICAL" type="Ground" layer="1" elPosition="16" >
	
		<symbol cx="80" cy="91.5" sx="35" sy="32" dx="38.9982" dy="220.802" onLabel="true" />
	
		<label cx="9" cy="12" dx="105.498" dy="325.802" />
	
	</component>

	<connector id="Connector_5" sShape="Rinput" sPort="e_n" eShape="G" ePort="e_p" elPosition="4" lineColor="0,170,0"   />

	<component id="Gf" library="ELECTRICAL" type="Ground" layer="1" elPosition="12" >
	
		<symbol cx="80" cy="91.5" sx="35" sy="32" dx="457.329" dy="163.207" onLabel="true" />
	
		<label cx="11" cy="12" dx="503.849" dy="245.617" />
	
	</component>

	<component id="Anode" library="ELECTRICAL" type="VoltageConstant" layer="1" elPosition="13" >
	
		<symbol cx="80" cy="104" sx="45" sy="57" dx="210.134" dy="17.0835" onLabel="true" />
	
		<label cx="22.5" cy="12" dx="296.355" dy="83.6266" />
	
		<instanceData>
			<datum id="V" value="Vd" />
		</instanceData>
	
	</component>

	<connector id="Connector_6" sShape="Anode" sPort="e_n" eShape="Gf" ePort="e_p" elPosition="7" lineColor="0,170,0"   />

	<component id="Valves" library="ELECTRICAL" type="VoltageConstant" layer="1" elPosition="14" >
	
		<symbol cx="80" cy="104" sx="45" sy="57" dx="501.986" dy="278.504" onLabel="true" />
	
		<label cx="22.5" cy="12" dx="589.564" dy="337.41" />
	
		<instanceData>
			<datum id="V" value="Vv" />
		</instanceData>
	
	</component>

	<connector id="Connector_7" sShape="Valves" sPort="e_n" eShape="Gf" ePort="e_p" points="559.741,391.568" elPosition="8" lineColor="0,170,0"   />

	<connector id="Connector_8" sShape="Thermothrottle" sPort="e_p" eShape="Gf" ePort="e_p" points="561.348,301.257" elPosition="9" lineColor="0,170,0"   />

	<component id="Heater" library="ELECTRICAL" type="CurrentConstant" layer="1" elPosition="17" >
	
		<symbol cx="79.8232" cy="103" sx="33.0607" sy="59" dx="506.109" dy="81.855" onLabel="true" />
	
		<label cx="23" cy="12" dx="592.903" dy="160.533" />
	
		<instanceData>
			<datum id="I" value="Ih" />
		</instanceData>
	
	</component>

	<connector id="Connector_9" sShape="Heater" sPort="e_p" eShape="Gf" ePort="e_p" elPosition="10" lineColor="0,170,0"   />

	<component id="Magnet" library="ELECTRICAL" type="CurrentConstant" layer="1" elPosition="18" >
	
		<symbol cx="79.8232" cy="103" sx="33.0607" sy="59" dx="436.568" dy="43.265" onLabel="true" />
	
		<label cx="25.5" cy="12" dx="519.626" dy="121.943" />
	
		<instanceData>
			<datum id="I" value="Im" />
		</instanceData>
	
	</component>

	<connector id="Connector_10" sShape="Magnet" sPort="e_p" eShape="Gf" ePort="e_p" elPosition="11" lineColor="0,170,0"   />

	<component id="IgnitorKeeper" library="ELECTRICAL" type="VoltageConstant" layer="1" elPosition="19" >
	
		<symbol cx="80" cy="104" sx="45" sy="57" dx="333.533" dy="22.6098" onLabel="true" />
	
		<label cx="42" cy="12" dx="415.576" dy="97.2564" />
	
		<instanceData>
			<datum id="V" value="Vik" />
		</instanceData>
	
	</component>

	<connector id="Connector_11" sShape="IgnitorKeeper" sPort="e_n" eShape="Gf" ePort="e_p" elPosition="12" lineColor="0,170,0"   />

	<component id="Ra" library="ELECTRICAL" type="Resistor" layer="1" elPosition="20" >
	
		<symbol cx="112" cy="77.5532" sx="73" sy="22.1064" xScale="0.704877" dx="159.525" dy="43.5566" rotation="-270" onLabel="true" />
	
		<label cx="12" cy="12" dx="219.826" dy="103.37" />
	
		<instanceData>
			<datum id="R" value="1000000" />
		</instanceData>
	
	</component>

	<connector id="Connector_12" sShape="Ra" sPort="e_p" eShape="Anode" ePort="e_p" elPosition="13" lineColor="0,170,0"   />

	<connector id="Connector_13" sShape="Ra" sPort="e_n" eShape="Anode" ePort="e_n" elPosition="14" lineColor="0,170,0"   />

	<component id="Rv" library="ELECTRICAL" type="Resistor" layer="1" elPosition="21" >
	
		<symbol cx="112" cy="77.5532" sx="73" sy="22.1064" xScale="0.750227" dx="519.716" dy="305.456" rotation="-270" onLabel="true" />
	
		<label cx="11" cy="12" dx="596.956" dy="364.765" />
	
		<instanceData>
			<datum id="R" value="1000000" />
		</instanceData>
	
	</component>

	<connector id="Connector_14" sShape="Rv" sPort="e_p" eShape="Valves" ePort="e_p" elPosition="15" lineColor="0,170,0"   />

	<connector id="Connector_15" sShape="Rv" sPort="e_n" eShape="Valves" ePort="e_n" elPosition="16" lineColor="0,170,0"   />

	<component id="Rik" library="ELECTRICAL" type="Resistor" layer="1" elPosition="22" >
	
		<symbol cx="112" cy="77.5532" sx="73" sy="22.1064" xScale="0.741446" dx="282.252" dy="48.497" rotation="-270" onLabel="true" />
	
		<label cx="13.5" cy="12" dx="348.358" dy="112.284" />
	
		<instanceData>
			<datum id="R" value="1000000" />
		</instanceData>
	
	</component>

	<connector id="Connector_16" sShape="Rik" sPort="e_p" eShape="IgnitorKeeper" ePort="e_p" elPosition="17" lineColor="0,170,0"   />

	<connector id="Connector_17" sShape="Rik" sPort="e_n" eShape="IgnitorKeeper" ePort="e_n" elPosition="18" lineColor="0,170,0"   />

	<component id="Ch" library="ELECTRICAL" type="Conductor" layer="1" elPosition="24" >
	
		<symbol cx="103.75" cy="74.875" sx="57.5" sy="19.25" dx="449.12" dy="112.443" rotation="-90" onLabel="true" />
	
		<label cx="12" cy="12" dx="533.814" dy="173.657" />
	
		<instanceData>
			<datum id="G" value="1000000" />
		</instanceData>
	
	</component>

	<component id="Ct" library="ELECTRICAL" type="Conductor" layer="1" elPosition="25" >
	
		<symbol cx="103.75" cy="74.875" sx="57.5" sy="19.25" dx="505.002" dy="203.699" rotation="-90" onLabel="true" />
	
		<label cx="10.5" cy="12" dx="591.797" dy="263.527" />
	
		<instanceData>
			<datum id="G" value="1000000" />
		</instanceData>
	
	</component>

	<connector id="Connector_18" sShape="Thermothrottle" sPort="e_p" eShape="Ct" ePort="e_p" elPosition="21" lineColor="0,170,0"   />

	<connector id="Connector_19" sShape="Thermothrottle" sPort="e_n" eShape="Ct" ePort="e_n" elPosition="22" lineColor="0,170,0"   />

	<connector id="Connector_20" sShape="Ch" sPort="e_p" eShape="Heater" ePort="e_p" elPosition="23" lineColor="0,170,0"   />

	<connector id="Connector_21" sShape="Heater" sPort="e_n" eShape="Ch" ePort="e_n" elPosition="24" lineColor="0,170,0"   />

	<component id="Cm" library="ELECTRICAL" type="Conductor" layer="1" elPosition="26" >
	
		<symbol cx="103.75" cy="74.875" sx="57.5" sy="19.25" dx="384.607" dy="72.9018" rotation="-90" onLabel="true" />
	
		<label cx="14" cy="12" dx="465.549" dy="133.16" />
	
		<instanceData>
			<datum id="G" value="1000000" />
		</instanceData>
	
	</component>

	<connector id="Connector_22" sShape="Magnet" sPort="e_n" eShape="Cm" ePort="e_n" elPosition="25" lineColor="0,170,0"   />

	<connector id="Connector_23" sShape="Cm" sPort="e_p" eShape="Magnet" ePort="e_p" elPosition="26" lineColor="0,170,0"   />

	<bodyEL>
	<![CDATA[COMPONENT %NAME%
&#34;based internally on several CONTROL and ELECTRICAL components; simulate the hardware and logic of a PPU&#34;
DATA
	ENUM ThrusterTYPE  ThrType = UserDefined UNITS &#34;-&#34; &#34; Definition of the adaptation of the PPU to the electric thruster used &#34;
	REAL IminOp = 1 UNITS &#34;A&#34; &#34;Operational domain with loop control&#34;
	REAL ImaxOp = 5 UNITS &#34;A&#34; &#34;Operational domain at constant voltage before the knee &#34;
	REAL Ishort = 9 UNITS &#34;A&#34; &#34;Short circuit Current after the knee &#34;
	REAL VminOp = 100 UNITS &#34;V&#34; &#34;Operational domain &#34;
	REAL Theating = 120 UNITS &#34;s&#34; &#34;Duration of heating cathode before ignition&#34;
	REAL Tflow = 5 UNITS &#34;s&#34; &#34;Duration of flow while still heating cathode before ignition&#34;
	REAL Tventing = 10000 UNITS &#34;s&#34; &#34;Duration of venting operation&#34;
	REAL PulseWidth = 0.005 UNITS &#34;s&#34; &#34;Duration of ignition pulses &#34;
	REAL VignitorKeeper = 280 UNITS &#34;V&#34; &#34;Ignition voltage &#34;
	REAL Vvalves = 28 UNITS &#34;V&#34; &#34;Valves voltage &#34;
	REAL Ittmax = 4 UNITS &#34;A&#34; &#34;Thermothrottle maximum current &#34;
	REAL e0 = 0.05 UNITS &#34;-&#34; &#34;Coefficient losses for the Electrical efficency of the PPU: etaPowerPPU=1-(e0+e1*PowerOutPPU+e2*PowerOutPPU**2) &#34;
	REAL e1 = 1e-005 UNITS &#34;-/W&#34; &#34;Coefficient losses for the Electrical efficency of the PPU &#34;
	REAL e2 = 0 UNITS &#34;-/W^2&#34; &#34;Coefficient losses for the Electrical efficency of the PPU &#34;
	REAL StandByPower = 20 UNITS &#34;W&#34; &#34;power consumption of the PPU in stand-by mode&#34;
DECLS

		-----------------------------------------------------------
		-- Coded in PPU
		-----------------------------------------------------------
	ENUM PPU_MODES  Mode UNITS &#34;-&#34; &#34;Operational mode of PPU &#34;
	BOOLEAN BusPowerON =  FALSE  UNITS &#34;-&#34; &#34;Flag true when the power bus is avalable to the PPU &#34;
	BOOLEAN PPU_ON =  FALSE  UNITS &#34;-&#34; &#34;Flag true when PPU is turned ON &#34;
	BOOLEAN LoopON =  FALSE  UNITS &#34;-&#34; &#34;Flag true when the loop contol is Enabled&#34;
	BOOLEAN IgnitionPulse =  FALSE  UNITS &#34;-&#34; &#34;Flag true when the ignition command occurs &#34;
	DISCR REAL VdSet = 300 UNITS &#34;V&#34; &#34;Default Anode voltage Set &#34;
	DISCR REAL VaccelSet = -100 UNITS &#34;V&#34; &#34;Default Accel voltage Set &#34;
	DISCR REAL IdSet = 4 UNITS &#34;A&#34; &#34;Default Discharge Current Set to be controlled &#34;
	DISCR REAL ImSet = 1 UNITS &#34;A&#34; &#34;Default Magnet Current Set &#34;
	DISCR REAL IhSet = 12 UNITS &#34;A&#34; &#34;Default Heater current sourcing level &#34;
	DISCR REAL IttSet = 2 UNITS &#34;A&#34; &#34;Default Thermothrottle Current Set &#34;
	DISCR REAL TCforbidden = 0 UNITS &#34;-&#34; &#34;Flag=0 when no error&#34;
	DISCR REAL AnodeSupply = 0 UNITS &#34;-&#34; &#34;1: Enable the supply 0: disabled. Those are activated by events, so discrete variables&#34;
	DISCR REAL HeaterSupply = 0 UNITS &#34;-&#34; &#34;idem&#34;
	DISCR REAL MagnetSupply = 0 UNITS &#34;-&#34; &#34;idem&#34;
	DISCR REAL ThermothrottleSupply = 0 UNITS &#34;-&#34; &#34;idem&#34;
	DISCR REAL IgnitorSupply = 0 UNITS &#34;-&#34; &#34;idem&#34;
	DISCR REAL ValveSupply = 0 UNITS &#34;-&#34; &#34;idem&#34;
	REAL Vd = 0 UNITS &#34;V&#34; &#34;Anode discharge voltage &#34;
	REAL Vaccel = 0 UNITS &#34;V&#34; &#34;Acceleration gridd voltage &#34;
	REAL Vik = 0 UNITS &#34;V&#34; &#34;ignition voltage &#34;
	REAL Vv = 0 UNITS &#34;V&#34; &#34;valves voltage &#34;
	REAL Id = 0 UNITS &#34;A&#34; &#34;Discharge current &#34;
	REAL Im = 0 UNITS &#34;A&#34; &#34;Magnet current &#34;
	REAL Ih = 0 UNITS &#34;A&#34; &#34;Heater current &#34;
	REAL Itt = 0 UNITS &#34;A&#34; &#34;Thermothrottle current &#34;
	REAL IttOpenLoop = 0 UNITS &#34;A&#34; &#34;Thermothrottle current in open loop&#34;
	REAL Iosc UNITS &#34;A&#34; &#34;Thruster RMS oscillation current measured into the FU&#34;
	DISCR REAL SlopeAfterKnee = 0 UNITS &#34;ohm&#34; &#34;negative or null resistance by design&#34;
	REAL Ibus = 0 UNITS &#34;A&#34; &#34;Current used by PPU on the bus &#34;
	REAL PowerInPPU = 0 UNITS &#34;W&#34; &#34;Power used by the PPU on the bus&#34;
	REAL PowerOutPPU = 0 UNITS &#34;W&#34; &#34;Power delivered by the PPU to the EP devices (thruster, XFC, FU) &#34;
	REAL etaPowerPPU UNITS &#34;-&#34; &#34;Electrical efficency of the PPU&#34;
	DISCR REAL VectorIttmax[1] = Ittmax UNITS &#34;A&#34; &#34;tentative to master the settings of the PID vector&#34;
INIT

		-----------------------------------------------------------
		-- Coded in PPU
		-----------------------------------------------------------
	SlopeAfterKnee = VdSet / (ImaxOp - Ishort)
	IF ThrType == T6 OR ThrType == EsaXX THEN
	SlopeAfterKnee = -100000000
	END IF
	TcTm.TC_Value = 0
DISCRETE

		-----------------------------------------------------------
		-- Coded in PPU
		-----------------------------------------------------------
	WHEN (e_p.v &#62; 45)  THEN
	BusPowerON =  TRUE 
	END WHEN
	WHEN (e_p.v &#60;= 45)  THEN
	BusPowerON =  FALSE 
	END WHEN
	WHEN (TcTm.DTC != 0 AND BusPowerON)  THEN
	IF TcTm.DTC == 1 THEN
	IF EP.event_RAMS(Fail_PPU_PROM_checksum) THEN
	PPU_ON =  FALSE 
	ELSE
	PPU_ON =  TRUE  AFTER 1
	END IF
		ELSEIF TcTm.DTC == 2 THEN
	PPU_ON =  FALSE  AFTER 1

	END IF
	TcTm.DTC = 0 AFTER 1
	END WHEN
	WHEN (Mode == Power_Off AND PPU_ON)  THEN
	Mode = StandBy AFTER 0.1
	END WHEN
	WHEN (Mode == StandBy AND TcTm.TC != None)  THEN
	IF TcTm.TC == TCStandBy OR TcTm.TC == TCValvesOn OR TcTm.TC == TCValvesOff OR TcTm.TC == TCHeaterOn OR TcTm.TC == TCHeaterOff OR TcTm.TC == TCMagnetOn OR TcTm.TC == TCMagnetOff OR TcTm.TC == TCLoopOn OR TcTm.TC == TCLoopOff OR TcTm.TC == TCIgnitorOn THEN
	TCforbidden = 1
	ELSE
	TCforbidden = 0
	END IF
	END WHEN
	WHEN (Mode == StandBy AND TcTm.TC == TCConfiguration)  THEN
	Mode = Configuration AFTER 0.1
	TcTm.TC = None
	END WHEN
	WHEN (Mode == StandBy AND TcTm.TC == TCRemote)  THEN
	Mode = Remote AFTER 0.1
	TcTm.TC = None
	END WHEN
	WHEN (Mode == StandBy AND TcTm.TC == TCAutomatic)  THEN
	Mode = Automatic AFTER 0.1
	TcTm.TC = None
	END WHEN
	WHEN (Mode == StandBy AND TcTm.TC == TCVenting)  THEN
	Mode = Venting AFTER 0.1
	TcTm.TC = None
	END WHEN
	WHEN (PPU_ON AND TcTm.TC == TCStandBy)  THEN
	Mode = StandBy
	TcTm.TC = None
	END WHEN
	WHEN (Mode == Configuration AND TcTm.TC != None)  THEN
	IF TcTm.TC == TCValvesOn THEN
	ValveSupply = 1
		ELSEIF TcTm.TC == TCValvesOff THEN
	ValveSupply = 0

	END IF
	TcTm.TC = None
	END WHEN
	WHEN (Mode == Venting)  THEN
	ValveSupply = 1
	ValveSupply = 0 AFTER Tventing
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCValvesOn)  THEN
	ValveSupply = 1
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCValvesOff)  THEN
	ValveSupply = 0
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCHeaterOn)  THEN
	HeaterSupply = 1
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCHeaterOff)  THEN
	HeaterSupply = 0
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCMagnetOn)  THEN
	MagnetSupply = 1
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCMagnetOff)  THEN
	MagnetSupply = 0
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCLoopOn)  THEN
	LoopON =  TRUE 
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCLoopOff)  THEN
	LoopON =  FALSE 
	END WHEN
	WHEN (Mode == Remote AND TcTm.TC == TCIgnitorOn)  THEN
	IgnitionPulse =  TRUE 
	END WHEN
	WHEN (PPU_ON AND TcTm.TC == TCIdSet)  THEN
	IdSet = TcTm.TC_Value
	TcTm.TC = None
	END WHEN
	WHEN (PPU_ON AND TcTm.TC == TCImagnet)  THEN
	ImSet = TcTm.TC_Value
	TcTm.TC = None
	END WHEN
	WHEN (PPU_ON AND TcTm.TC == TCIheater)  THEN
	IhSet = TcTm.TC_Value
	TcTm.TC = None
	END WHEN
	WHEN (PPU_ON AND TcTm.TC == TCIthermthrottle)  THEN
	IttSet = TcTm.TC_Value
	TcTm.TC = None
	END WHEN
	WHEN (PPU_ON AND TcTm.TC == TCVaccel)  THEN
	VaccelSet = TcTm.TC_Value
	TcTm.TC = None
	END WHEN
	WHEN (TcTm.TC == None)  THEN
	TcTm.TC_Value = -1
	END WHEN
	WHEN (NOT BusPowerON)  THEN
	PPU_ON =  FALSE 
	END WHEN
	WHEN (NOT PPU_ON)  THEN
	Mode = Power_Off
	AnodeSupply = 0
	HeaterSupply = 0
	MagnetSupply = 0
	ThermothrottleSupply = 0
	ValveSupply = 0
	TCforbidden = 0
	END WHEN
	WHEN (Mode == Automatic)  THEN
	AnodeSupply = 1
	HeaterSupply = 1
	ThermothrottleSupply = 1
	ValveSupply = 1 AFTER Theating
	IgnitionPulse =  TRUE  AFTER Theating + Tflow
	END WHEN
	WHEN (IgnitionPulse)  THEN
	HeaterSupply = 0
	IgnitorSupply = 1
	IgnitorSupply = 0 AFTER PulseWidth
	IgnitionPulse =  FALSE  AFTER PulseWidth
	END WHEN
	WHEN (Mode == Automatic AND Id &#62; IminOp)  THEN
	LoopON =  TRUE 
	MagnetSupply = 1
	END WHEN
CONTINUOUS

		-----------------------------------------------------------
		-- Coded in PPU
		-----------------------------------------------------------
	Vd =  ZONE (AnodeSupply == 1 AND Id &#60;= ImaxOp) VdSet ZONE (AnodeSupply == 1 AND Id &#62; ImaxOp AND Id &#60; (ImaxOp + VdSet / abs(SlopeAfterKnee))) VdSet + SlopeAfterKnee * (Id - ImaxOp) OTHERS 0
	Vik =  ZONE (IgnitorSupply == 1) VignitorKeeper OTHERS 0
	Vv =  ZONE (ValveSupply == 1) Vvalves OTHERS 0
	Ih =  ZONE (HeaterSupply == 1) IhSet OTHERS 0
	Im =  ZONE (MagnetSupply == 1) ImSet OTHERS 0
	IttOpenLoop =  ZONE (ThermothrottleSupply == 1) IttSet OTHERS 0
	Itt =  ZONE (LoopON) OutItth.s_out.signal[1] OTHERS IttOpenLoop
	Thr.Vdischarge = Anode.V
	Thr.VignitorKeeper = IgnitorKeeper.V
	Thr.Vacceleration = Vaccel
	Xfc.Vvalves = Vv
	IdMeasured.Amp = Id
	Xfc.Ithermothrottle = Thermothrottle.I
	Id = Thr.Idischarge
	Thr.Iheater = Heater.I
	Thr.Imagnet = Magnet.I
	Iosc = Thr.Ioscillation
	TcTm.TM_Data[TMthermistance] = TcTm.DTM_Thermistance
	TcTm.TM_Data[TMId] = Id
	TcTm.TM_Data[TMVd] = Vd
	TcTm.TM_Data[TMItt] = Itt
	TcTm.TM_Data[TMMode] = EP.Index(Mode)
	etaPowerPPU =  ZONE (EP.event_RAMS(Fail_PPU_power150pc)) (1 - (e0 + e1 * PowerOutPPU + e2 * PowerOutPPU ** 2)) / 1.5 OTHERS 1 - (e0 + e1 * PowerOutPPU + e2 * PowerOutPPU ** 2)
	PowerInPPU = e_p.v * Ibus
	PowerOutPPU = Thr.Power + Xfc.Power
	PowerInPPU =  ZONE (Mode == StandBy OR Mode == Configuration OR Mode == Remote) (PowerOutPPU + StandByPower) / etaPowerPPU OTHERS PowerOutPPU / etaPowerPPU

END COMPONENT]]>
	</bodyEL>

	<usedLibrary name="CONTROL" version="3.2" auto="false" />
	<usedLibrary name="ELECTRICAL" version="3.1.1" auto="false" />
	<usedLibrary name="PORTS_LIB" version="1.1" auto="false" />
</schematic>