mp1-hb4xakb2-l1coupun/controllers/part1a.controlio
mp1-hb4xakb2-l1coupun/controllers/part1b.controlio
mp1-hb4xakb2-l1coupun/controllers/part2a.controlio
mp1-hb4xakb2-l1coupun/controllers/part2b.controlio
mp1-hb4xakb2-l1coupun/controllers/part3a.controlio
mp1-hb4xakb2-l1coupun/controllers/part3b.controlio
mp1-hb4xakb2-l1coupun/mini_project_01_CPS_Security_Summer_2020.pdf
Mini Project #1: Design and Simulation of
Industrial Control Systems
CS 6263/ECE 8813: Cyber Physical System Security (Summer 2020)
Assigned: May 20, 2020 Due: June 3, 2020, 11:59pm EST
Environment Setup
The first step towards understanding the concepts of cyber-physical systems (CPS) security is
to get familiar with their control logics and mechanisms. In the first mini project, we will learn
how to model an industrial control system (ICS) with its control logic. To do so, an advanced
educational modeling software, namely Factory I/O coupled with Control I/O, will be used to
model the process and design the underlying controller. The latest trial version of Factory I/O
for Windows machines can be downloaded from here: Factory I/O trial version (Alternate Link).
You can use this version for 30 days.
Factory I/O requires Windows operating system (OS). If you do not have access to a Windows
machine, you can download Windows from Georgia Tech Azure Dev Tools (formally Microsoft
Imagine). If you have a Mac, then Parallels Desktop is a great way to set up the Windows virtual
environment. The trial version of Parallels is sufficient for this mini project but you can also get
a student discount for the full version. Otherwise, any virtual machine manager is allowed (e.g.,
VirtualBox). If you use VirtualBox, then you may need to install Guest Additions, so that GUI
resolution auto-adjusts. Please note that Factory I/O needs a GPU for better graphical render-
ing performance and a good amount of RAM. Therefore, make sure you have allocated enough
hardware resources from your host machine to get a smooth environment. If you are still unable
to get a smooth running experience, try to decrease the graphical rendering quality within the
Factory I/O settings. (Please avoid using VirtualBox if possible, it is not ideal for development).
Factory I/O requires heavy compute resources to run without any inexplicable problems and
anomalies. A machine with the following specifications would be ideal for this project. These
are not hard requirements, but will help improve your development experience. The listed
specifications are based on statistics from previous classes:
• CPU Utilization does not exceed 30%
• 16GB RAM
• 2GB Video RAM
• 50 FPS
1
https://factoryio.com/get-factory-io/
https://factoryio.com/download-archive/
https://support.cc.gatech.edu/resources/downloads
https://www.parallels.com/products/desktop/
https://www.virtualbox.org/wiki/Downloads
https://askubuntu.com/questions/22743/how-do-i-install-guest-additions-in-a-virtualbox-vm
Mini Project #1 Design and Simulation of Industrial Control Systems
Factory I/O
Inside Factory I/O, there is a visual environment where you can create the 3-D model of an
industrial control process. Also, you can design a controller for the process, where the actuators
are controlled by sensors, input buttons, and the underlying control logic. The control logic of
the process can be embedded inside a programmable logic controller (PLC) connected to your
computer. We will learn how to program a PLC in the next mini project. Instead of connecting
a real PLC, in this mini project, you will use the Control I/O interface with Factory I/O
to design your controller. You can connect the block diagrams of the inputs, sensors, and
actuators with different logic to form your controller. This is very similar to programming in
the Simulink/Matlab environment. Factory I/O can be very easy to learn, but for this project
you are only working in Control I/O.
It does take some time to get familiar and comfortable with Factory I/O and Control I/O
software. This project requires Function Block Diagram design which is a bit different from
traditional software programming (there are no IF statements!). Please do not wait till the last
weekend to start this project, as the estimated time of completion could be anywhere from 15
to 50 hours. Below are helpful resources to get started on Factory I/O, Control I/O, PLCs and
Function Block Programming.
Table 1: Helpful Resources
Description Link
Free Tutorial PLC Academy
Control IO Documentation Getting Started
Getting started with Control I/O YouTube Video
Summaries of PLC Programming
Languages
isd-soft
(Technical Background Section) Lab Assignment
Programming Language Features IEEE Paper
PLC Design Approach ACC Automation
Introduction to Function Blocks Function Blocks
Additional Note(s)
In order to get started and view the Part 1 scene, unzip the attached project zip. Double-click on
the scene file to open under the scenes directory (in this case part1.factoryio). In turn, this will
start Factory I/O with the scene loaded. Once Factory IO is open, it restricts opening scenes
from a specific directory (My Scenes directory) and does not allow navigation to a different
location. Controller I/O does allow you to navigate and open a controller file from a different
directory.
If Factory I/O is opened first, a blank Control I/O file might open. If this happens, you should
not use this Control I/O, instead you will need to open the Control I/O file associated with
your work. The blank Control I/O file will have a file name such as “Diagram1.controlio”, that
is your indication to load your Control I/O file, or the one provided with the project archive.
Make sure that the Control I/O file you are editing is the correct file. The best practice is to
Georgia Institute of Technology 2 Cyber Physical Systems Security
https://www.plcacademy.com/function-block-diagram-programming/
https://docs.factoryio.com/controlio/getting-started/
https://www.youtube.com/watch?v=aR8LK77QRj4&t=212s
http://isd-soft.com/en/tech_blog/plc-programming-languages-short-overview/
https://www.engr.siu.edu/staff/spezia/NewWeb438B/labs/Lab8_ET438b.pdf
https://www.engr.siu.edu/staff/spezia/NewWeb438B/labs/Lab8_ET438b.pdf
https://accautomation.ca/five-steps-to-plc-program-development/
http://www.functionblocks.org/Introduction.html
Mini Project #1 Design and Simulation of Industrial Control Systems
name the Factory I/O file and Control I/O file the same (with different extensions). Do not
modify the 3D environment in Factory I/O.
Logic Bombs
A logic bomb is a set of instructions incorporated into a program so that if some condition
is met, the instructions will be executed. Typically, triggering a logic bomb causes a harmful
change to the normal operation of the program. For the purpose of this assignment, the logic
bombs will result in a change to the normal operation, but the change may or may not appear to
be harmful to you. However, the plant owner may feel that the unauthorized change is harmful
or might result in an unobserved downstream effect that she considers harmful.
1 Water Tank System (20 Points)
Part 1a - Water Tank System (0 Points)
In this part, the goal is to design and implement a water tank system that fills and drains
automatically. In the pre-built Factory I/O scene, there are three water tanks. However, in this
part only requires working with one water tank (NOT all three). Below are the steps required
for the implementation:
• The fill process starts when the start button is pressed.
• Once the water level reaches 70% the tank’s capacity, the fill valve must stop and the
drain valve should open to decrease the tank level to 50%. This filling and draining
process should continue between 70% and 50% until the stop button is pressed.
• By pressing the stop button, the remaining water in Tank 1 must be drained and then the
entire process must stop. Only when the tank has been fully drained, pressing the start
button again must restart the entire process.
• Pressing the start button while a tank is draining below its minimum cycle level (ex: 40%
for Tank 1) can be ignored, or it can start the filling process, either method is acceptable.
This implementation has already been done and the solution is provided in the assignment zip
file. Also, there is a Youtube Video created to discuss how to implement the solution. This
is provided as reference and to assist the learning curve required for working with Factory &
Control I/O.
Part 1b - Logic Bomb Water Tank System (20 Points)
This part is an extension to the first, but will require using all three water tanks, and adding a
logic bomb.
For the first tank, once the water level reaches to 70% of the tank’s capacity, the fill valve must
stop and the drain valve must start and continue until the water level reaches 30% of tank’s ca-
pacity. This process must continue working in a repeated cycle until the stop button is pressed.
By pressing the stop button, the remaining water in the tank must be drained and then the
entire process must stop. Only when the tank has fully drained, pressing the start button again
Georgia Institute of Technology 3 Cyber Physical Systems Security
https://youtu.be/nX9t9o8ObS4
Mini Project #1 Design and Simulation of Industrial Control Systems
must restart the entire process.
For the second tank, once the water level reaches to 60% of the tank’s capacity, the fill valve
must stop and the drain valve must start and continue until the water level reaches 40% of
tank’s capacity. This process must continue working in a repeated cycle until the stop button is
pressed. By pressing the stop button, the remaining water in the tank must be drained and then
the entire process must stop. Only when the tank has fully drained, pressing the start button
again must restart the entire process.
For the third tank, once the water level reaches to 50% of the tank’s capacity, the fill valve
must stop and the drain valve must start and continue until the water level reaches 30% of
tank’s capacity. This process must continue working in a repeated cycle until the stop button is
pressed. By pressing the stop button, the remaining water in the tank must be drained and then
the entire process must stop. Only when the tank has fully drained, pressing the start button
again must restart the entire process.
After the third tank hits 50% 5 times (fills to 50% level 5 times), the fill and drain logic of the
second and third tanks should be affected. As a result, your logic bomb should cause the second
water tank to cycle between 10% and 10.1%. The cycle action is to fill to 10.1% and when 10.1%
is reached, it drains to 10% and then refills to 10.1% and continues the cycle. The third tank
should fill to 100% capacity. If the stop button (or start button) is pressed after the logic bomb
has triggered, tank 1 should continue to respond accordingly, however, tanks two and 3 should
NOT. In turn, tank 2 will continue to cycle between 10% and 10.1% and tank 3 will fill to 100%.
Grading Notes
A pre-built Factory I/O scene is provided, and you are not allowed to modify the pre-built scene,
as this will be the scene used for grading. Any points lost due to scene modifications are not
eligible for a regrade (including any sensors/actuators that are already FORCED). This part
will be graded under normal speed (1x); if your process takes too long (see Appendix A) to
operate then you will lose points. There are no points assessed for connecting the different lights
and control box for this part.
2 Sorting Station (40 Points)
Part 2a - Sorting Station (25 Points)
In this section, the goal is to design and implement a sorting station. Below are the steps
required for implementation:
• When the start button is pressed, all three rollers will emit pallets with boxes. One outer
emitter (on the outer roller) will emit pallets with small boxes, and the other emitter (on
the other roller) will emit pallets with large boxes. The middle roller emits pallets with
either a small or a large box. (The emitters are already configured).
• Once the pallets+box, on the middle roller, reach the chain transfer the pallets with small
boxes should be sorted to the right and the pallets with the large boxes should sort to the
Georgia Institute of Technology 4 Cyber Physical Systems Security
Mini Project #1 Design and Simulation of Industrial Control Systems
left. The pallets (with boxes) emitted on the outer rollers should continue to be removed
accordingly. (See video for additional details)
• Once the pallets are properly sorted to the appropriate roller, they should continue to
travel down and their respective roller and removed by the Remover at the end of the
roller(s).
• If the stop button is pressed, the process should pause and continue as normal when the
start button is pressed again. (Note: You do not have to worry about the stop button
being pressed mid-sort.)
• Ensure that the control box has the appropriate number of sorted boxes at all times,
configuration provided in the table below.
Table 2: Part 2 Control Box Configuration
Counter(s) Where Count is Taken
C1, C2, C3 Emitter Counters Respective conveyor line (1, 2, or 3)
C2 @ Entry Counters (Small/Large) At the C2 At Entry sensor
C1, C3 @ Removed Counters At the respective C1/C3 At Remover sensor
Part 2b - Logic Bomb Sorting Station (15 Points)
For this part, the goal is to introduce a logic bomb into the implementation. The logic bomb
should trigger when 5 pallets have been recognized by the middle At Transfer sensor. The logic
bomb should cause the sort logic to reverse and the system should stop responding to the start
and stop buttons. In other words, pallets with small boxes are sorted and merged into the
large box conveyor line, and pallets with large boxes are sorted and merged into the small box
conveyor line. There should be no changes to the control box logic, so it should be reporting
incorrect numbers.
Grading Notes
A pre-built Factory I/O scene is provided, and you are not allowed to modify the pre-built scene,
as this will be the scene used for grading. Any points lost due to scene modifications are not
eligible for a regrade (including any sensors/actuators that are already FORCED). This part
will be graded under normal speed (1x); if your process takes too long (see Appendix A) to
operate then you will lose points.
3 Production Line (40 Points)
Part 3a - Production Line (25 Points)
In this section, the goal is to design and implement a production line system with production
bases and lids. Below are the steps required for implementation:
• When the start button is pressed, one emitter produces lids and the second produces bases
(emitters already configured). They travel down the respective conveyor belts.
Georgia Institute of Technology 5 Cyber Physical Systems Security
Mini Project #1 Design and Simulation of Industrial Control Systems
• When both a base and lid have reached their respective positioner, they should be aligned
properly and then the Pick & Place is used to move the lid on top of the base
• After this, the positioner should lift up allowing the lid+base (packages) to move down
the conveyor belt, until the vision sensor is reached.
• The vision sensor should be used to determine the orientation of the wheel sorter in order
to sort the lid+base properly. Green lids should be sorted to the right, gray should go to
the left, and blue go straight to the middle. The lid+base should continue travelling down
the respective conveyor belt and be removed by the Remover.
• If the stop button is pressed, the process should pause and continue as normal when the
start button is pressed again.
• Ensure that the control box has the appropriate number of sorted boxes at all times. The
Packages Complete counter counts the number of lid+base (packages) that are detected
by the Package leaving sensor. The Blue, Green, Metal Packages Counters are represent
the counts of the packages at the corresponding Blue, Green, Metal Packages sensors.
Part 3b - Logic Bomb Production Line (15 Points)
For this part, the goal is to introduce a logic bomb into the implementation. The logic bomb
should trigger if 2 blue lids and 2 green lids are removed OR if 2 blue lids and 2 gray lids are
removed. The logic bomb should cause the sorting of green and gray packages to switch. Below
is the example of the logic:
(TWO BLUE LIDS + TWO GREEN LIDS) OR (TWO BLUE LIDS + TWO GRAY LIDS)
There should be no changes to the control box logic, so it should be reporting incorrect numbers.
Grading Notes
A pre-built Factory I/O scene is provided, and you are not allowed to modify the pre-built scene,
as this will be the scene used for grading. Any points lost due to scene modifications are not
eligible for a regrade (including any sensors/actuators that are already FORCED). This part
will be graded under normal speed (1x); if your process takes too long (see Appendix A) to
operate then you will lose points.
Optimizations as well as clean and clear implementations are very important in industry, as
solutions with many function blocks become difficult to debug and make collaboration impos-
sible. There will be special optimization penalty for Part 3. Part 3a and 3b solutions must be
developed with a certain number of blocks. This means that if your code satisfy all the require-
ments for part 3a but it has 220 blocks, it will receive 20 pts maximum. Similarly, a perfect
implementation of part 3a with 205 blocks will receive 22.5 pts maximum.
Georgia Institute of Technology 6 Cyber Physical Systems Security
Mini Project #1 Design and Simulation of Industrial Control Systems
Table 3: Part 3 Thresholds
Part Threshold Penalty
Part 3a >= 180 -2.5
Part 3a >= 210 -5
Part 3b >= 190 -2.5
Part 3b >= 220 -5
You may use the following python code snippet for enumerating the number of blocks in your
code:
import xml.etree.ElementTree as ET
controlio_path =
count = 0
tree = ET.parse(controlio_path)
root = tree.getroot()
diagram = root[1]
for element in diagram:
if (element.tag == "NodeData") and (element.attrib["NodeType"] != "NotesNode"):
count += 1
print(count)
Youtube Videos
To better assist this assignment, a series of Youtube videos have been created to highlight the
requirements for each part.
Table 4: Youtube Videos
Section Video
Water Tank Link
Sorting Station Link
Production Line Link
Georgia Institute of Technology 7 Cyber Physical Systems Security
https://youtu.be/PIikKczzNzg
https://youtu.be/nqA3BWZ38fE
https://youtu.be/l6nff-2ul2E
Mini Project #1 Design and Simulation of Industrial Control Systems
Deliverable and Submission Instructions
Create a zip file named --mp1.zip (e.g., Tohid-Shekari-mp1.zip),
that includes all your files and submit it on Canvas. Your zip file should be generated in such
a way that when it is extracted, we get two folders with the names of scenes and controllers.
Note: Failure to follow the submission and naming instructions will cause 20%
points loss.
--mp1.zip
|-- scenes
|-- part1.factoryio
|-- part2.factoryio
|-- part3.factoryio
|-- controllers
|-- part1b.controlio
|-- part2a.controlio
|-- part2b.controlio
|-- part3a.controlio
|-- part3b.controlio
Please check your submission multiple times as we will not accept any submissions after the
deadline for any reasons (e.g., wrong file submission).
Georgia Institute of Technology 8 Cyber Physical Systems Security
Mini Project #1 Design and Simulation of Industrial Control Systems
A Evaluation
Table 5: Water Tank Logic Bomb Evaluation (20 Points)
Requirement Points Notes
Simple Three Tank Sys-
tem
10 All three tanks start filling when Start button pressed, cycle appro-
priately, drain when Stop button pressed, and restart if Start button
pressed after completely draining
Logic Bomb Trigger 5 Logic bomb triggers after tank 3 hits 50% 5 times
Logic Bomb Effect 5 Tank 2 cycles between 10% and 10.1%, Tank 3 fills to capacity, and
both tanks do not respond to Start/Stop buttons
Table 6: Sorting Station (25 Points)
Requirement Points Notes
Process Starts/Stops 5 Process starts and stops appropriately when Start and Stop button(s)
pressed
Small Box Sort 5 Process accurately sorts pallets with small boxes to the right roller
Large Box Sort 5 Process accurately sorts pallets with large boxes to the left roller
Pallet+Box Removal 5 Once pallet+box sorted they are appropriately removed by Remover
Control Box Logic 5 Control box numbers are accurately displayed
Table 7: Sorting Station Logic Bomb (15 Points)
Requirement Points Notes
Logic Bomb Trigger 5 Logic bomb triggers after 5 total boxes have been sorted
Reversed Sort Logic &
Removal
5 Boxes accurately removed in opposite rollers
Start/Stop Buttons 5 Start/Stop buttons stop working
Table 8: Production Line (25 Points)
Requirement Points Notes
Process Starts/Stops 5 Process starts and stops appropriately when Start and Stop button(s)
pressed
Robot Arm 5 Pick & Place properly picks up lid and places onto base
Positioners 5 Positioners align lid(s) and base(s) so lid(s) are placed on-top of bases(s)
with no gaps (should be flush)
Wheel Sorter 5 Wheel sorter sorts lid+base package correctly
Control Box Logic 5 Control box numbers are accurately displayed
Georgia Institute of Technology 9 Cyber Physical Systems Security
Mini Project #1 Design and Simulation of Industrial Control Systems
Table 9: Production Line Logic Bomb (15 Points)
Requirement Points Notes
Logic Bomb Trigger 5 Logic bomb triggers after condition has been met)
Reversed Sort Logic &
Removal
5 Green & Gray lid sort logic is reversed
Start/Stop Buttons 5 Start/Stop buttons stop working
Georgia Institute of Technology 10 Cyber Physical Systems Security
Water Tank System (20 Points)
Sorting Station (40 Points)
Production Line (40 Points)
Evaluation
mp1-hb4xakb2-l1coupun/scenes/part1.factoryio