146 KiB
from typing import List from typing import Optional from enum import Enum
this file is auto - generated
def open_portal(portal_mode: Optional[Enums.PortalMode] = None, version: Optional[str] = None) -> Portal: """ Open a new TIA Portal instance Version-string in format major.minor e.g. "18.0"
Returns → Portal
TIA Portal instance
| Parameters | Type | Description | | --- | --- | --- |c:\Users\migue\miniconda3\envs\tia_scripting\Lib\site-packages\siemens_tiaportal_scripting.pyi c:\Users\migue\miniconda3\envs\tia_scripting\Lib\site-packages\siemens_tia_scripting.pyi | portal_mode | Enums.PortalMode | With or without user-interface | | version | str | Version string of TIA Portal to be used in format major.minor e.g. 18.0, (Latest installed TIA Portal version by default) |
Example usage
portal = siemens_tia_scripting.open_portal(portal_mode = siemens_tia_scripting.Enums.PortalMode.WithGraphicalUserInterface, version = "18.0")
"""
...
def attach_portal(portal_mode: Optional[Enums.PortalMode] = None, version: Optional[str] = None) -> Portal: """ Attach to running TIA Portal instance Version-string in format major.minor e.g. "18.0"
Returns → Portal
TIA Portal instance
Parameters | Type | Description |
---|---|---|
portal_mode | Enums.PortalMode | With or without user-interface |
version | str | Version string of TIA Portal to be used in format major.minor e.g. 18.0, (Latest installed TIA Portal version by default) |
portal = siemens_tia_scripting.attach_portal(portal_mode = Enums.PortalMode.WithGraphicalUserInterface, version = "18.0")
"""
...
def open_attach_project(project_file_path: str, portal_mode: Optional[Enums.PortalMode] = None) -> Project: """ Attach to running TIA Portal instance with already open project Or opens the project with a new instance of fitting TIA Portal version
Returns → Project
TIA Project instance
Parameters | Type | Description |
---|---|---|
project_file_path | str | Full path of the project file |
portal_mode | Enums.PortalMode | With or without user-interface |
project = siemens_tia_scripting.open_attach_project(project_file_path = "C:\\ws\\testproj\\testproj.ap17", portal_mode = siemens_tia_scripting.Enums.PortalMode.WithGraphicalUserInterface)
"""
...
def get_installed_bundles() -> List[ProductBundle]: """ Get a list of installed TIA Portal bundles
Returns → List[ProductBundle]
List of installed bundles
product_bundles = siemens_tia_scripting.get_installed_bundles()
"""
...
def get_installed_products() -> List[Product]: """ Get a list of installed TIA Portal products
Returns → List[Product]
List of installed products
products = siemens_tia_scripting.get_installed_products()
"""
...
def set_umac_credentials(user_name: str, user_password: str, user_type: Enums.UmacUserMode): """ Set UMAC Credentials which will be used for protected libraries or projects
Parameters | Type | Description |
---|---|---|
user_name | str | User name |
user_password | str | Password of the user |
user_type | Enums.UmacUserMode | Project or global user |
siemens_tia_scripting.set_umac_credentials(user_name = "admin", user_password = "Password123", user_type = Enums.UmacUserMode.Project)
"""
...
def set_logging(path: str, console: bool): """ Set logging output path or console (stdout) output
Parameters | Type | Description |
---|---|---|
path | str | Fullpath of the log file |
console | bool | (optional) True for Enable console output, False to disable the standard output to console window |
siemens_tia_scripting.set_logging(path = "c:\\ws\\tiascripting.log", console = False)
"""
...
class Enums: class PortalMode: WithGraphicalUserInterface: int WithoutGraphicalUserInterface: int AnyUserInterface: int class UmacUserMode: Project: int Global: int class ExportFormats: SimaticML: int ExternalSource: int SimaticSD: int class ExportOptions: WithDefaults: int Nan: int WithReadOnly: int class ApplicationTest: def get_name() -> str: """ Get the name of the Test Suite application test
Return → str
Name of the application test
name = app_test.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the Test Suite application test
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property of the Application Test |
property_value = app_test.get_property(name = "Property")
"""
...
def export(target_directory_path: str):
"""
Export the Test Suite application test
The folder "Application tests" will be automatically created on the target_directory_path
, if not already exists.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
app_test.export(target_directory_path = "C:\\ws\\export")
"""
...
def set_scope(plc_name: str, instance_name: Optional[str] = None, execution_mode: Optional[int] = None):
"""
Set the scope of the Test Suite application test
Parameters | Type | Description |
---|---|---|
plc_name | str | Name of the PLC to be used |
instance_name | str | PLCSIM Instance name (only V19 and higher) |
execution_mode | integer (enum) | (only V19 and higher) [1: 'SystemManagedPLCSIMInstance', 2: 'ExternallyManagedPLCSIMInstance'] |
app_test.set_scope(plc_name = "PLC_1")
"""
...
class ExternalSource: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def block_gen():
"""
Generate the blocks from the external source
ext_source.block_gen()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class ForceTable: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def is_consistent() -> bool:
"""
Check if the force table is consistent
Returns → bool
True if consistent
value = force_table.is_consistent()
"""
...
def show_in_editor():
"""
Open the PLC object in the editor
plc_object.show_in_editor()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class GlobalLibrary: def get_name() -> str: """ Get the name of the global library
Returns → str
Name of the global library
name = global_lib.get_name()
"""
...
def save():
"""
Save the global library
global_lib.save()
"""
...
def get_author() -> str:
"""
Get author of the global library
Returns → str
Name of the author
author = global_lib.get_author()
"""
...
def get_path() -> str:
"""
Get the path of the global library
Returns → str
Full path of the library
path = global_lib.get_path()
"""
...
def get_library_type_folder() -> LibraryTypeFolder:
"""
Get the folder containing library types & library type folders
Returns → LibraryTypeFolder
Library type folder
library_type = global_lib.get_library_type_folder()
"""
...
def is_modified() -> bool:
"""
Check if the global library was modified
Returns → bool
State if library was modified
state = global_lib.is_modified()
"""
...
def is_read_only() -> bool:
"""
Check if the global library is readonly
Returns → bool
State if global library is readonly
state = global_lib.is_read_only()
"""
...
def update_library(update_mode: int, delete_mode: int, conflict_mode: int, typename: Optional[str] = None, library_name: Optional[str] = None ):
"""
Update target library with type(s) from source
Parameters | Type | Description |
---|---|---|
type_name | str | This option should be used when a specific type has to be updated |
library_name | str | This option should be used when a specific global library has to be updated |
update_mode | integer (enum) | [1: 'ForceSetAnyUpdatedVersionAsDefault', 2: 'NoDefaultVersionChange', 3: 'SetOnlyHigherUpdatedVersionAsDefault'] |
delete_mode | integer (enum) | [0: 'AutomaticallyDelete', 1: 'DoNotDelete'] |
conflict_mode | integer (enum) | [1: 'CancelIfStructureConflicts', 2: 'RetainStructure', 3: 'UpdateStructure'] |
global_lib.update_library(update_mode = 1, delete_mode = 1, conflict_mode = 3)
"""
...
def update_project(update_mode: int, delete_mode: int, conflict_mode: int):
"""
Update current project with type(s) from global library
Parameters | Type | Description |
---|---|---|
update_mode | integer (enum) | [1: 'ForceSetAnyUpdatedVersionAsDefault', 2: 'NoDefaultVersionChange', 3: 'SetOnlyHigherUpdatedVersionAsDefault'] |
delete_mode | integer (enum) | [0: 'AutomaticallyDelete', 1: 'DoNotDelete'] |
conflict_mode | integer (enum) | [1: 'CancelIfStructureConflicts', 2: 'RetainStructure', 3: 'UpdateStructure'] |
global_lib.update_project(update_mode = 1, delete_mode = 1, conflict_mode = 3)
"""
...
def archive(target_directory_path: str, archive_name: str, delete_existing_archive: bool):
"""
Archive the TIA Portal library
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path where archive should be placed |
archive_name | str | Name of the archive file |
delete_existing_archive | bool | Set if the output file should be deleted first |
global_lib.archive(target_directory_path = "C:\\ws\\newfolder", archive_name = "testglobalib" , delete_existing_archive = True)
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class GlobalLibraryInfo: def get_name() -> str: """ Get the name of the global library info
Returns → str
Name of the global library info
name = global_lib_info.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class Hmi: def get_name() -> str: """ Get the name of the HMI
Returns → str
Name of the HMI
hmi_name = hmi.get_name()
"""
...
def open_device_editor():
"""
Open the editor of the HMI-device in TIA Portal
hmi.open_device_editor()
"""
...
def compile_hardware() -> bool:
"""
Compile the hardware of the HMI
Returns → bool
Result of the compile
Returns true if compile has errors, otherwise returns false
result = hmi.compile_hardware()
"""
...
def compile_software() -> bool:
"""
Compile the software of the HMI
Returns → bool
Result of the compile
Returns true if compile has errors, otherwise returns false
result = hmi.compile_software()
"""
...
def upgrade_hardware(full_upgrade: bool):
"""
Update hardware of the HMI
If full_upgrade
is set to True, all devices will be changed to the newest available order number (Device type) and firmware:
from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FK00-0AB0 V1.8.
With full upgrade: from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FL03-0AB0 V3.0.
Parameters | Type | Description |
---|---|---|
full_upgrade | bool | Set if for full upgrade (latest order number and firmware version) |
hmi.upgrade_hardware(full_upgrade = True)
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class LibraryType: def get_name() -> str: """ Get the name of the library type
Returns → str
Name of the type
name = lib_type.get_name()
"""
...
def get_author() -> str:
"""
Get the author of the library type
Returns → str
Author of the type
author = lib_type.get_author()
"""
...
def get_guid() -> str:
"""
Get the guid of the library type
Returns → str
Guid of the type
guid = lib_type.get_guid()
"""
...
def get_versions() -> List[LibraryTypeVersion]:
"""
Get the versions of the library type
Returns → List[LibraryTypeVersion]
Versions of the type
versions = lib_type.get_versions()
"""
...
def find_version(version: str) -> LibraryTypeVersion:
"""
Find the version of the library type
Returns → LibraryTypeVersion
Version des Bibliothekstyp
typeversion = lib_type.find_version(version = "1.0.0")
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class LibraryTypeFolder: def get_name() -> str: """ Get the name of the folder
Returns → str
Name of the folder
name = lib_folder.get_name()
"""
...
def get_folders() -> List[LibraryTypeFolder]:
"""
Get the library type folders
Returns → List[LibraryTypeFolder]
List of folders
folders = lib_folder.get_folders()
"""
...
def get_types() -> List[LibraryType]:
"""
Get the library types of the folder
Returns → List[LibraryType]
List of types
types = lib_folder.get_types()
"""
...
def find_library_type(library_type_name: str) -> LibraryType:
"""
Find the library type by name
Returns → LibraryType
Library type
Parameters | Type | Description |
---|---|---|
library_type_name | str | Name of the library type |
type = lib_folder.find_library_type(library_type_name = "MyType")
"""
...
def find_folder(folder_name: str) -> LibraryTypeFolder:
"""
Find the library type folder from the subfolders
Returns → LibraryTypeFolder
Library type folder
Parameters | Type | Description |
---|---|---|
folder_name | str | Name of the subfolder |
folder = lib_folder.find_folder(folder_name = "MyFolder")
"""
...
class LibraryTypeVersion: def get_author() -> str: """ Get the author of the library type version
Returns → str
Author
author = projectlib.get_author()
"""
...
def get_guid() -> str:
"""
Get the GUID of the library type version
Returns → str
GUID
guid = lib_type_version.get_guid()
"""
...
def get_version_number() -> str:
"""
Get the version number of the library type version
Returns → str
version number
version_number = lib_type_version.get_version_number()
"""
...
def get_modified_date() -> str:
"""
Get the modification date of the library type version
Returns → str
Modification date
date = lib_type_version.get_modified_date()
"""
...
def get_state() -> str:
"""
Get the state of the library type version
Returns → str
State of the library type version
state = lib_type_version.get_state()
"""
...
def get_type_object() -> LibraryType:
"""
Get the type of the library type version
Returns → LibraryType
Library type object
lib_type = lib_type_version.get_type_object()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class NamedValueType: def get_name() -> str: """ Get the name of the Named value data type
Returns → str
Name of the NVT
name = nvt.get_name()
"""
...
def get_namespace() -> str:
"""
Get the name of the Named value data type namespace
Returns → str
Name of the namespace
name = nvt.get_namespace()
"""
...
def export(target_directory_path: str, keep_folder_structure: Optional[bool] = None):
"""
Export the Named value data type
If keep_folder_structure
is set to true, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
nvt.export(target_directory_path = "C:\\ws\\export")
"""
...
class Plc: def get_name() -> str: """ Get the name of the PLC
Returns → str
Name of the PLC
plc_name = plc.get_name()
"""
...
def open_device_editor():
"""
Open the editor of the PLC-device in TIA Portal
plc.open_device_editor()
"""
...
def get_online_state() -> str:
"""
Get the current online state of the PLC
Returns → str
Online state
plc.get_online_state()
"""
...
def go_offline():
"""
Go offline with the PLC
plc.go_offline()
"""
...
def go_online(mode: str, pci_interface: str, ip_address: str) -> str:
"""
Go online with the PLC
Returns → str
Online status
Parameters | Type | Description |
---|---|---|
mode | str | Configuration mode |
pci_interface | str | PC Interface name |
ip_address | str | IP address |
plc.go_online(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10")
"""
...
def download(mode: str, pci_interface: str, ip_address: str) -> str:
"""
Download the PLC
Returns → str
Result of the download
Parameters | Type | Description |
---|---|---|
mode | str | Configuration mode |
pci_interface | str | PC Interface name |
ip_address | str | IP address |
result = plc.download(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10")
"""
...
def download_to_memory_card(download_directory: str) -> str:
"""
Download the PLC-configuration to memory card
Returns → str
Result of the download
Parameters | Type | Description |
---|---|---|
download_directory | str | Download directory |
result = plc.download_to_memory_card(download_directory = "E:\\")
"""
...
def get_plc_tag_tables() -> List[PlcTagTable]:
"""
Get the list of the PLC Tag Tables
Returns → List[PlcTagTable]
List of the PLC Tag tables
Parameters | Type | Description |
---|---|---|
folder_path | str | The group path of the item |
plc_tag_tables = plc.get_plc_tag_tables(folder_path = "group1/group2")
"""
...
def update_module_description() -> bool:
"""
Update the module description of the PLC
Returns → bool
Result state
result = plc.update_module_description()
"""
...
def compile_hardware() -> bool:
"""
Compile the hardware of the PLC
Returns → bool
Result of the compile
Returns true if compile has errors, otherwise returns false
result = plc.compile_hardware()
"""
...
def compile_software() -> bool:
"""
Compile the software of the PLC
Returns → bool
Result of the compile
Returns true if compile has errors, otherwise returns false
result = plc.compile_software()
"""
...
def upgrade_hardware(full_upgrade: bool):
"""
Upgrade the hardware the PLC
If full_upgrade
is set to True, all devices will be changed to the newest available order number (Device type) and firmware:
from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FK00-0AB0 V1.8.
With full upgrade: from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FL03-0AB0 V3.0.
Parameters | Type | Description |
---|---|---|
full_upgrade | bool | Set if for full upgrade (latest order number and firmware version) |
plc.upgrade_hardware(full_upgrade = True)
"""
...
def compare_to_online() -> bool:
"""
Compare actual PLC state to the online state
Returns → bool
Result of the compare
Returns false if folders are Identical, otherwise returns true
result = plc.compare_to_online()
"""
...
def get_program_blocks() -> List[ProgramBlock]:
"""
Get the list of program blocks
Returns → List[ProgramBlock]
List of the program blocks
Parameters | Type | Description |
---|---|---|
folder_path | str | The group path of the item |
blocks = plc.get_program_blocks(folder_path = "group1/group2")
"""
...
def get_system_blocks() -> List[SystemBlock]:
"""
Get the list of system blocks
Returns → List[SystemBlock]
List of the system blocks
blocks = plc.get_system_blocks()
"""
...
def get_user_data_types() -> List[UserDataType]:
"""
Get the list of PLC data types
Returns → List[UserDataType]
List of the PLC data types
Parameters | Type | Description |
---|---|---|
folder_path | str | The group path of the item |
udts = plc.get_user_data_types(folder_path = "group1/group2")
"""
...
def get_external_sources() -> List[ExternalSource]:
"""
Get the list of external source files
Returns → List[ExternalSource]
List of the external source files of the PLC
Parameters | Type | Description |
---|---|---|
folder_path | str | The group path of the item |
ext_sources = plc.get_external_sources()
"""
...
def get_force_tables() -> List[ForceTable]:
"""
Get the list of force tables
Returns → List[ForceTable]
List of the force tables of the PLC
tables = plc.get_force_tables()
"""
...
def get_watch_tables() -> List[WatchTable]:
"""
Get the list of watch tables
Returns → List[WatchTable]
List of the watch tables of the PLC
Parameters | Type | Description |
---|---|---|
folder_path | str | The group path of the item |
tables = plc.get_watch_tables()
"""
...
def get_technology_objects() -> List[TechnologyObject]:
"""
Get the list of technology objects
Returns → List[TechnologyObject]
List of the technology objects of the PLC
Parameters | Type | Description |
---|---|---|
folder_path | str | The group path of the item |
tos = plc.get_technology_objects()
"""
...
def get_software_units() -> List[SoftwareUnit]:
"""
Get the list of software units
Returns → List[SoftwareUnit]
List of the software units
software_units = plc.get_software_units()
"""
...
def get_safety_administration() -> SafetyAdministration:
"""
Get Safety administration of the PLC
Returns → SafetyAdministration
Safety Administration of the PLC
sa = plc.get_safety_administration()
"""
...
def import_blocks(import_root_directory: str):
"""
Import program blocks from a directory to the PLC
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_blocks(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Program blocks")
"""
...
def import_plc_tags(import_root_directory: str):
"""
Import tags from a directory to the PLC
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_plc_tags(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\PLC tags")
"""
...
def import_data_types(import_root_directory: str):
"""
Import user data types from a directory to the PLC
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_data_types(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\PLC data types")
"""
...
def import_technology_objects(import_root_directory: str):
"""
Import technology objects from a directory to the PLC
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_technology_objects(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Technology objects")
"""
...
def import_watch_tables(import_root_directory: str):
"""
Import watch tables from a directory to the PLC
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_watch_tables(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Watch and force tables")
"""
...
def import_software_units(import_root_directory: str):
"""
Import software units from a directory to the PLC
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_software_units(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Software Units")
"""
...
def safety_print(print_file: str) -> bool:
"""
Create a safety printout of the PLC and print it to a file
If the file already exists, it is overwritten.
Returns → bool
Returns true on success
Parameters | Type | Description |
---|---|---|
print_file | str | Full path of the printout file |
plc.safety_print(print_file = "C:\\ws\\safetyprint\\F_PLC_Printout.pdf")
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class PlcTag: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class PlcTagTable: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def get_plc_tags() -> List[PlcTag]:
"""
Get the list of PLC tags
Returns → List[PlcTag]
List of the PLC tags
plctags = table.get_plc_tags()
"""
...
def get_user_constants() -> List[UserConstant]:
"""
Get the list of the user constants
Returns → List[UserConstant]
List of the PLC constants
constants = table.get_user_constants()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the PLC tag table filter → integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
table.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
def show_in_editor():
"""
Open the PLC object in the editor
plc_object.show_in_editor()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class Portal: def get_process_id() -> int: """ Get the TIA Portal process ID
Returns → int
TIA Portal process id
id = portal.get_process_id()
"""
...
def open_project(project_file_path: str, server_project_view: Optional[bool] = None ) -> Project:
"""
Open a TIA Portal project or local session - optional in server view
Returns → Project
TIA Portal project
Parameters | Type | Description |
---|---|---|
project_file_path | str | Full path of the project file |
server_project_view | str | Default: false. If parameter set to true, open in server project view |
project = portal.open_project(project_file_path = "C:\\ws\\testproj\\testproj.ap17")
"""
...
def open_project_with_copy(project_file_path: str, target_directory_path: str, delete_existing_project: bool) -> Project:
"""
Open a TIA Portal project or local session in separate folder
Returns → Project
TIA Portal project
Parameters | Type | Description |
---|---|---|
project_file_path | str | Full path of the project file |
target_directory_path | str | Temporary path where the project should be copied before opened |
delete_existing_project | bool | Defines if the temporary project should be deleted |
project = portal.open_project_with_copy(project_file_path = "C:\\ws\\testproj\\testproj.ap17", target_directory_path = "C:\\ws\\temp" , delete_existing_project = True)
"""
...
def retrieve_archive(target_directory_path: str, archive_file_path: str, delete_existing_project: bool) -> Project:
"""
Retrieve a TIA Portal project archive
Returns → Project
TIA Portal project
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Temporary path where project should be copied before opened |
archive_file_path | str | Full path of the archived project file |
delete_existing_project | bool | Defines if the temporary project should be deleted |
project = portal.retrieve_archive(archive_file_path = "C:\\ws\\testproj\\testproj.zap17", target_directory_path = "C:\\ws\\temp" , delete_existing_project = True)
"""
...
def create_project(target_directory_path: str, project_name: str, delete_existing_project: bool) -> Project:
"""
Create a new TIA Portal project
Returns → Project
TIA Portal project
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Temporary path where project should be copied before opened |
project_name | str | Name of the new project |
delete_existing_project | bool | Defines if the temporary project should be deleted |
project = portal.create_project(target_directory_path = "C:\\ws\\temp" , project_name = "MyNewProject" delete_existing_project = True)
"""
...
def get_project() -> Project:
"""
Get opened TIA Portal project of the current TIA Portal instance
Returns → Project
TIA Portal project
project = portal.get_project()
"""
...
def get_global_library(library_name: str) -> GlobalLibrary:
"""
Get global library by name
Returns → GlobalLibrary
Global Library
Parameters | Type | Description |
---|---|---|
library_name | str | Name of the global library |
global_lib = portal.get_global_library(library_name = "GlobalLib1")
"""
...
def open_global_library(library_path: str) -> GlobalLibrary:
"""
Open global library by path
Returns → GlobalLibrary
Global Library
Parameters | Type | Description |
---|---|---|
library_path | str | Full path of the global library |
global_lib = portal.open_global_library(library_path = "C:\\ws\\testlib\\testlib.al17")
"""
...
def open_global_library_with_copy(target_directory_path: str, library_path: str, delete_existing_project: bool) -> GlobalLibrary:
"""
Open global library from a copy
Returns → GlobalLibrary
Global Library
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Temporary path where the library should be copied before opened |
library_path | str | Full path of the global library |
delete_existing_project | bool | Defines if the temporary project should be deleted |
global_lib = portal.open_global_library_with_copy(target_directory_path = "C:\\ws\\temp", library_path = "C:\\ws\\testlib\\testlib.al17", delete_existing_project = True)
"""
...
def retrieve_archive_library(target_directory_path: str, archive_file_path: str, delete_existing_project: bool) -> GlobalLibrary:
"""
Retrieve a TIA Portal library archive
Returns → GlobalLibrary
Global Library
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Temporary path where library should be copied before opened |
archive_file_path | str | Full path of the archived library file |
delete_existing_project | bool | Defines if the temporary project should be deleted |
global_lib = portal.retrieve_archive_library(target_directory_path = "C:\\ws\\temp", archive_file_path = "C:\\ws\\testproj\\testlib.zal17", delete_existing_project = True)
"""
...
def close_portal():
"""
Close the TIA Portal instance
portal.close_portal()
"""
...
def close_global_library(global_library_name: str):
"""
Close the global library instance
Parameters | Type | Description |
---|---|---|
global_library_name | str | Name of the global library |
portal.close_global_library(global_library_name = "GlobalLib1")
"""
...
def get_project_servers() -> List[ProjectServer]:
"""
Get a list of TIA Project-Servers found by host-filter
Returns → List[ProjectServer]
List of TIA Project-Servers
Parameters | Type | Description |
---|---|---|
host_filter | str | Host of the TIA Project-Servers |
portal.get_project_servers(host_filter = "CompanyServer")
"""
...
def get_project_server(url: str) -> ProjectServer:
"""
Get the TIA Project-Server found by URL
Returns → ProjectServer
TIA Project-Server
Parameters | Type | Description |
---|---|---|
url | str | URL of the TIA Project-Server |
portal.get_project_server(url = "https://project.server.net:8735/")
"""
...
def detach():
"""
Detach from the TIA Portal instance
portal.detach()
"""
...
class Product: def get_name() -> str: """ Get the name of the TIA Portal product
Returns → str
Name of the TIA Portal product
product_name = product.get_name()
"""
...
def get_release() -> str:
"""
Get the release of the TIA Portal product
Returns → str
Release tag of the TIA Portal product
product_release = product.get_release()
"""
...
def get_version() -> str:
"""
Get the version of the TIA Portal product
Returns → str
Version of the TIA Portal product
product_version = product.get_version()
"""
...
class ProductBundle: def get_title() -> str: """ Get the title of the TIA Portal Bundle
Returns → str
Title of the Siemens bundle
bundle_title = bundle.get_title()
"""
...
def get_release() -> str:
"""
Get the release of the TIA Portal Bundle
Returns → str
Release of the Siemens bundle
bundle_release = bundle.get_release()
"""
...
def get_products() -> List[Product]:
"""
Get the list of products of the TIA Portal Bundle
Returns → List[Product]
List of Siemens products
bundle_products = bundle.get_products()
"""
...
class ProgramBlock: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def compile():
"""
Compile the program block
programblock.compile()
"""
...
def is_consistent() -> bool:
"""
Check if the program block is consistent
Returns → bool
True if consistent
value = programblock.is_consistent()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the program block filter → integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
programblock.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
def show_in_editor():
"""
Open the PLC object in the editor
plc_object.show_in_editor()
"""
...
def get_type_version_guid() -> str:
"""
Get the GUID of the type version
Returns → str
GUID
guid = plc_object.get_type_version_guid()
"""
...
def get_type_guid() -> str:
"""
Get the GUID of the type
Returns → str
GUID
guid = plc_object.get_type_guid()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class Project: def get_portal() -> Portal: """ Get the TIA Portal instance from the current project
portal = project.get_portal()
"""
...
def save():
"""
Save the TIA Portal project
project.save()
"""
...
def close():
"""
Close the TIA Portal project
project.close()
"""
...
def set_simulation_support(value: bool):
"""
Set the simulation support for the TIA Portal project
Parameters | Type | Description |
---|---|---|
value | bool | Set the value of the simulation support |
project.set_simulation_support(value = True)
"""
...
def archive(target_directory_path: str, archive_name: str, delete_existing_archive: bool) -> str:
"""
Archive the TIA Portal project
Returns → str
Full path of the new archive
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path where archive should be placed |
archive_name | str | name of the archive file |
delete_existing_archive | bool | Set if the output file should be deleted first |
archive_fullpath = project.archive(target_directory_path = "C:\\ws\\newfolder", archive_name = "testproj" , delete_existing_archive = True)
"""
...
def save_as(target_directory_path: str, project_name: str) -> str:
"""
Save the TIA Portal project under another path and name
Returns → str
Full path of the saved project
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path where project should be saved |
project_name | str | Name of the project name |
project_file_path = project.save_as(target_directory_path = "C:\\ws\\newfolder", project_name = "testproj")
"""
...
def export_cax_data(export_file_path: str, log_file_path: str) -> bool:
"""
Export the CAx data of the TIA Portal project
Returns → bool
Result state of the export
Parameters | Type | Description |
---|---|---|
export_file_path | str | Full path of the export file |
log_file_path | str | Full path of the log file |
result = project.export_cax_data(export_file_path = "C:\\ws\\exportfolder\\exportCAX.aml", log_file_path = "C:\\ws\\exportfolder\\exportCAX.log")
"""
...
def import_cax_data(import_file_path: str, log_file_path: str) -> bool:
"""
Import CAx data to the TIA Portal project
Returns → bool
Result state of the import
Parameters | Type | Description |
---|---|---|
import_file_path | str | Fullpath of the import file |
log_file_path | str | Fullpath of the log file |
result = project.import_cax_data(import_file_path = "C:\\ws\\importfolder\\importCAX.aml", log_file_path = "C:\\ws\\importfolder\\importCAX.log")
"""
...
def open_topology_editor():
"""
Open the topology editor in TIA Portal for the TIA Portal project
project.open_topology_editor()
"""
...
def open_network_editor():
"""
Open the network editor in TIA Portal for the TIA Portal project
project.open_network_editor()
"""
...
def get_plcs() -> List[Plc]:
"""
Get a list of PLCs in the TIA Portal project
Returns → List[Plc]
All PLC's as list
plcs = project.get_plcs()
for plc in plcs:
...
"""
...
def get_hmis() -> List[Hmi]:
"""
Get a list of HMIs in the TIA Portal project
Returns → List[Hmi]
All HMI's as list
hmis = project.get_hmis()
for hmi in hmis:
...
"""
...
def get_application_tests() -> List[ApplicationTest]:
"""
Get a list of Test Suite application tests in the TIA Portal project
Needs Test Suite installed and licensed.
Returns → List[ApplicationTest]
All Application tests as list
tests = project.get_application_tests()
"""
...
def get_system_tests() -> List[SystemTest]:
"""
Get a list of Test Suite system tests in the TIA Portal project
Needs Test Suite installed and licensed.
Returns → List[SystemTest]
All System tests as list
tests = project.get_system_tests()
"""
...
def get_rule_sets() -> List[RuleSet]:
"""
Get a list of Test Suite Styleguide rule sets in the TIA Portal project
Needs Test Suite installed and licensed.
Returns → List[RuleSet]
All Rule sets as list
rule_sets = project.get_rule_sets()
"""
...
def get_project_library() -> ProjectLibrary:
"""
Get the project library
Returns → ProjectLibrary
Project library
project_lib = project.get_project_library()
"""
...
def web_block_generate():
"""
Generate Web block DBs according the user define pages
Web server must activated.
project.web_block_generate()
"""
...
def upgrade_hardware(full_upgrade: bool):
"""
Upgrade the devices to the latest order number and firmware version
If full_upgrade
is set to True, all devices will be changed to the newest available order number (Device type) and firmware:
from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FK00-0AB0 V1.8.
With full upgrade: from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FL03-0AB0 V3.0.
Parameters | Type | Description |
---|---|---|
full_upgrade | bool | Set if for full upgrade (latest order number and firmware version) |
project.upgrade_hardware(full_upgrade = True)
"""
...
def sivarc_generate():
"""
Start SiVArc-generation
SiVArc must be installed and licensed.
project.sivarc_generate()
"""
...
def update_module_description():
"""
Update the module description of all devices in the project
project.update_module_description()
"""
...
def set_virtual_plc_support(value: bool):
"""
Set virtual PLC support in the project
Available only in V19 or higher
Parameters | Type | Description |
---|---|---|
value | bool | Set the value of the virtual support |
project.set_virtual_plc_support(value = "True")
"""
...
def import_umac_config(import_file_path: str) -> int:
"""
Import UMAC and UMC Configuration to the TIA Portal project
Parameters | Type | Description |
---|---|---|
import_file_path | str | Full path of the import file |
secret | str | Secret for the encryption (optional if passwords encrypted) |
secret_env_name | str | Name of the environment variable where Secret is stored (optional if passwords encrypted) |
project.import_umac_config(import_file_path = "C:\\ws\\importfolder\\importUMAC.json", secret_env_name = "MYSECRETENV")
"""
...
def export_umac_config(export_file_path: str):
"""
Export UMAC and UMC configuration from the TIA Portal project
If export file already exists, it will be overwritten
Parameters | Type | Description |
---|---|---|
export_file_path | str | Full path of the export file |
project.export_umac_config(export_file_path = "C:\\ws\\exportfolder\\exportUMAC.json")
"""
...
def encrypt_umac_config(umac_file_path: str, secret: str, secret_env_name: str) -> str:
"""
Encrypt UMAC and UMC configuration from the TIA Portal project with provided secret
Parameters | Type | Description |
---|---|---|
umac_file_path | str | Full path of the umac config file |
secret | str | Secret for the encryption |
secret_env_name | str | Name of the environment variable where secret value is stored |
project.encrypt_umac_config(umac_file_path = "C:\\ws\\exportfolder\\exportUMAC.json", secret = "mySecret")
"""
...
def import_password_policy(import_file_path: str):
"""
Import Password Policies to the TIA Portal project
Parameters | Type | Description |
---|---|---|
import_file_path | str | Full path of the import file |
project.import_password_policy(import_file_path = "C:\\ws\\importfolder\\PWPolicy.json")
"""
...
def export_password_policy(export_file_path: str):
"""
Export Password Policies from the TIA Portal project
If export file already exists, it will be overwritten
Parameters | Type | Description |
---|---|---|
export_file_path | str | Full path of the import file |
project.export_password_policy(export_file_path = "C:\\ws\\exportfolder\\exportPWPolicy.json")
"""
...
def delete():
"""
Delete the TIA Portal project
project.delete()
"""
...
def start_transaction(undo_text: str, dialog_text: str):
"""
Start exclusive access and new transaction
Parameters | Type | Description |
---|---|---|
undo_text | str | Text on the Undo button |
dialog_text | str | Text on the dialog during the transaction |
project.start_transaction(undo_text = "MyUndoDescription", dialog_text = "MyExclusiveAccess")
"""
...
def end_transaction(rollback: Optional[bool] = None):
"""
End transaction and exclusive access
Parameters | Type | Description |
---|---|---|
rollback | bool | Set if changes during transaction should be rolled back (default: false) |
project.end_transaction()
"""
...
def update_transaction(dialog_text: str):
"""
Update transaction of the running exclusive access
Parameters | Type | Description |
---|---|---|
dialog_text | str | Text on the dialog during the transaction |
project.update_transaction(dialog_text = "MyNewExclusiveAccess")
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class ProjectLibrary: def get_type_folder() -> LibraryTypeFolder: """ Get the folder containing library types & library type folders
Returns → LibraryTypeFolder
Library type folder
typefolder = projectlib.get_type_folder()
"""
...
class ProjectServer: def get_host() -> str: """ Get the host of the TIA Project-Server
Returns → str
Host
host = server_project.get_host()
"""
...
def get_port() -> int:
"""
Get the port of the TIA Project-Server
Returns → int
Port number
port = server_project.get_port()
"""
...
def get_server_name() -> str:
"""
Get the server name of the TIA Project-Server
Returns → str
Server name
name = server_project.get_server_name()
"""
...
def print_info():
"""
Show information of the TIA Project-Server
server_project.print_info()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class RuleSet: def get_name() -> str: """ Get the name of the Test Suite style guide rule set
Return → str
Name of the rule set
name = rule.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the Test Suite style guide rule set
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property of the rule set |
property_value = rule.get_property(name = "Property")
"""
...
def export(target_directory_path: str):
"""
Export the Test Suite style guide rule set
The folder "Style guide" will be automatically created on the target_directory_path
, if not already exists.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
rule.export(target_directory_path = "C:\\ws\\export")
"""
...
class SafetyAdministration: def is_logged_on() -> bool: """ Check if user is logged in to Safety administration offline program
Returns → bool
Status of login
status = safety_admin.is_logged_on()
"""
...
def is_password_set() -> bool:
"""
Check if the safety administration has a password set for the safety offline program
Returns → bool
Status if password is set
status = safety_admin.is_password_set()
"""
...
def get_offline_serial_number() -> str:
"""
Get the offline serial number
Returns → str
Offline serial number
value = safety_admin.get_offline_serial_number()
"""
...
def export_config(target_directory_path: str):
"""
Export the safety administration configuration
The folder "SafetyAdministration" will be automaticcally created on the target_directory_path
, if not already exists.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
safety_admin.export_config(target_directory_path = "C:\\ws\\export")
"""
...
def import_config(import_root_directory: str):
"""
Import the safety administration configuration
Parameters | Type | Description |
---|---|---|
import_root_directory | str | Folder path for the import |
safety_admin.import_config(import_root_directory = "C:\\ws\\exported\\SafetyAdministration")
"""
...
class SoftwareUnit: def get_name() -> str: """ Get the name of the software unit
Return → str
Name of the software unit
*
name = software_unit.get_name()
"""
...
def compile():
"""
Compile the software unit
software_unit.compile()
"""
...
def export_configuration(target_directory_path: str):
"""
Export the software unit configuration
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
software_unit.export_configuration(target_directory_path = "C:\\ws\\export")
"""
...
def get_plc_tag_tables() -> List[PlcTagTable]:
"""
Get the list of the PLC tag tables
Returns → List[PlcTagTable]
List of the PLC tag tables of the software unit
pcl_tag_tables = software_unit.get_plc_tag_tables()
"""
...
def get_program_blocks() -> List[ProgramBlock]:
"""
Get the list of the program blocks
Returns → List[ProgramBlock]
List of the program blocks of the software unit
blocks = software_unit.get_program_blocks()
"""
...
def get_system_blocks() -> List[SystemBlock]:
"""
Get the list of the system blocks
Returns → List[SystemBlock]
List of the system blocks of the software unit
blocks = software_unit.get_system_blocks()
"""
...
def get_user_data_types() -> List[UserDataType]:
"""
Get the list of the user data types
Returns → List[UserDataType]
List of the user data types of the software unit
udts = software_unit.get_user_data_types()
"""
...
def get_external_sources() -> List[ExternalSource]:
"""
Get the list of the external sources
Returns → List[ExternalSource]
List of the external sources of the software unit
ext_sources = software_unit.get_external_sources()
"""
...
def get_named_value_types() -> List[NamedValueType]:
"""
Get the list of the named value types
Returns → List[NamedValueType]
List of the named value types of the software unit
nvts = software_unit.get_named_value_types()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the software unit object filter → integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
software_unit.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class SystemBlock: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def compile():
"""
Compile the system block
systemblock.compile()
"""
...
def is_consistent() -> bool:
"""
Check if the system block is consistent
Returns → bool
True if consistent
value = systemblock.is_consistent()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the system block filter → integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
systemblock.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
def show_in_editor():
"""
Open the PLC object in the editor
plc_object.show_in_editor()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class SystemTest: def get_name() -> str: """ Get the name of the Test Suite system test
Returns → str
Name of the system test
name = sys_test.get_name()
"""
...
def export(target_directory_path: str):
"""
Export the Test Suite system test
The folder "System tests" will be automatically created on the target_directory_path
, if not already exists.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
sys_test.export(target_directory_path = "C:\\ws\\export")
"""
...
def set_scope(opcua_server_address: str, opcua_server_interface_type: int, opcua_server_interface_folder_path: Optional[str] = None):
"""
Set the scope of the Test Suite system test
Parameters | Type | Description |
---|---|---|
opcua_server_address | str | OPC UA server adress e.g. opc.tcp://server.port/path |
opcua_server_interface_type | integer (enum) | [1: 'UserDefined', 2: 'StandardSIMATIC'] |
opcua_server_interface_folder_path | str | Folder path to interface files |
sys_test.set_scope(opcua_server_address = "opc.tcp://server.port/path", opcua_server_interface_type = 1 )
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class TechnologyObject: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def compile():
"""
Compile the technology object
to.compile()
"""
...
def is_consistent() -> bool:
"""
Check if the technology object is consistent
Returns → bool
True if consistent
value = to.is_consistent()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class UserConstant: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class UserDataType: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def compile():
"""
Compile the PLC data type
udt.compile()
"""
...
def is_consistent() -> bool:
"""
Check if the PLC data type is consistent
Returns → bool
True if consistent
value = udt.is_consistent()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export the cross references of the PLC data type filter → integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
udt.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
def get_type_version_guid() -> str:
"""
Get the GUID of the type version
Returns → str
GUID
guid = plc_object.get_type_version_guid()
"""
...
def get_type_guid() -> str:
"""
Get the GUID of the type
Returns → str
GUID
guid = plc_object.get_type_guid()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
class WatchTable: def get_name() -> str: """ Get the name of the PLC object
Returns → str
Name of the PLC object
name = plc_object.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the object
Properties which are not string will be converted to string if possible.
Returns → str
Value of the property as string
Parameters | Type | Description |
---|---|---|
name | str | Property name of the object |
property_value = tiap_object.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: Enums.ExportOptions, export_format: Optional[Enums.ExportFormats] = None, keep_folder_structure: Optional[bool] = None ):
"""
Export the PLC object
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
Parameters | Type | Description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | Enums.ExportOptions | Export options |
export_format | Enums.ExportFormats | Export format, by default SimaticML |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_object.export(target_directory_path = "C:\\ws\\export", export_options = Enums.ExportOptions.WithDefaults)
"""
...
def is_consistent() -> bool:
"""
Check if the watch table is consistent
Returns → bool
True if consistent
value = watch_table.is_consistent()
"""
...
def show_in_editor():
"""
Open the PLC object in the editor
plc_object.show_in_editor()
"""
...
def delete():
"""
Delete the object
tiap_object.delete()
"""
...
def get_properties() -> List[str]:
"""
Get all properties of the object
Returns → List[str]
Names of the attributes
properties = tiap_object.get_properties()
"""
...
from typing import List
this file is auto - generated
class ApplicationTest: def get_name() -> str: """ Get the name of the application test
Return -> 'str' Name of the application test
name = app_test.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the application test
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the Application Test |
property_value = app_test.get_property(name = "Name")
"""
...
def export(target_directory_path: str):
"""
Export the application test
The folder "Application tests" will be automaticcally created on the target_directory_path
, if not already exists.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
app_test.export(target_directory_path = "C:\\ws\\export")
"""
...
def set_scope(plc_name: str, instance_name: str, execution_mode: int):
"""
Set the scope of the application test
parameters | type | description |
---|---|---|
plc_name | str | Target PLC Name |
instance_name | str | PLCSIM Instance name (only V19 and higher) |
execution_mode | integer (enum) | (only V19 and higher) [1: 'SystemManagedPLCSIMInstance', 2: 'ExternallyManagedPLCSIMInstance'] |
app_test.set_scope(plc_name = "PLC_1")
"""
...
class ExternalSource: def get_name() -> str: """ Get the name of the external source
Returns -> str
Name of the external source
name = ext_source.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the external source
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the external source |
property_value = ext_source.get_property(name = "Name")
"""
...
def block_gen():
"""
Generate the blocks from the external source
ext_source.block_gen()
"""
...
class ForceTable: def get_name() -> str: """ Get the name of the force table
Returns -> str
Name of the force table
name = force_table.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the force table
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the Force table |
property_value = force_table.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: int):
"""
Exports the force table exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
The folder "Watch and force tables" will be automatically created on the target_directory_path
, if not already exists.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
force_table.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def is_consistent() -> bool:
"""
Check if the force table is consistent
Returns -> bool
True if consistent
value = force_table.is_consistent()
"""
...
def open_portal( show_gui: bool, version: str) -> Portal: """ Open a new TIA Portal instance show_gui can be True or False version string in format major.minor e.g. "18.0"
Returns -> Portal
TIA Portal instance
parameters | type | description |
---|---|---|
show gui | bool | Set if user-interface should be displayed (False by default) |
version | str | Version string of TIA Portal to be used in format major.minor e.g. 18.0, (Latest installed TIA Portal version by default) |
Example usage
portal = siemens_tiaportal_scripting.open_tiaportal(show_gui = True, version = "18.0")
"""
...
def attach_portal( show_gui: bool, version: str) -> Portal: """ Attach to running TIA Portal instance showgui can be True or False version string in format major.minor e.g. "18.0"
Returns -> Portal
TIA Portal instance
parameters | type | description |
---|---|---|
show gui | bool | Set if user-interface should be displayed (False by default) |
version | str | Version string of TIA Portal to be used in format major.minor e.g. 18.0, (Latest installed TIA Portal version by default) |
portal = siemens_tiaportal_scripting.attach_to_portal(show_gui = True, version = "18.0")
"""
...
def open_attach_project(project_file_path: str, show_gui: bool) -> Project: """ Attach to running TIA Portal instance with already open project or opens project with a new instance of latest available TIA Portal version
Returns -> Project
TIA Project instance
parameters | type | description |
---|---|---|
project_file_path | str | Full path of the project file |
show_gui | bool | Set if user-interface should be displayed (False by default) |
project = siemens_tiaportal_scripting.open_attach_project(project_file_path = "C:\\ws\\testproj\\testproj.ap17")
"""
...
def get_installed_bundles() -> List[ProductBundle]: """ Return a list of installed TIA Portal bundles
Returns -> List[ProductBundle]
List list of installed bundles
prodocuts_bundles = siemens_tiaportal_scripting.get_installed_bundles()
"""
...
def get_installed_products() -> List[Product]: """ Return a list of installed TIA Portal products
Returns -> List[Product]
List list of installed products
prodocuts = siemens_tiaportal_scripting.get_installed_products()
"""
...
def set_umac_credentials(user_name: str, user_password: str, user_type: int): """ Set UMAC Credentials which will be used for any protected library or project
parameters | type | description |
---|---|---|
user_name | str | User name |
user_password | str | Password of the user |
user_type | integer (enum) | [1: 'Project', 2: 'Global'] |
siemens_tiaportal_scripting.set_umac_credentials(user_name = "admin", user_password = "Password123", user_type = 1)
"""
...
class GlobalLibrary: def get_name() -> str: """ Get the name of the global library
Returns -> str
Name of the global library
name = global_lib.get_name()
"""
...
def save():
"""
Save the global library
global_lib.save()
"""
...
def get_author() -> str:
"""
Get author of the global library
Returns -> str
Name of the author
author = global_lib.get_author()
"""
...
def get_path() -> str:
"""
Get the path of the global library
Returns -> str
Full path of the library
path = global_lib.get_path()
"""
...
def get_modified_state() -> bool:
"""
Check if the global library was modified
Returns -> bool
State if library was modified
state = global_lib.get_modified_state()
"""
...
def get_read_only_state() -> bool:
"""
Check if the global library is readonly
Returns -> bool
State if global library is readonly
state = global_lib.get_read_only_state()
"""
...
def get_library_type_folder() -> LibraryTypeFolder:
"""
Get the folder containing library types & library type folders
Returns -> LibraryTypeFolder
Library type folder
library_type = global_lib.get_library_type_folder()
"""
...
def update_library( typename: str, library_name: str, update_mode: int, delete_mode: int, conflict_mode: int):
"""
Update target library with type(s) from source type_name -> string - This option should be used when a specific type has to be updated. library_name -> string - This option should be used when a specific global library has to be updated. update_mode -> integer - [1: 'ForceSetAnyUpdatedVersionAsDefault', 2: 'NoDefaultVersionChange', 3: 'SetOnlyHigherUpdatedVersionAsDefault'] delete_mode -> integer - [0: 'AutomaticallyDelete', 1: 'DoNotDelete'] conflict_mode -> integer - [1: 'CancelIfStructureConflicts', 2: 'RetainStructure', 3: 'UpdateStructure']
parameters | type | description |
---|---|---|
type_name | str | This option should be used when a specific type has to be updated |
library_name | str | This option should be used when a specific global library has to be updated |
update_mode | integer (enum) | [1: 'ForceSetAnyUpdatedVersionAsDefault', 2: 'NoDefaultVersionChange', 3: 'SetOnlyHigherUpdatedVersionAsDefault'] |
delete_mode | integer (enum) | [0: 'AutomaticallyDelete', 1: 'DoNotDelete'] |
conflict_mode | integer (enum) | [1: 'CancelIfStructureConflicts', 2: 'RetainStructure', 3: 'UpdateStructure'] |
global_lib.update_library(update_mode = 1, delete_mode = 1, conflict_mode = 3)
"""
...
def update_project(updatemode: int, deletemode: int, conflictmode: int):
"""
Update current project with type(s) from global library update_mode -> integer - [1: 'ForceSetAnyUpdatedVersionAsDefault', 2: 'NoDefaultVersionChange', 3: 'SetOnlyHigherUpdatedVersionAsDefault'] delete_mode -> integer - [0: 'AutomaticallyDelete', 1: 'DoNotDelete'] conflict_mode -> integer - [1: 'CancelIfStructureConflicts', 2: 'RetainStructure', 3: 'UpdateStructure']
parameters | type | description |
---|---|---|
type_name | str | This option should be used when a specific type has to be updated |
library_name | str | This option should be used when a specific global library has to be updated |
update_mode | integer (enum) | [1: 'ForceSetAnyUpdatedVersionAsDefault', 2: 'NoDefaultVersionChange', 3: 'SetOnlyHigherUpdatedVersionAsDefault'] |
delete_mode | integer (enum) | [0: 'AutomaticallyDelete', 1: 'DoNotDelete'] |
conflict_mode | integer (enum) | [1: 'CancelIfStructureConflicts', 2: 'RetainStructure', 3: 'UpdateStructure'] |
global_lib.update_project(update_mode = 1, delete_mode = 1, conflict_mode = 3)
"""
...
def compile_project( log_level: str) -> List[str]:
"""
Compile the TIA Portal project and return the compiler results
Returns -> List[str]
Compiler results
parameters | type | description |
---|---|---|
log_level | str | This option should be used when a specific type has to be updated |
global_lib.compile_project( log_level = "Error")
"""
...
def archive(target_directory_path: str, archive_name: str, delete_existing_archive: bool):
"""
Archive the TIA Portal library
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path where archive should be placed |
archive_name | str | Name of the archive file |
delete_existing_archive | bool | Set if the output file should be deleted first |
global_lib.archive(target_directory_path = "C:\\ws\\newfolder", archive_name = "testglobalib" , delete_existing_archive = True)
"""
...
class GlobalLibraryInfo: def get_name() -> str: """ Get the name of the global library info
Returns -> str
Name of the global library info
name = global_lib_info.get_name()
"""
...
class Hmi: def get_name() -> str: """ Get the name of the HMI
Returns -> str
Name of the HMI
hmi_name = hmi.get_name()
"""
...
def open_device_editor():
"""
Open the editor of the HMI-device in TIA Portal
hmi.open_device_editor()
"""
...
def compile_hardware() -> bool:
"""
Compile the hardware of the HMI
Returns -> bool
Result of the compile
returns true if compile has errors, otherwise returns false
result = hmi.compile_hardware()
"""
...
def compile_software() -> bool:
"""
Compile the software of the HMI
Returns -> bool
Result of the compare
returns true if compile has errors, otherwise returns false
result = hmi.compile_software()
"""
...
def upgrade_hardware(full_upgrade: bool):
"""
Update hardware of the HMI
If full_upgrade
is set to True, all devices will be changed to the newest available order number (Device type) and firmware:
from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FK00-0AB0 V1.8. With full upgrade: from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FL03-0AB0 V3.0.
parameters | type | description |
---|---|---|
full_upgrade | bool | Set if for full upgrade (latest order number and firmware version) |
hmi.upgrade_hardware(full_upgrade = True)
"""
...
class LibraryType: def get_name() -> str: """ Get the name of the library type
Returns -> str
Name of the type
name = lib_type.get_name()
"""
...
class LibraryTypeFolder: def get_name() -> str: """ Get the name of the folder
Returns -> str
Name of the folder
name = lib_folder.get_name()
"""
...
class LibraryTypeVersion: def get_author() -> str: """ Get the author of the library type version
Returns -> str
Author
author = projectlib.get_author()
"""
...
def get_guid() -> str:
"""
Get GUID of the library type version
Returns -> str
GUID
guid = lib_type_version.get_guid()
"""
...
def get_version_number() -> str:
"""
Get version number of the library type version
Returns -> str
version number
version_number = lib_type_version.get_version_number()
"""
...
def get_modified_date() -> str:
"""
Get the modification date of the library type version
Returns -> str
Modified date
date = lib_type_version.get_modified_date()
"""
...
def get_state() -> str:
"""
Get the state of the library type version
Returns -> str
State of the library type version
state = lib_type_version.get_state()
"""
...
def get_type_object() -> LibraryType:
"""
Get the type of the library type version
Returns -> LibraryType
Library type object
lib_type = lib_type_version.get_type_object()
"""
...
class NamedValueType: def get_name() -> str: """ Get the name of the named value type
Returns -> 'str' Name of the named value type
name = nvt.get_name()
"""
...
def get_namespace() -> str:
"""
Get the name of the named value type namespace
Returns -> 'str' Name of the namespace
name = nvt.get_namespace()
"""
...
def export(target_directory_path: str, keep_folder_structure: bool):
"""
Export the named value type type
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
nvt.export(target_directory_path = "C:\\ws\\export")
"""
...
class Plc: def get_name() -> str: """ Get the name of the PLC
Returns -> str
Name of the PLC
plc_name = plc.get_name()
"""
...
def open_device_editor():
"""
Open the editor of the PLC-device in TIA Portal
plc.open_device_editor()
"""
...
def get_online_status() -> str:
"""
Get the current online status of the PLC
Returns -> str
Online status
plc.get_online_status()
"""
...
def go_offline():
"""
Go offline with the PLC
plc.go_offline()
"""
...
def go_online(mode: str, pci_interface: str, ip_address: str) -> str:
"""
Go online with the PLC
Returns -> str
Online status
parameters | type | description |
---|---|---|
mode | str | Configuration mode |
pci_interface | str | PC Interface name |
ip_address | str | IP adress |
plc.go_online(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10")
"""
...
def download(mode: str, pci_interface: str, ip_address: str) -> str:
"""
Download the PLC
Returns -> str
Result of the download
parameters | type | description |
---|---|---|
mode | str | Configuration mode |
pci_interface | str | PC Interface name |
ip_address | str | IP adress |
result = plc.download(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10")
"""
...
def download_to_memory_card(download_directory: str) -> str:
"""
Download the PLC to memory card
Returns -> str
Result of the download
parameters | type | description |
---|---|---|
download_directory | str | Download directory |
result = plc.download_to_memory_card(download_directory = "E:\\")
"""
...
def get_plc_tag_tables( folder_path: str) -> List[PlcTagTable]:
"""
Get the list of the PLC Tag Tables
Returns -> List[PlcTagTable]
List of the PLC Tag tables
parameters | type | description |
---|---|---|
folder_path | str | The group path of the item |
pcl_tag_tables = plc.get_plc_tag_tables(folder_path = "group1/group2")
"""
...
def update_module_description() -> bool:
"""
Update the module description of the PLC
Returns -> bool
Result state
result = plc.update_module_description()
"""
...
def compile_hardware() -> bool:
"""
Compile the hardware of the PLC
Returns -> bool
Result of the compile
returns true if compile has errors, otherwise returns false
result = plc.compile_hardware()
"""
...
def compile_software() -> bool:
"""
Compile the software of the PLC
Returns -> bool
Result of the compile
returns true if compile has errors, otherwise returns false
result = plc.compile_software()
"""
...
def compare_to_online() -> bool:
"""
Compare actual PLC state to the online state
Returns -> bool
Result of the compare
returns false if folders are Identical, otherwise returns true
result = plc.compare_to_online()
"""
...
def upgrade_hardware(full_upgrade: bool):
"""
Upgrade the hardware the PLC
If full_upgrade
is set to True, all devices will be changed to the newest available order number (Device type) and firmware:
from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FK00-0AB0 V1.8. With full upgrade: from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FL03-0AB0 V3.0.
parameters | type | description |
---|---|---|
full_upgrade | bool | Set if for full upgrade (latest order number and firmware version) |
plc.upgrade_hardware(full_upgrade = True)
"""
...
def get_program_blocks( folder_path: str) -> List[ProgramBlock]:
"""
Get the list of program blocks
Returns -> List[ProgramBlock]
List of the program blocks
parameters | type | description |
---|---|---|
folder_path | str | The group path of the item |
blocks = plc.get_program_blocks(folder_path = "group1/group2")
"""
...
def get_system_blocks() -> List[SystemBlock]:
"""
Get the list of system blocks
Returns -> List[SystemBlock]
List of the system blocks
blocks = plc.get_system_blocks()
"""
...
def get_user_data_types( folder_path: str) -> List[UserDataType]:
"""
Get the list of user data types
Returns -> List[UserDataType]
List of the user data types
parameters | type | description |
---|---|---|
folder_path | str | The group path of the item |
udts = plc.get_user_data_types(folder_path = "group1/group2")
"""
...
def get_external_sources( folder_path: str) -> List[ExternalSource]:
"""
Get the list of external source files
Returns -> List[ExternalSource]
List of the external sources of the plc
parameters | type | description |
---|---|---|
folder_path | str | The group path of the item |
ext_sources = plc.get_external_sources()
"""
...
def get_force_tables() -> List[ForceTable]:
"""
Get the list of force tables
Returns -> List[ForceTable]
List of the force tables of the plc
tables = plc.get_force_tables()
"""
...
def get_watch_tables( folder_path: str) -> List[WatchTable]:
"""
Get the list of watch tables
Returns -> List[WatchTable]
List of the watch tables of the plc
parameters | type | description |
---|---|---|
folder_path | str | The group path of the item |
tables = plc.get_watch_tables()
"""
...
def get_technology_objects( folder_path: str) -> List[TechnologyObject]:
"""
Get the list of technology objects
Returns -> List[TechnologyObject]
List of the technology objects of the plc
parameters | type | description |
---|---|---|
folder_path | str | The group path of the item |
tos = plc.get_technology_objects()
"""
...
def get_software_units() -> List[SoftwareUnit]:
"""
Get the list of software units
Returns -> List[SoftwareUnit]
List of the software units
softwareunits = plc.get_software_units()
"""
...
def get_safety_administration() -> SafetyAdministration:
"""
Get safety administration of the PLC
Returns -> SafetyAdministration
Safety Administration of the PLC
sa = plc.get_safety_administration()
"""
...
def import_blocks(import_root_directory: str):
"""
Import program blocks from the directory to the PLC
parameters | type | description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_blocks(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Program blocks")
"""
...
def import_plc_tags(import_root_directory: str):
"""
Import tags from the directory to the PLC
parameters | type | description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_plc_tags(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\PLC tags")
"""
...
def import_data_types(import_root_directory: str):
"""
Import user data types from the directory to the PLC
parameters | type | description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_data_types(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\PLC data types")
"""
...
def import_technology_objects(import_root_directory: str):
"""
Import technology objects from the directory to the PLC
parameters | type | description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_technology_objects(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Technology objects")
"""
...
def import_watch_tables(import_root_directory: str):
"""
Import watch tables from the directory to the plc
parameters | type | description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_watch_tables(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Watch and force tables")
"""
...
def import_software_units(import_root_directory: str):
"""
Import software units from the directory to the PLC
parameters | type | description |
---|---|---|
import_root_directory | str | Directory of the import folder |
plc.import_software_units(import_root_directory = "C:\\ws\\importfolder\\PLC_1\\Software Units")
"""
...
def safety_print(print_file: str) -> bool:
"""
Create a safety printout of the PLC and prints it to a file
if the file already exists, it is overridden.
Returns -> bool
Returns true on success
parameters | type | description |
---|---|---|
print_file | str | Full path of the printout file |
plc.safety_print(print_file = "C:\\ws\\safetyprint\\F_PLC_Printout.pdf")
"""
...
class PlcTag: def get_name() -> str: """ Get the name of the PLC tag
Returns -> 'str' Name of the plc tag
name = plc_tag.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the PLC tag
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the PLC Tag |
property_value = plc_tag.get_property(name = "DataTypeName")
"""
...
def export(target_directory_path: str, export_options: int, keep_folder_structure: bool):
"""
Export the PLC tag exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
plc_tag.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
class PlcTagTable: def get_name() -> str: """ Get the name of the PLC tag table
Return -> 'str' Name of the plc tag table
name = table.get_name()
"""
...
def export(target_directory_path: str, export_options: int, keep_folder_structure: bool):
"""
Export the PLC tag table exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
table.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def get_plc_tags() -> List[PlcTag]:
"""
Get the list of PLC tags
Returns -> List[PlcTag]
List of the PLC tags
plctags = table.get_plc_tags()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the PLC tag table
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the PLC tag table |
property_value = table.get_property(name = "CreationDate")
"""
...
def get_user_constants() -> List[UserConstant]:
"""
Get the list of the user constants
Returns -> List[UserConstant]
List of the PLC constants
constants = table.get_user_constants()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the PLC tag table filter -> integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
table.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
class Portal: def get_process_id() -> int: """ Get the TIA Portal process ID
Returns -> int
TIA Portal process id
id = portal.get_process_id()
"""
...
def get_server_project_names(server_alias: str) -> List[str]:
"""
Get all the project names from the selected project server
Returns -> List[str]
Names of the projectnames
parameters | type | description |
---|---|---|
server_alias | str | Server alias |
project_names = portal.get_server_project_names(server_alias)
"""
...
def create_local_session(server_name: str, project_name: str, session_name: str, session_directory: str, exclusive: bool) -> str:
"""
Opens a TIA Portal local session and retuns the project
Warning: only ungrouped server projects are supported or can be retrieved.
Returns -> str TIA Portal project local session fullpath
parameters | type | description |
---|---|---|
server_name | str | Server Name |
project_name | str | Name of the project |
session_name | str | Name of the session |
session_directory | str | Local path of the session directory |
exclusive | bool | Default: true Opens exclusive session |
local_session_project_path = portal.create_local_session(server_name = "Local Project Server", project_name = "MyServerProject", session_name ="myLocalSession", session_directory = "C:\\ws\\sessionDir", exclusive = False )
"""
...
def open_project(project_file_path: str, server_project_view: bool) -> Project:
"""
Open a TIA Portal project, local session or a server view
Returns -> Project
TIA Portal project
parameters | type | description |
---|---|---|
project_file_path | str | Full path of the project file |
server_project_view | str | Default: false. If server project and set to true openns in server project view |
project = portal.open_project(project_file_path = "C:\\ws\\testproj\\testproj.ap17")
"""
...
def open_project_with_copy(project_file_path: str, target_directory_path: str, delete_existing_project: bool) -> Project:
"""
Open a TIA Portal project or local session
Returns -> Project
TIA Portal project
parameters | type | description |
---|---|---|
project_file_path | str | Full path of the project file |
target_directory_path | str | Temporary path where the project should be copied before opened |
delete_existing_project | bool | Defines if the temporary project should be deleted |
project = portal.open_project_with_copy(project_file_path = "C:\\ws\\testproj\\testproj.ap17", target_directory_path = "C:\\ws\\temp" , delete_existing_project = True)
"""
...
def retrieve_archive(target_directory_path: str, archive_file_path: str, delete_existing_project: bool) -> Project:
"""
Retrieve a TIA Portal project archive
Returns -> Project
TIA Portal project
parameters | type | description |
---|---|---|
target_directory_path | str | Temporary path where project should be copied before opened |
archive_file_path | str | Full path of the archived project file |
delete_existing_project | bool | Defines if the temporary project should be deleted |
project = portal.retrieve_archive(archive_file_path = "C:\\ws\\testproj\\testproj.zap17", target_directory_path = "C:\\ws\\temp" , delete_existing_project = True)
"""
...
def create_project(target_directory_path: str, project_name: str, delete_existing_project: bool) -> Project:
"""
Create a new TIA Portal project
Returns -> Project
TIA Portal project
parameters | type | description |
---|---|---|
target_directory_path | str | Temporary path where project should be copied before opened |
project_name | str | Name of the new project |
delete_existing_project | bool | Defines if the temporary project should be deleted |
project = portal.create_project(target_directory_path = "C:\\ws\\temp" , project_name = "MyNewProject" delete_existing_project = True)
"""
...
def get_project() -> Project:
"""
Get opened TIA Portal project of the current TIA Portal instance
Returns -> Project
TIA Portal project
project = portal.get_project()
"""
...
def get_global_library_infos() -> List[GlobalLibraryInfo]:
"""
Get a list of global library infos of the current TIA Portal instance
Returns -> List[GlobalLibraryInfo]
List of the global library information
global_lib_infos = portal.get_global_library_infos()
for info in global_lib_infos:
...
"""
...
def open_global_library(library_name: str) -> GlobalLibrary:
"""
Open global library
Returns -> GlobalLibrary
Global Library
parameters | type | description |
---|---|---|
library_name | str | Name of the global library |
global_lib = portal.open_global_library(library_name = "GlobalLib1")
"""
...
def open_global_library_by_path(library_path: str) -> GlobalLibrary:
"""
Open user global library Only user global libraries can be opened
Returns -> GlobalLibrary
Global Library
parameters | type | description |
---|---|---|
library_path | str | Full path of the global library |
global_lib = portal.open_global_library_by_path(library_path = "C:\\ws\\testlib\\testlib.al17")
"""
...
def open_global_library_with_copy(target_directory_path: str, library_path: str, delete_existing_project: bool) -> GlobalLibrary:
"""
Open user global library
Returns -> GlobalLibrary
Global Library
parameters | type | description |
---|---|---|
target_directorypath | str | Temporary path where the library should be copied before opened |
library_path | str | Full path of the global library |
delete_existing_project | bool | Defines if the temporary project should be deleted |
global_lib = portal.open_global_library_with_copy(target_directorypath = "C:\\ws\\temp", library_path = "C:\\ws\\testlib\\testlib.al17", , delete_existing_project = True)
"""
...
def retrieve_archive_library(target_directory_path: str, archive_file_path: str, delete_existing_project: bool) -> GlobalLibrary:
"""
Retrieve a TIA Portal library archive
Returns -> GlobalLibrary
Global Library
parameters | type | description |
---|---|---|
target_directory_path | str | Temporary path where library should be copied before opened |
archive_file_path | str | Full path of the archived library file |
delete_existing_project | bool | Defines if the temporary project should be deleted |
global_lib = portal.retrieve_archive_library(archive_filepath = "C:\\ws\\testproj\\testlib.zal17", target_directorypath = "C:\\ws\\temp" , delete_existing_project = True)
"""
...
def close_portal():
"""
Close the TIA Portal instance
portal.close_portal()
"""
...
def close_local_session():
"""
Close the TIA Portal local session
portal.close_localsession()
"""
...
def close_commit_local_session(comment: str) -> int:
"""
Close and commit changes of the local session
Returns -> int
Revision number
parameters | type | description |
---|---|---|
comment | str | Comment provided by user |
rev_number = portal.close_and_commit_local_session(comment = "Some example changes")
"""
...
def delete_local_session():
"""
Delete the local session
portal.delete_local_session()
"""
...
def close_global_library(global_library_name: str):
"""
Close the global library instance
parameters | type | description |
---|---|---|
global_library_name | str | Name of the global library |
portal.close_global_library(global_library_name = "GlobalLib1")
"""
...
def show_online_finger_prints(mode: str, pc_interface: str, ip_address: str):
"""
Close the global library instance
parameters | type | description |
---|---|---|
mode | str | Configuration mode |
pci_interface | str | PC Interface name |
ip_address | str | IP adress |
portal.show_online_finger_prints(mode = "PN/IE", pci_interface = "PLCSIM", ip_address = "192.168.0.10")
"""
...
def get_project_server_infos( host_filter: str) -> List[ProjectServer]:
"""
Get list of the Project servers
Returns -> List[ProjectServer]
List of project server information object
parameters | type | description |
---|---|---|
host_filter | str | Name of the global library |
portal.get_project_server_infos()
"""
...
def get_project_server_info(url: str) -> ProjectServer:
"""
Get the Project server information found by URL
Returns -> ProjectServer
Project server information object
parameters | type | description |
---|---|---|
url | str | URL of the server |
portal.get_project_server_info(url = "https://denbgm67021srv.ad001.siemens.net:8735/")
"""
...
def set_upgrader_log(project_name: str):
"""
Set name of the current executed upgrade process instance (Only for TIA Portal Project Upgrader)
(Only for Tia Portal Project Upgrader)
parameters | type | description |
---|---|---|
project_name | str | name of the project |
""" | ||
... |
class Product: def get_name() -> str: """ Get the name of the TIA Portal product
Returns -> str
Name of the siemens product
product_name = product.get_name()
"""
...
def get_release() -> str:
"""
Get the release of the TIA Portal product
Returns -> str
Release tag of the siemens product
product_release = product.get_release()
"""
...
def get_version() -> str:
"""
Get the version of the TIA Portal product
Returns -> str
Version of the siemens product
product_version = product.get_version()
"""
...
class ProductBundle: def get_title() -> str: """ Get the title of the TIA Portal Bundle
Returns -> str
Title of the siemens bundle
bundle_title = bundle.get_title()
"""
...
def get_release() -> str:
"""
Get the release of the TIA Portal Bundle
Returns -> str
Release of the siemens bundle
bundle_release = bundle.get_release()
"""
...
def get_products() -> List[Product]:
"""
Get the list of products of the TIA Portal Bundle
Returns -> List[Product]
List of siemens products
bundle_products = bundle.get_products()
"""
...
class ProgramBlock: def get_name() -> str: """ Get the name of the program block
Returns -> str
Name of the program block
name = programblock.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the program block
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the program block |
property_value = programblock.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: int, keep_folder_structure: bool):
"""
Export the program block exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
programblock.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def is_consistent() -> bool:
"""
Check if the program block is consistent
Returns -> bool
True if consistent
value = programblock.is_consistent()
"""
...
def compile():
"""
Compile the program block
programblock.compile()
"""
...
def can_generate_source() -> bool:
"""
Check if the program block is able to be generated as source
Returns -> bool
True if can generate source
value = programblock.can_generate_source()
"""
...
def generate_source(target_directory_path: str, keep_folder_structure: bool):
"""
Generate the external source of the program block
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
programblock.generate_source(target_directory_path = "C:\\ws\\exportfolder")
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the program block filter -> integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
programblock.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
class Project: def get_portal() -> Portal: """ Get the TIA Portal instance from the current project
portal = project.get_portal()
"""
...
def save():
"""
Save the TIA Portal project
project.save()
"""
...
def close():
"""
Close the TIA Portal project
project.close()
"""
...
def set_simulation_support(value: bool):
"""
Set the simulation support for the TIA Portal project
parameters | type | description |
---|---|---|
value | bool | Set the value of the simulation support |
project.set_simulation_support(value = True)
"""
...
def archive(target_directory_path: str, archive_name: str, delete_existing_archive: bool) -> str:
"""
Archive the TIA Portal project
Returns -> str
Full path of the new archive
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path where archive should be placed |
archive_name | str | name of the archive file |
delete_existing_archive | bool | Set if the output file should be deleted first |
archive_fullpath = project.archive(target_directory_path = "C:\\ws\\newfolder", archive_name = "testproj" , delete_existing_archive = True)
"""
...
def save_as(target_directory_path: str, project_name: str) -> str:
"""
Save the TIA Portal project under another path and name
Returns -> str
Full path of the saved project
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path where project should be saved |
project_name | str | Name of the project name |
project_file_path = project.save_as(target_directory_path = "C:\\ws\\newfolder", project_name = "testproj")
"""
...
def export_cax_data(export_file_path: str, log_file_path: str) -> bool:
"""
Export the CAx data of the TIA Portal project
Returns -> bool
Result state of the export
parameters | type | description |
---|---|---|
export_file_path | str | Full path of the export file |
log_file_path | str | Full path of the log file |
result = project.export_cax_data(export_file_path = "C:\\ws\\exportfolder\\exportCAX.aml", log_file_path = "C:\\ws\\exportfolder\\exportCAX.log")
"""
...
def import_cax_data(import_file_path: str, log_file_path: str) -> bool:
"""
Import CAx data to the TIA Portal project
Returns -> bool
Result state of the import
parameters | type | description |
---|---|---|
import_file_path | str | Fullpath of the import file |
log_file_path | str | Fullpath of the log file |
result = project.import_cax_data(import_file_path = "C:\\ws\\importfolder\\importCAX.aml", log_file_path = "C:\\ws\\importfolder\\importCAX.log")
"""
...
def open_topology_editor():
"""
Open the topology editor in TIA Portal for the TIA Portal project
project.open_topology_editor()
"""
...
def open_network_editor():
"""
Open the network editor in TIA Portal for the TIA Portal project
project.open_network_editor()
"""
...
def get_plcs() -> List[Plc]:
"""
Get a list of PLCs in the TIA Portal project
Returns -> List[Plc]
All PLC's as list
plcs = project.get_plcs()
for plc in plcs:
...
"""
...
def get_hmis() -> List[Hmi]:
"""
Get a list of HMIs in the TIA Portal project
Returns -> List[Hmi]
All HMI's as list
hmis = project.get_hmis()
for hmi in hmis:
...
"""
...
def get_application_tests() -> List[ApplicationTest]:
"""
Get a list of Test Suite application tests in the TIA Portal project
Test Suite is required.
Returns -> List[ApplicationTest]
All Application tests as list
tests = project.get_application_tests()
"""
...
def get_system_tests() -> List[SystemTest]:
"""
Get a list of Test Suite system tests in the TIA Portal project
Test Suite is required.
Returns -> List[SystemTest]
All System tests as list
tests = project.get_system_tests()
"""
...
def get_rule_sets() -> List[RuleSet]:
"""
Get a list of Test Suite rule sets in the TIA Portal project
Test Suite is required.
Returns -> List[RuleSet]
All Rule sets as list
rulesets = project.get_rule_sets()
"""
...
def get_project_library() -> ProjectLibrary:
"""
Get the project library
Returns -> ProjectLibrary
Project library
project_lib = project.get_project_library()
"""
...
def web_block_generate():
"""
Web block DB generate according the user define pages (Web server must activated)
project.web_block_generate()
"""
...
def upgrade_hardware(full_upgrade: bool):
"""
Upgrade the devices to the latest order number and firmware version
If full_upgrade
is set to True, all devices will be changed to the newest available order number (Device type) and firmware:
from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FK00-0AB0 V1.8. With full upgrade: from CPU1511F 6ES7 511-1FK00-0AB0 V1.7 to 6ES7 511-1FL03-0AB0 V3.0.
parameters | type | description |
---|---|---|
full_upgrade | bool | Set if for full upgrade (latest order number and firmware version) |
project.upgrade_hardware(full_upgrade = True)
"""
...
def sivarc_generate():
"""
Generate SiVArc functions (needs SiVArc installed and licensed)
Needs SiVArc installed and licensed.
project.sivarc_generate()
"""
...
def update_module_description():
"""
Update the module description of all devices in the project
project.update_module_description()
"""
...
def set_virtual_plc_support(value: bool):
"""
Set virtual PLC support in the project
Available only in V19 or higher
parameters | type | description |
---|---|---|
value | bool | Set the value of the virtual support |
project.set_virtual_plc_support(value = "True")
"""
...
def import_umac_config(import_file_path: str):
"""
Import UMAC and UMC Configuration to the TIA Portal project
parameters | type | description |
---|---|---|
import_file_path | str | Full path of the import file |
project.import_umac_config(import_file_path = "C:\\ws\\importfolder\\importUMAC.json")
"""
...
def export_umac_config(export_file_path: str):
"""
Export UMAC and UMC configuration from the TIA Portal project
if export file already exists, it will be overwritten
parameters | type | description |
---|---|---|
export_file_path | str | Full path of the import file |
project.export_umac_config(export_file_path = "C:\\ws\\exportfolder\\exportUMAC.json")
"""
...
class ProjectLibrary: def get_type_folder() -> LibraryTypeFolder: """ Get the folder containing library types & library type folders
Returns -> LibraryTypeFolder
Library type folder
typefolder = projectlib.get_type_folder()
"""
...
class ProjectServer: def get_host() -> str: """ Get the host of the Project-Server
Returns -> str
Host
name = server_project.get_host()
"""
...
def get_port() -> int:
"""
Get the port of the Project-Server
Returns -> int
Port number
name = server_project.get_port()
"""
...
def get_server_name() -> str:
"""
Get the server name of the Project-Server
Returns -> str
Server name
name = server_project.get_server_name()
"""
...
def print_info():
"""
Show information of the Project-Server
name = server_project.print_info()
"""
...
class RuleSet: def get_name() -> str: """ Get the name of the rule set
Return -> 'str' Name of the rule set
name = rule.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the rule set
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the Rule set |
property_value = rule.get_property(name = "Name")
"""
...
def export(target_directory_path: str):
"""
Export the rule set
The folder "Style guide" will be automaticcally created on the target_directory_path
, if not already exists.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
rule.export(target_directory_path = "C:\\ws\\export")
"""
...
class SafetyAdministration: def is_logged_on() -> bool: """ Check if the safety administration is logged on to safety offline program
Returns -> bool
Status of login
status = safety_admin.is_logged_on()
"""
...
def is_password_set() -> bool:
"""
Check if the safety administration has a password set for the safety offline program
Returns -> bool
Status if password is set
status = safety_admin.is_password_set()
"""
...
def get_offline_serial_number() -> str:
"""
Get the offline serial number
Returns -> str
Offline serial number
value = safety_admin.get_offline_serial_number()
"""
...
def export_config(target_directory_path: str):
"""
Export the safety administration configuration
The folder "SafetyAdministration" will be automaticcally created on the target_directory_path
, if not already exists.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
safety_admin.export_config(target_directory_path = "C:\\ws\\export")
"""
...
def import_config(import_root_directory: str):
"""
Import the safety administration configuration
parameters | type | description |
---|---|---|
import_root_directory | str | Folder path for the import |
safety_admin.import_config(import_root_directory = "C:\\ws\\exported\\SafetyAdministration")
"""
...
class SoftwareUnit: def get_name() -> str: """ Get the name of the software unit
Return -> 'str' Name of the software unit
name = software_unit.get_name()
"""
...
def export_configuration(target_directory_path: str):
"""
Export the software unit configuration
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
software_unit.export_configuration(target_directory_path = "C:\\ws\\export")
"""
...
def get_plc_tag_tables() -> List[PlcTagTable]:
"""
Get the list of the PLC tag tables
Returns -> List[PlcTagTable]
List of the PLC tag tables of the software unit
pcl_tag_tables = software_unit.get_plc_tag_tables()
"""
...
def get_program_blocks() -> List[ProgramBlock]:
"""
Get the list of the program blocks
Returns -> List[ProgramBlock]
List of the program blocks of the software unit
blocks = software_unit.get_program_blocks()
"""
...
def get_system_blocks() -> List[SystemBlock]:
"""
Get the list of the system blocks
Returns -> List[SystemBlock]
List of the system blocks of the software unit
blocks = software_unit.get_system_blocks()
"""
...
def get_user_data_types() -> List[UserDataType]:
"""
Get the list of the user data types
Returns -> List[UserDataType]
List of the user data types of the software unit
udts = software_unit.get_user_data_types()
"""
...
def get_external_sources() -> List[ExternalSource]:
"""
Get the list of the external sources
Returns -> List[ExternalSource]
List of the external sources of the software unit
ext_sources = software_unit.get_external_sources()
"""
...
def get_named_value_types() -> List[NamedValueType]:
"""
Get the list of the named value types
Returns -> List[NamedValueType]
List of the named value types of the software unit
nvts = software_unit.get_named_value_types()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the software unit object filter -> integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
software_unit.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
class SystemBlock: def get_name() -> str: """ Get the name of the system block
Returns -> str
Name of the system block
name = systemblock.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the system block
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the system block |
property_value = systemblock.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: int):
"""
Export the system block exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
The folder "System blocks" will be automatically created on the target_directory_path
, if not already exists.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
systemblock.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def is_consistent() -> bool:
"""
Check if the system block is consistent
Returns -> bool
True if consistent
value = systemblock.is_consistent()
"""
...
def compile():
"""
Compile the system block
systemblock.compile()
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export cross references of the system block filter -> integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
systemblock.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
class SystemTest: def get_name() -> str: """ Get the name of the system test
Returns -> 'str' Name of the system test
name = sys_test.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the system test
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the system test |
property_value = sys_test.get_property(name = "Name")
"""
...
def export(target_directory_path: str):
"""
Export the system test
The folder "System tests" will be automaticcally created on the target_directory_path
, if not already exists.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
sys_test.export(target_directory_path = "C:\\ws\\export")
"""
...
def set_scope(opcua_server_address: str, opcua_server_interface_type: int, opcua_server_interface_folder_path: str):
"""
Set the scope of the system test
parameters | type | description |
---|---|---|
opcua_server_address | str | OPC UA server adress e.g. opc.tcp://server.port/path |
opcua_server_interface_type | integer (enum) | [1: 'UserDefined', 2: 'StandardSIMATIC'] |
opcua_server_interface_folder_path | str | Folder path to interface files |
sys_test.set_scope(opcua_server_address = "opc.tcp://server.port/path", opcua_server_interface_type = 1 )
"""
...
class TechnologyObject: def get_name() -> str: """ Get the name of the technology object
Returns -> 'str' Name of the technology object
name = to.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the technology object
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the technology obejct |
property_value = to.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: int, keep_folder_structure: bool):
"""
Export the technology object exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
Only V19 and higher: If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
to.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def is_consistent() -> bool:
"""
Check if the technology object is consistent
Returns -> bool
True if consistent
value = to.is_consistent()
"""
...
def compile():
"""
Compile the technology object
to.compile()
"""
...
class UserConstant: def get_name() -> str: """ Get the name of the user constant
Returns -> 'str' Name of the user constant
name = user_constant.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the user constant
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the user Constant |
property_value = user_constant.get_property(name = "Name")
"""
...
def export(targetdirectorypath: str, exportoptions: int, keep_folder_structure: bool):
"""
Export the user constant exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
user_constant.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
class UserDataType: def get_name() -> str: """ Get the name of the user data type
Returns -> 'str' Name of the user data type
name = udt.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the user data type
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the user data type |
property_value = udt.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, exportoptions: int, keep_folder_structure: bool):
"""
Export the user data type exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
udt.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def is_consistent() -> bool:
"""
Check if the user data type is consistent
Returns -> bool
True if consistent
value = udt.is_consistent()
"""
...
def compile():
"""
Compile the user data type
udt.compile()
"""
...
def generate_source(target_directory_path: str, keep_folder_structure: bool):
"""
Generate the external source of the user data type
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
udt.generate_source(target_directory_path = "C:\\ws\\exportfolder")
"""
...
def export_cross_references(target_directory_path: str, filter: int):
"""
Export the cross references of the user data type filter -> integer - [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects']
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
filter | integer (enum) | [1: 'AllObjects', 2: 'ObjectsWithReferences', 3: 'ObjectsWithoutReferences', 4: 'UnusedObjects'] |
udt.export_cross_references(target_directory_path = "C:\\ws\\exportcrossreferences", filter = 2)
"""
...
class WatchTable: def get_name() -> str: """ Get the name of the watch table
Returns -> 'str' Name of the watch table
name = watch_table.get_name()
"""
...
def get_property(name: str) -> str:
"""
Get the property of the watch table
Properties which are not string will be converted to string if possible.
Returns -> str
Value of the property as string
parameters | type | description |
---|---|---|
name | str | Property name of the watch table |
property_value = watch_table.get_property(name = "CreationDate")
"""
...
def export(target_directory_path: str, export_options: int, keep_folder_structure: bool):
"""
Export the watch table exportoptions -> integer - [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly']
If keep_folder_structure
is set to True, all group names are represented hierarchically with folders.
parameters | type | description |
---|---|---|
target_directory_path | str | Folder path for the export |
export_options | integer (enum) | [1: 'WithDefaults', 2: 'None', 3: 'WithReadOnly'] |
keep_folder_structure | bool | True: All group names are represented hierarchically with folders |
watch_table.export(target_directory_path = "C:\\ws\\export", export_options = 1)
"""
...
def is_consistent() -> bool:
"""
Check if the watch table is consistent
Returns -> bool
True if consistent
value = watch_table.is_consistent()
"""
...