<root>
<document scada='0' schema='102' license='1,CityPlym-COVID,XT5CNC' title='' description='' fcversion='524802' target='PIC16.33E.Formula AllCode' >
	<config data='' clkspd='140000000' simspd='1' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='dx' />
		<watch expr='dy' />
		<watch expr='go' />
		<watch expr='xPos' />
		<watch expr='yPos' />
		<watch expr='Direction' />
	</debug>
	<traces />
	<ghost >
		<FK2 >
			<data name='FK2D0' port='4294967295' pin='4294967295' />
			<data name='FK2D1' port='4294967295' pin='4294967295' />
			<data name='FK2D2' port='4294967295' pin='4294967295' />
			<data name='FK2D3' port='4294967295' pin='4294967295' />
			<data name='FK2D4' port='4294967295' pin='4294967295' />
			<data name='FK2D5' port='4294967295' pin='4294967295' />
			<data name='FK2D6' port='4294967295' pin='4294967295' />
			<data name='FK2D7' port='4294967295' pin='4294967295' />
			<data name='FK2D8' port='4294967295' pin='4294967295' />
			<data name='FK2D9' port='4294967295' pin='4294967295' />
			<data name='FK2D10' port='4294967295' pin='4294967295' />
			<data name='FK2D11' port='4294967295' pin='4294967295' />
			<data name='FK2D12' port='4294967295' pin='4294967295' />
			<data name='FK2D13' port='4294967295' pin='4294967295' />
			<data name='FK2D14' port='4294967295' pin='4294967295' />
			<data name='FK2D15' port='4294967295' pin='4294967295' />
			<data name='FK2A0' port='4294967295' pin='4294967295' />
			<data name='FK2A1' port='4294967295' pin='4294967295' />
			<data name='FK2A2' port='4294967295' pin='4294967295' />
			<data name='FK2A3' port='4294967295' pin='4294967295' />
			<data name='FK2A4' port='4294967295' pin='4294967295' />
			<data name='FK2A5' port='4294967295' pin='4294967295' />
		</FK2>
		<ICD >
			<data name='AnalogPrescaleValue' value='19' />
			<data name='DigitalSampleRate' value='100000' />
			<data name='BreakpointCount' value='8' />
			<data name='CallStackDepthCount' value='8' />
			<data name='ClockPort' value='1' />
			<data name='ClockPin' value='1' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='0' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='2' />
			<data name='CalculatedCommsDelay' value='2' />
			<data name='AnalogEB2PrescaleValue' value='2' />
			<data name='DigitalEB2SampleRate' value='100000' />
		</ICD>
		<pins >
			<digital A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
			<analog A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
		</pins>
	</ghost>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='9e340013-b772-4df9-9f07-f59ca8ea38f6' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='1' iconpath='' />
		<component class_type='root' codename='panel' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='yPos' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='dy' type='u16' description='How many cells we move in one step' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='dx' type='u8' description='how many cells we move in one step' isconst='0' isinit='1' usrinit='4294967295' setinit='-1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='running' type='b1' description='is set to 0 one task is complete' isconst='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='complete' type='b1' description='set to true when task is complete' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='xPos' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='opening' type='u16' description='is there a gap to the right' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='go' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Direction' type='u8' description='0 - up, 1 - right, 2 - down, 3 - left' isconst='0' isinit='1' usrinit='3' setinit='3' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='sim' title='Simulation' cmdcolor='1879295' cmdcolor_sec='5751039' component='MazeGenerator1' macro='GenerateMaze' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LCDBacklight' >
							<argument exp='100' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LCDClear' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LCDPrintString' >
							<argument exp='20' />
							<argument exp='8' />
							<argument exp='&quot;Hello CITY2081&quot;' />
							<argument exp='128' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='LCDAdafruitOLED4x20' macro='Start' />
						<command class_type='sim' title='Simulation' disable='1' cmdcolor='1879295' cmdcolor_sec='5751039' component='TrafficLight_1Way1' macro='AutomaticMode' >
							<argument exp='1' />
						</command>
						<command class_type='loop' title='Loop' disable='1' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='go == 0' >
							<flowline >
								<command class_type='sim' title='Simulation' cmdcolor='1879295' cmdcolor_sec='5751039' component='TrafficLight_1Way1' macro='GetStopGo' >
									<return exp='go' />
								</command>
							</flowline>
						</command>
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='running' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='CheckIR' >
									<return exp='opening' />
									<argument exp='4' />
								</command>
								<command class_type='decision' title='Open door?' cmdcolor='12615680' cmdcolor_sec='15376912' exp='opening' swap='1' >
									<flowline >
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LogoTurnRight' >
											<argument exp='90' />
										</command>
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='Direction = ((Direction + 1) % 4)' />
										</command>
										<command class_type='switch' title='Switch' textarea='36,25,36,25' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Direction' >
											<case >
												<flowline />
											</case>
											<case exp='0' >
												<flowline >
													<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
														<exp exp='dx = 0' />
														<exp exp='dy = 1' />
													</command>
												</flowline>
											</case>
											<case exp='1' >
												<flowline >
													<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
														<exp exp='dx = 1' />
														<exp exp='dy = 0' />
													</command>
												</flowline>
											</case>
											<case exp='2' >
												<flowline >
													<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
														<exp exp='dx = 0' />
														<exp exp='dy = -1' />
													</command>
												</flowline>
											</case>
											<case exp='3' >
												<flowline >
													<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
														<exp exp='dx = -1' />
														<exp exp='dy = 0' />
													</command>
												</flowline>
											</case>
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LogoForwards' >
											<argument exp='180' />
										</command>
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='xPos = xPos + dx' />
											<exp exp='yPos = yPos + dy' />
										</command>
									</flowline>
									<flowline >
										<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='CheckIR' >
											<return exp='opening' />
											<argument exp='2' />
										</command>
										<command class_type='decision' title='End of corridor?' cmdcolor='12615680' cmdcolor_sec='15376912' exp='opening' swap='1' >
											<flowline >
												<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LogoForwards' >
													<argument exp='180' />
												</command>
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='xPos = xPos + dx' />
													<exp exp='yPos = yPos + dy' />
												</command>
											</flowline>
											<flowline >
												<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LogoTurnLeft' >
													<argument exp='90' />
												</command>
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='Direction = ((Direction + 3) % 4)' />
												</command>
												<command class_type='switch' title='Switch' textarea='36,25,36,25' cmdcolor='12615680' cmdcolor_sec='15376912' exp='Direction' >
													<case >
														<flowline />
													</case>
													<case exp='0' >
														<flowline >
															<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
																<exp exp='dx = 0' />
																<exp exp='dy = 1' />
															</command>
														</flowline>
													</case>
													<case exp='1' >
														<flowline >
															<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
																<exp exp='dx = 1' />
																<exp exp='dy = 0' />
															</command>
														</flowline>
													</case>
													<case exp='2' >
														<flowline >
															<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
																<exp exp='dx = 0' />
																<exp exp='dy = -1' />
															</command>
														</flowline>
													</case>
													<case exp='3' >
														<flowline >
															<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
																<exp exp='dx = -1' />
																<exp exp='dy = 0' />
															</command>
														</flowline>
													</case>
												</command>
											</flowline>
										</command>
									</flowline>
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LCDPrintNumber' >
									<argument exp='0' />
									<argument exp='0' />
									<argument exp='xPos' />
									<argument exp='127' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LCDPrintNumber' >
									<argument exp='0' />
									<argument exp='8' />
									<argument exp='yPos' />
									<argument exp='127' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='LCDAdafruitOLED4x20' macro='Cursor' >
									<argument exp='1' />
									<argument exp='1' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='LCDAdafruitOLED4x20' macro='PrintNumber' >
									<argument exp='xPos' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='LCDAdafruitOLED4x20' macro='Cursor' >
									<argument exp='1' />
									<argument exp='2' />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='LCDAdafruitOLED4x20' macro='PrintNumber' >
									<argument exp='yPos' />
								</command>
								<command class_type='decision' title='Target' cmdcolor='12615680' cmdcolor_sec='15376912' exp='((xPos == 9) &amp;&amp; (yPos == 9))' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
											<exp exp='complete = 1' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='decision' title='Home' cmdcolor='12615680' cmdcolor_sec='15376912' exp='((xPos == 0) &amp;&amp; (yPos == 0) &amp;&amp; complete)' swap='0' >
									<flowline >
										<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='1' exp='(Direction == 3)' >
											<flowline >
												<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='FormulaAllCode1' macro='LogoTurnRight' >
													<argument exp='90' />
												</command>
												<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
													<exp exp='Direction = (Direction + 1) % 4' />
													<exp exp='running = 0' />
												</command>
											</flowline>
										</command>
									</flowline>
									<flowline />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='e3be641a-8808-4138-bee5-805fbbce468c' vmin='3' vmaj='1' codename='FormulaAllCode1' x='-60' y='-420' z='21.9' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='-4.32555e-13' xquat='0' yquat='0' zquat='-3.77476e-15' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='wait_b4_start' data='0' />
					<value target='startup_time' data='2000' />
					<value target='CreationInfo' data='003' />
					<value target='BlueReset' data='1' />
					<value target='MotFeedback' data='0' />
					<value target='Model' data='000' />
					<value target='IRdistance' data='200' />
					<value target='LineSensitivity' data='50' />
					<value target='sim_speed' data='40' />
					<value target='timer_interval' data='50' />
					<value target='collision_mode' data='000' />
					<value target='collision_group' data='' />
					<value target='LightSource' data='' />
					<value target='AddonMech' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='4cbae05a-fee8-4685-b94c-829abc3466ab' vmin='0' vmaj='1' codename='shape_cuboid1' x='140' y='204.75' z='0.5' xsz='1' ysz='5.125' zsz='0.03125' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='Color' data='1973790' />
					<value target='Outline' data='0' />
					<value target='Thickness' data='0' />
					<value target='Image' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='fc012d2f-082a-4f6f-a61b-314c46477eb2' vmin='0' vmaj='1' codename='MazeGenerator1' x='-600' y='-600' z='25.75' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='1' >
				<resources />
				<properties />
				<values >
					<value target='GenMode' data='001' />
					<value target='Contained' data='1' />
					<value target='width' data='10' />
					<value target='height' data='10' />
					<value target='cell_count' data='100' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='0c6b22fc-6e81-4406-aabd-5feb928e6aee' vmin='0' vmaj='1' codename='TrafficLight_1Way1' x='-860' y='-860' z='91.875' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='Red' data='255' />
					<value target='Amber' data='65535' />
					<value target='Green' data='65280' />
					<value target='Off' data='0' />
					<value target='Flow' data='5000' />
					<value target='Trans' data='1000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='913991df-9bcb-475a-ae49-d9eb611b0d71' vmin='10' vmaj='1' codename='LCDAdafruitOLED4x20' x='-60' y='1268.68' z='655' xsz='1800' ysz='1310' zsz='60' xang='90' yang='0' zang='0' xquat='0.707107' yquat='0' zquat='0' wquat='0.707107' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='d0_pin' data='$PORTB.0' />
					<value target='d1_pin' data='$PORTB.1' />
					<value target='d2_pin' data='$PORTB.2' />
					<value target='d3_pin' data='$PORTB.3' />
					<value target='rs_pin' data='$PORTB.4' />
					<value target='rw_pin' data='$PORTB.5' />
					<value target='enable_pin' data='$PORTB.6' />
					<value target='Rows' data='4' />
					<value target='Columns' data='20' />
					<value target='BackgroundColor' data='4720649' />
					<value target='LineColor' data='8388608' />
					<value target='TextColor' data='16776960' />
					<value target='Font' data='Arial' />
					<value target='CursorPosX' data='2' />
					<value target='CursorPosY' data='2' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='7292207' img='' style='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='1' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='15793151' img='' style='0' size='45' />
		<camera xe='-894.008' ye='-1336.78' ze='2008.29' xt='-786.207' yt='-425.895' zt='38.8731' xquat='-0.20964' yquat='-0.0529045' zquat='0.348504' wquat='0.912029' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAA3wIAAIgDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='1' placement='LAAAAAAAAAABAAAA---------------------wUAAAAeAAAA3wIAAIgDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
