How to set programmatically the stepping mode of a stepper motor driver in Simscape?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I'm running a Simscape model stepper_motor.slx inspired by the demo "Stepper Motor with Control" (file ee_motor_stepper.slx). This model contains a Stepper Motor Driver block where it is possible to choice the stepping mode and eventually the number of microsteps per step.
I want to write program simulation_stepper.mlx which sets these parameters programmatically, or at least which can retrieve the values of the parameters set by the user, but I cannot find any example/documentation on how to do it. At present time the user must configure automatically the .mlx and the Simscape model in the same way, which is clearly nasty and error prone.
Any idea? Thank you in advance.
0 Commenti
Risposte (1)
Prathamesh
il 18 Lug 2023
Hi,
I understand that you want to programmatically update the parameters of the Stepper Motor Driver block. This can be done by using ‘get_param’ and ‘set_param’ functions.
%to update the stepping mode
get_param('stepper_motor/Stepper Motor Driver', 'value@stepping_mode')
set_param('stepper_motor/Stepper Motor Driver', 'stepping_mode', 'microStep')
%to update the number of micro steps
get_param('stepper_motor/Stepper Motor Driver', 'value@numMicroSteps')
set_param('stepper_motor/Stepper Motor Driver', 'numMicroSteps', '8')
Also save the model after setting appropriate parameters to reflect the changes.
Please refer to the documentation of ‘get_param’ and ‘set_param’ functions attached.
I hope this resolves your issue.
0 Commenti
Vedere anche
Categorie
Scopri di più su Electrical Sensors in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!