-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapax.yml
121 lines (113 loc) · 7.35 KB
/
apax.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# General information
name: "ae-hw-engineering"
version: 1.0.0
type: app
# Description will be displayed in the apax extension
description: This reposetory contains an example project to demonstrate how to IT-like hardware configuration with SIMATIX AX.
# Build targets
targets:
- "1500"
# "@ax/opcua-server-config": 1.0.0
# Dependencies
devDependencies:
"@ax/sdk": 2411.2.0
"@ax/hwc": 2.1.0
"@ax/hwld": 2.1.0
"@ax/hw-s7-1500": 2.1.0
# Project variables
variables:
APAX_BUILD_ARGS:
- --debug # Enable debug information for value debugging
# Folder where to find the compiled HW artifacts
HW_BIN_FOLDER: ./hwbin
# Folder where to find the compiled SW artifacts
SW_BIN_FOLDER: "./bin/1500"
# Choose your target RT, here : any S7-1500 PLC
# IP address must match with the IP address of your target device
# The IP address in the .vscode/launch.json must be equal
IP_ADDRESS: "192.168.0.10"
# The master password for protection of confidential PLC configuration data
# DISCLAIMER: Storing and publishing passwords in readable form is not a best practice. It is only done here to simplify the demonstration
# Please use a password that is case sensitive (1 big and 1 small letter), a special character and a number.
MASTER_PW: "Demo#123"
# The locations of the certificate files
TLS_CONNECT_CERTFILE: "certificate/reference_x509.crt"
TLS_IMPORT_CERTFILE: "certificate/containerWithPublicAndPrivateKeys_x509.p12"
# The password (or passphrase) to open containerWithPublicAndPrivateKeys_x509.p12 used when importing the certificate.
# DISCLAIMER: Storing and publishing passwords in readable form is not a best practice. It is only done here to simplify the demonstration
CERT_PASSPHRASE: "!S71500"
# The name of the plc as specified in the plc configuration
# The name should be specified before creating the plc security file, as the files are assigned using the plc name.
PLC_NAME: "cpu1516v31"
# The users names as specified in the plc configuration
USER_1_NAME: "Adam"
USER_2_NAME: "Otto"
# The passwords for users as specified in the plc configuration.
# DISCLAIMER: Storing and publishing passwords in readable form is not a best practice. It is only done here to simplify the demonstration.
USER_1_PASSWORD: "A123456z"
USER_2_PASSWORD: "O123456z"
# Apax scripts
scripts:
############### Inital runs for PLC / PLC Name changes ###########################
hw_install_gsd: hwc install-gsd -i hwc/gsd
hw_print_catalog: hwc get-supported-devices > hw_catalog.txt
# The bash function provide the easy creation of certificates via open ssl and then moves the certificate to the certificate folder.
# In order to call the script, the access level must be authorized at the beginning.
create_certificate:
- chmod +x certificate/createCertificateViaOpenSSL.sh
- certificate/createCertificateViaOpenSSL.sh
- echo "set in the apax.yml the variable CERT_PASSPHRASE to the value that you insert as password of import of certificate"
# Creates the file for the security configuration for the PLC
hwc_setup_secure_communication: hwc setup-secure-communication --module-name $PLC_NAME --input hwc --master-password:$MASTER_PW
# Imports the certificate for TLS (Transport Layer Security) communication in the project to the PLC
hwc_import_certificate:
- hwc import-certificate --module-name $PLC_NAME --input hwc --certificate $TLS_IMPORT_CERTFILE --passphrase $CERT_PASSPHRASE --purpose TLS
- hwc import-certificate --module-name $PLC_NAME --input hwc --certificate $TLS_IMPORT_CERTFILE --passphrase $CERT_PASSPHRASE --purpose OpcUAServer
- hwc import-certificate --module-name $PLC_NAME --input hwc --certificate $TLS_IMPORT_CERTFILE --passphrase $CERT_PASSPHRASE --purpose WebServer
# Creates the default user for the PLC
hwc_add_user:
- hwc manage-users --input hwc --module-name $PLC_NAME set-password --username $USER_1_NAME --password $USER_1_PASSWORD
- hwc manage-users --input hwc --module-name $PLC_NAME set-password --username $USER_2_NAME --password $USER_2_PASSWORD
##################################################################################
hw_generate_config_templates:
#s71500 cpu1516-3pn/dp v3.1
- apax hwc generate-template-file --order-number "6ES7 516-3AP03-0AB0" --version "V3.1" --output hwc/hw_templates/cpu1516_v3_1
#et200sp im155-6-pn-hf v3.3
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.45-SIEMENS-ET200SP-20241104.XML" --gsd-id "DIM HF V3.3" --output hwc/hw_templates/et200sp_im_155_6_pn_hf_v3_3
#et200sp im155-6-pn-st v4.1
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.45-SIEMENS-ET200SP-20241104.XML" --gsd-id "DIM ST V4.1" --output hwc/hw_templates/et200sp_im_155_6_pn_st_v4_1
#et200sp di8-st v1.1
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.45-SIEMENS-ET200SP-20241104.XML" --gsd-id "DI 8x24VDC ST V1.1" --output hwc/hw_templates/et200sp_di8x24vdcst_v1_1
#et200sp dq8-st v1.1
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.45-SIEMENS-ET200SP-20241104.XML" --gsd-id "DQ 8x24VDC/0,5A ST V1.1" --output hwc/hw_templates/et200sp_dq8x24VDC_v1_1
#et200sp server module
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.45-SIEMENS-ET200SP-20241104.XML" --gsd-id "Servermodule_without_io" --output hwc/hw_templates/et200sp_servermod_wo_io
#scalance x208 v4.2
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.33-Siemens-002A-SCALANCE_X200-20170328-103700.XML" --gsd-id "DAP 3D" --output hwc/hw_templates/scalancex208
#et200s IM151-3 PN HF V7.0
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.25-SIEMENS-ET200S-20191007.XML" --gsd-id "DIM 20" --output hwc/hw_templates/et200s_im151_3_pn_hf_v7_0
#et200s PM-E DC24V
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.25-SIEMENS-ET200S-20191007.XML" --gsd-id "7" --output hwc/hw_templates/et200s_pm_dc24v
#et200s 2DO DC24V/0.5A HF
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.25-SIEMENS-ET200S-20191007.XML" --gsd-id "161" --output hwc/hw_templates/et200s_dq2x24v_hf
#et200s 2DI DC24V HF
- apax hwc generate-template-file --gsd-file-name "GSDML-V2.25-SIEMENS-ET200S-20191007.XML" --gsd-id "1" --output hwc/hw_templates/et200s_di2x24v_hf
# Compile the hardware description (input:sources) to target specific data (output:binaries) and update the IO- and HwIdent mapping (SystemConstants)
hw_compile: hwc compile --input hwc --output $HW_BIN_FOLDER
# load the target specific hardware data (binaries) to the PLC
init_hw_load: hwld --input $HW_BIN_FOLDER/$PLC_NAME -t $IP_ADDRESS --accept-security-disclaimer -M:$MASTER_PW
hw_load: hwld --input $HW_BIN_FOLDER/$PLC_NAME -t $IP_ADDRESS --accept-security-disclaimer -C $TLS_CONNECT_CERTFILE -u:$USER_1_NAME -p:"$USER_1_PASSWORD" -r
hw_compile_and_load:
- apax hw_compile
- apax hw_load
# Call 'apax load' to download the builded program to the target. An 'apax build' might be required upfront
sw_load: sld load --input $SW_BIN_FOLDER --target $IP_ADDRESS --restart --accept-security-disclaimer --log debug -C $TLS_CONNECT_CERTFILE -u:$USER_1_NAME -p:"$USER_1_PASSWORD"
# Call 'apax dlplc' to build and download the application to the target
dlplc:
- apax build
- apax sw_load
# Compiles the hardware and software and then loads it onto the PLC
compile_and_load_all:
- apax hw_compile
- apax hw_load
- apax dlplc