Frequently Asked Question
Press "Ctrl + F" to find the keyword of your interest.
If you wish to have a direct link access to the video timestamps, please follow these instructions.
Found this video helpful? Why not take the whole HIL Specialist course? A Certificate is waiting for you for free at HIL Academy.
Would you or your organization benefit from having these videos narrated in your native language? Contact us and let us know if you wish to contribute.
Hello everyone and welcome to this demonstration on using Serial protocol
in the Typhoon HIL toolchain.Let s start by opening the Serial
Communication between HIL device and HIL SCADA example from the Examples Explorer.
This example model demonstrates communication between a HIL RS232
Serial interface and an instance of HIL SCADA on your computer, using the HIL SCADA
Serial widget and a Serial to USB converter.If you would like to follow along to this example
on your own HIL device, in addition to meeting the license requirements, you will also need a Serial
to USB converter cable, so that you can connect the HIL device to your PC over a Serial link.
Let s open it and go through the components and configurations.
As you can see, there is a Three Phase Inverter connected to an Induction Machine,
much like the model we worked on in Module 2 of HIL Fundamentals. In this case, we want to control
this model from Serial communication, by setting the enable and torque parameters in HIL SCADA.
This lets us control the inverter and load torque applied to the Induction Machine.
Also, with this model, you can see that we want to monitor the motor speed and current,
both of which are sent to the Serial Send component.
So let s go take a look at the Serial communication structure.
Starting with the Serial Setup component. By opening its properties, you can see how this
is configured in this example. The baud rate is left at the default of 9600 bits per second.
Now, let s look at the Serial Send component.As mentioned before, we want to send two
variables, motor speed and current. These are directly connected to the Serial Send
component with a bus join, because the Serial component accepts vectors as an input.
By opening the component properties of the Serial Send component,
we can see how it is configured. The message header in this case is left
as the component default value and the sending period is programmed to 500 ms.
The last component of the Serial communication structure in the Serial Receive component. In
this case we want to control two variables in the model, enable, that turn the inverter on
and off and the torque. These two are connected from the Serial Send component with a bus split,
as they are inside a vector.Let s open the properties of the Serial
Receive component. Here we can see the Header setting matches what we saw in the Send component,
and the number of input variables is set to two, as we want to receive two variables.
Finally, we should define the variable type, which in this case is real (or float) type.
Let s compile the model and open the SCADA panel to see how Serial is configured in the SCADA.
This SCADA panel is divided in three parts. The first part is the serial connection command,
where you can connect and disconnect the serial port with the serial connection widget.
If you open the properties of this widget, you can see that the Serial
port settings should be defined as the same as in the model, like here.
The message below the serial widget shows the serial connection status.
The second part is the SCADA to HIL communication. In this panel you can set
the parameters to control the model via serial commands, like Inverter Enable and Torque.
The third part is the HIL to SCADA communication. In this panel the
variables such as motor speed and current are read from the serial communication and output here.
Now let s look at how the serial communication is programmed in the SCADA.
To do this let s open the Panel Initialization dialog.
This script contains two main functions. The first is serial_write , which is responsible
for sending messages from the SCADA to the HIL device UART.
The second function is serial_read , which reads from the HIL device via serial.
Now, if you go back to the SCADA panel and click on the Continuous Write widget, inside
the SCADA to HIL sub panel, you can see that it executes the serial_write function periodically,
every 500 ms, and it sends the enable and torque variables to the HIL device.
Similarly, if you go to the Continuous Read Widget at the HIL to SCADA sub panel you
will see that the function serial_read is used periodically to read the serial
data from the HIL device, every 500 ms.Now let s get ready to test this model.
Before we start the model, we need to establish a Serial link over the computer. The first thing to
do is to verify which COM port is connected to the HIL device. To do that, open the device manager of
your Windows PC, go to the ports section, and check the number of the serial port where the
HIL device is connected, as shown here.Go back to the SCADA panel and,
in the Connection command panel, select the right COM number and click connect. Now run the model
and, if you selected the right COM port, you should get the message Connection Successful.
Now, let s enable the Inverter by selecting the Inverter Enable text box.
You should be able to read the speed and current of the motor in the HIL to SCADA sub panel now,
which means that serial communication is working fine.
You can also change the Torque to a higher value, like 4 Nm, and check that the motor
current increases and the RPM decreases, as is expected for open loop systems.
With this we conclude our Serial communication example in Typhoon HIL toolchain.
Thank you for your attention!