PROFIdrive Example
Table of Contents:
- 1 PROFIdrive Example
- 1.1 Predefined Example Configuration
- 1.2 Custom Example Configuration
- 1.2.1 Board Configuration
- 1.2.2 Motor-specific Configuration
- 1.2.3 PROFINET-IO Device Protocol Stack Configuration
- 1.2.3.1 Identification and Maintenance Data
- 1.2.3.2 PROFINET Device Type
- 1.2.3.3 PROFIdrive Module Configuration
- 1.2.4 PROFIdrive-specific Configuration
- 1.2.4.1 Simulation Parameters
- 1.2.4.2 Operation Parameters
- 1.2.4.3 Diagnosis Parameters
- 1.2.4.4 Sensor Interface Parameters
- 1.2.5 Application Class 4 (AC4)
PROFIdrive Example
The example can be used with its pre-defined configurations, which are approved and tested to work with the above-mentioned scenario. All motor and PROFINET/PROFIdrive parameters are pre-set and can be used “as is” for a more straightforward experience. The user can select between two possible motors just by uncommenting a corresponding “define” in the wscript file as described below. However, if any customizations are required, the contents of the “Custom Example Configuration“ section may become useful.
Predefined Example Configuration
The PROFIdrive example comes with preset configurations that can be selected in the build script: “Targets/wscript”. Uncomment one of the options, according to the Motor used (or simulation without motor):
"SIMULATION_WITHOUT_MOTOR", # Simulation mode. Motor is not needed here. Profile Tester tests will run OK.
"MOTOR_EMPAPST_ECI4220K1B100", # Motor type: ECl-42.20-K1-B00, manufacturer: ebm-papst.
"MOTOR_MAXON_ECI30", # Motor type: EC-i 30 30 mm, manufacturer: Maxon.
Simulation Mode: the PROFIdrive example provides an option to “simulate” all the features according to the PROFIdrive standard (Application Class 1 and 4) but without a real Motor connected. Motor’s “Actual Speed” value is simulated mathematically by a “PT1 element” (First Order Lag element). Application Class 4 requires an “Actual position” value which is also simulated in this mode.
Custom Example Configuration
Board Configuration
The MCL_MC_BOARD_CFG_PRM_T
structure contains some board-specific parameters. It provides the possibility to change configuration based on hardware changes and is initialized in “Targets\NXHX90-MC\Sources\FOCInitializer.c”. Normally these parameters are not supposed to be modified because they are tuned for the current NXHX90-MC board which is not expected to be changed once configured properly.
Parameter | Data Type | Meaning | Note |
---|---|---|---|
tMcBoardCfgPrm | MCL_MC_BOARD_CFG_PRM_T | Motor control board's configuration structure | |
flAdcVrefExtPin | float | ADC external reference voltage. The reference voltage determines the highest signal level that the ADC can convert, and all quantized digital outputs from an ADC will be some ratio of this input reference voltage. |
|
tMotorPhaseShuntRes | MCL_MOTOR_PHASE_SHUNT_RES_T | Motor phases shunt resistor structure |
3. Formula: Vmeas_curr = Iph_curr x Rsh x Gcurr_gain Iph_curr: Phase current[A]; Rsh: Shunt resistor[Ω]; Gcurr_gain: Current amp. gain |
| float | Phase A - Current measurement shunt resistor[Ω]. | |
| float | Phase B - Current measurement shunt resistor[Ω]. | |
| float | Phase C - Current measurement shunt resistor[Ω]. | |
tMotorPhaseVoltageDivRes | MCL_MOTOR_PHASE_VOLTAGE_DIV_T | Motor phases voltage divider structure |
Vin: Input voltage Vout: Attenuated signal voltage Rlow_side: Low-side resistor Rhigh_side: High-side resistor |
| MCL_VOLTAGE_DIV_T | Phase A voltage divider structure | |
I. flHighSideResOhm | float | Phase A voltage divider high-side. | |
II. flLowSideResOhm | float | Phase A voltage divider low-side. | |
| MCL_VOLTAGE_DIV_T | Phase B voltage divider structure | |
I. flHighSideResOhm | float | Phase B voltage divider high-side. | |
II. flLowSideResOhm | float | Phase B voltage divider low-side. | |
| MCL_VOLTAGE_DIV_T | Phase C voltage divider structure | |
I. flHighSideResOhm | float | Phase C voltage divider high-side. | |
II. flLowSideResOhm | float | Phase C voltage divider low-side. | |
flManualCtrlPotValOhm | float | NXHX90-MC board potentiometer resistance [Ω]. |
|
tMcBoardLimits | MCL_MC_BOARD_LIMIT_T | NXHX90-MC Board’s limits |
|
| float | Maximum ADC pin reference voltage [V]. |
|
| float | Maximum phase current [A]. |
|
| float | Maximum phase shunt resistance [Ω]. |
|
Motor-specific Configuration
The Motor-specific parameters are typically found in the Manufacturer's specification for the motor. In the PROFIdrive example, this configuration is found in the structure
The parameters defined by the following structure affects fundamental motor behavior - torque, speed, etc. Some of them require experimental fine-tuning for acquiring the best results. For the pre-defined motors provided with this example all the parameters have been already inspected and fine-tuned. However, if a new motor is to be adapted, those parameters might/should be changed accordingly. Not setting proper values may result in the motor producing strange sounds and heat. Please keep the motor under continuous supervision until the parameters are being adapted prove to be right.
FOC_USER_CFG_INITIALIZER
(in Targets/NXHX90-MC/FOCInitializer.c).
Parameter | Data Type | Meaning | Note |
---|---|---|---|
bMotorPolePairs | uint8_t | Number of Motor pole pairs. |
|
flMaxPhaseCurrAmp | float | Max continuous motor phase current[A]. |
|
usMotorSvpwmFreqHz | uint16_t | Space-Vector modulation PWM working frequency[Hz]. |
|
tMotorSpeedCfg | MCL_MOTOR_SPEED_CFG_T | Motor speed configuration structure |
|
| uint16_t | Minimum speed value - used for “stall” detection. |
|
| uint16_t | Nominal speed of the Motor [rpm]. |
|
| uint16_t | Maximum speed of the Motor [rpm]. Setting speed to greater values will result in error. |
|
tSpeedPiCtrlCfg | MCL_PI_CTRL_CFG_T | Motor speed PI control parameters structure |
|
| float | Proportional gain - Kp | |
| float | Integral gain - Ki | |
tTorquePiCtrlCfg | MCL_PI_CTRL_CFG_T | Motor torque PI control parameters structure |
|
| float | Proportional gain - Kp | |
| float | Integral gain - Ki | |
usQeiNumOfSlots | uint16_t | Maximum counts per revolution (Encoder resolution). |
|
eQeiMotorEncSrc | MCL_QEI_MOTOR_ENC_SRC_E | Connected encoder source to the NXHX-DH adapter.
|
|
eQeiInvMotorEncDir | MCL_QEI_INV_ENC_DIR_E |
|
|
fInvMotorDir | bool | Invert the direction of rotation. If “false” positive speed values refer to clockwise rotation, negative - counter clockwise. If “true” - positive speed values refer to counter clockwise direction of rotation. |
|
PROFINET-IO Device Protocol Stack Configuration
The data described below can be found in “Targets\NXHX90-MC\Sources\main.c”.
Identification and Maintenance Data
Identification & Maintainance Data are found at the static structure (in file “Targets\NXHX90-MC\Sources\main.c”):
PNS_IF_IM0_DATA_T tIM0_Data
Parameter | Data Type | Meaning |
---|---|---|
abManufacturerSpecific | uint8_t | Unused on Profinet, set to zero. |
abOrderId | uint8_t | Order ID. Space(0x20) padded. |
abSerialNumber | uint8_t | Serial number. Space(0x20) padded. |
tSoftwareRevision | struct | Software revision: PrefixX.Y.Z. |
| uint8_t | /** Type Recogninition / Prefix
*
* Allowed values:
* -# 'V' officially released version
* -# 'R' Revision
* -# 'P' Prototype
* -# 'U' Under Test (field test)
* -# 'T' Test Device
*/ |
| uint8_t | Functional enhancement. |
| uint8_t | Bug fix. |
| uint8_t | Internal change. |
usIMSupported | uint16_t |
|
usIMVersion | uint16_t | I&M Version. |
usManufacturerId | uint16_t | Manufacturer ID as assigned by PNIO/PROFIBUS office. |
usProfileId | uint16_t | Profile ID (default 0xF600). |
usProfileSpecificType | uint16_t | Profile specific type (optional). |
PROFINET Device Type
PROFINET Device Type data is found at the static structure (in file “Targets\NXHX90-MC\Sources\main.c”):
Parameter | Data Type | Meaning |
---|---|---|
ptSubmoduleList | PNS_SUB_LIST_ENTRY* | Pointer to a structure describing module configuration needed to meet the PROFIdrive standard. |
ptIM0_Data | PNS_IF_IM0_DATA_T* | Pointer to an Identification and Maintainance structure. |
szDeviceType | char* | Device type string, e.g. "NETX 90 RE/PNS“. |
ulDeviceTypeLen | uint32_t | Length of the device type string. |
szNameOfStation | char* | PROFINET Name of Station string, e.g. "netx90repns". |
ulNameOfStationLen | uint32_t | Length of the Name of Station string. |
szTypeOfStation | char* | PROFINET Type of Station string, e.g. "NETX 90 RE/PNS". |
ulTypeOfStationLen | uint32_t | Length of the Type of Station. |
ulApplyOutputsDuration | uint32_t | The time it takes to apply the Controller Outputs (e.g. speed setpoint). This affects IRT mode only (PROFIdrive Standard Telegram 3, AC4). |
PROFIdrive Module Configuration
The application example V4.0.0.1 supports PROFIdrive Standard Telegrams 1 and 2 (AC1 only). V4.1.0.0 supports Standard Telegram 3 as well (for AC4). The corresponding module/submodule configuration is described by the array:
in “Targets\NXHX90-MC\Sources\main.c”.
This configuration matches the GSDML provided with the example.
GSDML for Application example V4.0.0.1 (GSDML-V2.43-HILSCHER-NETX 90-RE PNS_PROFIdrive-20200402.xml);
GSDML for Application example V4.1.0.0 (GSDML-V2.43-HILSCHER-NETX 90-RE PNS_PROFIdrive-20230728.xml).
The PROFIdrive Module/Submodules data within the application example code (in main.c) should NOT be changed as they match the PROFIdrive specification.
The GSDML is to be imported to the Profile Tester (PRONETA), TIA Portal (for configuring a Siemens Controller or a CP1616 board) or SYCON.net.
PROFIdrive-specific Configuration
PROFIdrive-specific parameters are held by the structure:
in “Targets\NXHX90-MC\Sources\main.c”.
It includes the simulation, operation parameters and diagnosis parameters parameters. In the PROFIdrive application example V4.1.0.0 (that supports AC4) also sensor interface parameters are included.
Simulation Parameters
These matter ONLY in Simulation Mode (SIMULATION_WITHOUT_MOTOR should be uncommented in “Targets/wscript”). They are defined in the structure:
Parameter | Data Type | Meaning |
---|---|---|
bSimulationMode | PDRV_BOOL | If TRUE - simulation without motor. Output speed is computed by a First-order lag element based on the input setpoint speed. All PROFIdrive features are functional, Profile Tester (PRONETA) tests run successfully. If FALSE - a motor is driven via Field Oriented Control (FOC). |
sPT1GainFactor | Array of two PDRV_INT16-s. | Gain factor (data type N4 - PROFIdrive normalized value) for computing the output speed in simulation mode based on the input setpoint. An array of two values:
|
Operation Parameters
The operation parameters are defined in the structure:
Parameter | Data Type | Meaning |
---|---|---|
PDRV_UINT16 | PROFIdrive Standard Telegram number. Supported are 1, 2 and 3. | |
fltVelocityReferenceValue | float | Physical value in [rpm]. For normalized data type (such as the cyclic data values for the control/actual speed transmitted on the bus from/to the PROFINET Controller), this is the speed corresponding to 100%. Here the nominal speed in [revolutions per minute] of the motor is usually used, e.g. 4000 for ECI-42.40-K1-B00. |
fltVelocityMax | float | Maximum velocity [rpm] allowed to set to the motor drive. |
lRampGradient | PDRV_INT32 | Step in [% / ms] to increase/decrease the speed in case of normal operation. This parameter is used by the Ramp Generator in the PROFIdrive application. When a speed is set (by the Controller), a “ramp” is calculated increasing/decreasing the speed with this step. |
lNTolerance | PDRV_INT32 | Tolerance for calculation of “speed error in tolerance range” of Status Word 1 (ZSW1) bit 8 (PROFIdrive spec V4.2, Table 146). Bit 8 meaning: 0 - Speed in tolerance 1 - Speed out of tolerance |
usTmax | PDRV_UINT16 | Time in [ms] to get in the tolerance for speed. |
lRampDown | PDRV_INT32 | Ramps in [%/ms] during [0]=ramp stop, [1]=quick stop. |
lCompVal | PDRV_INT32 | Comparison value to calculate ZSW Bit 10 [N4]. |
For example, the operation parameters for ECI-42.20-BK1S.G7 are:
Parameter | Value |
---|---|
usTelegramNo | 1 (Standard Telegram 1. Can also be 2.) |
fltVelocityReferenceValue | 4000 rpm |
fltVelocityMax | 5000 rpm |
lRampGradient | 0x0010 (N2 value, PROFIdrive spec V4.2, Table 3) 16 (dec) * 0.0061% = 0.0976 %/ms → 3.9 rpm/ms Acceleration/deceleration from 0 to 4000 rpm in: 4000 / 3.9 = 1025 ms. |
lNTolerance | 0x0100 → 256 (dec) * 0.0061 = 1.56 %/ms = 62.4 rpm/ms |
usTmax | 100 ms |
lRampDown [0] | = Ramp gradient 3.9 rpm/ms |
lRampDown [1] | Quick stop 0x0020 (N2 value, PROFIdrive spec V4.2, Table 3) 32 (dec) * 0.0061% = 0.1952 %/ms → 7.8 rpm/ms Deceleration from 4000 to 0 rpm in: 4000 / 7.8 = 512 ms. |
lCompVal |
|
Diagnosis Parameters
The diagnostic parameters are defined in the structure:
Parameter | Data Type | Meaning |
---|---|---|
m_tWarningAttribs | PDRV_WARNINGATTRIBS | An array |
m_tFaultAttribs | PDRV_FAULTATTRIBS | The value for the velocity reference in [rpm] (100% value) for N2/N4 normalized speed setpoint and actual values. |
In “Targets\NXHX90-MC\Sources\main.c”, the user may define their own array of warnings and faults (with fault code and Controller reactions). In the static arrays:
the application example provides exemplary values.
Sensor Interface Parameters
The Sensor parameters are defined in the structure:
Parameter | Data Type | Meaning |
---|---|---|
ulHeader | PDRV_UINT32 | Corresponds to Parameter 979, Subindex 0 (Header). See PDRV Specification, Table 103. This PROFIdrive example application supports one sensor only. |
ulSensorType | PDRV_UINT32 | Corresponds to Parameter 979, Subindex 1 (Sensor Type). See PDRV Specification, Table 104. This PROFIdrive example application defines:
|
bSensorResolutionBitLength | PDRV_UINT8 | Sensor resolution (number of pulses) bit length - see PDRV Specification, Table 105. |
bShiftFactorXIST1BitLength | PDRV_UINT8 | “Shift factor” of Gx_XIST1 bit length - see PDRV Specification, section “6.3.6.2.2 Structure of parameter 979 “sensor format” “. |
bShiftFactorXIST2BitLength | PDRV_UINT8 | “Shift factor” of Gx_XIST2 bit length - see PDRV Specification, section “6.3.6.2.2 Structure of parameter 979 “sensor format” “. |
bDeterminableRevolutionsBitLength | PDRV_UINT8 | Determinable revolutions bit length - see PDRV Specification, section “6.3.6.2.2 Structure of parameter 979 “sensor format” “. |
For example, the Sensor parameters for the motor ECI-42.20-BK1S.G7 are:
Parameter | Value |
---|---|
ulHeader | 0x00005112 (One sensor, 5 assigned indeces.) |
ulSensorType | 0xC0000002 (Rotary sensor; Absolute position; No 64 bit absolute information available; Data in parameter 979 is static; Validity of data in parameter 979 is static; Data in parameter 979 is valid.) |
bSensorResolutionBitLength | 8 (G1 sensor resolution (Number of pulses) bit length). |
bShiftFactorXIST1BitLength | 2 (G1 shift factor of Gx_XIST1 (bit length)). |
bShiftFactorXIST2BitLength | 2 (G1 shift factor of Gx_XIST2 (bit length)). |
bDeterminableRevolutionsBitLength | 22 (G1 determinable revolutions (bit length)). |
Application Class 4 (AC4)
This section summarizes the AC4 specifics.
Process Data configuration:
The PLC or CP161 Board should be configured with Standard Telegram 3. The GSDML that comes with example V4.1.0.0 provides a submodule for this. It should be added to the PROFIdrive module.
Isochronous mode:
Standard Telegram 3 requires isochronous mode.
It should be activated in TIA Portal for the device and PLC. “Send clock” parameter (on the PLC side) can be adjusted, min value supported is 1 ms;
main.c: .tOperationParams → .usTelegramNo should be set to PDRV_STDTLG3.
CP1616 board or PLC:
LAN port matters. The physical connection between the port of the CP1616 board and the device-under-test port should exactly match the one in the Topology Editor in TIA Portal. No switch should be introduced between the ports (special industrial switches might work, provided they support the PROFINET isochronous requirements). Only a netANALYZER or a special device like a TAP can be used to create a trace of this communication because such device do not interrupt the IRT communication.
PRONETA: watch for “Sign-of-life synchronized” message on connection establishment. If only “Station come” message is present, check whether physical port connection matches the topology in TIA Portal.