Pratica di Shadowing: PLC State Machines Explained - Impara a parlare inglese con i video

Creazione lezione...
1
Hello and welcome back to the channel.
2
In today's video, we're going to cover a super important concept in the world of PLC programming, controls programming, called the finite state machine, or sometimes just state machine.
3
In a very basic setting, sometimes a state machine is also just considered like a sequencer or sequential logic.
4
They overlap a little bit in small systems, but when you get into large,
5
complex systems, a state machine is really like a hierarchy or a fundamental way of structuring your code that is super scalable,
6
easy to debug, easy to write additional code onto.
7
one together.
8
Okay, so let's talk about a very simple example of something that we could create a state machine to control.
9
And let's take a look at an industrial setting.
10
Okay, we have a tank, right?
11
We have some vessel that we want to be able to fill with material.
12
And then we want to be able to blend it and mix it up.
13
And then we want to be able to drain it and discharge material.
14
So I have all the IO, all the inputs and outputs used in this system shown here.
15
We're going to have a fill valve that will gravity feed raw material in.
16
We'll have a high and low level sensor, just digital inputs that tell us there is material in the tank at different levels
17
so we can see if we're below a low level set point or above a high level.
18
We'll actually have a mixer, kind of like a mixer descending into the tank to blend the material, and then we'll have a discharge valve that will also be gravity fed.
19
So we're not going to worry about pumps or things like that to
20
case and let's talk about how we want this system to operate normally okay
21
so we want the tank sort of sitting there waiting for a command someone would hit start
22
On an HMI or a push button doesn't really matter someone says okay start a blend and
23
and the system will check make sure everything's good no faults we're ready for
24
that command we're going to start by opening the fill valve until high level is reached
25
and then starting the mixer mix for some set point desired
26
and then we'll stop the mixer open the discharge valve
27
and once low level is reached then we'll close the discharge valve and return to idle okay so
28
conceptually you can see how this might make sense if you've been in industry or in a chemical plant
29
They are very simple.
30
It's like raw material in sometimes an operator will put a couple cups of additives in the top
31
or you use little diaphragm pumps for dosing.
32
You'll blend it up and mix it and then you'll send it on its merry way to go get packaged out.
33
So this is a very realistic real world scenario.
34
Now to program this in a logical way, a well documented, well structured way.
35
We want to create a state machine for it and state machines, broadly speaking, are defined by states and transitions between states.
36
Okay?
37
So for this system that we've just described, the states could effectively be idle, it's sitting there not doing anything,
38
filling where the mixer is off and the discharge valve is closed
39
and only the fill valve is open and the tank is building up its volume of raw material.
40
And then mixing where it's blending, no new materials coming in, no new materials going out.
41
We're just mixing and blending and then draining where the mixer's off, the fill valve's off, and we're just letting the blended material leave.
42
And then another state to think about is if something goes wrong, like the mixer fails to start or a valve gets stuck open,
43
that might go into alarm state.
44
So here shown in kind of the blue bubbles are what you could think of as the states.
45
schematic I'm showing here is known as a state transition diagram
46
because you're defining the states and the transition events
47
that take you from one state to another right so
48
when you're sitting there in idle the only thing that's going
49
to take you out of idle the way I've described the
50
system would be someone pressing the start button you could have an automated system where just like high level
51
or replacing a tote or something automatically triggers a fill,
52
that's a transition from the idle state to the filling state.
53
Now if I'm in filling and something bad happens, I might need to go into alarm state.
54
But if a person says this was a mistake, call it off, and they hit the stop button, I might just go right back to idle.
55
But in normal circumstances, I've hit start, I've started a fill, and I've reached high level,
56
then I will transition from the filling state to the mixing state.
57
Here, once low level is reached, I'll go back to idle.
58
So a normal operation flow is idle.
59
Someone presses start.
60
I fill to high level.
61
I mix for a desired set point.
62
And I drain to low level.
63
But you can see just in this one tank, 5IO point, simple system, how these state transition diagrams also capture a lot of unique edge cases.
64
And the PLC programmer needs to be thinking about these edge cases when they write the code for it.
65
diagram actually does not look too different from an IEC 61131 PLC programming language called SFC or sequential function chart.
66
Sometimes I think mislabeled sequential flow chart,
67
but it actually is a programming language that uses this concept of states and transitions similar to this.
68
It's not common in PLC programming.
69
Far more common is ladder diagram and structured text.
70
So we're going to stick with those.
71
But it is worth calling out that that is basically what an SFC is, is a document of the states and transitions between the states.
72
And you need to write lower level code to actually automate the system.
73
Okay, so enough PowerPoint engineering.
74
Let's take a look at what this actually means in a PLC program.
75
And because it would probably take, you know, hour to write together,
76
I'm going to go ahead and talk about the state machine that I have already written and walk you through it.
77
So let's go to main.
78
The main PLC let me close this side by side real quick.
79
Okay, and
80
so what I have set up ahead of time for this
81
Demonstration is something to handle the basic states something to simulate as
82
if we had these inputs and outputs This isn't a hardware tutorial
83
So I'm not you know actually standing up a tank in my garage to show you guys this
84
and then I have that running logic that normal sequence built Okay, so that's all that's in Maine.
85
Let's go to state handler, right?
86
at my main states and the things that could transition between primary states
87
so active just not being true me not being in sequence
88
is going to say I want to be in zero I want to be an idle
89
running will be our main control code this is where the things are happening that'll be
90
when someone hits the start command we'll start it up we'll say we're in active we're in run mode
91
One quick just sort of syntax thing, it's not a good idea to program yourself into a corner when you're doing PLC programming.
92
So when you're setting up a program initially for a small system, maybe you want to take jumps of tens rather than individual integers.
93
When you're doing a large system, maybe you would want to go from zero to 100 to 200 or 1 ,000, 2 ,000, 3 ,000.
94
added, sometimes you want to add a step that's actually halfway between idle and running, right, like a startup sequence,
95
and maybe you want to make that five or something so that these numbers still make sense and are sort of sequential.
96
So that's why this is zero to 10 and not zero to one.
97
It's just sort of like a programmer's delight sort of feature.
98
But anyways, so we have running, stopping, and alarmed or faulted, okay, those are kind of what you could think of as like your
99
modes and then we'll go into running
100
and we'll take a look at what actually happens
101
when we enter running
102
so someone has hit start we've entered active first thing we do is we check are there no active alarms
103
if there are no active alarms let's go start a fill
104
if there are active alarms let's go to that mode 30
105
and let's sit there until someone clears them or acknowledges them
106
Now we're in mode 11 right which is just right after starting up the running sequence.
107
Now we're in filling and we're going to open the fill valve until we reach high level.
108
And then once high level is reached we're going to move to step 12 and step 12 is going to be mixing.
109
Here we're going to start the mixer and again
110
if you've been following along with the PLC programming tutorials on the channel you already know this.
111
the fill valve just once this condition is no longer true the fill valve will shut
112
so these momentary coils imply if I'm in step 11
113
and I don't have high level open the fill valve
114
but it also says if I'm not in step 11
115
or I do have high level close the fill valve so
116
that you implicitly get that code for using these momentary coils hopefully that's clear go watch the
117
previous tutorials if
118
if you're unfamiliar with why we don't need to also command the fill valve to close okay
119
but now moving on to look at the mixing step again
120
we're turning on the mixer we'll wait to watch for mixer feedback
121
so this is a very common convention in digital outputs for motors
122
or pumps is you command a plc output to turn on a pump
123
or motor but usually that chunk some big motor contactor pulls in
124
and you want feedback off of that contactor that it has and pulled in.
125
So other than just looking at the output and saying is the output on ideally, you'd actually be looking at a feedback on that contactor that says, Yep, it pulled in.
126
And now I'm counting up in timing.
127
That's a normal source of alarms and faults is like, Hey, I commanded this output to turn on, but I never got feedback that the contactor pulled in.
128
And anyways, then we're going to time for some set point, I have one minute in there right now, this could be a
129
I just have one minute in there and when
130
that timer finishes we'll go to step 13 similar to the
131
valve we won't need to tell the mixer to turn off
132
it will just turn off once we're no longer in step 12.
133
Step 13 will be draining it looks exactly like filling
134
but now we open the drain valve until low level is met
135
and then when low level is met we're going to turn off the active bit
136
and we're going to go back to step 0 which is idle.
137
Okay so that's the normal sequence of events and you can see how handles this little discrete chunk of logic.
138
And it's really easy to see how from an HMI or a monitoring system of any sort,
139
you can always know exactly what your code thinks it ought to be doing just by looking at this one tag.
140
This one mode tag will tell you exactly what it should be trying to do
141
and what state it should be in right now.
142
This is a lot cleaner than a world of dozens of
143
Find what mode currently is and you go look at what it's trying to do in that specific step.
144
Now, because this is a software setup and I don't have all this physical IO, I'll walk you through the sim logic I have here really quickly.
145
When fill valve is open, I have every 500 milliseconds, so twice a second, I have add one to tank level,
146
just this integer value that's tracking the tank level.
147
fill and tank drain.
148
And then when the mixer turns on, I today tell the feedback to act as if that worked properly.
149
And then when tank level gets above 75, we say, okay, we have high level when it gets below 10, we say we have low level.
150
So that's the that's the simulation logic I've built so that we can test this sequencer.
151
All right.
152
So let's actually walk through what this looks like.
153
And then we'll just close the tutorial real quick.
154
So we're sitting here in idle system is just chilling.
155
Everything seems okay.
156
Nothing's faulted.
157
A person comes along and hits a start button.
158
Now I go to step 10.
159
Now I move into step 11.
160
I'm in running.
161
And if I go in and monitor my running logic, you can see we're sitting here with the fill valve open, waiting for high level to be reached.
162
So if I go over to my sim logic, you can see the tank level is rapidly counting up, it's counting up twice per second.
163
So we'll hit 75 in no time.
164
But if I had an HMI setup for this, and you know, we'll do some HMI tutorials on the channel soon, it would say, you know,
165
a graphic of the tank that is showing the volume counting up.
166
And then it just hit 75.
167
So now we're in mixing and you can see our mix timer is counting up the fill valve closed.
168
The level is holding at 75, which is what it filled to there.
169
And in 45 seconds, we're going to finish this mix timer.
170
And here you could is a good spot to say like you have the main logic of what you want to
171
this code is like what's a common issue you could have
172
at this step it would be like the mixer is being commanded to be on
173
but i don't have mixer feedback for five seconds
174
or one second like i gave the contactor a chance to pull in
175
and relay that back to the plc and
176
so you could have a oh i commanded the mixer to start
177
and i didn't get the feedback in that case i want to go to my
178
when everything's good and we get the feedback, we count up to 60 seconds, we get to our drain state.
179
Now the mixer's off, the fill valve's off, and all the system is trying to do is drain until we get low level.
180
We can see the level hurtling down now, kind of opposite of the filling step that we were just in.
181
And in a couple of seconds, we'll be at 10, which will trigger our low level indication, and we should go back to idle, right?
182
So this very simple logic actually would let us completely automate a filling and draining sequence.
183
And it all goes back to there.
184
There we go.
185
We hit 10.
186
Okay, so we should be back in idle.
187
All right, we hit low level, it moved to step zero, and it reset active.
188
And now everything is just chilling, waiting for commands and transitions.
189
It all goes back to being able to
190
writing the PLC code to actually do the thing is relatively trivial
191
and there are great ways to go through step by step
192
and check for edge cases
193
and of course it gets more complicated as you get into dozens
194
or thousands of IO points and large interconnected systems with DCSs
195
and SCADAs but if you can take every system and subsystem back to a state transition diagram and say what
196
move me from filling to mixing to draining, then you can create well -structured, easy to debug, easy to program PLC code.
197
And a big thing in our industry in controls
198
and automation is writing code for the next person who has to work on that system.
199
Over decades, it's very unlikely that one person will be responsible for all of the control code for a facility.
200
programmers and people working on a system what you were thinking when you created that system.
201
Okay, so like I said early on in the video, in a smaller system like this one I've demonstrated here, creating a sequencer where you just say like,
202
I'm in step 10, 11, 12, 13, is not super different from a state machine.
203
When you get to very large systems, you often have like zones of control that
204
have a mode that says I've gone from you know idle to fill
205
but you'll have a new like sub step
206
or sub mode that's like command all the valves to do a thing
207
and they'll all be sub functions inside of the fill sort of master mode control
208
so state machines can actually have state machines nested inside of them it gets very complicated at very large systems
209
but if you're able to break it down doing.
210
So I hope you found this useful.
211
As always, if you have questions about what you saw in this video, feel free to ask them in the comments below.
212
Please consider leaving a like on the video and subscribing to the channel.
213
And let me know what you want to see more of on the channel next time.
214
Thanks for watching and see you next time.
215
Thanks.
216
Bye.

Contesto e Sfondo

Nel video "PLC State Machines Explained", l'autore introduce il concetto fondamentale delle macchine a stati finiti in ambito di programmazione PLC (Control Logic Programming). Le macchine a stati sono essenziali per strutturare il codice in sistemi complessi, permettendo un controllo scalabile e semplice da gestire. L'esempio presentato riguarda un serbatoio industriale che deve riempire, mescolare e drenare materiali. Il video esplora i diversi stati operativi di questo sistema, fornendo un'ottima occasione per praticare conversazione in inglese, concentrandosi sulla terminologia tecnica e sulle frasi utili nel contesto dell'industria e della programmazione.

Le 5 Frasi Chiave per la Comunicazione Quotidiana

  • “The system will check make sure everything's good no faults” - Questo è un modo per assicurarsi che non ci siano problemi nel sistema.
  • “We want to be able to fill with material” - Importante per descrivere il processo di carico di un serbatoio.
  • “Start a blend and the system will check” - Usato per iniziare e monitorare il processo di mescolamento.
  • “Open the discharge valve” - Un passo chiave nel drenaggio del materiale dal serbatoio.
  • “Return to idle” - Indica che il sistema è pronto per un nuovo comando.

Guida Passo-Passo per il Shadowing

Per affrontare le difficoltà di questo video, ti consiglio di seguire questi passi per migliorare la tua pratica di conversazione in inglese attraverso il shadow speak:

  • Ascolta attentamente: Guardo il video una prima volta senza prendere appunti. Concentrati sulla pronuncia e l'intonazione delle frasi.
  • Ripeti insieme al video: Fai shadowing in inglese mentre il narratore parla. Cerca di imitare il ritmo e la melodia del discorso.
  • Focalizzati sulle frasi chiave: Scegli alcune delle frasi chiave che abbiamo elencato e ripetile diverse volte. Questo ti aiuterà a interiorizzare il vocabolario tecnico.
  • Registra la tua voce: Fai una registrazione di te stesso mentre parli delle macchine a stati. Riascolta la tua pronuncia e confrontala con quella dell'autore.
  • Pratica con un partner: Trova un amico o un collega con cui esercitarti. Utilizzate le frasi chiave in una conversazione simulata riguardo al funzionamento del sistema descritto nel video.

