wip
This commit is contained in:
@@ -238,21 +238,14 @@ class MXTuning(Tuning):
|
||||
s=' //input values\n'
|
||||
for i in range(len(u)):
|
||||
s+=' double {u}=Mptr->{u};\n'.format(u=u[i])
|
||||
prog+=s+'''\n
|
||||
prog+=s+'''
|
||||
if (Mptr->ClosedLoop)
|
||||
{
|
||||
return iqCmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
Mptr->Servo.Integrator=0.0;
|
||||
return 0.0;
|
||||
}
|
||||
'''
|
||||
|
||||
s=' //x[n+1]=A*x[n]+B*u;\n'
|
||||
s=' //x[n+1]=A*x[n]+B*u;\n'
|
||||
for i in range(A.shape[0]):
|
||||
s+=' x[%d]='%i
|
||||
s+=' x[%d]='%i
|
||||
for j in range(A.shape[1]):
|
||||
s+='%+28.22g*_x[%d]'%(A[i,j],j)
|
||||
for j in range(B.shape[0]):
|
||||
@@ -260,29 +253,37 @@ class MXTuning(Tuning):
|
||||
s+=';\n'
|
||||
prog+=s+'\n'
|
||||
|
||||
s=' //y=C*x[n]+D*x[n];\n'
|
||||
s=' //y=C*x[n]+D*x[n];\n'
|
||||
for i in range(C.shape[0]):
|
||||
s+=' %s='%y[i]
|
||||
s+=' %s='%y[i]
|
||||
for j in range(C.shape[1]):
|
||||
s+='%+28.22g*_x[%d]'%(C[i,j],j)
|
||||
s+=';\n'
|
||||
prog+=s+'\n'
|
||||
|
||||
|
||||
prog+=''' iqCmd=DesPos*{V}-{y};
|
||||
if (iqCmd>maxDac)
|
||||
{{
|
||||
iqCmd=maxDac;
|
||||
prog+=''' iqCmd=DesPos*{V}-{y};
|
||||
if (iqCmd>maxDac)
|
||||
{{
|
||||
iqCmd=maxDac;
|
||||
}}
|
||||
else
|
||||
{{
|
||||
if (iqCmd<-maxDac)
|
||||
{{
|
||||
iqCmd=-maxDac;
|
||||
}}
|
||||
}}
|
||||
//return iqCmd;
|
||||
pshm->P[200{motid}]=iqCmd; //lowpass of Position error
|
||||
return pshm->ServoCtrl(Mptr);
|
||||
}}
|
||||
else
|
||||
{{
|
||||
if (iqCmd<-maxDac)
|
||||
{{
|
||||
iqCmd=-maxDac;
|
||||
}}
|
||||
Mptr->Servo.Integrator=0.0;
|
||||
return 0.0;
|
||||
}}
|
||||
return iqCmd;
|
||||
}}'''.format(V=V[0,0],y=y[0])
|
||||
}}'''.format(V=V[0,0],y=y[0],motid=motid)
|
||||
|
||||
hdr='''double obsvr_servo_ctrl_{motid}(MotorData *Mptr);
|
||||
EXPORT_SYMBOL(obsvr_servo_ctrl_{motid});'''.format(motid=motid)
|
||||
@@ -336,7 +337,7 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n '
|
||||
|
||||
#plt.ion()
|
||||
#args.host='MOTTEST-CPPM-CRM0573'
|
||||
#args.host=None
|
||||
args.host=None
|
||||
if args.host is None:
|
||||
comm=gt=None
|
||||
else:
|
||||
|
||||
2535
python/MXTuningDoc/curr_step.eps
Normal file
2535
python/MXTuningDoc/curr_step.eps
Normal file
File diff suppressed because it is too large
Load Diff
BIN
python/MXTuningDoc/curr_step.png
Normal file
BIN
python/MXTuningDoc/curr_step.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
BIN
python/MXTuningDoc/current_step_of_motor_1.png
Normal file
BIN
python/MXTuningDoc/current_step_of_motor_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
11870
python/MXTuningDoc/m1_sim_pb.eps
Normal file
11870
python/MXTuningDoc/m1_sim_pb.eps
Normal file
File diff suppressed because it is too large
Load Diff
10011
python/MXTuningDoc/m1_sim_ss.eps
Normal file
10011
python/MXTuningDoc/m1_sim_ss.eps
Normal file
File diff suppressed because it is too large
Load Diff
10017
python/MXTuningDoc/m1_sim_ss_pref.eps
Normal file
10017
python/MXTuningDoc/m1_sim_ss_pref.eps
Normal file
File diff suppressed because it is too large
Load Diff
11242
python/MXTuningDoc/m2_mdl_bode.eps
Normal file
11242
python/MXTuningDoc/m2_mdl_bode.eps
Normal file
File diff suppressed because it is too large
Load Diff
9860
python/MXTuningDoc/m2_sim_pb.eps
Normal file
9860
python/MXTuningDoc/m2_sim_pb.eps
Normal file
File diff suppressed because it is too large
Load Diff
10299
python/MXTuningDoc/m2_sim_ss.eps
Normal file
10299
python/MXTuningDoc/m2_sim_ss.eps
Normal file
File diff suppressed because it is too large
Load Diff
10157
python/MXTuningDoc/m2_sim_ss_pref.eps
Normal file
10157
python/MXTuningDoc/m2_sim_ss_pref.eps
Normal file
File diff suppressed because it is too large
Load Diff
BIN
python/MXTuningDoc/observer.png
Normal file
BIN
python/MXTuningDoc/observer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
97
python/swissmx.svg
Normal file
97
python/swissmx.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 152 KiB |
Reference in New Issue
Block a user