Minor Project Report

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Use of Stateflow in Supervisory Control and Task

Scheduling
1st Puskar Neupane 2nd Saugat Baral 3rd Mecon Joshi
Department of Electrical Engineering Department of Electrical Engineering Department of Electrical Engineering
IOE Pulchowk Campus IOE Pulchowk Campus IOE Pulchowk Campus
Tribhuwan University Tribhuwan University Tribhuwan University
Lalitpur, Nepal Lalitpur, Nepal Lalitpur, Nepal
[email protected] [email protected] [email protected]

4th Subekshya Dani


Department of Electrical Engineering
IOE Pulchowk Campus
Tribhuwan University
Lalitpur, Nepal
[email protected]

Abstract—This paper explores the use of Stateflow, a graphical II. I MPLEMENTATION


programming tool offered by MathWorks, in supervisory control
and task scheduling for complex systems. The paper discusses
Stateflow is a graphical representation of control logic used
the benefits, challenges, and best practices of using Stateflow, to model and describe systems with the aid of flowcharts,
and provides examples of its use in different applications, such state transition tables, and truth tables Stateflow is a graphical
as autonomous machines like washing machine and in Battery representation of control logic used to model and describe
Management System. The paper also discusses the integration systems with the aid of flowcharts, state transition tables, and
of Stateflow with other tools and technologies, such as Simulink,
MATLAB, and external hardware. Overall, the paper aims to
truth tables [1].Resources for designing and building hybrid
demonstrate the usefulness of Stateflow in supervisory control systems, job scheduling, fault management, communication
and task scheduling, and provide insights into its practical protocols, and user interfaces are provided by Stateflow by
implementation. Mathworks. Stateflow also enables the simulation of sequential
Index Terms—MATLAB, stateflow, Washing machine, Battery and combinatorial decision logic, which can be implemented
Management System as a block in a Simulink model or executed as an object in
MATLAB. While logic is being executed, it can be examined
I. I NTRODUCTION and debugged. Edit-time and run-time checks are used to
guarantee design consistency and completion prior to imple-
Supervisory control and task scheduling are essential com- mentation. [2]
ponents of many complex systems, including manufacturing Stateflow objects can be used to make stateflow diagrams
processes, transportation systems, and automation systems. for charts. A new empty model with a Stateflow chart in a
These systems often require real-time monitoring, decision- Simulink system can be created using the sfnew or stateflow
making, and coordination of multiple tasks to ensure optimal instruction at the MATLAB command prompt. The Stateflow
performance and safety. block module is also shown by the stateflow command.
Stateflow, a graphical programming tool offered by Math- Additionally, extra charts from this library can be dragged and
Works, provides a powerful framework for designing and placed into the Simulink system if the model requires more
implementing supervisory control and task scheduling algo- than one chart.
rithms. With Stateflow, engineers can model complex systems
using state machines, flow charts, and truth tables, and gener- A. Washing Machine
ate efficient and reliable code for embedded systems. We have used washing machines for a very long time.
Overall, this paper aims to demonstrate the usefulness of Contemporary washing machines are quite sophisticated and
Stateflow in supervisory control and task scheduling and pro- technologically advanced. They can operate and carry out
vide insights into its practical implementation. By highlighting every process with a single button press. Yet, it only uses
the benefits and challenges of Stateflow, we hope to inspire a control system and an algorithm to operate. In this study,
researchers and engineers to explore its potential in their own stateflow was used in MATLAB to carry out the straightfor-
projects and applications. ward approach. Also, we carried out this process in stateflow
in two different ways: first, using a stateflow diagram, and format that is clear and concise. Additionally, a washing
second, using a state transition table. machine speed and gear system was developed in this tabular
format to show the various stateflow options for logical sys-
tems. The transition table, which includes states and columns
for if and else conditions, is shown in Fig.6.

Fig. 1. Washing Machine

Fig. 4. Stateflow Chart of Wahing Machine state

Fig. 5. Stateflow Chart of Gear System

Fig. 2. Gear System Using Stateflow Chart

Fig. 3. Gear System Using State Transition Table

Stateflow charts have been implemented for the Washing


