Skip to content
Snippets Groups Projects
Commit faabac05 authored by mooney's avatar mooney
Browse files

Moved to motor module

parent ace6edeb
No related branches found
No related tags found
No related merge requests found
# This database implements a generic 2-D coordinate transformation. Given two
# real motors (P)(MX) and (P)(MY), which move in the X,Y coordinate system,
# it will move two soft motors (P)(MXP) and (P)(MYP) in the X',Y'
# coordinate system. The offset between the two coordinate systems is
# X0 = (P)(MXP)C1 and Y0 = (P)(MYP)C1, and the coordinate systems are
# rotated by angle theta = (P)(MYP)C2.
# These two records are where the soft motors write their output.
# They are needed because writing to a transform record field does not
# cause the record to process?
# We use forward links to the transform record (rather than making the INPA and
# INPB fields of the transform record CP) so that the scan record waits
# for the motors to move.
grecord(ao,"$(P)$(MXP)DVAL") {
field(FLNK, "$(P)$(T)Drive")
}
grecord(ao,"$(P)$(MYP)DVAL") {
field(FLNK, "$(P)$(T)Drive")
}
# This record is processed whenever the soft motor records XP or YP write
# new values to the DVAL records above.
# Note: the INPA and INPB fields get their values directly from the .DVAL
# fields of the soft motor records, rather than from the DVAL record above.
# This is because the .DVAL fields are always correct, while the DVAL records
# do not get updated when the soft motor .DVAL fields are modified in SET mode.
grecord(transform,"$(P)$(T)Drive") {
field(INPA,"$(P)$(MXP).DVAL NPP NMS")
field(INPB,"$(P)$(MYP).DVAL NPP NMS")
field(INPC,"$(P)$(MXP)C1.VAL NPP NMS")
field(INPD,"$(P)$(MYP)C1.VAL NPP NMS")
field(INPE,"$(P)$(MYP)C2.VAL NPP NMS")
field(CLCF,"0.0174533 * E")
field(CLCG,"C+A*COS(F)-B*SIN(F)")
field(OUTG,"$(P)$(XDRV) PP MS")
field(CLCH,"D+A*SIN(F)+B*COS(F)")
field(OUTH,"$(P)$(YDRV) PP MS")
field(PREC,"$(PREC)")
}
# This record is processed to set the origin of the XP, YP coordinate system
# to be the current position of the motors.
grecord(transform,"$(P)$(T)synch") {
field(INPA,"$(P)$(XDRV) NPP NMS")
field(INPB,"$(P)$(YDRV) NPP NMS")
field(CLCC,"A")
field(OUTC,"$(P)$(MXP)C1.VAL PP MS")
field(CLCD,"B")
field(OUTD,"$(P)$(MYP)C1.VAL PP MS")
field(PREC,"$(PREC)")
}
# This record calculates the readback positions of the soft motors. It
# processes whenever the readbacks of the real motors change, or whenever
# one of the the geometry constants changes.
grecord(transform,"$(P)$(T)Readback") {
field(INPA,"$(P)$(XRBV) CP MS")
field(INPB,"$(P)$(YRBV) CP MS")
field(INPC,"$(P)$(MXP)C1.VAL CP MS")
field(INPD,"$(P)$(MYP)C1.VAL CP MS")
field(INPE,"$(P)$(MYP)C2.VAL CP MS")
field(CLCF,"0.0174533 * E")
field(CLCG,"(B-D)*SIN(F)+(A-C)*COS(F)")
field(CLCH,"(B-D)*COS(F)-(A-C)*SIN(F)")
field(PREC,"$(PREC)")
}
# This record processes if either of the sof motor STOP fields is set.
grecord(dfanout,"$(P)$(T)Stop") {
field(VAL,"1")
field(OUTA,"$(P)$(XSTOP) PP MS")
field(OUTB,"$(P)$(YSTOP) PP MS")
}
# This record computes whether the compound motor is done moving.
# It goes to 1 when both real motors are done moving.
# positions of the real motors.
grecord(calcout,"$(P)$(T)Done") {
field(INPA,"$(P)$(XDONE) CP MS")
field(INPB,"$(P)$(YDONE) CP MS")
field(CALC,"A & B")
}
grecord(bo,"$(P)$(M)_able")
{
field(DESC,"motor enable")
field(PINI,"YES")
field(OUT,"$(P)$(M)_ableput.A PP MS")
field(ZNAM,"Enable")
field(ONAM,"Disable")
}
grecord(motor,"$(P)$(M)")
{
field(DESC,"$(DESC)")
field(DTYP,"Soft Channel")
field(DINP,"$(DINP)")
field(DIR,"$(DIR)")
field(VELO,"$(VELO)")
field(VMAX,"$(VELO)")
field(S,"0")
field(VBAS,"$(VBAS)")
field(SBAS,"0")
field(ACCL,"$(ACCL)")
field(BDST,"$(BDST)")
field(BVEL,"$(BVEL)")
field(BACC,"$(BACC)")
field(OUT,"$(OUT)")
field(RDBL,"$(RDBL)")
field(URIP,"Yes")
field(STOO,"$(STOO)")
field(MRES,"$(MRES)")
field(RRES,"$(RRES)")
field(PREC,"$(PREC)")
field(EGU,"$(EGU)")
field(DHLM,"$(DHLM)")
field(DLLM,"$(DLLM)")
field(TWV,"1")
field(RTRY,"0")
field(OFF,"0.")
field(FOFF,"Frozen")
field(NTM,"NO")
}
grecord(transform,"$(P)$(M)_ableput")
{
field(CLCB,"a")
field(CLCC,"a")
field(OUTA,"$(P)$(M).DISA NPP NMS")
field(OUTB,"$(P)$(M).DISP NPP NMS")
field(OUTC,"$(P)$(M).DISA NPP NMS")
}
# Note: the C1-C5 records have PINI=1 so that they process once.
# If they don't then they have STAT=UDF and SEVR=Invalid, and records
# like the transform record will report bad input links.
grecord(ao,"$(P)$(M)C1") {
field(DESC, "User-defined geom. const. 1")
field(VAL,"1")
field(PINI,"1")
field(PREC, "$(PREC)")
field(EGU, "$(EGU)")
}
grecord(ao,"$(P)$(M)C2") {
field(DESC, "User-defined geom. const. 2")
field(VAL,"1")
field(PINI,"1")
field(PREC, "$(PREC)")
field(EGU, "$(EGU)")
}
grecord(ao,"$(P)$(M)C3") {
field(DESC, "User-defined geom. const. 3")
field(VAL,"1")
field(PINI,"1")
field(PREC, "$(PREC)")
field(EGU, "$(EGU)")
}
grecord(ao,"$(P)$(M)C4") {
field(DESC, "User-defined geom. const. 4")
field(VAL,"1")
field(PINI,"1")
field(PREC, "$(PREC)")
field(EGU, "$(EGU)")
}
grecord(ao,"$(P)$(M)C5") {
field(DESC, "User-defined geom. const. 5")
field(VAL,"1")
field(PINI,"1")
field(PREC, "$(PREC)")
field(EGU, "$(EGU)")
}
# FILE... pseudoMotor_settings.req
$(P)$(M).DHLM
$(P)$(M).DLLM
$(P)$(M).TWV
$(P)$(M).DISA
$(P)$(M).DISP
$(P)$(M).OFF
$(P)$(M)C1
$(P)$(M)C2
$(P)$(M)C3
$(P)$(M)C4
$(P)$(M)C5
$(P)$(M)_able.VAL
$(P)$(M):scanParms.SP
$(P)$(M):scanParms.EP
$(P)$(M):scanParms.NP
# This database implements a generic 2-D coordinate transformation. Given two
# real motors $(P)$(M1DRV) and $(P)$(M1DRV), which move parallel to each other,
# it will move two soft motors $(P)$(SUM) and $(P)$(DIFF) as the weighted
# average and difference of the two real motors. The weighting factors are
# as follows:
# SUM = (( $(P)$(M1DRV) * $(P)$(SUM)C1 ) + ( $(P)$(M2DRV) * $(P)$(SUM)C2 )) /
# ( $(P)$(SUM)C1) + $(P)$(SUM)C2 )
# DIFF = (( $(P)$(M1DRV) - $(P)$(M2DRV) ) * ( $(P)$(DIFF)C1 )
# Thus the SUM C1 and C2 terms are the "distances" from the center and the
# DIFF C1 term is a units conversion, e.g. to degrees for a rotation system.
# These two records are where the soft motors write their output.
# They are needed because writing to a transform record field does not
# cause the record to process?
# We use forward links to the transform record (rather than making the INPA and
# INPB fields of the transform record CP) so that the scan record waits
# for the motors to move.
grecord(ao,"$(P)$(SUM)DVAL") {
field(FLNK, "$(P)$(T)Drive")
}
grecord(ao,"$(P)$(DIFF)DVAL") {
field(FLNK, "$(P)$(T)Drive")
}
# This record is processed whenever the soft motor records SUM or DIFF write
# new values to the DVAL records above.
# Note: the INPA and INPB fields get their values directly from the .DVAL
# fields of the soft motor records, rather than from the DVAL record above.
# This is because the .DVAL fields are always correct, while the DVAL records
# do not get updated when the soft motor .DVAL fields are modified in SET mode.
grecord(transform,"$(P)$(T)Drive") {
field(INPA,"$(P)$(SUM).DVAL NPP NMS")
field(INPB,"$(P)$(DIFF).DVAL NPP NMS")
field(INPC,"$(P)$(SUM)C1.VAL NPP NMS")
field(INPD,"$(P)$(SUM)C2.VAL NPP NMS")
field(INPE,"$(P)$(DIFF)C1.VAL NPP NMS")
field(CLCF,"C+D")
field(CLCG,"A+(B*D)/(E*F)")
field(OUTG,"$(P)$(M1DRV) PP MS")
field(CLCH,"A-(B*C)/(E*F)")
field(OUTH,"$(P)$(M2DRV) PP MS")
field(PREC,"$(PREC)")
}
# This record calculates the readback positions of the soft motors. It
# processes whenever the readbacks of the real motors change, or whenever
# one of the the geometry constants changes.
grecord(transform,"$(P)$(T)Readback") {
field(INPA,"$(P)$(M1RBV) CP MS")
field(INPB,"$(P)$(M2RBV) CP MS")
field(INPC,"$(P)$(SUM)C1.VAL CP MS")
field(INPD,"$(P)$(SUM)C2.VAL CP MS")
field(INPE,"$(P)$(DIFF)C1.VAL CP MS")
field(CLCF,"C+D")
field(CLCG,"((A*C) + (B*D))/F")
field(CLCH,"(A-B)*E")
field(IVLA,"Do Nothing")
field(PREC,"$(PREC)")
}
# This record processes if either of the soft motor STOP fields is set.
grecord(dfanout,"$(P)$(T)Stop") {
field(VAL,"1")
field(OUTA,"$(P)$(M1STOP) PP MS")
field(OUTB,"$(P)$(M2STOP) PP MS")
}
# This record computes whether the compound motor is done moving.
# It goes to 1 when both real motors are done moving.
# positions of the real motors.
grecord(calcout,"$(P)$(T)Done") {
field(INPA,"$(P)$(M1DONE) CP MS")
field(INPB,"$(P)$(M2DONE) CP MS")
field(CALC,"A & B")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment