OLE Automation Server. Schneider Electric PL7 Micro/Junior/Pro - Appendices
Tangazo
Tangazo
OLE Automation Server
5
Introduction
Contents of this section
This section describes how the OLE Automation server works
What's in this
Chapter?
This Chapter contains the following Sections:
Section
5.1
5.2
5.3
Topic
Introduction
Implementation
OLE Functions
Page
TLX DR PL7 xxE
71
OLE Automation Server
5.1
Introduction
Introduction
Subject of this sub-section
What's in this
Section?
This sub-section makes some general points concerning the OLE Automation server
This Section contains the following Maps:
Topic
Introduction to the OLE Automation server
OLE Automation server operating modes
Page
72
TLX DR PL7 xxE
OLE Automation Server
Introduction to the OLE Automation server
Introduction The OLE Automation Server PL7 functionality offers the possibility of executing the
PL7 in a programmed, non-interactive mode (i.e. without operator intervention) for applications external to the PL7. You use PL7 OLE Automation Server client application terminology.
PLC
Server
Client
Applications clients
PL7
*.stx
Conforming fully with the standard defined by Microsoft in its OLE package to respond to this need, PL7 now features a standard, public interface, which is independent of the client application programming language.
l l l l
The characteristic principles are: automation of repetitive tasks delegation to PL7 of processing tasks that only it can handle access to application information contained in the *.stx files more generally, development of higher level integrator type function, with encapsulation of PL7 specific implementation details.
TLX DR PL7 xxE
73
OLE Automation Server
Context of use The OLE Automation server PL7 functionality is built into PL7 Pro. It is installed and used under the same installation and use conditions as PL7. The OLE Automation server is supported by the Microsoft OLE Automation run-time provided with
Windows 95, 98 and NT
Note: To create an OLE server client application, you must know one of the l l l following OLE Automation programming languages:
Microsoft Visual Basic, version 5.0 or above
Microsoft Visual C++, version 4.2 or above
Microsoft VBA in Excel, version 5.0 or above.
74
TLX DR PL7 xxE
OLE Automation Server
OLE Automation server operating modes
General
Description
In addition to the PL7 operating mode known up until the present which is designated as "interactive", where the PL7 reacts to operator inputs only, there is now the OLE automation server operating mode where the PL7 can also react to commands transmitted from an OLE client application.
Operating mode selection is dependen on the PL7 start procedure: l Interactive mode is initialized during PL7 start via Windows (Start menu/
Programs/ Modicon Telemecanique/PL7 Pro.).
l Server mode is selected if the OLE Automation PL7 server is invoked in the programming of an OLE client application. An instance can not change the current mode.
Each time a client application invokes the OLE Automation PL7 server, a specific
PL7 instance is started, independently of any other instances which may be in progress. Any number of PL7 instances in server mode or interactive mode can be running on the same terminal. The instances are all completely independent of each other and so can each run in their own context.
For all of these instances the same denial rules concerning concurrent access to an
STX application or a PLC apply, these being: an STX application or a PLC can only be handled by one instance at a time.
This rule was developed for the OLE Automation PL7 server which can open an already open STX application but not save it. In the same way, it can perform a PLC
—> PC transfer, on explicit demand, from a reserved PLC.
A client application can instantiate several competing "OLE Automation PL7 servers".
TLX DR PL7 xxE
75
OLE Automation Server
5.2
Implementation
Introduction
Subject of this sub-section
What's in this
Section?
This sub-section describes the procedure for implementation of the OLE Automation server
This Section contains the following Maps:
Topic
Installation of OLE Automation
Accessing the PL7 OLE Automation server
Server start in local mode (COM mode)
Server start in remote mode (DCOM)
Implementing the server in remote mode
PL7 Server execution modes
Input points: OLE Function
Page
76
TLX DR PL7 xxE
OLE Automation Server
Installation of OLE Automation
Description l l
Installation of the PL7 product OLE Automation Server is transparent for the user, as it self-installs during PL7 installation.
The installation includes: l Four OLE Automation client examples, complete with source code and README file supplied with the software.
These examples are: l l a "minimal" visual C++ 4.2 client: the minimum needed to be able to write an
OLE client.
a "complete" visual C++ 4.2 client, which makes use of all the available input points.
l a visual Basic 5.0 client, which makes use of all the available input points.
l an Excel client.
A *.h file which defines the value of the error codes generated by the server.
A TLB interface file for a Visual C++ client.
TLX DR PL7 xxE
77
OLE Automation Server
Accessing the PL7 OLE Automation server
Local access
The PL7 OLE Automation server offers two ways to access its utilities.
The client application and the PL7 OLE Automation server are on the same terminal.
Remote access via DCOM
The client application and the PL7 Automation server are on two separate terminals which are linked by the TCP/IP network:
Client station Server station
DCOM
78
TLX DR PL7 xxE
OLE Automation Server
Server start in local mode (COM mode)
Introduction COM mode (Component object Model) defines an interface for communication between applications. It provides independence from the development tools.
Server start in local mode (COM mode)
To start the server in local mode, follow the procedure below:
1
2
3
4 declare an object " A " on the client application to communicate with the server application
Execute a Createdispatch function on object " A " from the client application in order to instantiate the server application
Save PL7Pro as OLE server in the register base for correct operation in server mode
(the link between the client application and the server application is created if the latter is referenced in the register base).
The client application can now interrogate the server application via the interface accessed through object "A".
E.g.: OpenStx("C:\appli.stx).
TLX DR PL7 xxE
79
OLE Automation Server
Server start in remote mode (DCOM)
Introduction The PL7 server runs according to the information present in its register base. It can be located on the client machine or on a remote machine.
DCOM mode is an extension of COM (Component Object Model) mode. COM mode is used for a client application and a server application to communicate with each other on one machine.
DCOM mode is used for two remote machines to communicate with one another. It replaces inter-process communication protocols with network protocols.
Illustration of OLE Automation operation in remote server mode:
Driver choice
PL7Servur
Client
PC a
Client
Client
PC b
COM run-time
Security provider
DCE RPC
Protocol stack
Driver choice
PL7Server
PC c
COM run-time
Security provider
DCE RPC
Protocol stack
Component
DCOM network protocol
80
TLX DR PL7 xxE
Configuration utility
OLE Automation Server
To establish communication between two machines, we use a configuration utility called, "DCOMCNFG.EXE".
By default, the utility "DCOMCNFG.EXE" included in Windows 95. The user must connect to the following Internet address: " http://www.microsoft.com " and search on this site to download this utility. This allows the server to operate in
DCOM when running Windows 95.
TLX DR PL7 xxE
81
OLE Automation Server
Implementing the server in remote mode
Example of use
Procedure
Let’s suppose a machine A (Windows NT 4) installed with a PL7Pro server.
The machine user must log in as "administrator" in order to manage access rights.
The client is machine B (Windows 95).
Follow the procedure outlined below:
1 Start DCOMCNFG on machine B: l Select the «Default Properties» tab to view the following information: l l
[X] "Enable Distributed COM on this computer"
Default Authentication Level: CONNECT l l Default Impersonation Level: Identify
On the «Default Security» tab, check the option: l l [X] Enable remote connection
On the «Application» tab: l Select PL7Pro server "PL7 server", then "properties"
2 Start DCOMCNFG on machine A: l Select the «Default Properties» tab to view the following information: l l
[X] «Enable Distributed COM on this computer
Default Authentication Level: CONNECT l Default Impersonation Level: Identify
3 Machine B, the "Client" can control PL7Pro server" located on machine A.
4 Select the «Default security» tab, and add the users who are to have write authorization on the machine.
For more information
There are Newsgroups on the Internet, where you can ask questions about DCOM.
82
TLX DR PL7 xxE
OLE Automation Server
PL7 Server execution modes
Introduction
Execution modes
The OLE Automation PL7 server has two execution modes which can be chosen dynamically during execution (see SetHMIServer ) l l
Execution mode without HMI. The PL7 is started as a "background task", with no display or possibility of operator input. It is the mode used typically, for example, to automate repetitive tasks or to access application information contained in an stx file.
Application mode with HMI. The PL7 is started as an "interactive" PL7 with display and the possibility of operator input but it remains receptive to commands from its client application. This mode has been developed to view the program or configuration elements of an application contained in an stx file using external tools such as DIAG Viewer.
Note: Utilities for displaying programs, tools, and modules can only be executed in the mode with HMI.
The OLE Automation PL7 server in HMI mode is subject to monitoring of user rights. It is set in "Read Only" user profile, which corresponds to its code display and PL7 I/O module display role.
When not in HMI mode the OLE Automation PL7 server is not subject to monitoring of user rights but the application cannot be modified with the utilities provided.
TLX DR PL7 xxE
83
OLE Automation Server
Input points: OLE Function
Introduction
Execution context l l l l
There are four types of input points:
Execution context
API monitoring
Read information
Application element display
Input points
Name
OpenStx
SaveStx
CloseStx
Set DriverAndAddress
SetServerHMI
GetPL7HMI
GetMessageError
Description
Opening an application
Saving the active application
Closing the active application
Setting the driver and the address of the accessed PLC
Making the OLE Automation PL7 server interactive or noninteractive
Giving the status: open or closed application, local – online mode , API status
Reads the error message associated with the error code
API monitoring Input points
Name
ConnectPLC
DisconnectPLC
SenCommandToPLC
DownloadToPLC
UploadFromPLCM
Description
Enters online mode
Exits online mode
Command sent to the PLC (RUN, STOP INIT)
Loading the active application into a PLC
Copies a PLC application into the active application
84
TLX DR PL7 xxE
OLE Automation Server
Read information Input points
Name
ExportScyFile
ExportFefFile
GetSymbol
GetSTXAppIdentity
GetPLCAppIdentity
GetServerVersion
Application element display
Input points
Name
SetPosPL7Window
ShowProgram
CloseProgram
ShowIOModule
CloseIOModule
ShowDFB
CloseDFB
OpenTool
Description
Exports the symbols in the active application as an scy file
Exports the active application as an fef file
Reads the symbol and the comment associated with an address
Reads the general application information contained in an
STX file
Reads the general application information contained in a
PLC
Reads the server version
Description
Sets the PL7 display characteristics (position and form)
Opens an editor on a given program module
Closes a program editor
Opens an editor on a given I/O module
Closes a given I/O module editor
Opens an editor on a given DFB code
Closes a editor on the given DFB code
Opens any MDI tool without context
Note: The input points concerning application element display do not work if the server is not in HMI mode.
TLX DR PL7 xxE
85
OLE Automation Server
5.3
OLE Functions
Introduction
Subject of this sub-section
What's in this
Section?
This sub-section describes the OLE functions of the OLE Automation server
This Section contains the following Maps:
Topic
OpenStx
CloseStx
OpenStxWithMaj
ExportScyFile
ExportFeFile
ExportFefFileWithConfiguration
DisconnectPLC
ConnectPLC
SaveStx
DownloadDataToPLC
DownloadToPLC
UploadFromPLC
UploadDataFromPLC
UploadFromPLCWithSymbol
GetSymbol
SetServerHMI
SetDownloadFunction
GetPL7State
GetSTXAppIdentity
GetPLCAppIdentity
SendCommandToPLC
SetDriverAndAddress
OpenTool
SetPosPL7Windows
ShowProgram
CloseProgram
86
Page
TLX DR PL7 xxE
Topic
ShowIOModule
CloseIOModule
ShowDFB
CloseDFB
GetMessageError
GetServerVersion
ImportScyFile
OLE Automation Server
Page
TLX DR PL7 xxE
87
OLE Automation Server
OpenStx
General
Description
This function is used to open the stx file application type.
Syntax: integer OpenStx(String lpAppPathName) l l l l
Input:
Enter the string of characters containing the name of the file that needs to be opened.
Function called:
OpenStation : Station management function (gesta.dll).
Nominal context:
The PL7 server is active.
When there is an error:
SRV_ERR_GEN_FILENOTFOUND
SRV_ERR_OPEN_BADZIP
SRV_ERR_OPEN_BADFILE There is a problem reading the stx file
SRV_ERR_OPEN_NOK_COMPATIBLE The processor is not compatible with the PL7 being open.
SRV_ERR_OPEN_OPEN
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_DRIVE FULL
The file has not been found. Open Station
There is a problem with opening the file
An application is already open
The Path Name is empty
There is an error on opening the application
There is no more free disk space for opening the application l Output:
Short type feedback code. Either 0 on a successful opening, or error code.
88
TLX DR PL7 xxE
OLE Automation Server
CloseStx
General
Description
This function is used to close the current application
Syntax: integer CloseStx( integer p_bWithoutSave) l l l l
Input:
If an application has been modified, it can be closed without having to notify the user ( p_bWithoutSave a TRUE ).
Function called:
CloseStation : Station management function (gesta.dll).
Nominal context:
The PL7 server is active and an application is open.
When there is an error:
SRV_ERR_GEN_NOTOPEN
SRV_ERR_CLOSE_NOTSAVE
No application is open.
The application has been modified, and changes must be saved before closing.
l Output:
Short type feedback code. Either 0 on a successful closing, or error code.
TLX DR PL7 xxE
89
OLE Automation Server
OpenStxWithMaj
General
Description
This function is used to export the active application along with its configuration to a fef file.
Syntax:
OpenStxWithMaj integer (NameFile string, WithNewCat integer) l l l l
Input: l Enter 1 character string containing the name and the path of the stx file that you wish to open.
l An integer which indicates whether or not it is necessary to update the catalog files (0 for no update necessary or 1 for update necessary).
Function called:
OpenStation: Station management function (gesta.dll).
Nominal context: l The PL7 server is active, l PL7 is in offline mode.
Errors:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_DRIVEFULL
SRV_ERR_OPEN_OPEN
SRV_ERR_GEN_FILENOTFOUND
SRV_ERR_OPEN_BADZIP
Error occurred while the function was being executed.
The name of the dat file is incorrect or empty.
No free space on disk available to open the application.
An application is already open.
The file could not be found.
Problem encountered when extracting zip file.
l l
Output:
Short return code. Either 0 for a successfully opened station, or an error code.
Limitations:
Once an import has been successful, a PL7 server without an HMI cannot operate with an HMI without first saving the open application.
90
TLX DR PL7 xxE
OLE Automation Server
ExportScyFile
General
Description
This function is used to export symbols in the enabled application under the scy file format.
Syntax: integer ExportScyFile(String p_psScyFile) l l l l
Input:
Enter the character string containing the scy file name.
Function called:
ExportScyFile : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_NOTOPEN
Error on creation of sourcesymbol file.
No application is open.
SRV_ERR_GEN_PARAM_EMPTY p_ psScyFile is empty.
SRV_EXPORT_ERRFILE A write error has occurred in the source file.
l Output:
Short type feedback code. Is either 0 on a successful export, or error code.
TLX DR PL7 xxE
91
OLE Automation Server
ExportFefFile
General
Description
This function is used to export the active application under the fef file format.
Syntax: integer ExportFefFile(String p_psNamefile) l l l l
Input:
Enter the character string containing the fef file name.
Function called:
ExportFefFile : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open.
When there is an error:
SRV_ERR_GEN_ACTION Error on creation of source application file.
SRV_ERR_GEN_PARAM_EMPTY No application is open.
SRV_ERR_GEN_PARAM_EMPTY p_ psNamefile is empty.
SRV_EXPORT_ERRFILE A write error has occurred in the source file.
l Output:
Short type feedback code. Is either 0 on a successful export, or error code.
92
TLX DR PL7 xxE
OLE Automation Server
ExportFefFileWithConfiguration
General
Description
This function is used to export the active application along with its configuration to a fef file.
Syntax:
ExportFefFileWithConfiguration integer (FefFile string) l l l l
Input:
Enter 1 character string containing the name and the path of the scy file that you wish to export.
Function called:
ExportFefFileWithConf: Station management function (gesta.dll).
Nominal context: l The PL7 server is active, l PL7 is in offline mode, and the station is open.
Errors:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_NOTOPEN
SRV_EXPORT_ERRFILE
Error occurred while the function was being executed.
The name of the dat file is incorrect or empty.
No STX application open.
Unable to create the export file.
l Output:
Short return code. Either 0 for a successful export, or an error code.
TLX DR PL7 xxE
93
OLE Automation Server
DisconnectPLC
General
Description
This function is used to carry out disconnection between the PLC and the PL7.
Syntax: integer ExportFefFile(String p_psNamefile) l l l
Function called:
DisconnectStation : Station management function (gesta.dll).
Nominal context:
The PL7 server is active.
Output:
Short feedback code type. Either shows 0 on a successful disconnection, or error code (SRV_ERR_GEN_ACTION).
94
TLX DR PL7 xxE
OLE Automation Server
ConnectPLC
General
Description
This function is used to connect up to a PLC.
Syntax: integer ConnectPLC(String p_lpDriver, String p_lpAddress) l l l l
Enter:
Enter the two character strings containing the driver and the PLC address.
Function called:
ConnectStation : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. Wherever parameters consist of empty strings, the server carries out the function using the driver and/or the current address.
When there is an error:
SRV_ERR_GEN_CONNECT
SRV_ERR_GEN_COMMUNICATION
SRV_ERR_GEN_RESERVED
SRV_ERR_PLC_BLANK
SRV_ERR_PC_BLANK
SRV_ERR_DIFFERENCE_PLC_STX
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_PROTECTEDAPPLI
SRV_COMPATIBLE_PLC
Connection was unsuccessful.
There is a communication problem between the PL7pro and the PLC
The PLC has been reserved, and therefore cannot be connected to.
The PLC does not contain any applications, and therefore connection cannot take place.
No applications are open, and therefore connection cannot take place.
The application which is open and the application contained in the PLC are different, and it is therefore impossible for connection to take place.
The parameter address is invalid.
An error has occurred on carrying out the function.
The parameter driver is invalid.
No application is open.
Protected application.
There is a compatibility problem with the PLC.
l Output:
Short type feedback code. Either 0 on a successful connection, or error code.
TLX DR PL7 xxE
95
OLE Automation Server
SaveStx
General
Description
This function is used to save the application which is open.
Syntax: integer SaveStx(String p_lpStxFile) l l l l
Enter:
Enter a character string containing the path and the name of the file to be saved.
Function called:
SaveStx : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open and PL7 is in offline mode.
When there is an error:
SRV_ERR_SAVEDENIED
SRV_ERR_SAVEERRZIP
SRV_ERR_SAVEERRREN
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_ACTION
SRV_ERR_PLC_CONNECT
Access to the file has been refused
An error has occurred on compacting the application
Renaming has not been allowed
No application is open p_ lpStxFile is empty.
There is an error on saving the application
Saving can only be carried out in offline mode.
l Output:
Short type feedback code. Either 0 on a successful save, or error code.
96
TLX DR PL7 xxE
OLE Automation Server
DownloadDataToPLC
General
Description
This function is used to download a file containing words to the PLC.
Syntax:
DownLoadDataToPLC integer (Driver string, Address string, NameFile string) l l l l
Input:
Enter the 3 character strings containing the driver, the PLC address and the complete name of the dat file.
Function called: l l l
DownloadData: Station management function (gesta.dll).
Nominal context:
The PL7 server is active,
PL7 is in offline mode,
If the parameters (driver and address) are empty strings, the server executes the function with the current driver and/or address.
Errors:
SRV_ERR_DOWNLOAD_CART
SRV_ERR_COMPATIBLE_PLC
SRV_ERR_PC_BLANK
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_RESERVED
SRV_ERR_GEN_COMMUNICATION
SRV_ERR_PLC_CONNECT
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_PROTECTEAPPLI
SRV_ERR_TRFDATA_READDS
Problem of compatibility of cartridge between the open application and the PLC.
Problem of compatibility between the open application and the PLC.
No application is open.
The p_IpAddress parameter is incorrect.
The p_IpDriver parameter is incorrect.
The PLC is reserved. It is therefore impossible to connect to the PLC.
Communication problem between PL7pro and the PLC.
You have to be in offline mode to download.
Error occurred while the function was being executed.
The name of the dat file is incorrect or empty.
The application is read-protected. It is not possible to connect to the PLC.
Communication error.
TLX DR PL7 xxE
97
OLE Automation Server
SRV_ERR_TRFDATA_NODATA
SRV_ERR_TRFDATA_READWRITE
SRV_ERR_TRFDATA_INFOFILE
SRV_ERR_TRFDATA_RUNREFUSED
SRV_ERR_TRFDATA_READOBJ
SRV_ERR_TRFDATA_WRITEOBJ
SRV_TRFDATA_OVERFLOW
SRV_TRFDATA_BORNENOCORRECT
Numerical variables not configured or incorrectly read. The file has not been created.
Problem with dat file.
Problem with dat file.
The PLC has refused the request to change to RUN (RUN/STOP input set to STOP).
Numerical variable read or write error.
Numerical variable read or write error.
Caution, the range of values was too large.
An overflow has occurred.
The minimum and maximum values are incorrect.
l Output:
Short return code. Either 0 for a successful download, or an error code.
98
TLX DR PL7 xxE
OLE Automation Server
DownloadToPLC
General
Description
This function is used to download an application into the PLC memory.
Syntax: integer DownloadToPLC(String p_lpDriver, String p_lpAdresse) l l l l
Enter:
Enter the two character strings containing the driver and the PLC address.
Function called:
DownloadStation : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open and PL7 is in offline mode.
Wherever parameters consist of empty strings, the server carries out the function using the driver and/or the current address.
When there is an error:
SRV_ERR_DOWNLOAD_CART
SRV_ERR_COMPATIBLE_PLC
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_RESERVED
SRV_ERR_GEN_COMMUNICATION
SRV_ERR_PLC_CONNECT
SRV_ERR_PLC_ACTION
There is a memory cartridge compatibility problem between the application which is open and the PLC.
There is a compatibility problem between the
PLC and the application which is open.
The p_lpAdresse parameter is invalid.
The p_lpDriver parameter is invalid.
No application is open.
The PLC has been reserved.
Communication problem.
The PLC has already been connected.
An error has occurred while downloading.
l Output:
Short type feedback code. Either 0 on a successful download, or error code.
TLX DR PL7 xxE
99
OLE Automation Server
UploadFromPLC
General
Description
This function is used to copy an application in a PLC over to the memory.
Syntax: integer UploadFromPLC(String p_lpDriver, String p_lpAdresse, integer p_iReservedMode) l l l l
Input:
Enter the two character strings containing the driver and the PLC address. An integer ( p_iReservedMode ) which can be used to upload onto a reserved PLC.
Function called:
UploadStation : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. There are no applications open and the PL7 is in offline mode. If parameters consist of empty strings, the server carries out the function using the driver and/or the current address.
When there is an error:
SRV_ERR_UPLOAD_TRANSFER
SRV_ERR_UPLOAD_ABORT
SRV_ERR_UPLOAD_RESERVED
SRV_ERR_UPLOAD_NOAPPLI
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_ACTION
SRV_ERR_PLC_CONNECT
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_COMMUNICATION
SRV_ERR_PLC_CONNECT
SRV_OPEN_NOT_COMPATIBLE
There is a problem in transferring the application contained in the PLC
Transfer is put on hold.
The application has been reserved.
The PLC is empty.
Invalid address.
An error has occurred in carrying out the function.
There is a connection error.
Invalid driver.
There is a communication error.
The PLC has already been connected.
Compatibility problem.
l Output:
Short type feedback code. Either 0 on a successful upload, or error code.
100
TLX DR PL7 xxE
OLE Automation Server
UploadDataFromPLC
General
Description
TLX DR PL7 xxE
This function is used to upload a file containing words contained in the PLC.
Syntax:
UpLoadDataFromPLC integer (Driver string, Address string, ValMin integer, ValMax integer,
NameFile string) l l l l
Input: l Enter the 3 character strings containing the driver, the PLC address and the l complete name of the dat file,
Enter the 2 integers for the minimum and maximum values you wish to retrieve.
Function called: l l l
UploadData: Station management function (gesta.dll).
Nominal context:
The PL7 server is active,
PL7 is in offline mode,
If the parameters (driver and address) are empty strings, the server executes the function with the current driver and/or address.
Errors:
SRV_ERR_COMPATIBLE_PLC
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_RESERVED
SRV_ERR_GEN_COMMUNICATION
SRV_ERR_PLC_CONNECT
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_PROTECTEAPPLI
SRV_ERR_TRFDATA_READDS
SRV_ERR_TRFDATA_NODATA
Problem of compatibility between the open application and the PLC.
The p_IpAddress parameter is incorrect.
The p_IpDriver parameter is incorrect.
The PLC is reserved. It is therefore impossible to connect to the PLC.
Communication problem between PL7pro and the PLC.
You have to be in offline mode to download.
Error occurred while the function was being executed.
The name of the dat file is incorrect or empty.
The application is read-protected. It is not possible to connect to the PLC.
Communication error.
Numerical variables not configured or incorrectly read. The file has not been created.
101
OLE Automation Server
SRV_ERR_TRFDATA_READWRITE
SRV_ERR_TRFDATA_INFOFILE
SRV_ERR_TRFDATA_RUNREFUSED
SRV_ERR_TRFDATA_READOBJ
SRV_ERR_TRFDATA_WRITEOBJ
SRV_TRFDATA_OVERFLOW
SRV_TRFDATA_BORNENOCORRECT
Problem with dat file.
Problem with dat file.
The PLC has refused the request to change to RUN (RUN/STOP input set to STOP).
Numerical variable read or write error.
Numerical variable read or write error.
Caution, the range of values was too large.
An overflow has occurred.
The minimum and maximum values are incorrect.
l Output:
Short return code. Either 0 for a successful upload, or an error code.
102
TLX DR PL7 xxE
OLE Automation Server
UploadFromPLCWithSymbol
General
Description
TLX DR PL7 xxE
This function is used to upload an application with the associated symbols contained in the PLC.
Syntax:
UpLoadFromPLCWithSymbol integer (Driver string, Address string, ReserveMode integer) l l l l
Input:
Enter the 2 character strings containing the driver and the PLC address. An integer ( p_IReserveMode ) allowing a PLC to PC transfer to be performed on a reserved PLC.
Function called: l l l
UploadStationWithSymbol: Station management function (gesta.dll).
Nominal context:
The PL7 server is active,
PL7 is in offline mode,
If the parameters (driver and address) are empty strings, the server executes the function with the current driver and/or address.
Errors:
SRV_ERR_COMPATIBLE_PLC
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_RESERVED
SRV_ERR_GEN_COMMUNICATION
SRV_ERR_PLC_CONNECT
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_PROTECTEAPPLI
SRV_OPEN_NOK_COMPATIBLES
SRV_ERR_UPLOAD_NOAPPLI
Problem of compatibility between the open application and the PLC.
The p_IpAddress parameter is incorrect.
The p_IpDriver parameter is incorrect.
The PLC is reserved. It is therefore impossible to connect to the PLC.
Communication problem between PL7pro and the PLC.
You have to be in offline mode to download.
Error occurred while the function was being executed.
The name of the dat file is incorrect or empty.
The application is read-protected. It is not possible to connect to the PLC.
The server does not support the level of STX application to be opened.
An error occurred while the application was being transferred.
103
OLE Automation Server
SRV_ERR_UPLOAD_READINFOSYMB
SRV_ERR_UPLOAD_WRITEINFOSYMBOL Write error. If the disk is on which the dat file is saved is saturated.
SRV_ERR_UPLOAD_INVALIDSYMB On-board symbol database in the PLC invalid.
SRV_ERR_UPLOAD_INVALIDVERSION
Communication error while reading data from the on-board database..
The version of the on-board symbol database is not supported by this version of
PL7.
SRV_ERR_UPLOAD_SYMBERR
SRV_ERR_UPLOAD_NBSYMBERR_NOCO
RRECT
SRV_ERR_UPLOAD_SYMBFILE
Internal error in on-board symbol database.
Inconsistency in objects stored in the compressed database
SRV_ERR_UPLOAD_READSYMBFILE
SRV_ERR_UPLOAD_PBMEM
Problem reading from the database in the
PLC.
Error reading from the database in the PLC.
The memory is saturated. The operation cannot be completed in the normal way.
SRV_ERR_UPLOAD_ABORTSYMB
SRV_ERR_UPLOAD_CHECKSYMB
SRV_ERR_UPLOAD_DIFFSYMB
Reading of on-board symbol database abandoned.
A difference has been detected between the on-board "checksum" and the recalculated
"checksum".
A difference has been detected between the information transferred and the recalculated information.
l Output:
Short return code. Either 0 for a successful upload, or an error code.
104
TLX DR PL7 xxE
OLE Automation Server
GetSymbol
General
Description
This function is used to give the symbol and comment associated with an address.
Summary: integer GetSymbol(String p_lpRepere, String* p_bsSymbole, String* p_bsComment) l l l l
Input:
Enter the character string containing the address to be modified or completed.
Function called:
GetSymbol : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open and in offline mode.
When there is an error:
SRV_ERR_ADDRESSSYNTAX
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_ACTION the character string entered as a parameter does not match an address.
No application is open.
p_lpRepere is empty.
Error has occurred on carrying out the function.
Invalid address.
Error has occurred in carrying out the function.
l Output:
Short type feedback code. Either 0 on a successful upload, or error code.
l l
Two character strings:
The associated symbol ( p_bsSymbol ).
The associated comment ( p_bsComment )
TLX DR PL7 xxE
105
OLE Automation Server
SetServerHMI
General
Description
This function can be used to display (or not display) the PL7 server. It switches from one operating mode to another. i.e. switch from a PL7 Pro server without HMI to a
PL7 Pro server with HMI, and vice versa.
Syntax: integer SetServerHMI (integer p_bHMI) l l l l
Input:
A Boolean (HMI display or non-display).
Function called:
SetIHMServer : Windows application function (sawinapp.cpp).
Nominal context:
The PL7 server is active.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_MODIFAPPLI
Error has occurred on carrying out the function.
Application is in the process of being modified.
l Output:
Short type feedback code. Either 0 on a successful upload, or error code.
106
TLX DR PL7 xxE
OLE Automation Server
SetDownloadFunction
General
Description
This function is used to authorize or block the transfer of an application to the PLC via the server.
Syntax:
SetDownloadFunction Boolean (Download integer) l l l l
Input:
Enter 1 integer (value 0 or 1) to activate or deactivate transfer of the application to the PLC,
Nominal context: l The PL7 server is active, l PL7 is in offline mode.
Output:
TRUE.
Limitations:
This function only prohibits the transfer when used in server mode.
TLX DR PL7 xxE
107
OLE Automation Server
GetPL7State
General
Description
This function is used to obtain the state of the server.
Syntax: integer GetPL7State(String* p_lpStation, String * p_lpConnection) l l l
Function called:
GetPL7State : Station management function (gesta.dll).
Nominal context:
The PL7 server is active.
When there is an error:
SRV_ERR_GEN_ACTION An error has occurred on carrying out the function.
l Output:
Short feedback code type. Either 0 on a successful upload, or error code.
l l
Two character strings inform the user on:
The state of the station (open or closed).
The mode state (on- or offline). In online mode, the state of the PLC (run or stop) is indicated.
108
TLX DR PL7 xxE
OLE Automation Server
GetSTXAppIdentity
General
Description
This function is used to find out general information about an application.
Syntax: integer GetSTXAppIdentity(String p_lpNameStx, VARIANT FAR* p_pVarInfo) l l l l
Enter:
Enter the character string ( p_1pNameStx ) containing the name of the application.
Function called:
IdentAppliForm : Station management function (gesta.dll).
Nominal context:
The PL7 server is active.
When there is an error:
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_ACTION
SRV_ERR_APPLIINFO_NOK p_ lpNameStx is empty.
An error has occurred on carrying out the function.
Invalid information l Output:
Short feedback code type. Either 0 on a successful upload, or error code.
Displayed information:
6
7
4
5
2
3
0
1
8
9
10
11
Station name,
Application version number,
Date and time of modification
Station application ID,
ID concerning local inputs/outputs configuration,
ID concerning remore inputs/outputs configuration,
PL7 code ID
Grafcet ID,
Constants ID,
Symbol ID,
ID for reservations,
The comment associated with the application.
TLX DR PL7 xxE
109
OLE Automation Server
GetPLCAppIdentity
General
Description
110
This function is used to find out general information about an application in a PLC.
Syntax: integer GetPLCAppIdentity(String p_lpDriver, String p_lpAdresse, VARIANTFAR* p_pvInfoAppli) l l l l
Enter:
Enter the two character strings containing the driver and the PLC address.
Function called:
IdentAppliOnPlcForm : Station management function (gesta.dll).
Nominal context:
The PL7 sever is enabled and in offline mode.
When there is an error:
SRV_ERR_APPLIINFO_NOK
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_ADDRESS
SRV_ERR_COMPATIBLE_PLC
SRV_ERR_PLC_BLANK
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_DRIVER
SRV_ERR_GEN_COMMUNICATION
Invalid information
An error has occurred on carrying out the function.
Invalid address.
Compatibility problem between the API and PL7 software.
There are no applications in the PLC.
A problem has occurred while storing application information.
The p_lpDriver parameter is invalid.
There is a communication error.
4
5
6
2
3
0
1 l Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
Displayed information:
Station name,
Application version number,
Date and time of modification
Station application ID,
ID concerning local inputs/outputs configuration,
ID concerning remote inputs/outputs configuration,
PL7 code ID
TLX DR PL7 xxE
7
8
9
10
11
Grafcet ID,
Constants ID,
Symbol ID,
ID for reservations,
The comment associated with the application.
OLE Automation Server
TLX DR PL7 xxE
111
OLE Automation Server
SendCommandToPLC
General
Description
This function is used to send a command to the PLC.
Syntax: integer SendCommandToPLC(integer p_iCommand)) l l l l
Enter:
The type of command that is to be executed
There are 3 possible types: l SRV_COMMAND_INIT: Command to initialize PLC l SRV_COMMAND_STOP: Command to stop PLC l SRV_COMMAND_RUN: Command to run PLC
Function called:
StationCommand : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open, and PL7 is online and in STOP mode.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_NOTOPEN
SRV_ERR_COMMAND_NOTINLOCAL
SRV_COMMAND_ERRINIT
Invalid command.
There are no applications open.
The server is in offline mode.
INIT function cannot be carried out as PLC is already in RUN mode.
l Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
112
TLX DR PL7 xxE
OLE Automation Server
SetDriverAndAddress
General
Description
This function is used to change the driver and the address for the current station.
Syntax: integer SetDriverAndAddress(String p_lpDriver, String p_lpAddress) l l l l
Enter:
Enter the two character strings containing the driver and the PLC address.
Function called:
DriverAndAddress : Station management function (gesta.dll).
Nominal context:
The PL7 server is active. An application is open and in offline mode. If parameters are not fully completed or are invalid, their current values remain unchanged.
When there is an error:
SRV_ERR_GEN_ADDRESS
SRV_ERR_GEN_DRIVER
SRV_ERR_PLC_CONNECT
SRV_ERR_PLC_ACTION
The address put into the parameter is invalid.
The driver in the parameter is invalid.
The server is in online mode.
An error has occurred on carrying out the function.
The parameters are empty.
SRV_ERR_PARAM_EMPTY l Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
TLX DR PL7 xxE
113
OLE Automation Server
OpenTool
General
Description
This function is used to open the tools present in the character string placed in the parameters.
Syntax: integer OpenTool(String p_lpListTool)) l l l l
Enter:
The character strings containing the list of tools that the server must open.
Formatting example: tools1;tools2;tools3
Function called:
OpenTool : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled. An application is open.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_WITHIHM
SRV_ERR_GEN_OPENEDTVDATA l Output:
Short feedback code type.
A tool cannot be opened.
Empty parameter.
No application is open.
Function available using PL7 server in HMI mode.
The "Animation Table" tool cannot be opened.
114
TLX DR PL7 xxE
OLE Automation Server
SetPosPL7Windows
General
Description
This function is used to set the position of the PL7 window.
Syntax: integer PosPL7Windows(integer CoordX, integer CoordY, integer CoordCX,integer
CoordCY) l l l l
Enter:
Th X-Y coordinates for the window.
Function called:
MoveWindow : mfc. function
Nominal context:
The PL7 server with HMI is enabled.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_WITHIHM
Command failed.
Empty parameter.
Function available using PL7 server in HMI mode.
l Output:
Short feedback code type.
TLX DR PL7 xxE
115
OLE Automation Server
ShowProgram
General
Description
This function is used to open the programs present in the parameter string placed in the parameters.
Syntax: integer ShowProgram(String p_lpListProgram)) l l l l
Enter:
Enter the character strings containing the list of programs that the server must open.
Formatting example: mast\lad1;mast\lit2;evt\evt0;sr1;mast\prl
Function called:
ShowProgram : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled.
An application is open.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_WITHIHM
Command failed.
There are no applications open.
Empty parameter.
Function available using PL7 server in HMI mode.
The module cannot be opened.
SRV_ERR_GEN_SHOWPROGRAM l l
Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
Limitations:
This function is not able to open a non-instanced DFB. To display a noninstanced DFB code, the ShowDFB function must be used.
116
TLX DR PL7 xxE
OLE Automation Server
CloseProgram
General
Description
This function is used to close the programs present in the character string placed in the parameters.
Syntax: integer CloseProgram(String p_lpListProgram) l l l l
Enter:
The character strings containing the list of programs that the server must close.
Formatting example: mast\lad1;mast\lit2;evt\evt0;sr1;mast\prl.
Function called:
CloseProgram : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled.
An application is open.
When there is an error:
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_WITHIHM
There are no applications open.
Close failed.
Empty parameter.
Function available using PL7 server in HMI mode.
The module cannot be closed.
SRV_ERR_GEN_CLOSEPROGRAMM l l
Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
Limitations:
This function cannot close a DFB which is open.
TLX DR PL7 xxE
117
OLE Automation Server
ShowIOModule
General
Description
This function is used to open the input/output modules present in the character string placed in the parameters.
l l l l
Enter:
The character strings containing the list of modules that the server must open.
The formatting for the character string is rack,module; rack,module
Formatting example: 0,0;0,1;1,2
Function called:
ShowIOModule : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled.
An application is open.
When there is an error:
SRV_ERR_GEN_NOTOPEN
SRV_ACTION_NOK
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_WITHIHM
There are no applications open.
There is a problem with enabling user rights.
Empty parameter.
Function available using PL7 server in HMI mode.
l l
Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
Limitations:
An IO module is opened in offline mode, while the module configuration screen is open. If the user changes from offline to online mode, the server does not switch from the configuration screen to the debugging screen. The user can either operate the PL7 Pro directly or open/close the module using a client.
118
TLX DR PL7 xxE
OLE Automation Server
CloseIOModule
General
Description
This function is used to close the input/output modules present in the character string placed in the parameters.
Syntax
CloseIOModule(String p_lpListIOModule) integer.
l l l l
Enter:
The character strings containing the list of modules that the server must open.
formatting example: 0,0;0,1;1,2
Function called:
CloseIOModule : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled.
An application is open.
When there is an error:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_WITHIHM
Close command failed.
Empty parameter.
There are no applications open.
Function available using PL7 server in HMI mode.
l l
Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
Limitations:
This function does not close the configuration editor which is open using the
ShowIOModule function.
TLX DR PL7 xxE
119
OLE Automation Server
ShowDFB
General
Description
This function is used to display the code for one or many DFBs present in the character string placed in the parameters. Opening a DFB using this application does not require instancing.
Syntax integer ShowDFB(String p_lpListeDFB) l l l l
Enter:
The character strings containing the list of DFBs that the server must open.
Function called:
ShowDFB : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled.
An application is open.
When there is an error:
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_WITHIHM
Empty parameter
There are no applications open
A problem has occurred while opening a DBF.
Function available using PL7 server in HMI mode.
l Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
120
TLX DR PL7 xxE
OLE Automation Server
CloseDFB
General
Description
This function is used to close the one or several DFBs present in the character string placed in the parameters.
Syntax integer CloseDFB(String p_lpListeDFB) l l l l
Enter:
The character strings containing the list of DFBs that the server must close.
Function called:
CloseDFB : Station management function (gesta.dll).
Nominal context:
The PL7 server with HMI is enabled.
An application is open.
When there is an error:
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_NOTOPEN
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_WITHIHM
Empty parameter
There are no applications open
A problem has occurred while opening a DBF.
Function available using PL7 server in HMI mode.
l Output:
Short feedback code type. Either 0 on a successful upload, or there is a code error.
TLX DR PL7 xxE
121
OLE Automation Server
GetMessageError
General
Description
This function is used to associate an error message with and according to the error code placed in the parameters.
Syntax
String GetMessageError(integer p_iCodeError) l l l
Enter:
The error code for one of the departments to return.
Nominal context:
The PL7 server is active.
Output:
A character string corresponding to the error label.
122
TLX DR PL7 xxE
OLE Automation Server
GetServerVersion
General
Description
This function is used to find out the version number for the PL7 Pro server.
Syntax
String GetServerVersion() l l
Nominal context:
The PL7 server is active.
Output:
A character string corresponding to the version number label for the PL7 Pro server.
TLX DR PL7 xxE
123
OLE Automation Server
ImportScyFile
General
Description
This function is used to import symbols into the active application from a scy file.
Syntax:
ImportScyFile integer (ScyFile string) l l l l
Input:
Enter 1 character string containing the name and the path of the scy file that you wish to import.
Function called:
ImportScyFile: Station management function (gesta.dll).
Nominal context: l The PL7 server is active, l PL7 is in offline mode, and the station is open.
Errors:
SRV_ERR_GEN_ACTION
SRV_ERR_GEN_PARAM_EMPTY
SRV_ERR_GEN_NOTOPEN
SRV_ERR_SRC_FILE
Error occurred while the function was being executed.
The name of the dat file is incorrect or empty.
No STX application open.
Problem with source file.
l l
Output:
Short return code. Either 0 for a successful import.
Limitations:
Once an import has been successful, a PL7 server without an HMI cannot operate with an HMI without first saving the open application.
124
TLX DR PL7 xxE
Pakua
Tangazo