Machine state, and various states have been created in accor-
dance[3]. Stateflow charts have given the simplest method of Fig. 6. State Transition Table
task scheduling. Using the chart and transitions in Fig.4,it is
simple to plan the various washing machine states of soak,
wash, rinse, and dry in logical flow patterns. Similar to the B. BMS
way a gear system is simply applied in the stateflow diagram A very important component of any area is the battery
shown in Fig.5. management system (BMS). To run the battery safely and
Another building component of stateflow is the state transi- efficiently, it must be constantly monitored. Cell balancing is a
tion table, which presents sequential modal logic in a tabular crucial component of BMS. A module is made up of a certain
number of cells, and a battery pack is made up of several and acronyms the first time they are used in the text, even after
modules. The State of Charge (SOC) of the various cells must they have been defined in the abstract. Abbreviations such as
be continuously monitored in order to balance the system. IEEE, SI, MKS, CGS, ac, dc, and rms do not have to be
If there is a difference in voltage between various cells, we defined. Do not use abbreviations in the title or heads unless
can simply implement the balancing algorithm in stateflow.The they are unavoidable.
one portion of cell balancing supervisory algorithm is shown in
Fig.7. Three knob are attached in model to vary the cell voltage
and cell voltages are given as input to the chart. The Chart
contains the flowchart for BalancingOFF and BalancingON
states which is shown in Fig.12.

Fig. 9.

Fig. 7. Cell Balancing in BMS

Fig. 10. Gear Box

Fig. 11. Gear Box


Fig. 8. Cell Balancing State Flow Chart
Define abbreviations and acronyms the first time they are
used in the text, even after they have been defined in the ab-
III. D ISCUSSIONS stract. Abbreviations such as IEEE, SI, MKS, CGS, ac, dc, and
Define abbreviations and acronyms the first time they are rms do not have to be defined. Do not use abbreviations in the
used in the text, even after they have been defined in the ab- title or heads unless they are unavoidable.Define abbreviations
stract. Abbreviations such as IEEE, SI, MKS, CGS, ac, dc, and and acronyms the first time they are used in the text, even after
rms do not have to be defined. Do not use abbreviations in the they have been defined in the abstract. Abbreviations such as
title or heads unless they are unavoidable.Define abbreviations IEEE, SI, MKS, CGS, ac, dc, and rms do not have to be
Fig. 12. Stateflow Chart Debugging of BMS

defined. Do not use abbreviations in the title or heads unless


they are unavoidable.
Define abbreviations and acronyms the first time they are
used in the text, even after they have been defined in the
abstract. Abbreviations such as IEEE, SI, MKS, CGS, ac, dc,
and rms do not have to be defined. Do not use abbreviations
in the title or heads unless they are unavoidable.
IV. C ONCLUSION
Define abbreviations and acronyms the first time they are
used in the text, even after they have been defined in the
abstract. Abbreviations such as IEEE, SI, MKS, CGS, ac, dc,
and rms do not have to be defined. Do not use abbreviations
in the title or heads unless they are unavoidable.
ACKNOWLEDGMENT
We hant to thank................Define abbreviations and
acronyms the first time they are used in the text, even after
they have been defined in the abstract. Abbreviations such as
IEEE, SI, MKS, CGS, ac, dc, and rms do not have to be
defined. Do not use abbreviations in the title or heads unless
they are unavoidable.
R EFERENCES
[1] “Stateflow Documentation,” www.mathworks.com.
https://www.mathworks.com/help/stateflow/ (accessed Feb. 15, 2023).
[2] “Stateflow,” Mathworks.com, 2019. https://www.mathworks.com/products/stateflow.html

[3] Skill-Lync, “Control logic of Washing Machine and Gear


Shift mechanism using STATEFLOW,” Skill-Lync. https://skill-
lync.com/student-projects/control-logic-of-washing-machine-and-gear-
shift-mechanism-using-stateflow (accessed Feb. 25, 2023).
[4] K. Elissa, “Title of paper if known,” unpublished.
[5] R. Nicole, “Title of paper with only first word capitalized,” J. Name
Stand. Abbrev., in press.

You might also like