Seguendo questa guida, non solo migliorerai la tua pronuncia in inglese, ma acquisirai anche sicurezza nel parlare di temi tecnici, ampliando il tuo lessico e le tue competenze linguistiche nel contesto della programmazione PLC.

Cos'è la tecnica dello Shadowing?

Shadowing è una tecnica di apprendimento delle lingue supportata da studi scientifici, originariamente sviluppata per la formazione dei traduttori professionisti e resa popolare dal poliglotta Dr. Alexander Arguelles. Il metodo è semplice ma potente: ascolti un audio in inglese di madrelingua e lo ripeti immediatamente ad alta voce — come un'ombra che segue il parlante con un ritardo di solo 1–2 secondi. A differenza dell'ascolto passivo o degli esercizi di grammatica, lo shadowing costringe il tuo cervello e i muscoli della bocca a elaborare e riprodurre simultaneamente i modelli di discorso reale. La ricerca dimostra che migliora significativamente la precisione della pronuncia, l'intonazione, il ritmo, il discorso connesso, la comprensione dell'ascolto e la fluidità del parlato — rendendolo uno dei metodi più efficaci per la preparazione alla prova di speaking dell'IELTS e per la comunicazione reale in inglese.

Tecnica dello shadowing: leggi la guida completa passo dopo passo →