The objective of this text file is to reproduce and disseminates the results presented in the paper.

Platform underwhich experiments carried-out:

1. Windows 10 64 bit
2. MATLAB Simulink 2016a
3. CPAL version 1.21 {https://www.designcps.com/binaries/}
4. Python 2.7.13
5. Saleae logic Pro 8 and correspnding Software {https://www.saleae.com/downloads}

The following folders and files are present:
--------------------------------------------

1) analinta - ANAlysis of INtegrated TAsk.
			- This folder gives the schedulability analysis (FIFO) discussed.
			- Run the python script "analinta.py" for option (1) for reading task set paramters from "cpal_model"   
			  folder option (2) to add new task parameters to which analysis to be carried-out
			- Complete set of source files given for better understaning.
			- taskset file is in the folder "inputs" 
			- Any CPAL controller model can be converted into taskset file by "./cpal2x.exe -T rt-format -I./pkg   
			  plant.cpal controller.rt-format"
			
2) co_simulation - CPAL controller model execution in Simulink environment.
				 - cpal_interpreter.mexw64 is the CPAL interpreter MEX file for Simulink, which executes the CPAL model.
				 - cpal_parameters.mexw64 is a MEX file enables the CPAL interfaces to Simulink for simulation.
				 - controller_co_simulation_init.m will create binary version of CPAL controller model.
				 - controller_co_simulation.cpal is the controller model.
				 - controller_co_simulation.ast is the correspnding binary format.
				 - cpal_parser.exe CPAL parser for Simulink environment.
				 - controller_co_simulation_Fig_10_11.slx is the co-simulation model file with controller and plant 
				   integrated. While this file excutes, one can get the co-simulation results Figure 8 - 9.
				 - pkg folder contains CPAL related files, no need to touch, just keep it as it is.
				 - Run the controller_co_simulation_Fig_10_11.slx under "Normal" simulation mode for desired amount of  
				   duration.

3) cruise - This folder contains the motivating example discussed in the paper.
		  - cpal_interpreter.mexw64 is the CPAL interpreter MEX file for Simulink, which executes the CPAL controller   
		    model.
		  - cpal_parameters.mexw64 is a MEX file enables the CPAL interfaces to Simulink for simulation.
		  - cruise.slx is the co-simulation model file for cruise control application.
		  - cpal_parser.exe CPAL parser for Simulink environment.
		  - pkg folder contains CPAL related files, no need to touch, just keep it as it is.
		  - init_cruise.m will create binary version of CPAL controller model.
		  - cruiseControl.cpal is the cruise controller model.
		  - cruiseControl.ast is the correspnding binary format.
		  - pkg folder contains CPAL related files, no need to touch, just keep it as it is.
		  - CPAL_MLSL_Comparison folder provides the same application as sample model to show how CPAL interpretaion   
		    replaces Simulink/Simscape
		  - Run the cruise.slx under "Normal" simulation mode for desired amount of duration.
		 
4) introspection_bare_metal_FRDM - This folder contains the experiment files related to observing automata (i.e. introspection).
				 - The controller model can be executed on FRDMK64F (use the bin file for flashing, model file can be modified and compiled using CPAL editor, check for CPAL user manual)
				 - Check the logic analyzer setup and capture files. Saleae logic Pro 8 is used. Image files provide the snap-shot of sample captures.
				   
5)  introspection_on_target_Raspberry_Pi - This folder contains the experiment files related to observing automata (i.e. introspection).
				 - The controller model is executed on Raspberry Pi
				 - The same controller model is now executed on Raspberry Pi  - Figure 10 in the paper.
				 - Figure 11 and Figure 12 are the measurements log drawn.
				 - Figure 13 is the measurement using logic analyzer
				 - The controller model is same as (2) and (3) except added with introspection routines.
				 - Use the command "sudo chrt 60 ./cpal_interpreter_raspberry -r -t 10000 -q observer.ast" to execute 
				   the controller model.
				 - This folder provides the code for Raspberry Pi excution of model and corresponding binary file to  
				   measure the jitters using logic analyser. Saleae logic Pro 8 is used. Image files   
                   provide the snap-shot of sample captures. Logic analyser setup and capture files are also provided.
				   
6)  introspection_simulation - This folder contains the experiment files related to observing automata (i.e. introspection).
				 - The controller model is executed on co-simulation environment (use the MEX and model files and refer 
				   (b),(c) above)
				 - This folder provides the code for Simulink platform excution of model and 
				   corresponding binary file to measure the jitters using simulation. Follow steps like in "b" option above				   
				   
7) jitter_margin - These protected jitter margin scripts are from Prof. Cervin Lund University (Hence provided as "file.p").
				 - servo_wccpf_period12ms.m calculates the jitter margins and one could arrive the Figure 7 by running  
				   the script. 
				 
8) wcet - wcet_frdm.cpal is the controller model for WCET measurment on target (FRDM K64F)
		- wcet_frdm.ast is the corresponding ast file.
		- wcet_frdm.bin is the corresponding binary file (can be flshed like in https://os.mbed.com/platforms/FRDM-K64F/)
		- wcet_raspi.cpal is the controller model for WCET measurment on target (Raspberry Pi)
		- wcet_raspi.ast is the corresponding ast file.		
		- Some images to show measurment graphs in logic analyzer and in command line (in the case of Raspberry Pi).
		
		---------------------------------------------------------------------------------------------------------	
		
