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  2020  2021  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  2020  2021  2022  2023  <2024
<== Date ==> <== Thread ==>

Subject: Re: Questions about creating a Model 3 Driver for stepper motor axis
From: Torsten Bögershausen via Tech-talk <tech-talk at aps.anl.gov>
To: Paul-Elie GUILLOT <peguillot at irelec-alcen.com>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Wed, 17 Jan 2024 14:25:34 +0100


On 2024-01-17 14:03, Paul-Elie GUILLOT wrote:
Hello Torsten,
I looked through your driver, it is quite dense.
it seems you are using ADS to communicate with Beckhoff PLC variables and your function directly write to it and polls them.

The interface structures that you are talking about are related to the nCommand and nCmdData you seem to manipulate to issue command to the axis, right?

Yes


I see you have defined lot of records in your ethercatmc.template to replace those of the motor record and accommodate to your driver features?

Yes, there are some additional records defined.
Some of them are not really needed in production,
so they can be taken out.



My application is pretty simple, so for starter I was thinking of using TCP/IP connection to the Beckhoff PLC and issuing command through there.

Yes, that is how we started.
If you want, see this (now historic) repo, which s our "phase 0".
https://github.com/EuropeanSpallationSource/MCAG_Base_Project



I am using the basic TC2_Motion functions such as MC_MoveAbsolute, MC_MoveRelative, etc…
Yes, that is what we are doing as well.
"Generation 1" has another functionblock on top of these blocks,
that what includes "nCommand and nCmdData".


If you are handling the encoder inside the code, does the record always passes step command to your PLC?

Not sure, if I understand the question....
In our world, the encoder and it's scaling are "connected" into the NC,
which, once the Axis is commissioned, does everything.
I think that our test crate019 has still "generation 1" software:
<https://bitbucket.org/europeanspallationsource/tc_lab_mcu019>


How do you use your motor record? Do you use its backlash compensation or do you only use the record as an interface to modify say the dval and your PLC do the rest?

We use the VAL field, or course, JOGF, JOGR, HOMF/HOMR (they do the same) and a lot of other fields.
Backlash can be used from the motorRecord, that is the easist way, I think.

And, by the way, we have a motorRecord with many patches/bug fixes/improvements, which are not part of the upstream version.

HTH
/Torsten



Thank you for your help.

Best Regards

Paul-Elie GUILLOT

Technology Manager in Automation and Robotics

Téléphone: +33 (0)4 76 44 9893

20 rue du Tour de l'Eau

F-38400 St Martin d’Hères Cedex

Phone : +33 (0)4 76 44 12 96

irelec-alcen.com <http://www.irelec-alcen.com/en>

*IRELEC after sales services – please send your request to support at irelec-alcen.zendesk.com <mailto:support at irelec-alcen.zendesk.com> *

Any disclosure, use, dissemination or reproduction (either whole or partial) of this message or the information contained herein is strictly prohibited without prior consent of Irelec.

*De :*Torsten Bögershausen <Torsten.Bogershausen at ess.eu>
*Envoyé :* mercredi 17 janvier 2024 11:48
*À :* Paul-Elie GUILLOT <peguillot at irelec-alcen.com>; tech-talk at aps.anl.gov
*Objet :* Re: Questions about creating a Model 3 Driver for stepper motor axis

Salut Paul-Elie,

welcome to the world of motion and EPICS.

I try to answer some.

First of all, we do our microstepping, hadnling the encoder,

and calculating EGU (mm) inside the Beckhoff, using TwinCAT and

the motion libraries. (NC in TwinCAT speech).

