EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Home motorSim Device
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: William Cork <wcork at lbl.gov>
Cc: tech-talk <tech-talk at aps.anl.gov>
Date: Fri, 10 Apr 2020 18:37:42 +0000
Hi Will,

> Behaviour is as you've stated. As for bugs, I've also seen the following when starting the IOC:

IOC:m1Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m2Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m3Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m4Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m1Offset devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_OFFSET

...

Those error are all for motors m1-m3, the Model 2 driver.  They are expected because the Model 2 driver does not support that feature.

I just changed st.cmd.unix and motor.substitutions as follows to change to only use a single Model 3 driver.

*********************************
corvette:motorSimIOC/iocBoot/iocMotorSim>git diff .
diff --git a/iocs/motorSimIOC/iocBoot/iocMotorSim/motor.substitutions b/iocs/motorSimIOC/iocBoot/iocMotorSim/motor.substitutions
index c01e659..9ddebc0 100644
--- a/iocs/motorSimIOC/iocBoot/iocMotorSim/motor.substitutions
+++ b/iocs/motorSimIOC/iocBoot/iocMotorSim/motor.substitutions
@@ -6,9 +6,8 @@ pattern
 {IOC:,  2,  "m$(N)",  "asynMotor",  motorSim1,  1,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
 {IOC:,  3,  "m$(N)",  "asynMotor",  motorSim1,  2,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
 {IOC:,  4,  "m$(N)",  "asynMotor",  motorSim1,  3,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
-
-{IOC:,  5,  "m$(N)",  "asynMotor",  motorSim2,  0,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
-{IOC:,  6,  "m$(N)",  "asynMotor",  motorSim2,  1,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
-{IOC:,  7,  "m$(N)",  "asynMotor",  motorSim2,  2,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
-{IOC:,  8,  "m$(N)",  "asynMotor",  motorSim2,  3,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
+{IOC:,  5,  "m$(N)",  "asynMotor",  motorSim1,  4,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
+{IOC:,  6,  "m$(N)",  "asynMotor",  motorSim1,  5,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
+{IOC:,  7,  "m$(N)",  "asynMotor",  motorSim1,  6,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
+{IOC:,  8,  "m$(N)",  "asynMotor",  motorSim1,  7,     "motor $(N)",  degrees,  Pos,  1,     .1,    .2,    0,     1,     .2,    0.01,  5,     100,   -100,  ""}
 }
diff --git a/iocs/motorSimIOC/iocBoot/iocMotorSim/st.cmd.unix b/iocs/motorSimIOC/iocBoot/iocMotorSim/st.cmd.unix
index f7ef9e6..71a6cf3 100644
--- a/iocs/motorSimIOC/iocBoot/iocMotorSim/st.cmd.unix
+++ b/iocs/motorSimIOC/iocBoot/iocMotorSim/st.cmd.unix
@@ -9,18 +9,22 @@ motorSim_registerRecordDeviceDriver(pdbbase)
 dbLoadTemplate("motor.substitutions")

 # Create simulated motors: ( start card , start axis , low limit, high limit, home posn, # cards, # axes to setup)
-motorSimCreate( 0, 0, -32000, 32000, 0, 1, 4 )
+#motorSimCreate( 0, 0, -32000, 32000, 0, 1, 4 )
 # Setup the Asyn layer (portname, low-level driver drvet name, card, number of axes on card)
-drvAsynMotorConfigure("motorSim1", "motorSim", 0, 4)
+#drvAsynMotorConfigure("motorSim1", "motorSim", 0, 4)

-motorSimCreateController("motorSim2", 8)
-#asynSetTraceIOMask("motorSim2", 0, 4)
-#asynSetTraceMask("motorSim2", 0, 255)
+motorSimCreateController("motorSim1", 8)
+#asynSetTraceIOMask("motorSim1", 0, 4)
+#asynSetTraceMask("motorSim1", 0, 255)

 # motorSimConfigAxis(port, axis, lowLimit, highLimit, home, start)
-motorSimConfigAxis("motorSim2", 0, 20000, -20000,  500, 0)
-motorSimConfigAxis("motorSim2", 1, 20000, -20000, 1500, 0)
-motorSimConfigAxis("motorSim2", 2, 20000, -20000, 2500, 0)
-motorSimConfigAxis("motorSim2", 3, 20000, -20000, 3000, 0)
+motorSimConfigAxis("motorSim1", 0, 20000, -20000,  500, 0)
+motorSimConfigAxis("motorSim1", 1, 20000, -20000, 1500, 0)
+motorSimConfigAxis("motorSim1", 2, 20000, -20000, 2500, 0)
+motorSimConfigAxis("motorSim1", 3, 20000, -20000, 3000, 0)
+motorSimConfigAxis("motorSim1", 4, 20000, -20000,  500, 0)
+motorSimConfigAxis("motorSim1", 5, 20000, -20000, 1500, 0)
+motorSimConfigAxis("motorSim1", 6, 20000, -20000, 2500, 0)
+motorSimConfigAxis("motorSim1", 7, 20000, -20000, 3000, 0)

 iocInit
*********************************

With those changes there are no errors on startup.

Mark


________________________________
From: William Cork <wcork at lbl.gov>
Sent: Friday, April 10, 2020 12:48 PM
To: Mark Rivers
Cc: tech-talk
Subject: Re: Home motorSim Device

Mark,

Interesting. I've switched to the motorSim included with the motor module in synApps.

Behaviour is as you've stated. As for bugs, I've also seen the following when starting the IOC:
```
#!../../bin/linux-x86_64/motorSim
< envPaths
epicsEnvSet("IOC","iocMotorSim")
epicsEnvSet("TOP","/mnt/Data/Development/CXRO/tpi/iocs/tpi-motor-sim")
epicsEnvSet("EPICS_BASE","/opt/epics/base")
epicsEnvSet("ASYN","/opt/epics/modules/synApps/support/asyn-R4-37")
epicsEnvSet("MOTOR","/opt/epics/modules/synApps/support/motor-R7-1")
epicsEnvSet("SUPPORT","/opt/epics/modules/synApps/support")
epicsEnvSet("SNCSEQ","/opt/epics/modules/synApps/support/seq-2-2-6")
epicsEnvSet("BUSY","/opt/epics/modules/synApps/support/busy-R1-7-2")
epicsEnvSet("IPAC","/opt/epics/modules/synApps/support/ipac-2-15")
epicsEnvSet("MOTOR_MOTORSIM","/opt/epics/modules/synApps/support/motor-R7-1/modules/motorMotorSim")
cd "/mnt/Data/Development/CXRO/tpi/iocs/tpi-motor-sim"
## Register all support components
dbLoadDatabase "dbd/motorSim.dbd"
motorSim_registerRecordDeviceDriver pdbbase
cd "/mnt/Data/Development/CXRO/tpi/iocs/tpi-motor-sim/iocBoot/iocMotorSim"
dbLoadTemplate("motor.substitutions")
# Create simulated motors: ( start card , start axis , low limit, high limit, home posn, # cards, # axes to setup)
motorSimCreate( 0, 0, -32000, 32000, 0, 1, 4 )
Creating motor simulator: card: 0, axis: 0, hi: 32000, low -32000, home: 0, ncards: 1, naxis: 4
Created motor for card 0, signal 0 OK
Created motor for card 0, signal 1 OK
Created motor for card 0, signal 2 OK
Created motor for card 0, signal 3 OK
# Setup the Asyn layer (portname, low-level driver drvet name, card, number of axes on card)
drvAsynMotorConfigure("motorSim1", "motorSim", 0, 4)
motorSimCreateController("motorSim2", 8)
# asynSetTraceIOMask("motorSim2", 0, 4)
# asynSetTraceMask("motorSim2", 0, 255)
# motorSimConfigAxis(port, axis, lowLimit, highLimit, home, start)
motorSimConfigAxis("motorSim2", 0, 20000, -20000,  500, 0)
motorSimDriver:motorSimConfigAxis: configuring controller motorSim2 axis 0
motorSimConfigAxis("motorSim2", 1, 20000, -20000, 1500, 0)
motorSimDriver:motorSimConfigAxis: configuring controller motorSim2 axis 1
motorSimConfigAxis("motorSim2", 2, 20000, -20000, 2500, 0)
motorSimDriver:motorSimConfigAxis: configuring controller motorSim2 axis 2
motorSimConfigAxis("motorSim2", 3, 20000, -20000, 3000, 0)
motorSimDriver:motorSimConfigAxis: configuring controller motorSim2 axis 3
## motorUtil (allstop & alldone)
dbLoadRecords("/opt/epics/modules/synApps/support/motor-R7-1/db/motorUtil.db", "P=motorSim:")
##
iocInit
Starting iocInit
############################################################################
## EPICS R7.0.3.1
## EPICS Base built Jan  7 2020
############################################################################
IOC:m1Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m2Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m3Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m4Direction devAsynInt32::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_DIRECTION
IOC:m1Offset devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_OFFSET
Error (514,514) PV: IOC:m1Offset ao: init_record

IOC:m1Resolution devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_RESOLUTION
Error (514,514) PV: IOC:m1Resolution ao: init_record

IOC:m2Offset devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_OFFSET
Error (514,514) PV: IOC:m2Offset ao: init_record

IOC:m2Resolution devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_RESOLUTION
Error (514,514) PV: IOC:m2Resolution ao: init_record

IOC:m3Offset devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_OFFSET
Error (514,514) PV: IOC:m3Offset ao: init_record

IOC:m3Resolution devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_RESOLUTION
Error (514,514) PV: IOC:m3Resolution ao: init_record

IOC:m4Offset devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_OFFSET
Error (514,514) PV: IOC:m4Offset ao: init_record

IOC:m4Resolution devAsynFloat64::initCommon drvUserCreate drvmotorAsyn::drvUserCreate, unknown command=MOTOR_REC_RESOLUTION
Error (514,514) PV: IOC:m4Resolution ao: init_record

iocRun: All initialization complete
## motorUtil (allstop & alldone)
motorUtilInit("motorSim:")
epics>
```

Otherwise, the simulator works as intended. Including the allstop and alldone util records.

-Will

On Fri, Apr 10, 2020 at 9:49 AM Mark Rivers <rivers at cars.uchicago.edu<mailto:rivers at cars.uchicago.edu>> wrote:
Hi Will,


I don't know the state of Kunal's repository that you referenced.  I think the more "official" simulated motor repository is this one:


https://github.com/epics-motor/motorMotorSim


There are actually 2 drivers in that source code, a "Model 2" driver (drvMotorSim.c) and a new "Model 3" driver (motorSimDriver.cpp).  I recommend only using motorSimDriver.cpp since that is the current standard framework.


The example IOC loads 8 motors.  The first 4 are the old Model 2 driver, and the last 4 are the new Model 3 driver.


I just tested homing with both drivers.


With the Model 2 driver when the homing is complete MSTA is 0xa.  This is bits 1 and 3 which mean

        unsigned int RA_HOME        :1; /* The home signal is on */
        unsigned int RA_DONE        :1; /* a motion is complete */

With the Model 3 driver when the homing is complete the MSTA is 0x82.  This is bits 1 and 7 which mean
        unsigned int EA_HOME        :1; /* encoder home signal on */
        unsigned int RA_DONE        :1; /* a motion is complete */

So one driver sets RA_HOME (not encoder home) while the other set EA_HOME (encoder home).

Note that neither of them set bit 14 which is
  unsigned int RA_HOMED       :1; /* Axis has been homed.*/

This is probably an bug in these drivers, they should be setting that bit as well.

Mark






________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov<mailto:tech-talk-bounces at aps.anl.gov>> on behalf of William Cork via Tech-talk <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>>
Sent: Friday, April 10, 2020 10:25 AM
To: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
Subject: Home motorSim Device

Playing around with the motor and asyn modules to get more familiar with EPICS motion control.

I'm using an example motorSim found here: https://github.com/shroffk/motorsim.git
Using:
asyn-R4-37
motor-R7-1
calc-R3-7-3

Having an issue where I tell an sioc using motorSim to home but, the MSTA record never updates the HOMED bit.

Startup deck has these lines to configure motorSim device:
```
motorSimCreate( 0, 0, -32000, 32000, 0, 1, 6 )
drvAsynMotorConfigure("motorSim1", "motorSim", 0, 6)
```

fakemotor.db:
```
record(ao, "$(Sys)$(Dev)-SP") {
    field(FLNK, "$(Sys)$(Dev)-SP_")
}

record(seq, "$(Sys)$(Dev)-SP_") {
    #disable mtr rec processing
    field(DOL1, "1")
    field(LNK1, "$(Mtr).DISA")

    # write setpoint to mtr rec
    field(DLY2, "0.1")
    field(DOL2, "$(Sys)$(Dev)-SP")
    field(LNK2, "$(Mtr).VAL CP")

    # to re-enable mtr rec processing, write or process "$(Sys)$(Dev)Cmd:Go-Cmd"
}

record(ai, "$(Sys)$(Dev)-I") {
    field(INP, "$(Mtr).RBV CPP")
}

record(bo, "$(Sys)$(Dev)Cmd:Go-Cmd") {
    field(DOL, "0")
    field(OUT, "$(Mtr).DISA CPP")
}

record(bo, "$(Sys)$(Dev)Cmd:Stop-Cmd") {
    field(VAL, "1")
    field(OUT, "$(Mtr).STOP CPP")
}

record(bi, "$(Sys)$(Dev)Sts:Moving-Sts") {
    field(INP, "$(Mtr).DMOV CPP")
    field(ZNAM, "Moving")
    field(ONAM, "Done")
}
```

Does motorSim have support for homing?
Is it broken from the seq record in fakemotor.db?

Your help is appreciated,
Will

References:
Home motorSim Device William Cork via Tech-talk
Re: Home motorSim Device Mark Rivers via Tech-talk
Re: Home motorSim Device William Cork via Tech-talk

Navigate by Date:
Prev: Re: Home motorSim Device William Cork via Tech-talk
Next: Re: Filtering messages print on the IOC shell console Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Home motorSim Device William Cork via Tech-talk
Next: Re: Home motorSim Device Peterson, Kevin M. via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 10 Apr 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·