Custom uz_GUI for ParameterID#

Since controlling the ParameterID only via the debugger windows is cumbersome and not very practical, a custom-made uz_GUI is shipped. This page details the additional steps needed and how to use the uz_GUI.

Usage#

This section gives an overview of how to use the ParameterID tab in the uz_GUI.

../../../../_images/GUI_overview.png
  1. The ParameterID is organized in its own panel, which can be selected via the ParameterID button. Each individual ID-state is further organized in its own sub-panel and can be selected in the top left corner.

  2. Visible on the right side is the GlobalControl for the UltraZohm. The Enable System, Enable Control and STOP buttons are mirrored to the ones in the UltraZohm-Gui Control tab.

  3. The button ParameterID enables or disables the ParameterID. The status indicator to the right signals the current state of the ParameterID (on/off).

  4. Here all individual ID-states can be turned on or off. The current state of the ID-state is signaled via the status indicators next to the buttons. The possible states are:

    • Disabled, for when the state is disabled and not requested for future use. As long as this status is active, the controls for this ID-state are locked.

    • Requested, for when a ID-state is supposed to be executed but has not started yet. In this state, the config values should be changed.

    • Active. for when this state is currently executing.

    • Finished, for when the state is finished and another ID-state can be started.

  5. The State Control buttons are used for general control of the ParameterID.

    • The ACCEPT button is used to transition the ParameterID into a different state. This is mostly used to enable the ID-states after requesting them. Other uses can be to continue one ID-state, after some operations have to be done, i.e., start up the load machine.

    • The RESET button resets the entire ParameterID.

  6. Each ID-state has a unique activeState variable for each substate. This is displayed here to give further information to the user that the state is running and what it’s doing.

  7. Selection for control method after every Offline-state is finished. The selection can only be changed if the Control state of the UltraZohm is disabled.

    • If CurrentControl is selected, \(i_d\) and \(i_q\) reference values can be entered in the appropriate field in the JavaScope panel.

    • If SpeedControl is selected, a \(n_{ref}\) reference value can be entered in the appropriate field in the JavaScope panel.

    • If Disable Control is selected, every previous control method selection is disabled, and nothing happens.

  8. Each ID-state has its own individual panel, where the individual config values can be configured, and the identified values can be displayed. They have to be configured before entering the ID-state. Standard values for the config values are displayed, which proved appropriate in the past. They can be used as an introductory baseline.