(I need to mention that we also have a complete different solution,

where not TwinCAT is used, but Linux. This does include an EPICS driver

and everything.

Please see https://github.com/epics-modules/ecmc <https://github.com/epics-modules/ecmc>  )

If you go for TwinCAT, what do you use ?
We have defined ‘interface structures’ inside the PLC program,

and then written a model 3 driver, that talks to the PLC.

Of course, the PLC program must match the EPICS driver, and vice versa.

Over the years, there are 2 generations of PLC/EPICS, the first one more

straightforward, the second one more advanced.

Both versions of the PLC code are (still) in one EPICS module .

The first generation of an Axis is here :

<https://github.com/EuropeanSpallationSource/m-epics-ethercatmc/blob/master/ethercatmcApp/src/ethercatmcAxis.cpp <https://github.com/EuropeanSpallationSource/m-epics-ethercatmc/blob/master/ethercatmcApp/src/ethercatmcAxis.cpp>>

(And then you find the other stuff as well, I think).

HTH
/Torsten, happy to answer more questions

*From: *Tech-talk <tech-talk-bounces at aps.anl.gov <mailto:tech-talk-bounces at aps.anl.gov>> on behalf of Paul-Elie GUILLOT via Tech-talk <tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>> *Reply to: *Paul-Elie GUILLOT <peguillot at irelec-alcen.com <mailto:peguillot at irelec-alcen.com>>
*Date: *Wednesday, 17 January 2024 at 11:11
*To: *"tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>" <tech-talk at aps.anl.gov <mailto:tech-talk at aps.anl.gov>>
*Subject: *Questions about creating a Model 3 Driver for stepper motor axis

Hello to everyone at tech-talk,

I am currently working on implementing an EPICS driver for controlling axis which are stepper motors with absolute encoders. My hardware controller is a Beckhoff PLC I am programming to interface with. I am planning to use mm as EGU.

I have read multiple documentation and I have started to implement a driver based on the Model 3 drivers, I have heavily inspired myself from the MCB4B Driver for ACS and the Phytron driver.

I am starting to get a better understanding on how it works but I still need clarifications on some points. Would you be so kind to help me on those matters?

First of all,

  * I see that when creating an axis controller using the class
    asynMotorController, it creates a lot of parameters then linked to a
    motor record by their names (the string passed to the createParam()
    function), is that correct?
  * How does each axis has its own set of parameters while connected to
    the same asynMotorController, is it because the asynMotorAxis class
    creates an AsynUser which connects to the controller?
    By doing this, it creates a separate set of parameters for the axis
    with the pasynUser_?

  * I heavily rely on the record programming to carry out advanced
    functions, such as backlash compensation and closed loop motion on
    the encoder.
    Do you have experience in those matters? How will the system reach a
    specific encoder position? Will it use a linear term between encoder
    ticks and motor steps?
    But if the axis is not linear enough, there will be issues in
    reaching the position?
    If I understand correctly, usually motors use the FRAC and RTRY
    mechanism to reach a encoder position with a certain number of retry?
    In practice, how do most people operate with an encoder? Do they
    use  the motor in open loop and monitor the encoder, or do they set
    UEIP at 1 and use FRAC motion?

  * My motors are able to do microstepping (decomposing a full step in
    64 microsteps), should I implement this in the MRES field of the
    record, as not being 200 full steps but 12800 microsteps?
    I think so because I intend to give the motor positions in
microsteps. Is there a low limit on the MRES value?
  * On the system, we will be using absolute encoders, in that regard
    the encoder ratio is always 1 to transfer to encoder counts, correct?
     From my understanding, encoder ratio is mainly to interface with
incremental encoders converting to raw A/B ticks in full encoder tick. Because from what I gathered the motorEncoderPosition_ must be linked to the Field REP and is the hardware counter of the encoder.

  * Is there a filter of some sorts on the encoder counts field or
    should I implement one directly on my Beckhoff controller and then
    use the delayAfterMove parameter to allow the encoder counts to
    stabilize?
  * As I have absolute encoder on all axis, for an axis the parameter
    motorhasEncoder_ is always at 1 as well as the motorStatusHomed_ .
    However, to use and encoder, the record needs to have the record
field UEIP at 1. Is it defined by the user, or should initialize UEIP at 1, in my template defined in “motor.substitutions.irelec” adding the field UEIP to my .db file (which is derived from basic_asyn_motor.db with some field added)?

  *  From what I understand, the motor record is defined by the
    motorRecord.cc and motorRecord.dbd and Model 3 drivers mainly
    interface with the devMotorAsyn.c, is it correct?
    A change on a field of the record will be processed by
    motorRecord.cc and use the different functions I have redefined for
    my Driver (move, poll, etc…), is it correct?
    Does the devMotorAsyn.c defines the support entry table required to
    process the record commands? (with the function start_trans,
    build_trans and end_trans)
    Looking through the code, I understood that for Model 2 Driver and
    Support, one needs to defined the support entry table to process the
    record commands? (ex: MCB4B_build_trans function)

In Model 3, it seems the asynMotorController directly handles the modification of its parameters by calling the needed function of an axis. How does the record interface with the asynMotorController parameters?

I can’t find where devMotorAsyn.c writes to the asynMotorController parameters.

Bottom line of this topic is: Can I use the record advanced functions such as backlash compensation even with a Model 3 Driver?

  * The record always feed steps command to the controller if I
    understood the code correctly.
    However as I don’t have a home routine (due to absolute encoders),
    the open loop (step count) is reset at each hardware controller
    power reset.
    Thus, the user should never do move_absolute in openloop. To disable
    it, I would like the UEIP to be always at 1? Or something should be
    done to set the open loop position using setposition based on the
    absolute encoder at the start of the controller?

It could be the home procedure, just sending a setposition() to the stepper based on the encoder position? Or does the home position require motion?

  * I noticed there is no process of error catching on the motor and
    error resetting, is that correct?
    Should I always reset an axis in Error on my Beckhoff hardware
    controller or should I include command on my EPICS driver to do so,
    thus adding record for those specific actions?
    Because for example, if my motor reaches a hardware limit switch
    while in motion it will put itself in error state, which then needs
    an error reset using the MC_Reset.

I need it’s a lot of questions, I hope it is clear enough.

In any case, thank you for your time and help.

Paul-Elie GUILLOT

Technology Manager in Automation and Robotics

Téléphone: +33 (0)4 76 44 9893

20 rue du Tour de l'Eau

F-38400 St Martin d’Hères Cedex

Phone : +33 (0)4 76 44 12 96

irelec-alcen.com <http://www.irelec-alcen.com/en>

*IRELEC after sales services – please send your request to support at irelec-alcen.zendesk.com <mailto:support at irelec-alcen.zendesk.com> *

Any disclosure, use, dissemination or reproduction (either whole or partial) of this message or the information contained herein is strictly prohibited without prior consent of Irelec.


Replies:
RE: Questions about creating a Model 3 Driver for stepper motor axis Paul-Elie GUILLOT via Tech-talk
References:
Questions about creating a Model 3 Driver for stepper motor axis Paul-Elie GUILLOT via Tech-talk
Re: Questions about creating a Model 3 Driver for stepper motor axis Torsten Bögershausen via Tech-talk
RE: Questions about creating a Model 3 Driver for stepper motor axis Paul-Elie GUILLOT via Tech-talk

Navigate by Date:
Prev: RE: Questions about creating a Model 3 Driver for stepper motor axis Paul-Elie GUILLOT via Tech-talk
Next: Re: Generic EPICS IOCs Knap, Giles (DLSLtd,RAL,LSCI) 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  2020  2021  2022  2023  <2024
Navigate by Thread:
Prev: RE: Questions about creating a Model 3 Driver for stepper motor axis Paul-Elie GUILLOT via Tech-talk
Next: RE: Questions about creating a Model 3 Driver for stepper motor axis Paul-Elie GUILLOT 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  2020  2021  2022  2023  <2024
ANJ, 17 Jan 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·