setup torque of electric motor via PCI 6703

2 views (last 30 days)
Hi everyone.
Now, I have an electric motor controlled by speed its via PCI 6703. I would like know if I want setup torque its instead of speed. How to way I can do it.
Thanks so much
Best regards,

Answers (1)

Abhishek Chakram
Abhishek Chakram on 7 May 2024
Hi Hien Nguyen Van,
To set up torque control for an electric motor using the PCI-6703 in MATLAB, you will need to adjust your approach to generate the appropriate control signals for torque instead of speed. This process involves interfacing with the hardware using “Data Acquisition Toolbox” and the “Instrument Control Toolbox”, depending on your setup. Here is a guide for the same:
  • Ensure you have the Data Acquisition Toolbox installed in MATLAB, as it is necessary for interfacing with National Instruments hardware. If you are using any specific communication protocol or need to interface with other types of equipment, the Instrument Control Toolbox might also be required.
% Check for installed toolboxes
ver
  • Create a data acquisition session in MATLAB and add an analog output channel corresponding to the PCI-6703 device. You wll need to know the device ID, which you can find using the daq.getDevices command.
% Discover connected DAQ devices
devices = daq.getDevices;
% Create a session
s = daq.createSession('ni');
% Add an analog output channel (Assuming 'Dev1' is your device ID and you're using channel 0)
addAnalogOutputChannel(s,'Dev1', 0, 'Voltage');
  • Determine the voltage range that corresponds to the full range of torque. For example, if 0-10V corresponds to 0 to the maximum torque, you will need to scale your torque command accordingly.
  • Create a function to send a voltage signal corresponding to the desired torque. Ensure you scale your desired torque to the voltage range correctly.
function commandTorque(session, desiredTorque, maxTorque)
% Example function to command torque on an electric motor
% Parameters
maxVoltage = 10; % Max voltage corresponding to maxTorque
% Scale the desiredTorque to the voltage
voltageCommand = (desiredTorque / maxTorque) * maxVoltage;
% Ensure the command is within limits
voltageCommand = min(max(voltageCommand, 0), maxVoltage);
% Output the voltage to the motor
outputSingleScan(session, voltageCommand);
end
  • You can now use the commandTorque function within a control loop to command torque to your motor. If implementing closed-loop control, you will also need to acquire feedback, such as motor current, and adjust your torque command based on the difference between the desired and actual torque.
You can refer to the following documentation to know more about functions used:
You can also refer to the following alternative ways to set up torque control for an electric motor:
Best Regards,
Abhishek Chakram

Categories

Find more on Code Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!