Maximum RPM with different Voltage source

Hi everybody.

I have a axial flux motor that is mentioned in spec that the KV rating is 7 RPM/Volt.

But when I use SimpleFoc in FOC_Current mode and the source is 12 volt the below scenario is happened :

1- The motor reaches Target = 6 ( velocity rad/s ) and Vq does not reach maximum voltage and everthings is good and drive tries to control motor in desired velocity.

2- When we set Target = 7 the motor can not reach this velocity and Vq sticking to maximum and it does not what I expected.

This scenario happens with different voltage source and higher Target.
For example with 24V , motor can reach T=11 and everything is good but when I set T=12 Vq sticking to max.

Is there any parameter that should I change ?

My code is here :

#include <SimpleFOC.h>


HardwareSerial Serial2(PB11, PB10);
/// F103 TIM1
// #define PHA_H PA8 // TIM1
// #define PHA_L PB13 // TIM1
// #define PHB_H PA9 // TIM1
// #define PHB_L PB14 // TIM1
// #define PHC_H PA10 // TIM1
// #define PHC_L PB15 // TIM1


/// F407VGT6 TIM1
#define PHA_H PE9 // TIM1
#define PHA_L PA7 // TIM1
#define PHB_H PE11 // TIM1
#define PHB_L PB0 // TIM1
#define PHC_H PE13 // TIM1
#define PHC_L PB1 // TIM1

// magnetic sensor instance - AS5600 I2C
// MagneticSensorI2C sensor = MagneticSensorI2C(AS5600_I2C);


// /SPI 1 (AS5048A)
#define MOSI_ENC PB5// PA7    
#define MISO_ENC PB4// PA6    
#define CLK_ENC  PB3// PA5    
#define CS_ENC   PE3

// MagneticSensorSPIConfig_s AS5048A_SPI_Config{
//     .spi_mode = SPI_MODE1,
//     .clock_speed = 10000000,
//     .bit_resolution = 14,
//     .angle_register = 0x3FFF,
//     .data_start_bit = 13,
//     .command_rw_bit = 14,
//     .command_parity_bit = 15
// };

MagneticSensorSPI sensor = MagneticSensorSPI(AS5147_SPI, CS_ENC);
SPIClass SPI_1(MOSI_ENC, MISO_ENC, CLK_ENC);  //(mosi, miso, sclk)




// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(5);
// BLDCMotor motor = BLDCMotor(5);
BLDCDriver6PWM driver = BLDCDriver6PWM(PHA_H, PHA_L, PHB_H, PHB_L, PHC_H, PHC_L);


// InlineCurrentSense current_sense  = InlineCurrentSense(16.33f,  PA0, PA1, PA2);
InlineCurrentSense current_sense  = InlineCurrentSense(31.3f,  PA0, PA1, PA2);




// velocity set point variable
float target_velocity = 0;

// instantiate the commander
// Commander command = Commander(Serial1);


Commander command = Commander(Serial2);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }

// void doMotor(char* cmd) { command.motor(&motor, cmd); }





void setup() {
  sensor.init(&SPI_1);

  motor.linkSensor(&sensor);
  motor.phase_inductance = 0.25;
  motor.KV_rating = 7.17;

  // motor.zero_electric_angle = 5.06;
  // motor.sensor_direction = Direction::CCW;


  motor.zero_electric_angle = 2.12;
  motor.sensor_direction = Direction::CCW;

  // motor.zero_electric_angle = 1.90;
  // motor.sensor_direction = Direction::CW;
  
  // driver config
  // power supply voltage [V]
  // default voltage_power_supply
  driver.voltage_power_supply = 24;
  driver.voltage_limit = 22;
  motor.voltage_limit = 22;
  
  driver.pwm_frequency = 32000;
  driver.dead_zone = 0.05;
  driver.init();
  // current_sense.gain_b *=-1;
  // current_sense.skip_align = true;

  
  // link the motor and the driver
  motor.linkDriver(&driver);

  current_sense.linkDriver(&driver);
  // current sense init hardware
  current_sense.init();
  // current_sense.gain_a *=-1;
  // current_sense.gain_b *=-1;
  // current_sense.gain_c *=-1;
  // current_sense.skip_align = true;
  // link the current sense to the motor
  motor.linkCurrentSense(&current_sense);

  motor.voltage_sensor_align = 6;
  

  // set motion control loop to be used
  // motor.controller = MotionControlType::velocity;
  motor.controller = MotionControlType::torque;
  motor.torque_controller = TorqueControlType::foc_current;
  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
  motor.modulation_centered =1;
  motor.motion_downsample = 10;

  // contoller configuration
  // default parameters in defaults.h

  // velocity PI controller parameters
  motor.PID_velocity.P = 0.2;
  motor.PID_velocity.I = 20;
  motor.PID_velocity.D = 0;

  motor.LPF_velocity.Tf = 0.05f;
  motor.LPF_angle.Tf = 0.05f;
  
  motor.PID_current_q.P = 0.15;
  motor.PID_current_q.I= 0.6;
  // motor.PID_current_q.limit = motor.voltage_limit;;
  motor.PID_current_d.P= 0.15;
  motor.PID_current_d.I = 0.6;
  // motor.PID_current_d.P= 0.001;
  // motor.PID_current_d.I = 0.001;
  // motor.PID_current_d.limit = motor.voltage_limit;;
  motor.LPF_current_q.Tf = 0.005f;
  motor.LPF_current_d.Tf = 0.005f;
  


  // motor.phase_resistance = 0.25;
  motor.current_limit = 20; // 36V

  motor.PID_velocity.output_ramp = 1000;

  // velocity low pass filtering
  // default 5ms - try different values to see what is the best.
  // the lower the less filtered
  

  // use monitoring with serial
  Serial2.begin(115200);
  // command.add('A', doMotor, "motor target");
  // command.add('A',doMyMotor,"my motor");

  // comment out if not needed
  motor.useMonitoring(Serial2);
  // motor.monitor_downsample = 0;

  // initialize motor
  

  
  
  

  motor.init();

  // align sensor and start FOC
  motor.initFOC();
  
  // add target command T
  command.add('T', doTarget, "target velocity");
  

  // command.add('M', doMotor, "Motor");
  // motor.monitor_downsample = 100;
  Serial2.println(F("Motor ready."));
  Serial2.println(F("Set the target velocity using serial terminal:"));
  _delay(1000);

  
}

  
}
void loop() {

  motor.loopFOC();

  motor.move(target_velocity);
  

  motor.monitor();


  command.run();
  
  
}

Hi,

Probably this section of the documentation helps.