Giter Site home page Giter Site logo

mosri / lcls-twincat-motion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pcdshub/lcls-twincat-motion

0.0 1.0 0.0 1.92 MB

TwinCAT 3 Motion Control Utilities - PLC Motion Library for all PCDS Applications

Home Page: https://pcdshub.github.io/lcls-twincat-motion/index.html

License: Other

Python 91.42% Shell 8.58%

lcls-twincat-motion's Introduction

lcls-twincat-motion

Twincat 3 Motion Control Utilities for LCLS PCDS EPICS

Quick Start

The library is installed on the plc programming nodes as lcls-twincat-motion. Once installed, you can create a motion-ioc-compatible setup with default settings by declaring in Main:

M1: DUT_MotionStage;
fbMotion1: FB_MotionStage;

And invoking as:

fbMotion1(stMotionStage:=M1);

You would then link your hardware as appropriate to M1.Axis, M1.bLimitForwardEnable, M1.bLimitBackwardEnable, M1.bHome, M1.bBrakeRelease, and M1.bHardwareEnable. It is important to set M1.nEnableMode the value the most fits your use case (see settings below). You also need to set bPowerSelf to TRUE, unless your device participates in LCLS's PMPS system, where it must be FALSE.

Note that currently, the DUT_MotionStage instances must be named Main.M1, Main.M2... etc. due to limitations in the EPICS driver.

Simulated Axis

If you want to try out the IOC with a simulated axes, a shortcut function block is provided as:

fbMotionSim: FB_MotionStageSim;
fbMotionSim(stMotionStage:=M1);

This block removes all hardware-related protections to get the simulated axis moving, e.g.

stMotionStage.bLimitBackwardEnable := TRUE;
stMotionStage.bLimitForwardEnable := TRUE;
stMotionStage.bHardwareEnable := TRUE;
stMotionStage.bPowerSelf := TRUE;
stMotionStage.nEnableMode := ENUM_StageEnableMode.ALWAYS;
fbMotionStage(stMotionStage := stMotionStage);

Settings

DUT_MotionStage has the following settings:

Setting Type Usage Default
bPowerSelf BOOL If FALSE (default), then FB_MotionStage will expect an external PMPS function block to call MC_Power appropriately. You can switch this to TRUE to opt out of PMPS and handle motor enabling within FB_MotionStage. FALSE
nEnableMode ENUM_StageEnableMode Automatically enable the NC Axis ALWAYS, NEVER, or only DURING_MOTION (default). Switch this to ALWAYS if you want active position correction at all times and to NEVER if you're doing checkout with the TwinCAT NC GUI. DURING_MOTION
nBrakeMode ENUM_StageBrakeMode Break disengage timing. Disengage the break IF_ENABLED (default), IF_MOVING, or never change the break state with NO_BRAKE. Note that this does nothing unless a brake is linked to bBrakeRelease. IF_ENABLED
nHomingMode ENUM_EpicsHomeCmd Pick which switch to home to, or not to require homing (default) NONE
bGantryMode BOOL Set to TRUE to activate gantry EPS FALSE
nGantryTol LINT If the gantry error is greater than this number of encoder counts, trigger a virtual limit. 0
nEncRef ULINT Encoder count for gantry motion where the two axes are aligned. 0

Provided Resources

Resource Type Usage
DUT_MotionStage struct Contains all relevant information about a single axis. You can pass this around and manipulate it inside of other function blocks. It relys on FB_MotionStage to provide the logic.
DUT_PositionState struct Contains all information about a specific position state, e.g. "out"
FB_MotionStage function block Provides a connection to ESS's motion library for motor record functionality, as well as some standard handling of brake and auto enable/disable.
FB_MotionStageSim function block Shortcut to getting a simulated axis running.
FB_MotionRequest function block Moves an axis handled by FB_MotionStage to a specific position.
FB_PositionStateMove function block Moves an axis to a specific position state.
FB_PositionStateManager function block Moves an axis to any one of 15 preset position states. Intended for EPICS use.
FB_EpicsInOut function block Example usage of FB_PositionStateManager for a simple in/out device.
FB_PositionStateLock function block Allows states to be immutable if configured as such
ENUM_EpicsHomeCmd enum Options for axis homing through the motor record
ENUM_EpicsMotorCmd enum Options for axis commands through the motor record. You can use these through TwinCAT too.
ENUM_StageBrakeMode enum Options for axis brake mode. Brake can be enabled at standstill or at disabled.
Enum_StageEnableMode enum Options for axis enable/disable handling. Axis can be enabled always, never, or only during motion.

lcls-twincat-motion's People

Contributors

ghalym avatar klauer avatar slacawallace avatar zllentz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.