Skip to content

Commit

Permalink
AMCBLDC: v1.2.12 codegen alignement (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiraz authored Apr 7, 2023
1 parent 5cf9dd1 commit 37ed3f6
Show file tree
Hide file tree
Showing 56 changed files with 1,032 additions and 964 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ constexpr uint8_t minor =

constexpr embot::app::theCANboardInfo::applicationInfo applInfo
{
embot::prot::can::versionOfAPPLICATION {1, minor, 11},
embot::prot::can::versionOfAPPLICATION {1, minor, 12},
embot::prot::can::versionOfCANPROTOCOL {2, 0}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Code generated for Simulink model 'AMC_BLDC'.
//
// Model version : 5.1
// Simulink Coder version : 9.8 (R2022b) 13-May-2022
// C/C++ source code generated on : Mon Mar 13 14:26:47 2023
// Model version : 6.1
// Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
// C/C++ source code generated on : Thu Apr 6 14:47:14 2023
//
// Target selection: ert.tlc
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
Expand All @@ -18,8 +18,8 @@
//
#include "AMC_BLDC.h"
#include "rtw_mutex.h"
#include "AMC_BLDC_types.h"
#include "rtwtypes.h"
#include "AMC_BLDC_types.h"
#define estimation_velocity_MDLREF_HIDE_CHILD_
#include "estimation_velocity.h"
#define filter_current_MDLREF_HIDE_CHILD_
Expand Down Expand Up @@ -168,74 +168,54 @@ void AMC_BLDC_step0(void) // Sample time: [1.1428571428571438E-6s, 0.0s]
// Model step function for TID1
void AMC_BLDC_step_FOC(void) // Sample time: [3.65714285714286E-5s, 0.0s]
{
FOCSlowInputs rtb_BusConversion_InsertedFor_F;
int8_T wrBufIdx;

// RateTransition generated from: '<Root>/Adapter2'
rtw_mutex_lock();
AMC_BLDC_DW.RTBInsertedForAdapter_Inserte_p =
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_hj;
rtw_mutex_unlock();

// BusCreator generated from: '<Root>/FOC' incorporates:
// RateTransition generated from: '<Root>/Adapter2'

rtb_BusConversion_InsertedFor_F.flags =
AMC_BLDC_B.BusConversion_InsertedFor_FOC_a.flags =
AMC_BLDC_DW.RTBInsertedForAdapter_Inserte_l[AMC_BLDC_DW.RTBInsertedForAdapter_Inserte_p];

// RateTransition generated from: '<Root>/Adapter2'
rtw_mutex_lock();
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_m3 =
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_mp;
rtw_mutex_unlock();

// BusCreator generated from: '<Root>/FOC' incorporates:
// RateTransition generated from: '<Root>/Adapter2'

rtb_BusConversion_InsertedFor_F.configurationparameters =
AMC_BLDC_B.BusConversion_InsertedFor_FOC_a.configurationparameters =
AMC_BLDC_DW.RTBInsertedForAdapter_InsertedF[AMC_BLDC_DW.RTBInsertedForAdapter_Insert_m3];

// RateTransition generated from: '<Root>/Adapter2'
rtw_mutex_lock();
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_ko =
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_b2;
rtw_mutex_unlock();

// BusCreator generated from: '<Root>/FOC' incorporates:
// RateTransition generated from: '<Root>/Adapter2'

rtb_BusConversion_InsertedFor_F.estimateddata =
AMC_BLDC_B.BusConversion_InsertedFor_FOC_a.estimateddata =
AMC_BLDC_DW.RTBInsertedForAdapter_Inserte_k[AMC_BLDC_DW.RTBInsertedForAdapter_Insert_ko];

// RateTransition generated from: '<Root>/Adapter2'
rtw_mutex_lock();
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_mb =
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_jj;
rtw_mutex_unlock();

// BusCreator generated from: '<Root>/FOC' incorporates:
// RateTransition generated from: '<Root>/Adapter2'

rtb_BusConversion_InsertedFor_F.targets =
AMC_BLDC_B.BusConversion_InsertedFor_FOC_a.targets =
AMC_BLDC_DW.RTBInsertedForAdapter_Inserte_m[AMC_BLDC_DW.RTBInsertedForAdapter_Insert_mb];

// RateTransition generated from: '<Root>/Adapter2'
rtw_mutex_lock();
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_bw =
AMC_BLDC_DW.RTBInsertedForAdapter_Insert_p5;
rtw_mutex_unlock();

// BusCreator generated from: '<Root>/FOC' incorporates:
// RateTransition generated from: '<Root>/Adapter2'

rtb_BusConversion_InsertedFor_F.controlouteroutputs =
AMC_BLDC_B.BusConversion_InsertedFor_FOC_a.controlouteroutputs =
AMC_BLDC_DW.RTBInsertedForAdapter_Inserte_i[AMC_BLDC_DW.RTBInsertedForAdapter_Insert_bw];

// ModelReference: '<Root>/FOC' incorporates:
// Inport generated from: '<Root>/In Bus Element5'
// Outport generated from: '<Root>/Out Bus Element'

control_foc(&AMC_BLDC_U.SensorsData_p, &rtb_BusConversion_InsertedFor_F,
control_foc(&AMC_BLDC_U.SensorsData_p,
&AMC_BLDC_B.BusConversion_InsertedFor_FOC_a,
&AMC_BLDC_Y.ControlOutputs_p);

// RateTransition generated from: '<Root>/Adapter1' incorporates:
Expand Down Expand Up @@ -317,6 +297,7 @@ void AMC_BLDC_step_Time(void) // Sample time: [0.001s, 0.0s]
ControlOuterOutputs rtb_OuterControl;
BUS_STATUS_TX rtb_SupervisorFSM_TX_o2;
ControlOutputs rtb_BusConversion_InsertedFor_F;
MotorCurrent rtb_Filter_Current;
int8_T wrBufIdx;

// RateTransition generated from: '<Root>/Adapter1'
Expand Down Expand Up @@ -346,13 +327,17 @@ void AMC_BLDC_step_Time(void) // Sample time: [0.001s, 0.0s]

// End of RateTransition generated from: '<Root>/Adapter1'

// BusCreator generated from: '<S5>/Filter_Current'
rtb_Filter_Current.current = 0.0F;

// BusCreator generated from: '<S5>/Filter_Current'
rtb_BusConversion_InsertedFor_F.Vq = 0.0F;
rtb_BusConversion_InsertedFor_F.Vabc[0] = 0.0F;
rtb_BusConversion_InsertedFor_F.Vabc[1] = 0.0F;
rtb_BusConversion_InsertedFor_F.Vabc[2] = 0.0F;
rtb_BusConversion_InsertedFor_F.Iq_fbk =
AMC_BLDC_B.RTBInsertedForAdapter_Inserte_a.Iq_fbk;
rtb_BusConversion_InsertedFor_F.Id_fbk = rtb_Filter_Current;

// RateTransition generated from: '<Root>/Adapter3'
rtw_mutex_lock();
Expand Down Expand Up @@ -391,8 +376,12 @@ void AMC_BLDC_step_Time(void) // Sample time: [0.001s, 0.0s]
&AMC_BLDC_Y.EstimatedData_p.jointvelocities);

// ModelReference: '<S5>/Filter_Current'
filter_current(&rtb_BusConversion_InsertedFor_F,
&AMC_BLDC_Y.EstimatedData_p.Iq_filtered);
filter_current(&rtb_BusConversion_InsertedFor_F, &rtb_Filter_Current);

// BusCreator: '<S9>/Bus Creator' incorporates:
// Outport generated from: '<Root>/Out Bus Element2'

AMC_BLDC_Y.EstimatedData_p.Iq_filtered = rtb_Filter_Current;

// ModelReference: '<S6>/CAN_Decoder' incorporates:
// Inport generated from: '<Root>/In Bus Element2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Code generated for Simulink model 'AMC_BLDC'.
//
// Model version : 5.1
// Simulink Coder version : 9.8 (R2022b) 13-May-2022
// C/C++ source code generated on : Mon Mar 13 14:26:47 2023
// Model version : 6.1
// Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
// C/C++ source code generated on : Thu Apr 6 14:47:14 2023
//
// Target selection: ert.tlc
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
Expand Down Expand Up @@ -46,13 +46,14 @@

// Block signals (default storage)
struct B_AMC_BLDC_T {
FOCSlowInputs BusConversion_InsertedFor_FOC_a;
BUS_MESSAGES_RX_MULTIPLE CAN_Decoder_o1;// '<S6>/CAN_Decoder'
ConfigurationParameters ZOHBlockInsertedForAdapter_Inse;// '<Root>/Adapter4'
BUS_MESSAGES_TX MessagesTx; // '<S7>/SupervisorFSM_TX'
SensorsData RTBInsertedForAdapter_InsertedF;// '<Root>/Adapter3'
ControlOutputs RTBInsertedForAdapter_Inserte_a;// '<Root>/Adapter1'
BUS_STATUS_RX_MULTIPLE CAN_Decoder_o2;// '<S6>/CAN_Decoder'
BUS_CAN_RX_ERRORS_MULTIPLE CAN_Decoder_o3;// '<S6>/CAN_Decoder'
ControlOutputs RTBInsertedForAdapter_Inserte_a;// '<Root>/Adapter1'
};

// Block states (default storage) for system '<Root>'
Expand All @@ -63,10 +64,10 @@ struct DW_AMC_BLDC_T {
SensorsData RTBInsertedForAdapter_Inserte_c;// synthesized block
SensorsData RTBInsertedForAdapter_Inserte_j;// synthesized block
Targets RTBInsertedForAdapter_Inserte_m[3];// synthesized block
ControlOuterOutputs RTBInsertedForAdapter_Inserte_i[3];// synthesized block
ControlOutputs RTBInsertedForAdapter_Inserte_d;// synthesized block
ControlOutputs RTBInsertedForAdapter_Insert_j2;// synthesized block
ControlOutputs RTBInsertedForAdapter_Inserte_o;// synthesized block
ControlOuterOutputs RTBInsertedForAdapter_Inserte_i[3];// synthesized block
EstimatedData RTBInsertedForAdapter_Inserte_k[3];// synthesized block
Flags RTBInsertedForAdapter_Inserte_l[3];// synthesized block
void* RTBInsertedForAdapter_Insert_mf;// synthesized block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Code generated for Simulink model 'AMC_BLDC'.
//
// Model version : 5.1
// Simulink Coder version : 9.8 (R2022b) 13-May-2022
// C/C++ source code generated on : Mon Mar 13 14:26:47 2023
// Model version : 6.1
// Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
// C/C++ source code generated on : Thu Apr 6 14:47:14 2023
//
// Target selection: ert.tlc
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Code generated for Simulink model 'AMC_BLDC'.
//
// Model version : 5.1
// Simulink Coder version : 9.8 (R2022b) 13-May-2022
// C/C++ source code generated on : Mon Mar 13 14:26:47 2023
// Model version : 6.1
// Simulink Coder version : 9.9 (R2023a) 19-Nov-2022
// C/C++ source code generated on : Thu Apr 6 14:47:14 2023
//
// Target selection: ert.tlc
// Embedded hardware selection: ARM Compatible->ARM Cortex-M
Expand Down Expand Up @@ -303,6 +303,7 @@ struct ControlOuterOutputs
boolean_T vel_en;
boolean_T cur_en;
boolean_T out_en;
boolean_T pid_reset;
MotorCurrent motorcurrent;
real32_T current_limiter;
};
Expand Down Expand Up @@ -336,6 +337,9 @@ struct ControlOutputs

// quadrature current
MotorCurrent Iq_fbk;

// direct current
MotorCurrent Id_fbk;
};

#endif
Expand Down Expand Up @@ -628,6 +632,8 @@ struct BUS_FLAGS_TX
struct BUS_MSG_STATUS
{
MCControlModes control_mode;

// control effort (quadrature)
real32_T pwm_fbk;
BUS_FLAGS_TX flags;
};
Expand Down
Loading

0 comments on commit 37ed3f6

Please sign in to comment.