matlab wip
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
function [Kp,Kvfb,Ki,Kvff,Kaff,MaxInt,mot_num,mot_den,Ts,MaxDac,MaxPosErr,A,B,C,D]=simFxFyStage(mot,motid)
|
||||
%global Kp Kvfb Ki Kvff Kaff MaxInt mot_num mot_den Ts MaxDac MaxPosErr A B C D
|
||||
function [pb]=simFxFyStage(mot,motid)
|
||||
% !!! first it need to run: [mot1,mot2]=identifyFxFyStage() tobuild a motor object !!!
|
||||
%
|
||||
%loads the current (11.10.2018) controller settings of the
|
||||
%Powerbrick and opens its simulink file
|
||||
%the returned variable pb contains varous parameters:
|
||||
% Kp,Kvfb,Ki,Kvff,Kaff,MaxInt,mot_num,mot_den,Ts,MaxDac,MaxPosErr,A,B,C,D
|
||||
|
||||
Ts=2E-4; % 0.2ms=5kHz
|
||||
MaxDac=2011.968;
|
||||
MaxPosErr=10000;
|
||||
@@ -22,20 +28,8 @@ function [Kp,Kvfb,Ki,Kvff,Kaff,MaxInt,mot_num,mot_den,Ts,MaxDac,MaxPosErr,A,B,C,
|
||||
%ServoDeltaTau_z(motid)
|
||||
[A,B,C,D]=tf2ss(mot_num,mot_den);
|
||||
|
||||
%mdlWks=get_param(mdlName,'ModelWorkspace');
|
||||
%whos global
|
||||
%whos(mdlWks)
|
||||
%for k=["Kp","Kvfb","Ki","Kvff","Kaff","MaxInt","mot_num","mot_den","Ts","MaxDac","MaxPosErr"]
|
||||
% assignin(mdlWks,k,eval(k))
|
||||
%end
|
||||
|
||||
%assignin(mdlWks,'Ts',1234)
|
||||
%getVariable(mdlWks,'Ts')
|
||||
% in global space call:
|
||||
%global Kp Kvfb Ki Kvff Kaff MaxInt
|
||||
%global mot_num mot_den Ts MaxDac MaxPosErr
|
||||
%[mot1,mot2]=identifyFxFyStage();
|
||||
%simFxFyStage(mot1,mot2);
|
||||
|
||||
%
|
||||
pb=struct();
|
||||
for k=["Kp","Kvfb","Ki","Kvff","Kaff","MaxInt","mot_num","mot_den","Ts","MaxDac","MaxPosErr","A","B","C","D"]
|
||||
pb=setfield(pb,k,eval(k));
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user