Академический Документы
Профессиональный Документы
Культура Документы
Remote
Operation,
Monitoring,
Configuration
Table of Contents
Chapter 1
1.1 Starting a new project in FST 4 ………………………………………... 1-1
Chapter 2
2.1 FEC34 Command Interpreter (CI)………………………………….…... 2-1
IP addresses 3-5
IP address classes 3-5
Subnet masks 3-6
Chapter 4
4.1 Modification of a project for remote access……...…………………. 4-1
JavaScript 5-5
Event handlers with JavaScript 5-5
Chapter 6
6.1 Dynamic Data Exchange (DDE) with IPC Data Server…..…………. 6-1
Installation 6-2
IPS Data Server configuration 6-2
Controller operands available through the IPC Data Server 6-4
6.3 Microsoft Excel spread sheet for remote process monitoring..…. 6-6
Chapter 1
Station Control Program
Summary
This chapter provides basic information about development of a PLC
program to operate a stand-alone MPS Distribution Station.
Specifically, it introduces details of using FST 4.0 software for the
development of the program.
1. Station Control Program
Table of Contents
Resources required
Software
• FST 4.0
Files
• DIST_STA project files
Hardware
• Personal computer
• MPS Distribution station with FC34 controller
• RS232 serial communications cable
1. Station Control Program
In FST a project is used to organize all components of a control program. Each project has a
name. The name can be up to 8 characters long.
Project location on
the hard drive
During installation of FST, a project directory is created on the hard
drive of the computer. If default settings are used, this directory will
be at:
C:\FST4\Projects
C:\FST4\Projects\DIST_STA
Then, all DIST_STA project files will be saved into this subdirectory.
This is a convenient organization of the project and its components
because if the project needs to be transferred to another computer,
simply copying the project subdirectory will ensure proper transfer of
all necessary files.
Creating a new
project
Start FST by clicking on the Windows START button and by navigating
to the program from the menus. If the default settings are used
during installation of FST you can start it by choosing:
Programs
Festo Software
1-1
1. Station Control Program
FST 4
FST 4
1. From the FST menu select Project and New …. The New Project
window will be displayed:
The dialog box displays all projects that are in the current Projects
directory.
Enter DIST_STA as the name of the new project and click OK.
Remember the project name can have at most 8 characters and
must not be the name of an already existing project.
2. After entering a name for the new project, the Project Settings
dialog box is displayed. This dialog box allows you to choose the
controller type. Also you can enter a comment (up to 255
characters long). The comment is used to give a short description
for your project for easier recognition. Whenever you have to
select a project in FST this comment will be displayed together
with the project name and can be used for sorting lists. Choose
FEC Compact as the controller:
1-2
1. Station Control Program
1. Controller settings,
2. I/O configuration,
3. Driver Configuration,
4. Allocation list and,
5. Control program development.
Controller Settings
Controller settings refer to several runtime and download options for
an FST project. To modify these settings:
(If the Project Tree window is not currently displayed, select View,
Project Tree from the FST menu to display it). The Controller
Settings dialog box has various tabs:
1-3
1. Station Control Program
2. Select Autostart from the Run Mode tab. This will automatically
start the project after it is downloaded to the controller without
having to give an explicit run command.
3. Depending on the controller type there can be more than one COM
port. The FC34 has only one COM port; therefore the controller
COM port should be set to zero (default). To set the
communication port for downloading programs to FEC from your
PC click on the Options tab and set the Controller COM Port to 0.
Click OK to finish controller settings.
I/O Configuration
The IPC is a modular system and there are numerous input and output
modules available. Therefore, it is necessary to indicate which I/O
module is used in the FEC controller. Double click the I/O
Configuration item in the Project Tree window to open the I/O
Configuration dialog box:
The standard IO module of the FEC is already entered and given the IO
address 0. If you want to change this address double click the entry
and modify. If you want to add other modules double click somewhere
inside the IO configuration and select the desired module.
1-4
1. Station Control Program
Communication
Configuration
To establish communication between the PC and the FC34 the COM
port for the PC that will be used for communications.
4. Click OK.
Allocation List
Allocation list is used to assign names to specific I/O items. For
example, if a push button is wired to I1.0, then the name “START” can
be assigned to this I/O item through the Allocation List. The
advantage is that during control program development these names
can directly be used to refer to specific I/O devices, making the
program very easy to read and maintain. Therefore, an allocation list
should be developed before control program development. To start
an allocation list:
1. Double click Allocation List item in the Project View window. This
will open the Allocation List window.
1-5
1. Station Control Program
1-6
1. Station Control Program
1-7
1. Station Control Program
Control Program
Development
Control program (or PLC program) can be developed using different
languages such as ladder programming or STL. In this chapter we will
use STL (Statement List).
MAIN
The main program is designed to do the following:
1. Initialize the station by resetting the CycleRun Flag to indicate
that the station is currently not running, by sending the swivel
arm to the next station and by turning the vacuum off.
2. Start the cycle and set CycleRun flag if the start button is
pressed. Continuously loop to monitor the front panel
buttons. If the stop button is pressed stop the cycle.
CYCLE
The cycle program is designed to do the following:
1. Set delay timer durations,
2. If the cycle is already not running and the magazine is not
empty then start the cycle,
3. Feed a part with the Ejector,
4. When the part is fully ejected, move the swivel arm to the
magazine position,
5. When the arm gets to the magazine position, turn the vacuum
on and wait for the vacuum to build up,
6. When sufficient vacuum is built up, retract the Ejector,
7. When the ejector is fully retracted, transfer the part to the next
station,
8. When the swivel arm gets to the next station, turn vacuum off
to release the part and pause for a short duration,
9. When the vacuum is lost go back to the beginning of the cycle.
10. End of cycle.
1-8
1. Station Control Program
ALLOCATION LIST
MAIN PROGRAM
STEP init
IF NOP
THEN RESET CycleRun 'Cycle running
1
SET Swi2Next 'Swivel to next
RESET Swi2Mag 'Swivel to mag.
SET VacOFF 'Vacuum OFF
STEP loop
IF START 'Start button
AND N MagEmpty 'Mag. Empty (NC)
AND N CycleRun 'Cycle running
THEN SET CycleProg 'Cycle program
SET CycleRun 'Cycle running
2
IF N STOP 'Stop button (NC)
THEN RESET CycleRun 'Cycle running
IF NOP
THEN JMP TO loop
1-9
1. Station Control Program
CYCLE PROGRAM
STEP init
IF NOP
THEN LOAD V100
1
TO T1Preset 'Timer 1 duration
LOAD V2
TO T2Preset 'Timer 2 duration
STEP start
IF N CycleRun 'Cycle running
2 OR MagEmpty 'Mag. Empty (NC)
THEN JMP TO end
OTHRW NOP
STEP ejector
3 IF NOP
THEN SET Eject 'Ejector cylinder
STEP
IF
4 EjectOUT 'Ejector extended
THEN RESET Swi2Next 'Swivel to next
SET Swi2Mag 'Swivel to mag.
STEP
IF
SwiAtMag 'Swivel at mag.
5 AND EjectOUT 'Ejector extended
THEN RESET VacOFF 'Vacuum OFF
SET VacON 'Vacuum ON
SET VacTimer1 'Delay timer 1
STEP
IF
6
VacSensor 'Vacuum Sensor ON
THEN RESET Eject 'Ejector cylinder
STEP
IF
7 EjectIN 'Eject retracted
THEN RESET Swi2Mag 'Swivel to mag.
SET Swi2Next 'Swivel to next.
STEP
IF
SwiAtNext 'Swivel at next
8
THEN RESET VacON 'Vacuum ON
SET VacOFF 'Vacuum OFF
SET VacTimer2 'Delay timer 2
STEP
IF
9 N VacSensor 'Vacuum Sensor ON
THEN RESET VacOFF 'Vacuum OFF
JMP TO start
STEP end
10 IF NOP
THEN RESET CycleRun 'Cycle running
1-10
1. Station Control Program
How to Create an
STL Program
This section describes how to create a new STL program using FST. It
is assumed that a project with correct settings has already been
created following the procedures described in this chapter.
2. Set Number to 0 and type Main Program for the Comment and
click OK. This will start a new program file and will also pop up an
STL shortcuts toolbar as shown below:
1-11
1. Station Control Program
To enter the first statement of the main program (given on page 1-10):
1. Click the STEP button of the STL Shortcuts toolbar and type init
and press Enter.
2. Click the IF and then the NOP buttons of the toolbar, press Enter.
3. Click the THEN button followed by the RESET button.
4. To enter an operand for the reset command click the Operand
button and choose CycleRun from the list. Press Enter.
Notice that you picked the operand from the Allocation list.
Therefore, it is quite important to make an Allocation list before
writing a control program. Otherwise, the symbolic operands will
not be available during program development. The program can
still be developed by entering names or direct I/O addresses but
the allocation list has to be edited parallel to the program
development.
5. Click SET, then Operand and choose Swi2Next from the list. Press
enter.
6. Click RESET, then Operand and choose Swi2Mag from the list
(this is necessary since the rotational cylinder at the swivel arm is
a double-acting one). Press Enter.
7. Click SET, then Operand and choose VacOFF from the list. Press
Enter.
8. Press Enter twice to advance the cursor down a couple of lines to
leave some space before you start entering the next statement.
You just finished entering the first statement of the main program.
Now enter the next statement to finish the main program.
When you are done with the main program, you need to start a new
file for the cycle program. Therefore, right-click on the Programs item
of the Project Tree and choose Insert program. Set the program
number to 1 and its name to Cycle. Enter all the control statements.
Finally, click on the Save All button on the main toolbar of FST (fourth
button from left).
1-12
1. Station Control Program
In this chapter serial port communication is assumed. Therefore, before downloading make
sure that the serial cable SM14 is connected from COM1 serial port of the PC to the COM port
of the FC34.
Downloading station
control program
1. To download the project either press F5 key or select Download
from the Online menu of FST.
2. If the project has never been downloaded or compiled before, the
following message will be displayed:
1-13
2. FC34 Command Interpreter (CI)
Chapter 2
FEC FC34 Command Interpreter (CI)
Summary
This chapter introduces the CI Command Interpreter. Specifically, it
demonstrates how to read and modify FC34 controller registers using
FST 4.0 software.
2. FC34 Command Interpreter (CI)
Table of Contents
Resources required
Software
• FST 4.0
Files
• DIST_STA project files
Hardware
• Personal computer
• MPS Distribution station with FC34 controller
• RS232 serial communications cable (SM14)
2. FC34 Command Interpreter (CI)
Communication between the CI and the terminal is done through the serial port. There are
two ways of communicating with the CI:
CI commands and
FC34 operands
A complete CI command consists of:
• A command,
• An operand and,
• A parameter value.
DT2
Where
D: Display command,
T: timer operand and,
2: parameter value (timer 2).
2-1
2. FC34 Command Interpreter (CI)
2-2
2. FC34 Command Interpreter (CI)
Using terminal
emulator of FST
Turn the distribution station power on and start FST by clicking on the
Windows START button and by navigating to the program from the
menus. If the default settings are used during installation of FST you
can start it by choosing:
Programs
Festo Software
FST 4
FST 4
1. If it is not already open, select Open from the File menu to open
the DIST_STA project.
2. Verify the serial communication settings by selecting Preferences
from the Extras menu. Make sure that the SM14 serial cable is
connected to the proper COM terminal of the PC.
3. Click the Online Terminal button on the toolbar or select Terminal
from the Online menu to start the terminal emulator. This will pop
up the following CI Terminal window:
DE0.0
2-3
2. FC34 Command Interpreter (CI)
The FC34 will respond with DE0.0=1 indicating that the input bit
zero is currently on.
2-4
2. FC34 Command Interpreter (CI)
DEW0=9 means: bits 0 and 3 of the 16 bit input word are ON.
DAW1=12 means: bits 2 and 3 of the 16 bit output word are ON.
2-5
2. FC34 Command Interpreter (CI)
If the value returned from the controller is 1 then that bit is ON. If it is
0 (zero) then that bit is OFF.
Modifying an entire
register
To modify an entire register (a word) you must use the “M” command
with a proper parameter value. For example, to move the swivel arm
of the distribution station from magazine to next station we can enter:
2-6
2. FC34 Command Interpreter (CI)
Modifying a single
bit of a register
To modify a single bit of a register (a word) you must use the “M”
command with a proper parameter value. For example, to feed a part
from the magazine (make sure that the swivel arm is not at magazine):
Online display of
FC34 registers
Another tool provided with the FST is the Online Display of all FC34
registers. This tool can be used along with the CI Terminal to view the
status of various controller registers and bits. Select Online Display
form the Online menu to display the following window:
2-7
3. Basics of Networking
Chapter 3
Basics of Networking
Summary
This chapter provides basic definitions of network terminology such
as IP address, TCP/IP, server, client, gateway, etc. In addition, it
introduces network topologies.
3. Basics of Networking
Table of Contents
IP addresses 3-5
IP address classes 3-5
Subnet masks 3-6
3. Basics of Networking
Resources required
Software
• None
Files
• None
Hardware
• None
3. Basics of Networking
Laptop
Computer Server
Ethernet
Printer
Mainframe
A network with different types of nodes.
Network
terminologies
Workstation: is a computer that is home to local applications such as
Microsoft Office and that can run network applications such as
software that accesses data on a mainframe computer.
3-1
3. Basics of Networking
3-2
3. Basics of Networking
1. Bus,
2. Ring, and
3. Star.
Bus topology
A bus topology network consists of running cable from one node to
the next.
Printer
Mainframe
Ring topology
A ring topology is a network in the shape of a ring or circle, with nodes
connected around the ring.
Mainframe
Laptop
Printer
Computer
Server
3-3
3. Basics of Networking
Star topology
In a star topology network the nodes are connected to a central hub,
resembling a star.
Computer
Laptop
Workstation
Hub
Printer
Computer
Server Computer
Server
Star network topology
Laptop
Workstation
Hub
Printer
Computer
Server Computer
Backbone
Laptop
Workstation
Hub
Printer
Computer
Server Computer
3-4
3. Basics of Networking
3.3. TCP/IP
TCP/IP (Transmission Control Protocol/Internet Protocol) is a packet transmission protocol
used around the world.
The TCP portion was originally developed to ensure reliable connections on government,
military and educational networks. It performs extensive error checking to ensure that data is
delivered successfully.
The IP portion provides network addressing to ensure that data packets quickly reach the
correct destination. It uses a dotted decimal notation system of addressing, which consists of
four numbers separated by a period, such as 141.134.77.15.
IP addresses
IP addresses are 32-bit binary numbers (zeros and ones) that contain
both a subnet address and a host address. For example, the following
is an IP address:
11000001000010100001111000000010
193.10.30.2
IP address classes
Each IP address consists of two fields:
Together the netid and the hostid provide each node of the network
with a unique IP address.
When the TCP/IP protocol was first developed, it was thought that
computer networks would fall into one of three categories called
Class A, Class B and Class C.
3-5
3. Basics of Networking
Class A addresses use only the first octet of the IP number to identify
a subnet (a group of networked devices). The remaining three octets
are used for node IDs. It was envisioned that a Class A network would
be made up of small number of clusters of subnets but with large
number of nodes in each subnet.
Class B addresses use the first two octets to identify a subnet. The
remaining two octets are used for node addresses.
Class C addresses use the first three octets to identify a network. The
remaining octet is used for node addresses.
Subnet masks
A subnet mask is a bit pattern that defines which portion of the IP
address represents a subnet address. For example, consider the
following class B IP address: 170.203.93.5. In binary form this is
equal to:
255.255.0.0
The network software combines the subnet mask with the IP address
to identify the subnet ID and the host ID for a network node. The
subnet masks make this operation easier and faster.
3-6
4. Remote Access to Distribution Station
Chapter 4
Remote Access to
Distribution Station
Summary
This chapter describes how to access the distribution station remotely
over the Internet. First, it explains how to modify a project to include
network drivers and a Web server. Then, it introduces fundamental
HTML tags necessary to implement a simple Web page. This is
followed by development of more advanced Web pages with
embedded CI commands to remotely monitor the Distribution Station.
4. Remote Access to Distribution Station
Table of Contents
Resources required
Software
• FST 4.0
• Notepad text editor
• Web browser (Internet Explorer or Netscape)
• Ping Windows utility program
Files
• DIST_STA project files
• Main1.htm Web page file
• Main2.htm Web page file
• Main3.htm Web page file
Hardware
• Personal computer
• MPS Distribution station with FC34 controller
• RS232 serial communications cable SM14
• Network and Ethernet cable
4. Remote Access to Distribution Station
Modifying a project
for remote access
In order to access the FC34 controller over a network and use it as a
Web server, we need to configure and download a TCP/IP and a Web
server driver as part of the project.
Also, when you configure network settings and drivers for the FC34 for
the first time, you need to use the RS232 serial communication to
download the settings and the drivers to the controller. After this, the
FC34 can be accessed over the network and therefore, the RS232
cable can be removed.
4-1
4. Remote Access to Distribution Station
4-2
4. Remote Access to Distribution Station
Downloading project
and drivers to FC34
At this point the TCP/IP and Web server drivers are configured and the
project is ready to be downloaded to the FC34. As mentioned before,
when downloading the network drivers to FC34 for the first time you
need to use RS232 serial communication with the FC34 to transfer the
network drivers to it. Once a project with the network drivers are
downloaded, the controller can be accessed over the network.
1. Save all files by clicking Save All button from the toolbar.
2. Verify that RS232 is the current communication mode by selecting
Preferences from the Extras menu and by choosing the
Communication port tab. Make sure that use RS232 is selected.
3. Press F5 key to start downloading the project. The FST will detect
the changes in the project and will prompt you to make the project
again. Click Yes to recompile the project. When the download is
completed the status window will look similar to the following:
4-3
4. Remote Access to Distribution Station
Communicating with
the controller over
the network
Once the network drivers are downloaded to the FC34 using the
RS232 serial port, the controller will be ready for network
communications.
The ping command sends test packets to the controller and tries to
receive them back from the controller. If the controller network
settings are correct you should get a reply back from the controller
such as:
4-4
4. Remote Access to Distribution Station
Communicating with the controller over the network using the FST
If the above test was successful, then the controller is ready for
network communications.
1. Select Preferences from the Extras menu of the FST and click on
the Communication Port tab.
2. Enter the Controller IP Address (such as 199.237.83.68 in this
example) and select use TCP/IP:
3. If you check Save in Project option, all settings will be saved into
this project. Otherwise, they become settings for the FST in
general. Check the Save in Project option and click OK.
Now you are ready to communicate with the controller over the
network and therefore can remove the RS232 cable.
4-5
4. Remote Access to Distribution Station
HTML tags
HTML is a markup language where tags are inserted into regular text
to enhance the document in some way such as changing fonts, font
colors, or adding hyperlinks to other Web pages. The tags are not
visible to the viewer of the page. They tell the browser how to render
the page as it loads it from a Web server. The tags can be considered
as commands to the Web browser. They are enclosed in angle
brackets. For example:
uses the tag <B> to make the text “Festo FC34” boldface. Notice that
most tags must be used in pairs. The <B> in the above example tells
the browser where to start using boldface as it renders the page. The
</B> tells the browser where to stop using boldface.
4-6
4. Remote Access to Distribution Station
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
</HEAD>
<BODY>
Festo FC34 Controller
</BODY>
</HTML>
<HTML>
<HEAD><TITLE>Festo FC34 Controller Web Page</TITLE></HEAD>
<BODY>Festo FC34 Controller</BODY></HTML>
Creating an HTML
document
HTML documents can be created using:
• An HTML editor or,
• A simple text editor.
In this chapter we will use a simple text editor, namely, Notepad. This
editor comes with the Windows operating system.
4-7
4. Remote Access to Distribution Station
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
</HEAD>
<BODY>
Festo FC34 Controller
</BODY>
</HTML>
3. Save the file as an HTML file. This requires using “htm” or “html”
as an extension after the filename. Notepad will automatically
add a “txt” extension to any filename used. To avoid this, enclose
the filename and the extension in double quotes.
To save the file click File and select Save As. Navigate to a
directory where you want to save the file (remember this directory
for later exercises).
Viewing an HTML
document
You can view an HTML document using a browser such as Microsoft
Internet Explorer or Netscape Navigator. Throughout this chapter
Internet Explorer is used as the browser for viewing Web pages.
4-8
4. Remote Access to Distribution Station
Currently, the Web page you just created is located on the hard drive
of the PC (local copy). Therefore, we will first view it from the hard
drive. Later, we will send the page to the FC34 Web server and view it
from there.
This page is not very interesting but it shows the basic concepts of
creating and viewing an HTML page.
4-9
4. Remote Access to Distribution Station
4-10
4. Remote Access to Distribution Station
The page will be delivered to your browser over the network by the
FC34 Web server.
Please note:
The Explorer has to be configured in a way that it allows to search for
WEB pages within the network not necessarily via a modem or similar.
4-11
4. Remote Access to Distribution Station
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
</HEAD>
<BODY>
Festo FC34 Festo Controller
<BR><BR>
</BODY>
</HTML>
The <BR><BR> tags insert two blank lines in the page after the
“Festo FC34 Controller” text.
4-12
4. Remote Access to Distribution Station
Repeated inquiries
to the FC34 Web
server
A Web server delivers a Web page to the requesting browser and the
browser renders the page formatting it with the embedded tags. This
is a static mechanism of content delivery.
After the page is delivered to the browser, if the state of the station
changes the change will not be reflected in the Web page currently
being viewed unless the user hits the refresh button of the browser.
Even then, it is not guaranteed that the content will be updated
because, by default, the browser will make a copy of the Web page
(cache the page) on the local hard drive when it is first delivered.
Later, if the refresh button is pressed, it will get the cached copy and
display it instead of requesting the Web server to deliver the
document over the network again. This mechanism was developed to
help reduce network traffic.
Remember that the FC34 Web server goes through the requested Web
page and replaces the embedded CI commands with the current
values of registers. Therefore, unless we force the browser to request
a copy of the same page from the Web server again, we will not get an
updated page reflecting the current state of the register.
This tag tells the browser to request the current file from the Web
server every 3 seconds.
1. Open the “main2.htm” file and place the above meta tag into the
head section of the HTML document:
4-13
4. Remote Access to Distribution Station
<HTML>
<HEAD>
<TITLE>
Festo FC34 Controller Web Page
</TITLE>
<META http-equiv=”refresh” content=”3”>
</HEAD>
<BODY>
Festo FC34 Festo Controller
<BR><BR>
</BODY>
</HTML>
2. Save the file and download it to the FC34 using the File Transfer
utility of FST.
3. Run the Internet Explorer and enter your FC34 IP number followed
by the main2.htm filename as the URL:
You should see the Web page being refreshed every 3 seconds
and therefore, the input word being updated. However,
sometimes it is hard to correlate the input word to the current
state of the station since the station may change its state faster
than the Web page can be updated.
4-14
4. Remote Access to Distribution Station
In this section you will learn how to design an advanced Web page with embedded graphics.
The page will display the status of all FC34 input and output registers.
Design of an
advanced Web page
The advanced Web page you will design in this section will have the
following layout:
The page starts with a Festo logo image that is also an active link to
the Festo-usa.com Web site. This is followed by a title and a table that
displays all input and output registers of the Distribution station.
Using such a page it is possible to monitor the station remotely over a
network such as the Internet.
<HTML>
<HEAD>
<TITLE> MPS Distribution Station Remote Monitor </TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="refresh" content="3"> 1
</HEAD>
4-15
4. Remote Access to Distribution Station
<BODY bgcolor="#CCCCCC">
<DIV align="center">
<A href="http://www.festo-usa.com"><IMG src="FestoLog.gif" width="113" height="20" border="0"></A>
<H2><FONT color="#0000CC">MPS Distribution Station Remote Monitor</FONT></H2>
<HR width="62%" align="center"> 2
<BR>
4-16
4. Remote Access to Distribution Station
Section 1:
This is the HEAD section of the HTML document where the title for the
page, as well as the content-type is declared. In addition, to load the
page from the FC34 server every 3 seconds we have the “refresh”
META tag as explained before. The title of the document is displayed
in the title-bar (top blue stripe) of the browser window when the page
is displayed by the browser.
Section 2:
This section of the code creates the following part of the page:
In this section we start defining the BODY of the page. Most of the
HTML tags have parameters associated with them. In this section we
are using the background color parameter of the BODY tag to set the
background of the page to a tone of gray color (given by the
“#CCCCCC” hexadecimal code). The BODY tag without any
parameters is used as follows:
<BODY>
<BODY bgcolor=”#CCCCCC”>
Notice that the tag and its parameter are enclosed in the angle
brackets.
To embed the FESTO logo image (graphics file) in the page we are
using the <IMG> tag. This tag requires a source file for the graphics
file to be displayed as the image. Therefore, the source parameter of
the <IMG> tag is set to “FestoLog.gif.” This is a GIF-type image file
that contains the blue FESTO logo displayed at the top of the page. In
addition to the source parameter the image width and height
4-17
4. Remote Access to Distribution Station
parameters are also set. Finally, the border parameter is set to zero
indicating no borders around the image.
The <A> is the anchor tag. This tag is used to create hyperlinks in the
page. To make the FESTO logo image a hyperlink to the www.festo-
usa.com Web site we place the <A> tag in front of the <IMG> tag and
set its “href” parameter to the URL of the linked Web site.
To draw the horizontal line below the text, we use the <HR> tag. The
<HR> (horizontal rule) tag is used with its width set to 62% of the
browser window width and is aligned to be at the center of the page.
Finally, the <BR> tag is used to provide one line of spacing after the
horizontal rule.
Section 3:
The <TABLE> tag in this section defines a table whose width is set to
62% of the width of the browser window. In addition, the table border
width is set to 1 unit.
Section 4:
This section of the code creates the following part of the page:
The first row of the table contains two cells (columns). Each cell
content is enclosed in a <TD> … </TD> pair of tags. Therefore, the
first <TD> … </TD> tag pair defines the cell with the word “Inputs”
and the second pair of tags defines the cell with the word “output” in
it.
The width of each cell is set to 50% of the table width, along with the
cell background color setting and the vertical alignment of the text
setting.
4-18
4. Remote Access to Distribution Station
Section 5:
This section of the code creates the following part of the page:
Similar to the Section 4 above, this section of the code defines the
second row of the table. Once again, this row also contains two
columns each of which is defined by a <TD> … </TD> tag pair.
To format the list of FC34 inputs and outputs as seen in the page, we
use a <PRE> (“Preformatted”) tag. Any text enclosed in a pair of
<PRE> … </PRE> tags is displayed exactly it is typed in the HTML
code.
When the browser requests the page from the FC34 Web server, the
server first examines the page looking for the special <FSTCI> tags. It
then replaces these tags with the corresponding current register
values and sends the page to the browser. As a result, when the
browser receives the page all <FSTCI> special tags are replaced by
simple “0” or “1” register values.
Section 6:
This section simply finishes the document by closing the pending
<TABLE>, <DIV> and <BODY> tags.
Creating,
downloading and
viewing the page
To create this page:
4-19
4. Remote Access to Distribution Station
1. Start the FST software and select File Transfer from the Online
menu. This will start the file transfer utility to send the files to the
FC34.
2. Make sure that the virtual drive B is selected. This is where the
Web server looks for files.
3. Click on the download button (with the downward blue arrow) and
navigate to the “main3.htm” file on your hard drive.
4. Click OK to download to the FC34.
5. Repeat steps 3 and 4 but this time to download the FestoLog.gif
image file.
4-20
5. Advanced HMI Development
Chapter 5
Advanced HMI
Development
Summary
This chapter describes design of advanced Human Machine Interfaces
(HMI) for remote operation and configuration of the Distribution
station. First, it introduces HTML forms and event handling with
JavaScript. Then, it explains how to design and implement a Web
page to remotely operate the station over the Internet. Finally, it
describes how to modify the PLC program and the HMI to remotely
configure the station.
5. Advanced HMI Development
Table of Contents
JavaScript 5-5
Event handlers with JavaScript 5-5
Resources required
Software
• FST 4.0
• Notepad text editor
• Web browser (Internet Explorer or Netscape)
Files
• DIST_REM project files
• DIST_CFG project files
• hmi1.htm Web page file
• hmi2.htm Web page file
• hmi3.htm Web page file
• hmi4.htm Web page file
• CISend.js file
Hardware
• Personal computer
• MPS Distribution station with FC34 controller
• Network and Ethernet cable
5. Advanced HMI Development
One design element used in making a Web page dynamic is a FORM. Forms allow users to
enter information into a Web page. Forms can contain various other types of elements such
as buttons, drop-down lists, areas to enter text, etc. that are all associated with receiving
information from the user.
Design of a Web page with a functioning form requires two components to work together: (1)
A Web page with a form and associated elements to collect input data from the user; and (2)
A program that can receive the collected data and process it.
A typical Web page with a form can process the user input data by either sending it to a
program running on a server (typically called a CGI program) or can process the data on the
client machine that the user is using with the help of a scripting language such as JavaScript
or VBScript.
In this chapter, we will use client-side processing with JavaScript. Specifically, we will explore
the relationship between HTML forms and JavaScript to implement dynamic Web pages.
Using this technology, we will implement human-machine interfaces (HMI) for the distribution
station.
Some form elements have a set of “events” that they can generate.
For example, the button element has an “onClick” event that it
5-1
5. Advanced HMI Development
generates when the user clicks on it. The Web page can react to the
user clicking the button through a so called “event handler.” An event
handler is a script (program) that is run when the button is clicked.
Button element
The following code segment creates a Web page with a form that
contains a button. When the button is clicked, an event handler,
called “Move()” is run to move the arm to magazine position (details
of the event handler are not shown).
<HTML>
<HEAD>
<TITLE>Button Example</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY bgcolor="#FFFFFF">
<H2>Distribution station</H2>
<FORM>
Swivel to Magazine:
<INPUT type="button" name="MoveArm" value="Move" onClick="Move()">
</FORM>
</BODY>
</HTML>
The <FORM> and </FORM> tags enclose the form within the Web
page where the user input will be received through the button
element. In the form we simply display a message on the page
(Swivel to Magazine:) and place a button next to it using the following
tag:
5-2
5. Advanced HMI Development
The <INPUT> tag specifies that this is an input field. This tag has
various attributes:
Attribute Definition
type specifies that this will be a button.
name assigns a name to the button object. Later this name can be used in a
script (program) to refer to the button object.
value Label displayed on the button.
onClick Click event generated by the button to call the “Move()” event handler
when the user clicks the button.
Check box
The following code segment creates a Web page with a form that
contains a checkbox. When the checkbox is checked its value is set to
1. This value can later be examined by a script to determine whether
the checkbox was checked or not.
<HTML>
<HEAD>
<TITLE>Checkbox Example</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY bgcolor="#FFFFFF">
<H2>Distribution station</H2>
<FORM>
Vacuum ON
<INPUT type="checkbox" name="VacuumON" value="1">
</FORM>
</BODY>
</HTML>
The check box element on the form is created using the following tag:
5-3
5. Advanced HMI Development
Attribute Definition
type specifies that this will be a checkbox.
name assigns a name to the checkbox object. Later this name can be used in a
script (program) to refer to the checkbox object.
value is the value that will be sent to the processing program when the
checkbox is checked.
Text box
The following code segment creates a Web page with a form that
contains a text box. The text, entered by the user, can later be
examined by a script.
<HTML>
<HEAD>
<TITLE>Text box Example</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY bgcolor="#FFFFFF">
<H2>Distribution station</H2>
<FORM>
Flag register value:
<INPUT type="text" name="FlagRegisterValue" maxlength="10">
</FORM>
</BODY>
</HTML>
Attribute Definition
type specifies that this will be a text box.
name assigns a name to the text box object. Later this name can be used in a
script (program) to refer to the text box object.
maxlength Determines the width of the text box. It also limits the maximum
number of characters that can be typed into the text box by the user.
5-4
5. Advanced HMI Development
In this chapter we will use JavaScript for processing the user input.
JavaScript
JavaScript is a scripting (programming) language developed by
Netscape in collaboration with Sun Microsystems.
<SCRIPT LANGAGE=”javascript”>
</SCRIPT>
The following Web page displays a message box when the user clicks
the MOVE button:
5-5
5. Advanced HMI Development
<HTML>
<HEAD>
<TITLE>Button Example</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="javascript">
function Move()
{
alert("You clicked the button");
}
</SCRIPT>
</HEAD>
<BODY bgcolor="#FFFFFF">
<H2>Distribution station</H2>
<FORM>
Swivel to Magazine:
<INPUT type="button" name="MoveArm" value="Move" onClick="Move()">
</FORM>
</BODY>
</HTML>
5-6
5. Advanced HMI Development
5-7
5. Advanced HMI Development
CISend JavaScript
function
Remote control of the station can be accomplished by sending
appropriate CI commands to the station as a result of user
interactions with a Web page.
function CISend(Operand,Value) {
var found;
var href;
if ( Value == "NaN" ) {
alert("Value is not a number");
return;
}
CISend(‘AW0’, ‘0’)
5-8
5. Advanced HMI Development
The function then takes these arguments and first checks the “value”
that was passed to it to make sure that it is acceptable. Then, it forms
a query string to the FC34 Web server to deliver the CI command to
the station.
CISend2 JavaScript
function
In many situations it is necessary or suitable to send more than just
one CI command. The following example combines two CI commands
into one function call so that we have 4 arguments: 2 operands and 2
parameters. To use this function it is very simple to modify the 2 coils
of a valve in one call.
//Check value 1
if ( Value1 == "NaN" ) {
alert("Value1 is not a number");
return;
}
// Verify variable value1
if ( (Value1 < -65535) || (Value1 > 65535) ) {
alert("Allowed range for value1 is -65535 to 65535");
return;
}
//Check value 2
if ( Value2 == "NaN" ) {
alert("Value2 is not a number");
return;
}
// Verify variable value2
if ( (Value2 < -65535) || (Value2 > 65535) ) {
alert("Allowed range for value2 is -65535 to 65535");
return;
}
// Strip previous modify command from URL
href = this.location.href;
found = href.indexOf("?");
if ( found > 0 ) {
href = href.substring(0, found);
}
5-9
5. Advanced HMI Development
Both functions are saved in a single file so that each function can be
added to any HTML document by simply referring to this file from the
HTML document (as shown in the next section). The functions are
saved into “CISend.js” file. Note that this file must be in the same
directory as the Web page that is referring to it.
Remote operation of
the Swivel arm
Let’s develop a Web page that can be used to move the swivel arm of
the distribution station remotely. Please note that the swivel arm in
our station is controlled by a pneumatic valve with two coils. To
control the arm it is necessary to modify both coils. Therefore we use
the function CISend2( ). The following is the HTML code (hmi1.htm
file) for the Web page:
<HTML>
<HEAD>
<TITLE>Remote control of swivel arm</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="javascript" src="CISend.js">
</SCRIPT>
<SCRIPT LANGUAGE=”javascript”>
function SwivelToMag()
{
//Turn bit 1 ON, Bit 2 OFF
CISend2(‘A0.2’,’0’, 'A0.1', '1');
return;
}
function SwivelToNext()
{
//Turn bit 2 ON, Bit 1 OFF.
CISend2(‘A0.1’,’0’, 'A0.2', '1');
return;
} 1
</SCRIPT>
</HEAD>
<BODY bgcolor="#FFFFFF">
<H2>Remote Control of Swivel Arm</H2>
<FORM>
<INPUT type="button" name="ArmToMag" value="To Magazine"
onClick="SwivelToMag()">
<br>
<INPUT type="button" name="ArmToNext" value="To Next "
onClick="SwivelToNext()">
2
</FORM>
</BODY>
</HTML>
5-10
5. Advanced HMI Development
The code in the previous page is broken into two sections. The
following paragraphs explain each section. We’ll start with the second
section.
Section 2:
This section is an HTML form with two buttons. Each button has an
event handler that is called if the user clicks it. For example, the “To
Magazine” button calls “SwivelToMag()” event handler when it is
clicked.
Section 1:
In this section of the code we have the definition of JavaScript
functions SwivelToMag() and SwivelToNext() that are used as event
handlers for the two buttons on the Web page.
The section starts with the <SCRIPT> tag to indicate to the browser
that the following content is to be interpreted as JavaScript code.
Note that both of these event handlers use the CISend2() function.
However, the function is not defined in the HTML code of this Web
page. Instead, the file that contains the CISend2() function is
referenced to include it in the page. The reference is in the source
attribute of the <SCRIPT> tag as follows:
function SwivelToMag()
{
//Turn bit 1 ON, Bit 2 OFF
CISend2(‘A0.2’,’0’, 'A0.1', '1');
return;
}
5-11
5. Advanced HMI Development
Similarly, the event handler for the “To Next” button is the
“SwivelToNext()” function. This function simply sends the two CI
commands to modify the outputs.
function SwivelToNext()
{
//Turn bit 2 ON, Bit 1 OFF.
CISend2(‘A0.1’,’0’, 'A0.2', '1');
return;
}
To try this:
This Web page was saved as “hmi1.htm.” If it is already on the “B”
virtual drive of FC34 controller then point your browser to the
controller network address followed by the “hmi1.htm” file name to
run the page. For example:
If the page (and/or the CISend.js Java file) is not on the FC34 already,
you need to first download it to the controller using the FST software
(Chapter 4). Then, you can run it using the proper URL as explained
above.
5-12
5. Advanced HMI Development
Remote operation of
the distribution
station
In this section we will expand the Web page that was designed to
control the swivel arm (hmi1.htm). The new Web page will enable
control of each actuator in the station as well as remote starting and
stopping of the station.
Before you can test these HMIs you must download DIST_REM
project to the FC34. This project contains two flags that are used in
parallel to the actual START and STOP buttons on the station. This
way the station can receive START or STOP commands either from the
console buttons or from an HMI. The modified statements of the main
project program are shown below:
STEP loop
IF ( START 'Start button
OR RemSTART ) 'Remote Start
AND N MagEmpty 'Magazine Empty (NC)
AND N CycleRun 'Cycle running
THEN SET CycleProg 'Cycle program
SET CycleRun 'Cycle running
IF NOP
THEN JMP TO loop
MAIN Program on FC34 controller
Where RemSTART (flag F1.0) and RemSTOP (flag F1.1) were added in
parallel to the console buttons START and STOP. Also, whenever
either one of the STOP buttons is pressed, the RemSTART and
RemSTOP flags are cleared.
As we have done before in the design of the previos HMI, we will use
the “CISend()” function and push buttons with JavaScript event
handlers to build the page. The final HMI (hmi2.htm file) will look like
the following:
5-13
5. Advanced HMI Development
In this design we will use an HTML table with two rows and four
columns. The first row will have the “Swivel arm”, “Feeder”,
“Vacuum” and “Station” titles for each column. The second row
contains two buttons in each column. Stacking buttons as seen in this
interface is not possible unless they are embedded in a table.
The following pages contain complete listing of the new HMI. The file
is called hmi2.htm. To try it, type the IP address of your FEC34
followed by hmi2.htm file name as the URL to open. If the hmi2.htm
and the CISend.js files are not already on the FEC34, you will have to
first download them (refer to Chapter 4).
5-14
5. Advanced HMI Development
<HTML>
<HEAD>
<TITLE>Remote control of MPS Distribution Station</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="javascript" src="CISend.js">
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function SwivelToMagazine(){
//This function moves the swivel arm to magazine
function SwivelToNext(){
//This function moves the swivel arm to next station
function FeedPart(){
//This function feeds a part
CISend('A0.0', ‘1’);
return true;
}
1
hmi2.htm file listing (continued on next two pages)
5-15
5. Advanced HMI Development
function FeederRetract(){
//This function retracts the feeder
CISend('A0.0', ‘0’);
return true;
}
function VacuumON(){
//This function turns vacuum ON
function VacuumOFF(){
//This function turns vacuum OFF
function RemSTART(){
//This function starts the station cycle
//Send to MPS
CISend('MW1', '1');
return true;
}
function RemSTOP(){
//This function stops the station cycle
//Send to MPS
CISend('MW1', '2');
return true;
}
//-->
</SCRIPT> 1
</HEAD>
hmi2.htm file listing (continued on next page)
5-16
5. Advanced HMI Development
<BODY bgcolor="#CCCC99">
<H2 align="center"><IMG src="FestoLog.gif" width="110" height="19"></H2>
<H2 align="center"><FONT color="#0000FF" face="Verdana, Arial, Helvetica, sans-serif" size="3">MPS
Distribution Station</FONT></H2>
<H2 align="center"><FONT color="#0000FF" face="Verdana, Arial, Helvetica, sans-serif" size="3">Remote
Control</FONT></H2>
2
<TR>
<TD width="21%" bgcolor="#9999FF">
<INPUT type="button" name="btnMagazine" value=" Magazine " , onClick="SwivelToMagazine()">
<INPUT type="button" name="btnNextStation" value="Next Station" , onClick="SwivelToNext()">
</TD>
<TD width="17%" bgcolor="#FF0000">
<INPUT type="button" name="btnFeed" value=" Feed ", onClick="FeedPart()">
<INPUT type="button" name="btnRetract" value=" Retract ", onClick="FeederRetract()">
</TD>
<TD width="17%" bgcolor="#00CC00">
<INPUT type="button" name="btnVacuumON" value=" ON ", onClick="VacuumON()">
<INPUT type="submit" name="btnVacuumOFF" value=" OFF ", onClick="VacuumOFF()">
</TD>
<TD width="17%" bgcolor="#000000">
<INPUT type="button" name="RemSTART" value=" START ", onClick="RemSTART()">
<INPUT type="submit" name="RemSTOP" value=" STOP ", onClick="RemSTOP()"> 4
</TD> </TR>
</TABLE>
</BODY>
</HTML>
5-17
5. Advanced HMI Development
We will look at the details of this HTML document starting from the
BODY section of the document first.
Section 2:
In this section we are using the <H2> heading style tag along with
the <FONT> tag to define font style, size and color for the titles that
appear at the top of the page. In addition, the <IMG> tag is used to
display the Festo logo image file.
Section 3:
This section defines the first row of the table. This row contains four
columns (cells) which are defined by the <TD> … </TD> tag
pairs. They display titles for each column of the table.
Section 4:
This section defines the second row of the table. This row contains
four columns (cells) which are defined by the <TD> …</TD> tag
pairs. Each cell contains two buttons defined by the <INPUT> tag
with its “type” attribute set to “button.” Each button has an onClick
event handler which are implemented as JavaScript functions in the
HEAD section of the document.
Section 1:
This section contains the JavaScript implementation of all event
handlers for the buttons on the page. When a button is clicked by the
user, its event handler function is executed.
The section starts with a call to the “CISend.js” file that contains the
definition of the “CISend()” and the “CISend2()” functions we use to
send commands to the FC34 over the network.
5-18
5. Advanced HMI Development
Now, we will put these two Web pages together to finalize the design
of an advanced HMI that can be used to remotely operate and monitor
the distribution station. This HMI was saved as hmi3.htm. Since it
was designed simply by putting two previously designed Web pages
together, detailed explanation of the HTML document will not be
provided.
To try this HMI please enter the IP address of your FC34 followed by
“hmi3.htm” file name as the URL in your browser (assuming the
hmi3.htm file is already on the FC34).
5-19
5. Advanced HMI Development
<HEAD>
<SCRIPT LANGUAGE="javascript" src="CISend.js">
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function SwivelToMagazine(){
//This function moves the swivel arm to magazine
CISend2('A0.2','0', 'A0.1', '1');
return true;
}
function SwivelToNext(){
//This function moves the swivel arm to next station
CISend2('A0.1', '0', 'A0.2', '1');
return true;
}
function FeedPart(){
//This function feeds a part
CISend('A0.0', '1');
return true;
}
function FeederRetract(){
//This function retracts the feeder
CISend('A0.0', '0');
return true;
}
function VacuumON(){
//This function turns vacuum ON
CISend2('A0.3', '0', 'A0.4', '1');
return true;
}
function VacuumOFF(){
//This function turns vacuum OFF
CISend('A0.4', '0', 'A0.3', '1');
return true;
}
function RemSTART(){
//This function starts the station cycle
CISend('MW1', '1');
return true;
}
function RemSTOP(){
//This function stops the station cycle
CISend('MW1', '2');
return true;
}
//-->
</SCRIPT>
</HEAD>
hmi3.htm file listing (continued on next two pages)
5-20
5. Advanced HMI Development
<BODY bgcolor="#CCCC99">
<H2 align="center"><IMG src="FestoLog.gif" width="110" height="19"></H2>
<H2 align="center"><FONT color="#0000FF" face="Verdana, Arial, Helvetica, sans-serif" size="3">MPS
Distribution Station</FONT></H2>
<H2 align="center"><FONT color="#0000FF" face="Verdana, Arial, Helvetica, sans-serif" size="3">Remote
Control</FONT></H2>
<TR>
<TD width="21%" bgcolor="#9999FF">
<FORM>
<INPUT type="button" value=" Magazine " onClick="SwivelToMagazine()">
<INPUT type="button" value="Next Station" onClick="SwivelToNext()">
</FORM>
</TD>
5-21
5. Advanced HMI Development
<TR>
</TR>
</TABLE>
</DIV>
</BODY>
</HTML>
5-22
5. Advanced HMI Development
Now, we will look at how the station can be remotely configured to process a desired number
of pucks.
5-23
5. Advanced HMI Development
The new HMI was created by modifying the previous one (hmi3.htm).
Therefore, only the modification, namely, text input field and the
associated event handler will be described in detail. The following
code segment is used to put the text input field and the SET button
on the page:
The first <INPUT> tag is used to create the text input field by setting
the “type” attribute of the tag to “text.” Also, the text input object is
named “NumOfPucks.” This is like a variable name used to refer to
the text field object. The “size” attribute determines the width of the
text input object. The “maxlength” attribute is the maximum allowed
number of characters that can be typed into the text input object by
the user.
The second <INPUT> tag is used to create the SET button object by
setting the “type” attribute of the tag to “button.”
The user of the Web page will first click on the text input field and type
the desired number of pucks to be processed by the station. Then,
the SET button will be clicked. When the button detects the mouse
click, it will call the onClick event handler called “SetNumOfPucks.”
This is implemented in the <HEAD> section of the page as a JavaScript
function as follows:
function SetNumOfPucks(){
//This function puts the number of pucks to be processed
//in flagword 2 of FC34
//Send to MPS
CISend('MW2',NumOfPucks.value);
return true;
}
5-24
5. Advanced HMI Development
<SCRIPT LANGUAGE="JavaScript">
<!--
function RemSTART(){
//This function starts the station cycle
//Send to MPS
CISend('MW1', '1');
return true;
}
function SetNumOfPucks(){
//This function puts the number of pucks to be processed
//in flagword 2 of FC34
//Send to MPS
CISend('MW2',NumOfPucks.value);
return true;
}
function RemSTOP(){
//This function stops the station cycle
//Send to MPS
CISend('MW1', '2');
return true;
}
//-->
</SCRIPT>
</HEAD>
<BODY bgcolor="#CCCC99">
<H2 align="center"><IMG src="FestoLog.gif" width="110" height="19"></H2>
<H2 align="center"><FONT color="#0000FF" face="Verdana, Arial, Helvetica, sans-serif" size="3">MPS
Distribution Station</FONT></H2>
<H2 align="center"><FONT color="#0000FF" face="Verdana, Arial, Helvetica, sans-serif" size="3">Remote
Control</FONT></H2>
5-25
5. Advanced HMI Development
<TR>
</TR>
</TABLE>
</DIV>
</BODY>
</HTML>
hmi4.htm file listing (continued from previous page)
5-26
5. Advanced HMI Development
PLC program
modifications for
remote station
configuration
The next step in remote configuration of the station involves slight
modifications in the PLC program of the station.
Using the new HMI we are able to remotely put the desired number of
pucks to be processed into Flagword 2 of FC34. Therefore, if we
modify the PLC program by:
5-27
5. Advanced HMI Development
5-28
5. Advanced HMI Development
IF NOP
THEN JMP TO loop
The main program starts when either the console START button is
pressed or the START button on the HMI is pressed. Note that in step
2 the RemSTART bit is reset as soon as the program starts. This
allows the HMI start button to act like a momentary push button. If
this statement is omitted, the RemSTART bit remains ON (like a
latched physical START button) and keeps the station running
continuously.
The station goes through its processing cycle up to step 8. In this step
a puck is delivered to the next station and the counter is incremented.
To try this HMI and the PLC program first make sure that DIST_CFG
project and the hmi4.htm files are downloaded to the FC34 (if not,
refer to Chapter 4 for details on downloading to FC34). Then type the
IP address of your FC34 followed by hmi4.htm file name as the URL to
open in your Web browser.
5-29
6. Remote Monitoring with Excel
Chapter 6
Remote Monitoring
With Excel
Summary
This chapter describes design of an Excel spread sheet for remote
process monitoring of the Distribution station using Dynamic Data
Exchange (DDE). First, it introduces the IPC Data Server and its
configuration. This is followed by explanations of how the station
control program should be modified. Finally, it describes how to
design an Excel sheet and link it to the station through the DDE
mechanism to remotely monitor the process.
6. Remote Monitoring with Excel
Table of Contents
6.1 Dynamic Data Exchange (DDE) with IPC Data Server…..…………. 6-1
Installation 6-2
IPS Data Server configuration 6-2
Controller operands available through the IPC Data Server 6-4
6.3 Microsoft Excel spread sheet for remote process monitoring..…. 6-6
Resources required
Software
• FST 4.0
• Web browser (Internet Explorer or Netscape)
Files
• DIST_CFG project files
• DIST_DDE project files
• hmi4.htm Web page file
• CISend.js file
• ExcelRemoteMonitor.xls
• FestoLog.gif
Hardware
• Personal computer
• MPS Distribution station with FEC FC34 controller
• Network and Ethernet cable
6. Remote Monitoring with Excel
Two applications, called DDE Client and DDE Server, exchange information by engaging in a
DDE conversation. The client application requests information from the server and sends
information and commands to it. The server application serves the needs of the client
application by returning information, accepting information, and carrying out commands.
The FST Software CD-ROM contains a DDE Server application called IPC Data Server. This
program can send and receive data from up to 48 IPC controllers (such as FEC FC34) over the
network. In addition, being a DDE Server, it can have a DDE conversation with Windows
applications such as Excel. Note that not all Windows applications are DDE enabled.
IPC 1
(FEC34)
DDE Client
(Excel)
IPC Data
Server
IPC 2
TCP/IP network
IPC 3
Personal computer
Using the IPC Data Server with a DDE Client application such as Excel enables us to bring live
data from the FEC FC34 into the DDE Client. In this chapter, we will see how Microsoft Excel
can be used for remote process monitoring of the MPS Distribution Station. We will be able
to create an Excel chart that automatically updates based on live data coming from the
station over the network.
6-1
6. Remote Monitoring with Excel
E:\TOOLS\IpcDataServer\SETUP.EXE
2. Click Config menu and select IPCs (TCP/IP) item (the first one).
This will open the following configuration window:
6-2
6. Remote Monitoring with Excel
3. Click the Config button next to IPC 1. This will open the following
window:
6-3
6. Remote Monitoring with Excel
Controller operands
available through
the IPC Data Server
Once the IPC Data Server is configured and started, most of the FEC
FC34 controller operands can be accessed. The DDE conversation
protocol requires the following format:
ApplicatioName|TopicName!Operand
The application name and the topic name keywords are separated by
a vertical line character that is found in most keyboards on the same
key as the backward slash character. The topic name and the operand
are separated by an exclamation mark.
6-4
6. Remote Monitoring with Excel
application name and IPC_1 (or the correct number for the configured
controller in place of “1”) as the topic. For example, if you are
configuring an Excel spread sheet where a cell is to display input bit 2,
you need to enter the following formula for that cell:
= IPC_DATA|IPC_1!E0.2
The following table lists all FEC FC34 controller operands available
through the IPC Data Server.
6-5
6. Remote Monitoring with Excel
PLC program
modifications
To use Excel along with the IPC Data Server for remote process
monitoring we have to make slight changes in the DIST_CFG PLC
program that was used in Chapter 5.
The next modification is the addition of Flag word 3 (FW3) which will
hold the current puck count of Counter 1. Note that there is no
possibility to directly access CW1 from the IPC Data Server. Therefore,
it is necessary to transfer the puck count from CW1 into FW3 which
can be accessed from the IPC Data Server. The new allocation list is
as follows:
6-6
6. Remote Monitoring with Excel
There are two changes made in the Cycle program Statement list. The
first change is in step 1 where the last line initializes the current count
for DDE to zero when the cycle is first started.
STEP init
IF NOP
THEN LOAD V100
TO T1Preset 'Timer 1 duration
LOAD V2
TO T2Preset 'Timer 2 duration
1 LOAD FW2 'No. of pucks
TO C1Presel 'C1 preselect
SET Counter 'Puck counter
LOAD V0
TO DDECount 'Cur. count DDE
STEP
IF
SwiAtNext 'Swivel at next
THEN RESET VacON 'Vacuum ON
SET VacOFF 'Vacuum OFF
8 SET VacTimer2 'Delay timer 2
INC Counter 'Puck counter
LOAD CurCount 'Cur. puck count
TO DDECount 'Cur. count DDE
The PLC program uses Flag word 2 to store the desired number of
pucks to be processed. Flag word 3 stores the number of pucks
processed by the station so far. Now let’s see how the DDE link is
established:
1. Make sure that the IPC Data Server is running and configured as
explained in the previous section.
6-7
6. Remote Monitoring with Excel
5. Select cell B10 and type the following formula (as it appears
below):
=IPC_DATA|IPC_1!mw2
where
Note that the IPC_DATA keyword and the IPC_1 keyword are
separated by a vertical line character that is found in most
keyboards on the same key as the backward slash character. The
IPC_1 keyword is separated from the mw2 parameter by an
exclamation mark. This format is required by the DDE protocol.
6-8
6. Remote Monitoring with Excel
6. Select cell B11 and type the following formula (as it appears
below):
=IPC_DATA|IPC_1!mw3
3. Click Add to define the cell to be plotted as the first bar on the
chart. Then, type To process as the name for this data:
6-9
6. Remote Monitoring with Excel
4. To specify the cell to be plotted first click in the Values text box.
Then, go back to the spread sheet and click on cell B10. This will
fill in the necessary formula automatically:
5. Click Add again to define the data to be plotted as the second bar
on the chart. Then, type Processed as the name for this data:
6-10
6. Remote Monitoring with Excel
7. Click Next to open another window and type the chart title and Y-
axis label as MPS Distribution Station Process Monitor and
Number of Pucks, respectively:
8. Click Finish. This will put the chart on the sheet. Now position the
chart so that the window looks like the following:
6-11
6. Remote Monitoring with Excel
9. Now let’s add a title and a logo and make some color changes to
make the page a bit more appealing as shown below:
ExcelRemoteMonitor.xls file
6-12
6. Remote Monitoring with Excel
10. .Click the Drawing button on the Excel toolbar. This will pop up
another toolbar at the bottom of the screen. On this toolbar click
the Text Box button and draw a text box on the window as shown
below:
Click in the text box and type MPS Distribution Station Remote
Monitoring.
11. Highlight the text with the mouse and change its color to blue
using the Font Color button on the Excel toolbar. Also, change its
font size to 14 and center it.
12. To add the Festo logo (or any graphics from a file), click Insert
menu item and select Picture, From file. Then, navigate to the file
location and click Open on the dialog box to complete the task.
13. Now let’s change the background color. Click in cell A1. Hold the
SHIFT key down and click in cell E30. This will select all the cells
on the background. Right-click in the selected area and choose
Format Cells from the pop up menu. This will open the Format
cells dialog box. Click on the Patterns tab and select a light color.
Click OK.
14. Finally, let’s change the color of the bar that shows the number of
processed pucks on the chart. Right-click on the processed bar
(currently purple) and select Format Data Series from the pop up
menu. This will open a dialog box with multiple tabs. Click the
Patterns tab and select another color. Click OK.
15. You may have to resize the chart and the title text box to make
them look like those in the ExcelRemoteMonitor.xls file. Save
your work with a different file name.
6-13
6. Remote Monitoring with Excel
Remote process
monitoring with
Excel
Now that we have an Excel sheet constructed and linked to the IPC
Data Server, we can test the system.
1. Make sure that the DIST_DDE project was downloaded to the FEC
FC34.
2. Make sure that the IPC Data Server is running and properly
configured.
3. Start Excel and open ExcelRemoteMonitor.xls file or the one you
just designed as explained above. A message will pop up
indicating that the workbook contains automatic links (the DDE
links) and will ask if you want to update the information. Click No.
4. Start your Web browser, point it to the FEC FC34 and run
hmi4.htm. Using the HMI specify the number of pucks to be
processed by the station as 5. Click SET.
5. Click START on the HMI to remotely start the station.
6. Switch over to the Excel file and watch the bar chart updating as
the pucks are processed. You may try to size the two windows so
that they fit your screen side-by-side as shown below:
6-14