Setup#

  1. In the properties.ini file change the value of the ParameterID variable to 1.

  2. Replace the appropriate code in the javascope.h file with the following:

    Listing 113 Changes to the JS_SlowData enum in the javascope.h file. Only add the new entries at the end.#
     1// slowData Naming Convention: Use JSSD_FLOAT_ as prefix
     2// Do not change the first (zero) and last (end) entries.
     3enum JS_SlowData {
     4    ....
     5    JSSD_FLOAT_Rs_Offline,
     6    JSSD_FLOAT_Ld_Offline,
     7    JSSD_FLOAT_Lq_Offline,
     8    JSSD_FLOAT_PsiPM_Offline,
     9    JSSD_FLOAT_J,
    10    JSSD_FLOAT_activeState,
    11    JSSD_FLOAT_ArrayCounter,
    12    JSSD_FLOAT_measArraySpeed,
    13    JSSD_FLOAT_measArrayTorque,
    14    JSSD_FLOAT_ArrayControlCounter,
    15    JSSD_FLOAT_Stribtorque,
    16    JSSD_FLOAT_Coulombtorque,
    17    JSSD_FLOAT_Viscotorque,
    18    JSSD_FLOAT_Rs_online_FMID,
    19    JSSD_FLOAT_Wtemp_FMID,
    20    JSSD_FLOAT_TrainInertia,
    21    JSSD_FLOAT_LoadInertia,
    22    JSSD_FLOAT_c_est,
    23    JSSD_FLOAT_d_est,
    24    JSSD_FLOAT_MapCounter,
    25    JSSD_FLOAT_psidMap,
    26    JSSD_FLOAT_psiqMap,
    27    JSSD_FLOAT_FluxTemp,
    28    JSSD_FLOAT_MapControl,
    29    JSSD_FLOAT_I_rated,
    30    JSSD_FLOAT_Ld_Online,
    31    JSSD_FLOAT_Lq_Online,
    32    JSSD_FLOAT_PsiPM_Online,
    33    JSSD_FLOAT_Rs_Online,
    34    JSSD_FLOAT_n_FluxPoints,
    35    JSSD_FLOAT_totalRotorInertia,
    36    JSSD_FLOAT_MapControlCounter,
    37    JSSD_FLOAT_polePairs,
    38    JSSD_ENDMARKER
    39}
    
    Listing 114 Changes to the gui_button_mapping enum in the javascope.h file. Only add the new entries at the end.#
     1// Determination of Button IDs via enum. When a button in the GUI is pressed,
     2// the GUI sends an ID and a value. IDs of the buttons are the respective enum
     3// numbers in the following enum.
     4// Do not change the first (zero) and last (end) entries.
     5// Do not change names! They are hard coupled within the GUI!
     6enum gui_button_mapping {
     7    GUI_BTN_ZEROVALUE=0,
     8    ....
     9    ParaID_Enable_System,
    10    ParaID_Enable_Control,
    11    ParaID_Enable_ParameterID,
    12    ParaID_Disable_ParameterID,
    13    ParaID_Enable_ElectricalID,
    14    ParaID_Disable_ElectricalID,
    15    ParaID_Enable_FrictionID,
    16    ParaID_Disable_FrictionID,
    17    ParaID_Enable_TwoMassID,
    18    ParaID_Disable_TwoMassID,
    19    ParaID_Enable_FluxMapID,
    20    ParaID_Disable_FluxMapID,
    21    ParaID_Enable_OnlineID,
    22    ParaID_Disable_OnlineID,
    23    ParaID_Enable_Current_Control,
    24    ParaID_Enable_Speed_Control,
    25    ParaID_Disable_FOC_Control,
    26    ParaID_ACCEPT,
    27    ParaID_RESET,
    28    ParaID_EID_sampleTimeISR,
    29    ParaID_EID_n_ref_meas,
    30    ParaID_EID_goertzl_Torque,
    31    ParaID_EID_goertzl_Freq,
    32    ParaID_EID_DutyCyc,
    33    ParaID_EID_MaxContinousCurrent,
    34    ParaID_EID_Enable_IdentLQ,
    35    ParaID_EID_Disable_IdentLQ,
    36    ParaID_EID_Admit_Params,
    37    ParaID_FID_max_speed,
    38    ParaID_FID_N_Brk,
    39    ParaID_FID_N_Visco,
    40    ParaID_FID_s_step,
    41    ParaID_FID_Brk_Count,
    42    ParaID_FID_eta_speed,
    43    ParaID_FID_Array_Control_counter,
    44    ParaID_TMID_Scale_PRBS,
    45    ParaID_TMID_d_TMS_start,
    46    ParaID_TMID_n_ref,
    47    ParaID_TMID_f_min,
    48    ParaID_TMID_f_max,
    49    ParaID_TMID_Admit_Params,
    50    ParaID_FMID_i_d_start,
    51    ParaID_FMID_i_d_stop,
    52    ParaID_FMID_i_d_step,
    53    ParaID_FMID_i_q_start,
    54    ParaID_FMID_i_q_stop,
    55    ParaID_FMID_i_q_step,
    56    ParaID_FMID_Rs_ref,
    57    ParaID_FMID_Temp_ref,
    58    ParaID_FMID_identRAmp,
    59    ParaID_FMID_enable_ident_R,
    60    ParaID_FMID_disable_ident_R,
    61    ParaID_FMID_enable_AMM,
    62    ParaID_FMID_disable_AMM,
    63    ParaID_OID_Refresh_Flux_Maps,
    64    ParaID_OID_Reset_OnlineID,
    65    ParaID_OID_Enable_AutoCurrentControl,
    66    ParaID_OID_Disable_AutoCurrentControl,
    67    ParaID_OID_d_current_steps,
    68    ParaID_OID_q_current_steps,
    69    ParaID_OID_max_current,
    70    ParaID_OID_ref_temp,
    71    ParaID_OID_ref_Rs,
    72    ParaID_OID_max_speed,
    73    ParaID_OID_min_speed,
    74    ParaID_OID_Ident_range_factor,
    75    ParaID_OID_max_ident_pause,
    76    ParaID_OID_identR_Amp,
    77    ParaID_OID_Fluxmap_Control_counter,
    78    GUI_BTN_ENDMARKER
    79};
    
    Listing 115 Changes to the send fiels in the javascope.h file. Only replace the first three entries.#
     1/* Visualization Config for GUI*/
     2// LEAVE IT COMMENTED OUT AS IT IS, the plain text below is parsed by the GUI!
     3// Change entries according to your needs.
     4/*
     5// Description (printed text) for the send_fields top to bottom
     6// Do not change the first (zero) and last (end) entries.
     7
     8SND_FLD_ZEROVALUE=0,
     9n_ref,
    10i_d_ref,
    11i_q_ref,
    12....
    13SND_FLD_ENDMARKER
    14
    15
    16// Physical unit label (printed text) for the send_fields top to bottom
    17// Do not change the first (zero) and last (end) entries.
    18
    19SND_LABELS_ZEROVALUE=0,
    20RPM,
    21A,
    22A,
    23....
    24SND_LABELS_ENDMARKER
    
    Listing 116 Changes to the receive fiels in the javascope.h file. Only replace the first six entries.#
     1// Description (printed text) for the receive_fields top to bottom
     2// Do not change the first (zero) and last (end) entries.
     3
     4RCV_FLD_ZEROVALUE=0,
     5speed,
     6torque,
     7i_d,
     8i_q,
     9u_d,
    10u_q,
    11....
    12RCV_FLD_ENDMARKER
    13
    14
    15// Physical unit label (printed text) for the receive_fields top to bottom
    16// Do not change the first (zero) and last (end) entries.
    17
    18RCV_LABELS_ZEROVALUE=0,
    19RPM,
    20Nm,
    21A,
    22A,
    23V,
    24V,
    25....
    26RCV_LABELS_ENDMARKER
    27
    28
    29// Slow Data values that are displayed in the receive_fields top to bottom
    30// Do not change the first (zero) and last (end) entries.
    31// Make sure that the signal names below are also present in the JS_SlowData enum!
    32
    33SLOWDAT_DISPLAY_ZEROVALUE=0,
    34JSSD_FLOAT_speed,
    35JSSD_FLOAT_torque,
    36JSSD_FLOAT_i_d,
    37JSSD_FLOAT_i_q,
    38JSSD_FLOAT_u_d,
    39JSSD_FLOAT_u_q,
    40JSSD_FLOAT_Error_Code,
    41....
    42SLOWDAT_DISPLAY_ENDMARKER
    43*/
    
  3. Add the following code to the ipc_ARM.c file.

    Listing 117 Changes to the ipc_ARM.c file. (Breaks in the code are marked with ....).#
      1// slowData Naming Convention: Use JSSD_FLOAT_ as prefix
      2// Do not change the first (zero) and last (end) entries.
      3extern uz_ParameterID_Data_t ParaID_Data;
      4//If FOC is used
      5extern uz_CurrentControl_t* CC_instance;
      6extern uz_SetPoint_t* SP_instance;
      7
      8void ipc_Control_func(uint32_t msgId, float value, DS_Data *data)
      9{
     10    // HANDLE RECEIVED MESSAGE
     11    if (msgId != 0)
     12    {
     13        // GENERAL VARIABLES
     14        switch (msgId)
     15        {
     16        ....
     17        //Change Send_Field 1-3
     18        case (Set_Send_Field_1):
     19            ParaID_Data.GlobalConfig.n_ref = value;
     20            break;
     21
     22        case (Set_Send_Field_2):
     23            ParaID_Data.GlobalConfig.i_dq_ref.d = value;
     24            break;
     25
     26        case (Set_Send_Field_3):
     27            ParaID_Data.GlobalConfig.i_dq_ref.q = value;
     28            break;
     29        ....
     30        //After all My_Button cases add the following
     31        //ParameterID
     32
     33        case (ParaID_Enable_System):
     34            ultrazohm_state_machine_set_enable_system(true);
     35            break;
     36
     37        case (ParaID_Enable_Control):
     38            ultrazohm_state_machine_set_enable_control(true);
     39            break;
     40
     41        case (ParaID_Enable_ParameterID):
     42            ParaID_Data.GlobalConfig.enableParameterID = true;
     43            break;
     44
     45        case (ParaID_Disable_ParameterID):
     46            ParaID_Data.GlobalConfig.enableParameterID = false;
     47            ParaID_Data.GlobalConfig.ElectricalID = false;
     48            ParaID_Data.GlobalConfig.TwoMassID = false;
     49            ParaID_Data.GlobalConfig.FrictionID = false;
     50            ParaID_Data.GlobalConfig.FluxMapID = false;
     51            ParaID_Data.GlobalConfig.OnlineID = false;
     52            ParaID_Data.FluxMapID_Config.start_FM_ID = false;
     53        break;
     54
     55        case (ParaID_Enable_Current_Control):
     56            if (ultrazohm_state_machine_get_state() != control_state) {
     57                ParaID_Data.ParaID_Control_Selection = Current_Control;
     58            }
     59            break;
     60
     61        case (ParaID_Enable_Speed_Control):
     62            if (ultrazohm_state_machine_get_state() != control_state) {
     63                ParaID_Data.ParaID_Control_Selection = Speed_Control;
     64            }
     65            break;
     66
     67        case (ParaID_Disable_FOC_Control):
     68            ParaID_Data.ParaID_Control_Selection = No_Control;
     69            break;
     70
     71        case (ParaID_Enable_ElectricalID):
     72            ParaID_Data.GlobalConfig.ElectricalID = true;
     73            break;
     74
     75        case (ParaID_Disable_ElectricalID):
     76            ParaID_Data.GlobalConfig.ElectricalID = false;
     77            break;
     78
     79        case (ParaID_Enable_FrictionID):
     80            ParaID_Data.GlobalConfig.FrictionID = true;
     81            break;
     82
     83        case (ParaID_Disable_FrictionID):
     84            ParaID_Data.GlobalConfig.FrictionID = false;
     85            break;
     86
     87        case (ParaID_Enable_TwoMassID):
     88            ParaID_Data.GlobalConfig.TwoMassID = true;
     89            break;
     90
     91        case (ParaID_Disable_TwoMassID):
     92            ParaID_Data.GlobalConfig.TwoMassID = false;
     93            break;
     94
     95        case (ParaID_Enable_FluxMapID):
     96            ParaID_Data.GlobalConfig.FluxMapID = true;
     97            break;
     98
     99        case (ParaID_Disable_FluxMapID):
    100            ParaID_Data.GlobalConfig.FluxMapID = false;
    101            ParaID_Data.FluxMapID_Config.start_FM_ID = false;
    102            break;
    103
    104        case (ParaID_Enable_OnlineID):
    105            ParaID_Data.GlobalConfig.OnlineID = true;
    106            break;
    107
    108        case (ParaID_Disable_OnlineID):
    109            ParaID_Data.GlobalConfig.OnlineID = false;
    110            ParaID_Data.AutoRefCurrents_Config.enableCRS = false;
    111            break;
    112
    113        case (ParaID_ACCEPT):
    114            ParaID_Data.GlobalConfig.ACCEPT = true;
    115            break;
    116
    117        case (ParaID_RESET):
    118            ParaID_Data.GlobalConfig.Reset = true;
    119            ParaID_Data.GlobalConfig.ElectricalID = false;
    120            ParaID_Data.GlobalConfig.TwoMassID = false;
    121            ParaID_Data.GlobalConfig.FrictionID = false;
    122            ParaID_Data.GlobalConfig.FluxMapID = false;
    123            ParaID_Data.GlobalConfig.OnlineID = false;
    124            ParaID_Data.AutoRefCurrents_Config.enableCRS = false;
    125            ParaID_Data.ParaID_Control_Selection = No_Control;
    126            ParaID_Data.ElectricalID_Config.identLq = false;
    127            ParaID_Data.FluxMapID_Config.start_FM_ID = false;
    128
    129            break;
    130
    131        case (ParaID_EID_sampleTimeISR):
    132            ParaID_Data.GlobalConfig.sampleTimeISR = value * 0.000001f;
    133            break;
    134
    135        case (ParaID_EID_n_ref_meas):
    136            ParaID_Data.ElectricalID_Config.n_ref_measurement = value;
    137            break;
    138
    139        case (ParaID_EID_goertzl_Torque):
    140            ParaID_Data.ElectricalID_Config.goertzlTorque = value;
    141            break;
    142
    143        case (ParaID_EID_goertzl_Freq):
    144            ParaID_Data.ElectricalID_Config.goertzlFreq = value;
    145            break;
    146
    147        case (ParaID_EID_DutyCyc):
    148            ParaID_Data.ElectricalID_Config.dutyCyc = value;
    149            break;
    150
    151        case (ParaID_EID_MaxContinousCurrent):
    152            ParaID_Data.GlobalConfig.PMSM_config.I_max_Ampere = value;
    153            break;
    154
    155        case (ParaID_EID_Enable_IdentLQ):
    156            ParaID_Data.ElectricalID_Config.identLq = true;
    157            break;
    158
    159        case (ParaID_EID_Disable_IdentLQ):
    160            ParaID_Data.ElectricalID_Config.identLq = false;
    161            break;
    162
    163        case (ParaID_EID_Admit_Params):
    164            //If FOC is used
    165            uz_CurrentControl_set_PMSM_parameters(CC_instance, ParaID_Data.ElectricalID_Output->PMSM_parameters);
    166            uz_SetPoint_set_PMSM_config(SP_instance, ParaID_Data.ElectricalID_Output->PMSM_parameters);
    167            break;
    168
    169        case (ParaID_FID_max_speed):
    170            ParaID_Data.FrictionID_Config.n_eva_max = value;
    171            break;
    172
    173        case (ParaID_FID_N_Brk):
    174            ParaID_Data.FrictionID_Config.N_Brk = value;
    175            break;
    176
    177        case (ParaID_FID_N_Visco):
    178            ParaID_Data.FrictionID_Config.N_Visco = value;
    179            break;
    180
    181        case (ParaID_FID_s_step):
    182            ParaID_Data.FrictionID_Config.StepScale = value;
    183            break;
    184
    185        case (ParaID_FID_Brk_Count):
    186            ParaID_Data.FrictionID_Config.BrkCount = value;
    187            break;
    188
    189        case (ParaID_FID_eta_speed):
    190            ParaID_Data.FrictionID_Config.eta = value;
    191            break;
    192
    193        case (ParaID_TMID_Scale_PRBS):
    194            ParaID_Data.TwoMassID_Config.ScaleTorquePRBS = value;
    195            break;
    196
    197        case (ParaID_TMID_d_TMS_start):
    198            ParaID_Data.TwoMassID_Config.d_TMS_start = value;
    199            break;
    200
    201        case (ParaID_TMID_n_ref):
    202            ParaID_Data.TwoMassID_Config.n_ref_measurement = value;
    203            break;
    204
    205        case (ParaID_TMID_f_min):
    206            ParaID_Data.TwoMassID_Config.f_min = value;
    207            break;
    208
    209        case (ParaID_TMID_f_max):
    210            ParaID_Data.TwoMassID_Config.f_max = value;
    211            break;
    212
    213        case (ParaID_FMID_i_d_start):
    214            ParaID_Data.FluxMapID_Config.IDstart = value;
    215            break;
    216
    217        case (ParaID_FMID_i_d_stop):
    218            ParaID_Data.FluxMapID_Config.IDstop = value;
    219            break;
    220
    221        case (ParaID_FMID_i_d_step):
    222            ParaID_Data.FluxMapID_Config.IDstepsize = value;
    223            break;
    224
    225        case (ParaID_FMID_i_q_start):
    226            ParaID_Data.FluxMapID_Config.IQstart = value;
    227            break;
    228
    229        case (ParaID_FMID_i_q_stop):
    230            ParaID_Data.FluxMapID_Config.IQstop = value;
    231            break;
    232
    233        case (ParaID_FMID_i_q_step):
    234            ParaID_Data.FluxMapID_Config.IQstepsize = value;
    235            break;
    236
    237        case (ParaID_FMID_Rs_ref):
    238            ParaID_Data.FluxMapID_Config.R_s_ref = value;
    239            break;
    240
    241        case (ParaID_FMID_Temp_ref):
    242            ParaID_Data.FluxMapID_Config.Temp_ref = value;
    243            break;
    244
    245        case (ParaID_FMID_identRAmp):
    246            ParaID_Data.FluxMapID_Config.identRAmp = value;
    247            break;
    248
    249        case (ParaID_FMID_enable_ident_R):
    250            ParaID_Data.FluxMapID_Config.identR = true;
    251            break;
    252
    253        case (ParaID_FMID_disable_ident_R):
    254            ParaID_Data.FluxMapID_Config.identR = false;
    255            break;
    256
    257        case (ParaID_FMID_enable_AMM):
    258            ParaID_Data.FluxMapID_Config.start_FM_ID = true;
    259            break;
    260
    261        case (ParaID_FMID_disable_AMM):
    262            ParaID_Data.FluxMapID_Config.start_FM_ID = false;
    263            break;
    264
    265        case (ParaID_OID_Refresh_Flux_Maps):
    266            ParaID_Data.calculate_flux_maps = true;
    267            break;
    268
    269        case (ParaID_OID_Reset_OnlineID):
    270            ParaID_Data.OnlineID_Config.OnlineID_Reset = true;
    271            ParaID_Data.AutoRefCurrents_Config.Reset = true;
    272            ParaID_Data.AutoRefCurrents_Config.enableCRS = false;
    273            break;
    274
    275        case (ParaID_OID_Enable_AutoCurrentControl):
    276            ParaID_Data.AutoRefCurrents_Config.enableCRS = true;
    277            break;
    278
    279        case (ParaID_OID_Disable_AutoCurrentControl):
    280            ParaID_Data.AutoRefCurrents_Config.enableCRS = false;
    281            break;
    282
    283        case (ParaID_OID_d_current_steps):
    284            ParaID_Data.AutoRefCurrents_Config.id_points = value;
    285            break;
    286
    287        case (ParaID_OID_q_current_steps):
    288            ParaID_Data.AutoRefCurrents_Config.iq_points = value;
    289            break;
    290
    291        case (ParaID_OID_max_current):
    292            ParaID_Data.AutoRefCurrents_Config.max_current = value;
    293            break;
    294
    295        case (ParaID_OID_ref_temp):
    296            ParaID_Data.OnlineID_Config.Temp_ref = value;
    297            break;
    298
    299        case (ParaID_OID_ref_Rs):
    300            ParaID_Data.GlobalConfig.PMSM_config.R_ph_Ohm = value;
    301            break;
    302
    303        case (ParaID_OID_max_speed):
    304            ParaID_Data.OnlineID_Config.max_n_ratio = value;
    305            break;
    306
    307        case (ParaID_OID_min_speed):
    308            ParaID_Data.OnlineID_Config.min_n_ratio = value;
    309            break;
    310
    311        case (ParaID_OID_Ident_range_factor):
    312            ParaID_Data.OnlineID_Config.nom_factor = value;
    313            break;
    314
    315        case (ParaID_OID_max_ident_pause):
    316            ParaID_Data.OnlineID_Config.Rs_time = value;
    317            break;
    318        case (ParaID_OID_identR_Amp):
    319            ParaID_Data.OnlineID_Config.identRAmp = value;
    320            break;
    321
    322        case (ParaID_OID_Fluxmap_Control_counter):
    323            ParaID_Data.FluxMap_Control_counter = value;
    324            break;
    325
    326        case (ParaID_FID_Array_Control_counter):
    327            ParaID_Data.Array_Control_counter = value;
    328            break;
    329        ....
    330        }
    331    }
    332
    333    ....
    334    //Replace Bit 13-19 with the following
    335    /* Bit 13 - Ident_Lq */
    336    if (ParaID_Data.ElectricalID_Config.identLq == true) {
    337        js_status_BareToRTOS |= (1 << 13);
    338    } else {
    339        js_status_BareToRTOS &= ~(1 << 13);
    340    }
    341
    342    /* Bit 14 - FluxMapID R-Online */
    343    if (ParaID_Data.FluxMapID_Config.identR == true) {
    344        js_status_BareToRTOS |= (1 << 14);
    345    } else {
    346        js_status_BareToRTOS &= ~(1 << 14);
    347    }
    348
    349    /* Bit 15 - FluxMapID start */
    350    if (ParaID_Data.FluxMapID_Config.start_FM_ID == true) {
    351        js_status_BareToRTOS |= (1 << 15);
    352    } else {
    353        js_status_BareToRTOS &= ~(1 << 15);
    354    }
    355
    356    /* Bit 16 - ParaID_FOC_CC */
    357    if (ParaID_Data.ParaID_Control_Selection == Current_Control) {
    358        js_status_BareToRTOS |= (1 << 16);
    359    } else {
    360        js_status_BareToRTOS &= ~(1 << 16);
    361    }
    362
    363    /* Bit 17 - ParaID_FOC_SC */
    364    if (ParaID_Data.ParaID_Control_Selection == Speed_Control) {
    365        js_status_BareToRTOS |= (1 << 17);
    366    } else {
    367        js_status_BareToRTOS &= ~(1 << 17);
    368    }
    369
    370    /* Bit 18 -ParaID_FOC_no_control */
    371    if (ParaID_Data.ParaID_Control_Selection == No_Control) {
    372        js_status_BareToRTOS |= (1 << 18);
    373    } else {
    374        js_status_BareToRTOS &= ~(1 << 18);
    375    }
    376
    377    /* Bit 19 -ParameterID active */
    378    if (ParaID_Data.GlobalConfig.enableParameterID == true) {
    379        ultrazohm_state_machine_set_userLED(true);
    380        js_status_BareToRTOS |= (1 << 19);
    381    } else {
    382        js_status_BareToRTOS &= ~(1 << 19);
    383        ultrazohm_state_machine_set_userLED(false);
    384    }
    385    ....
    386}
    
  4. Change the code of js_slowDataArray in the javascope.c file.

    Listing 118 Changes to the javascope.c file. (Breaks in the code are marked with ....).#
     1//ParameterID
     2extern uz_ParameterID_Data_t ParaID_Data;
     3float activeState = 0.0f;
     4float FluxMapCounter = 0.0f;
     5float ArrayCounter = 0.0f;
     6
     7int JavaScope_initalize(DS_Data* data)
     8{
     9    ....
    10    // Store slow / not-time-critical signals into the SlowData-Array.
    11    // Will be transferred one after another
    12    // The array may grow arbitrarily long, the refresh rate of the individual values decreases.
    13    // Only float is allowed!
    14    js_slowDataArray[JSSD_FLOAT_u_d]                    = &(ParaID_Data.ActualValues.v_dq.d);
    15    js_slowDataArray[JSSD_FLOAT_u_q]                    = &(ParaID_Data.ActualValues.v_dq.q);
    16    js_slowDataArray[JSSD_FLOAT_i_d]                    = &(ParaID_Data.ActualValues.i_dq.d);
    17    js_slowDataArray[JSSD_FLOAT_i_q]                    = &(ParaID_Data.ActualValues.i_dq.q);
    18    js_slowDataArray[JSSD_FLOAT_speed]                  = &(data->av.mechanicalRotorSpeed);
    19    js_slowDataArray[JSSD_FLOAT_torque]                 = &(data->av.mechanicalTorqueObserved);
    20    js_slowDataArray[JSSD_FLOAT_PsiPM_Offline]          = &(ParaID_Data.ElectricalID_Output->PMSM_parameters.Psi_PM_Vs);
    21    js_slowDataArray[JSSD_FLOAT_Lq_Offline]             = &(ParaID_Data.ElectricalID_Output->PMSM_parameters.Lq_Henry);
    22    js_slowDataArray[JSSD_FLOAT_Ld_Offline]             = &(ParaID_Data.ElectricalID_Output->PMSM_parameters.Ld_Henry);
    23    js_slowDataArray[JSSD_FLOAT_Rs_Offline]             = &(ParaID_Data.ElectricalID_Output->PMSM_parameters.R_ph_Ohm);
    24    js_slowDataArray[JSSD_FLOAT_polePairs]              = &(ParaID_Data.ElectricalID_Output->PMSM_parameters.polePairs);
    25    js_slowDataArray[JSSD_FLOAT_J]                      = &(ParaID_Data.ElectricalID_Output->PMSM_parameters.J_kg_m_squared);
    26    js_slowDataArray[JSSD_FLOAT_activeState]            = &(activeState);
    27    js_slowDataArray[JSSD_FLOAT_SecondsSinceSystemStart]= &System_UpTime_seconds;
    28    js_slowDataArray[JSSD_FLOAT_ISR_ExecTime_us]        = &ISR_execution_time_us;
    29    js_slowDataArray[JSSD_FLOAT_ISR_Period_us]          = &ISR_period_us;
    30    js_slowDataArray[JSSD_FLOAT_Milliseconds]           = &System_UpTime_ms;
    31    js_slowDataArray[JSSD_FLOAT_encoderOffset]          = &(ParaID_Data.ElectricalID_Output->thetaOffset);
    32    js_slowDataArray[JSSD_FLOAT_ArrayCounter]           = &(ArrayCounter);
    33    js_slowDataArray[JSSD_FLOAT_measArraySpeed]         = &(ParaID_Data.MeasArraySpeed_pointer);
    34    js_slowDataArray[JSSD_FLOAT_measArrayTorque]        = &(ParaID_Data.MeasArrayTorque_pointer);
    35    js_slowDataArray[JSSD_FLOAT_ArrayControlCounter]    = &(ArrayCounter);
    36    js_slowDataArray[JSSD_FLOAT_Stribtorque]            = &(ParaID_Data.FrictionID_Output->BrkTorque);
    37    js_slowDataArray[JSSD_FLOAT_Coulombtorque]          = &(ParaID_Data.FrictionID_Output->CoulTorque);
    38    js_slowDataArray[JSSD_FLOAT_Viscotorque]            = &(ParaID_Data.FrictionID_Output->ViscoTorque);
    39    js_slowDataArray[JSSD_FLOAT_TrainInertia]           = &(ParaID_Data.TwoMassID_Output->TrainInertia);
    40    js_slowDataArray[JSSD_FLOAT_LoadInertia]            = &(ParaID_Data.TwoMassID_Output->LoadInertia);
    41    js_slowDataArray[JSSD_FLOAT_c_est]                  = &(ParaID_Data.TwoMassID_Output->c_est_out);
    42    js_slowDataArray[JSSD_FLOAT_d_est]                  = &(ParaID_Data.TwoMassID_Output->d_est_out);
    43    js_slowDataArray[JSSD_FLOAT_I_rated]                = &(ParaID_Data.GlobalConfig.ratCurrent);
    44    js_slowDataArray[JSSD_FLOAT_totalRotorInertia]      = &(ParaID_Data.TwoMassID_Output->rotorInertia);
    45    js_slowDataArray[JSSD_FLOAT_Ld_Online]              = &(ParaID_Data.OnlineID_Output->Ld_out);
    46    js_slowDataArray[JSSD_FLOAT_Lq_Online]              = &(ParaID_Data.OnlineID_Output->Lq_out);
    47    js_slowDataArray[JSSD_FLOAT_PsiPM_Online]           = &(ParaID_Data.OnlineID_Output->psi_pm_out);
    48    js_slowDataArray[JSSD_FLOAT_Rs_Online]              = &(ParaID_Data.OnlineID_Output->Rph_out);
    49    js_slowDataArray[JSSD_FLOAT_n_FluxPoints]           = &(ParaID_Data.FluxMap_MeasuringPoints);
    50    js_slowDataArray[JSSD_FLOAT_Rs_online_FMID]         = &(ParaID_Data.FluxMapID_Output->R_s);
    51    js_slowDataArray[JSSD_FLOAT_Wtemp_FMID]             = &(ParaID_Data.FluxMapID_Output->WindingTemp);
    52    js_slowDataArray[JSSD_FLOAT_MapCounter]             = &(FluxMapCounter);
    53    js_slowDataArray[JSSD_FLOAT_psidMap]                = &(ParaID_Data.Psi_D_pointer);
    54    js_slowDataArray[JSSD_FLOAT_psiqMap]                = &(ParaID_Data.Psi_Q_pointer);
    55    js_slowDataArray[JSSD_FLOAT_MapControlCounter]      = &(FluxMapCounter);
    56    return Status;
    57}
    
  5. In the JavaScope_update function in the javascope.c file add.

    Listing 119 Changes to the javascope.c file. (Breaks in the code are marked with ....).#
    1void JavaScope_update(DS_Data* data)
    2{
    3    ....
    4    uz_ParameterID_update_transmit_values(&ParaID_Data, &activeState, &FluxMapCounter, &ArrayCounter);
    5    ....
    6}