diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c7c2471 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +include /ioc/tools/driver.makefile + +MODULE = ecmc_master_slave + +BUILDCLASSES = Linux +ARCH_FILTER = deb10% +EXCLUDE_VERSIONS+=3 7.0.5 7.0.6 + +SCRIPTS += axis_sm.plc_inc +SCRIPTS += axis_kin_slit.plc_inc + diff --git a/README.md b/README.md index bfb06f4..d49cb67 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,4 @@ -# ecmc master slave - - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: +# ecmc_master_slave ``` -cd existing_repo -git remote add origin https://git.psi.ch/motion/ecmc_master_slave.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://git.psi.ch/motion/ecmc_master_slave/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +``` \ No newline at end of file diff --git a/axis_kin_slit.plc_inc b/axis_kin_slit.plc_inc new file mode 100755 index 0000000..5b200fb --- /dev/null +++ b/axis_kin_slit.plc_inc @@ -0,0 +1,25 @@ +#- KINEMATICS +#- forward kinematics +ax${AX_CEN}.enc.actpos:=(ax${AX_LO}.enc.actpos+ax${AX_HI}.enc.actpos)/2; +ax${AX_GAP}.enc.actpos:=ax${AX_HI}.enc.actpos-ax${AX_LO}.enc.actpos; +#- inverse kinematics (Note: use extsetpos to ensure write is to external setpoint) +ax${AX_LO}.traj.extsetpos:=ax${AX_CEN}.traj.setpos-ax${AX_GAP}.traj.setpos/2; +ax${AX_HI}.traj.extsetpos:=ax${AX_CEN}.traj.setpos+ax${AX_GAP}.traj.setpos/2; + +#- LIMIT FLAGS +#- propagation of limit flags from Real to Virtual positioners +ax${AX_CEN}.mon.ilockfwd:=ax${AX_LO}.mon.highlim and ax${AX_HI}.mon.highlim; +ax${AX_CEN}.mon.ilockbwd:=ax${AX_LO}.mon.lowlim and ax${AX_HI}.mon.lowlim; +ax${AX_GAP}.mon.ilockfwd:=ax${AX_LO}.mon.highlim and ax${AX_HI}.mon.highlim; +ax${AX_GAP}.mon.ilockbwd:=ax${AX_LO}.mon.lowlim and ax${AX_HI}.mon.lowlim; + +#- SOFT LIMITS +#- calculation of Virtual positioner soft limits based on Real positioner soft limits +ax${AX_GAP}.mon.lowsoftlim := 2*max(ax${AX_CEN}.enc.actpos-ax${AX_LO}.mon.highsoftlim, ax${AX_HI}.mon.lowsoftlim-ax${AX_CEN}.enc.actpos); +ax${AX_GAP}.mon.highsoftlim := 2*min(ax${AX_CEN}.enc.actpos-ax${AX_LO}.mon.lowsoftlim, ax${AX_HI}.mon.highsoftlim-ax${AX_CEN}.enc.actpos); +ax${AX_GAP}.mon.lowsoftlimenable := ax${AX_LO}.mon.lowsoftlimenable and ax${AX_HI}.mon.lowsoftlimenable; +ax${AX_GAP}.mon.highsoftlimenable := ax${AX_LO}.mon.highsoftlimenable and ax${AX_HI}.mon.highsoftlimenable; +ax${AX_CEN}.mon.lowsoftlim := max(ax${AX_LO}.mon.lowsoftlim-ax${AX_GAP}.enc.actpos/2, ax${AX_HI}.mon.lowsoftlim+ax${AX_GAP}.enc.actpos/2); +ax${AX_CEN}.mon.highsoftlim := min(ax${AX_LO}.mon.highsoftlim+ax${AX_GAP}.enc.actpos/2, ax${AX_HI}.mon.highsoftlim-ax${AX_GAP}.enc.actpos/2); +ax${AX_CEN}.mon.lowsoftlimenable := ax${AX_LO}.mon.lowsoftlimenable and ax${AX_HI}.mon.lowsoftlimenable; +ax${AX_CEN}.mon.highsoftlimenable := ax${AX_LO}.mon.highsoftlimenable and ax${AX_HI}.mon.highsoftlimenable; diff --git a/axis_sm.plc_inc b/axis_sm.plc_inc new file mode 100755 index 0000000..aaea21a --- /dev/null +++ b/axis_sm.plc_inc @@ -0,0 +1,121 @@ + +#- Initial PLC values +if(plc${PLC_ID}.firstscan) { + static.counter:=0; + static.VMState:=-2; +}; + +#- this is needed because initially upon IocInit, motor busy flags are briefly enabled, and the first motorRecord poll at 100ms might cause issues +if ( static.counter<105 ) { + static.counter+=1; + + if ( static.counter==105) { static.VMState:=0 }; + + #- VMs in Internal mode, ready to listen + mc_grp_set_traj_src(${GRP_ID_VA},0); +}; + + +# STATES +# State -1: at least 1 RM is in motion, RM in charge. +# State 0: all RM and VM are off. +# State 1: at least 1 VM is in motion, VM in charge. + + +#- State -1 +if(static.VMState==-1) { + + #- RM are no longer in motion + #- -1 -> 0 + #- Trigger Condition: + #- - all RM are not busy + if( mc_grp_get_any_busy(${GRP_ID_RA})==0 ) { + + #- disable real motors + mc_grp_set_enable(${GRP_ID_RA},0); + + #- VMs in Internal mode, back to ground state + mc_grp_set_traj_src(${GRP_ID_VA},0); + + #- state change + println('-1 -> 0'); + static.VMState:=0; + }; + + #- If RM Motion is occuring, and user commands VM motion: simply disable the VMs to void the command. + if( mc_grp_get_any_enabled(${GRP_ID_VA})==1 and mc_grp_get_any_enable(${GRP_ID_VA})==1 ) { + mc_grp_set_enable(${GRP_ID_VA},0); + }; +} + +#- State 0 +else if(static.VMState==0) { + + #- 0 -> -1 + #- Trigger Condition: + #- - at least 1 RM is running + #- - all RM are in internal mode + #- - all VM are disabled + + mc_grp_get_any_traj_src_ext(${GRP_ID_RA})==0 + if( mc_grp_get_any_busy(${GRP_ID_RA})==1 and mc_grp_get_any_traj_src_ext(${GRP_ID_RA})==0 and mc_grp_get_any_enabled(${GRP_ID_VA})==0 ) { + #- VMs in PLC mode, so no following errors occur + mc_grp_set_traj_src(${GRP_ID_VA},0); + + #- state change + println('0 -> -1'); + static.VMState:=-1; + } + + #- 0 -> 1 + #- Trigger Condition: + #- - at least 1 VM is enabled + else if( mc_grp_get_any_enabled(${GRP_ID_VA})==1 ) { + + #- Exit Condition: all axes are on + if( mc_grp_get_enabled(${GRP_ID_RA})==1 and mc_grp_get_enabled(${GRP_ID_VA})==1 and mc_grp_get_any_busy(${GRP_ID_RA})==0 ) { + + if( mc_grp_get_any_busy(${GRP_ID_VA})==1 ) { + mc_grp_set_traj_src(${GRP_ID_RA},1); + #- state change + println('0 -> 1'); + static.VMState:=1; + }; + } + + #- Actions: If Exit Conditions not met + else { + #- enable motors + mc_grp_set_enable(${GRP_ID_VA},1); + mc_grp_set_enable(${GRP_ID_RA},1); + + #- halt real motors + mc_grp_halt(${GRP_ID_RA}); + }; + }; +} + +#- State 1 +else if(static.VMState==1) { + + #- basically a done test + #- 1 -> 0 + if( mc_grp_get_any_busy(${GRP_ID_VA})==0 ) { + + #- disable motors and set source + mc_grp_set_enable(${GRP_ID_VA},0); + mc_grp_set_enable(${GRP_ID_RA},0); + + mc_grp_set_traj_src(${GRP_ID_RA},0); + + #- once VMs are done, RMs need a bit longer to disable + if( mc_grp_get_any_busy(${GRP_ID_RA})==0 ) { + #- For some reason, an interlock is raised, but not sure why or what the implications are. It can be cleared this way. + mc_grp_reset_error(${GRP_ID_RA}); + + #- state change + println('1 -> 0'); + static.VMState:=0; + }; + }; +}; diff --git a/example/cfg/EPICSVERSION b/example/cfg/EPICSVERSION new file mode 100644 index 0000000..2f2974f --- /dev/null +++ b/example/cfg/EPICSVERSION @@ -0,0 +1 @@ +7.0.7 diff --git a/example/cfg/axis_ax5_lower.yaml b/example/cfg/axis_ax5_lower.yaml new file mode 100644 index 0000000..7746e48 --- /dev/null +++ b/example/cfg/axis_ax5_lower.yaml @@ -0,0 +1,78 @@ +# https://paulscherrerinstitute.github.io/ecmccfg/manual/axis/axisyaml/ + +axis: + id: 5 + mode: CSV + features: + allowSrcChangeWhenEnabled: true + +epics: + name: TRYB + precision: 4 + unit: mm + motorRecord: + enable: false + description: "Test Y Bottom" + +drive: + numerator: 10 # max velo in EGU/s + denominator: 32768 # MAX_INT for a 16-bit register, always this for this stepper drive! + type: 0 + control: ec0.s$(DRV_SLAVE).driveControl01 + status: ec0.s$(DRV_SLAVE).driveStatus01 + setpoint: ec0.s$(DRV_SLAVE).velocitySetpoint01 + +encoder: + numerator: 1 # 1egu = 1mm + denominator: 12800 # Number of ticks when motor moves numerator (=1mm): 1 mm / 50 nm = 20000 + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 16 # Total bit count of encoder raw data + absBits: 0 # Absolute bit count (for abs enc) always least significant part of 'bits' + absOffset: 0.0000 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(ENC_SLAVE).positionActual$(ENC_CHANNEL) + +controller: + Kp: 10.00 + Ki: 0.001 + Kd: 0.000 + Kff: 1.00 + +trajectory: + axis: + velocity: 1.0 + acceleration: 1.0 + deceleration: 1.0 + +input: + limit: + forward: ec0.s$(DRV_SLAVE).driveStatus01.12 # 1119994 cnts // 55.9997 mm + backward: ec0.s$(DRV_SLAVE).driveStatus01.11 # 98010 cnts // 4.9005 mm + home: ec0.s$(DRV_SLAVE).ONE.0 # unused + interlock: ec0.s$(DRV_SLAVE).ONE.0 # unused + +softlimits: + enable: false + backwardEnable: true + forwardEnable: true + forward: 55.8 + backward: 5.1 + +monitoring: + lag: + enable: true + tolerance: 0.05 + time: 100 + target: + enable: true + tolerance: 0.05 + time: 100 + velocity: + enable: true + max: 5 + time: + trajectory: 100 + drive: 200 + +plc: + enable: true + externalCommands: true diff --git a/example/cfg/axis_ax6_upper.yaml b/example/cfg/axis_ax6_upper.yaml new file mode 100644 index 0000000..0be39ce --- /dev/null +++ b/example/cfg/axis_ax6_upper.yaml @@ -0,0 +1,78 @@ +# https://paulscherrerinstitute.github.io/ecmccfg/manual/axis/axisyaml/ + +axis: + id: 6 + mode: CSV + features: + allowSrcChangeWhenEnabled: true + +epics: + name: TRYT + precision: 4 + unit: mm + motorRecord: + enable: false + description: "Test Y Top" + +drive: + numerator: 10 # max velo in EGU/s + denominator: 32768 # MAX_INT for a 16-bit register, always this for this stepper drive! + type: 0 + control: ec0.s$(DRV_SLAVE).driveControl01 + status: ec0.s$(DRV_SLAVE).driveStatus01 + setpoint: ec0.s$(DRV_SLAVE).velocitySetpoint01 + +encoder: + numerator: 1 # 1egu = 1mm + denominator: 12800 # Number of ticks when motor moves numerator (=1mm): 1 mm / 50 nm = 20000 + type: 0 # Type: 0=Incremental, 1=Absolute + bits: 16 # Total bit count of encoder raw data + absBits: 0 # Absolute bit count (for abs enc) always least significant part of 'bits' + absOffset: 0.0000 # Encoder offset in eng units (for absolute encoders) + position: ec0.s$(ENC_SLAVE).positionActual$(ENC_CHANNEL) + +controller: + Kp: 2.000 + Ki: 0.001 + Kd: 0.000 + Kff: 1.00 + +trajectory: + axis: + velocity: 1.0 + acceleration: 1.0 + deceleration: 1.0 + +input: + limit: + forward: ec0.s$(DRV_SLAVE).driveStatus01.12 # 1111969 cnts // 55.5984 mm + backward: ec0.s$(DRV_SLAVE).driveStatus01.11 # 109007 cnts // 5.4504 mm + home: ec0.s$(DRV_SLAVE).ONE.0 # unused + interlock: ec0.s$(DRV_SLAVE).ONE.0 # unused + +softlimits: + enable: false + backwardEnable: true + forwardEnable: true + forward: 55.4 + backward: 5.7 + +monitoring: + lag: + enable: true + tolerance: 0.05 + time: 100 + target: + enable: true + tolerance: 0.05 + time: 100 + velocity: + enable: true + max: 5 + time: + trajectory: 100 + drive: 200 + +plc: + enable: true + externalCommands: true diff --git a/example/cfg/axis_main.plc b/example/cfg/axis_main.plc new file mode 100755 index 0000000..b241a07 --- /dev/null +++ b/example/cfg/axis_main.plc @@ -0,0 +1,8 @@ + +####### Kinematics for slit system. +# Macros cannot be used in an include. In order to find files, the loadPLCFile.cmd parameter "INC" defines the dirs that MSI will look for the file) +include "axis_kin_slit.plc_inc" + +####### State machine +# Macros cannot be used in an include. In order to find files, the loadPLCFile.cmd parameter "INC" defines the dirs that MSI will look for the file) +include "axis_sm.plc_inc" diff --git a/example/cfg/axis_vax5_YCEN.yaml b/example/cfg/axis_vax5_YCEN.yaml new file mode 100644 index 0000000..4c38efc --- /dev/null +++ b/example/cfg/axis_vax5_YCEN.yaml @@ -0,0 +1,64 @@ +axis: + id: ${AX_ID} + type: end effector + +epics: + name: CENTERY + precision: 4 + unit: mm + motorRecord: + enable: false + description: "Center Y (Virtual)" + +encoder: + type: 1 + source: 1 + numerator: 1 + bits: 32 + +trajectory: + axis: + velocity: 0.5 + acceleration: 0.25 + jerk: 0.25 + +input: + limit: + forward: ec0.s0.ONE.0 # unused + backward: ec0.s0.ONE.0 # unused + home: ec0.s0.ONE.0 # unused + interlock: ec0.s0.ONE.0 # unused + +softlimits: + enable: false + forwardEnable: true + backwardEnable: true + forward: 52 + backward: 8 + +monitoring: + lag: + enable: yes + tolerance: 0.02 + time: 100 + target: + enable: yes + tolerance: 0.02 + time: 100 + velocity: + enable: yes + max: 0.6 + time: + trajectory: 100 + drive: 100 + +plc: + enable: true + externalCommands: true + filter: + velocity: + enable: false + size: 10 + trajectory: + enable: false + size: 10 diff --git a/example/cfg/axis_vax6_YGAP.yaml b/example/cfg/axis_vax6_YGAP.yaml new file mode 100644 index 0000000..0aeb86d --- /dev/null +++ b/example/cfg/axis_vax6_YGAP.yaml @@ -0,0 +1,64 @@ +axis: + id: ${AX_ID} + type: end effector + +epics: + name: GAPY + precision: 4 + unit: mm + motorRecord: + enable: false + description: "Gap Y (Virtual)" + +encoder: + type: 1 + source: 1 + numerator: 1 + bits: 32 + +trajectory: + axis: + velocity: 0.5 + acceleration: 0.25 + jerk: 0.25 + +input: + limit: + forward: ec0.s0.ONE.0 # unused + backward: ec0.s0.ONE.0 # unused + home: ec0.s0.ONE.0 # unused + interlock: ec0.s0.ONE.0 # unused + +softlimits: + enable: false + forwardEnable: true + backwardEnable: true + forward: 20 + backward: -20 + +monitoring: + lag: + enable: yes + tolerance: 0.02 + time: 100 + target: + enable: yes + tolerance: 0.02 + time: 100 + velocity: + enable: yes + max: 0.6 + time: + trajectory: 100 + drive: 100 + +plc: + enable: true + externalCommands: true + filter: + velocity: + enable: false + size: 10 + trajectory: + enable: false + size: 10 diff --git a/example/readme.md b/example/readme.md new file mode 100644 index 0000000..79ac180 --- /dev/null +++ b/example/readme.md @@ -0,0 +1,19 @@ +# Test ioc for a slit system +Note: Motor record disabled in this test system + +## Changes +1. Use ecmc/ecmccfg version 9.5.4 or newer. +2. Divide statemachine and kinematics into separate include files (add INC param to loadPLCFile.cmd needed) +3. Use extsetpos in kinematics +4. Use new axis group functions in statemachine to make it generic (no direct access to axes in statemachine) +5. Set allow source change when enabled in axis yaml cfg (remove in startup script) +6. Remove encoder.position in virtual axis (not needed anymore) +7. Remove filter cfgs in yaml files + +## Panel +``` +caqtdm -macro "IOC=c6025a" ecmcMain.ui +``` + +## TODO +Test with motor record. diff --git a/example/startup.script b/example/startup.script new file mode 100644 index 0000000..eeb970f --- /dev/null +++ b/example/startup.script @@ -0,0 +1,11 @@ +# The following lines were generated by "ioc install" +# Generated at: 2024-08-07 16:32:41.171272 + +epicsEnvSet IOC c6025a +epicsEnvSet ENGINEER sandst_a +< /ioc/startup/startup.script_linux + +# ---- ioc/system specific startup script(s) +< startup.script_ecmc + +iocInit diff --git a/example/startup.script_ecmc b/example/startup.script_ecmc new file mode 100644 index 0000000..3511ba5 --- /dev/null +++ b/example/startup.script_ecmc @@ -0,0 +1,94 @@ +require ecmccfg sandst_a,"ECMC_VER=sandst_a,MODE=NO_MR,ENG_MODE=1,EC_RATE=100" +require ecmccomp +require ecmc_master_slave sandst_a + +#- ############################################################################ +#- add slaves +#- list of slaves (4 axis test motion box) +# Master0 +# 0 0:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) +# 1 0:1 PREOP + EL9227-5500 �berstromschutz 24V DC, 2K., max. 10A (Summe), eins +# 2 0:2 PREOP + EL5042 2Ch. BiSS-C Encoder +# 3 0:3 PREOP + EL5042 2Ch. BiSS-C Encoder +# 4 0:4 PREOP + EL3204 4K. Ana. Eingang PT100 (RTD) +# 5 0:5 PREOP + EL2008 8K. Dig. Ausgang 24V, 0.5A +# 6 0:6 PREOP + EL1008 8K. Dig. Eingang 24V, 3ms +# 7 0:7 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +# 8 0:8 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +# 9 0:9 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +# 10 0:10 PREOP + EL7041 1Ch. Stepper motor output stage (50V, 5A) +# + +# 0:0 - EK1100 EtherCAT coupler +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EK1100" + +# 0:1 - EL9227-5500 +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL9227-5500" + +# 0:2 - EL5042 2Ch BiSS-C Encoder +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5042" + +# 0:3 - EL5042 2Ch BiSS-C Encoder +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL5042" + +# 0:4 - EL3204 +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL3204" + +# 0:5 - EL2008 +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL2008" + +# 0:6 - EL1008 8K. Dig. Eingang 24V, 3ms +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL1008" + +# 0:7 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" +${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper,MACROS='I_MAX_MA=1000,I_STDBY_MA=500,U_NOM_MV=48000,R_COIL_MOHM=1230,STEPS=400'" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_ax5_lower.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01" + +# 0:8 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" +${SCRIPTEXEC} ${ecmccomp_DIR}applyComponent.cmd "COMP=Motor-Generic-2Phase-Stepper,MACROS='I_MAX_MA=1000,I_STDBY_MA=500,U_NOM_MV=48000,R_COIL_MOHM=1230,STEPS=400'" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_ax6_upper.yaml, DRV_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_SLAVE=${ECMC_EC_SLAVE_NUM}, ENC_CHANNEL=01" + +# 0:9 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" + +# 0:10 - EL7041 1Ch Stepper +${SCRIPTEXEC} ${ecmccfg_DIR}addSlave.cmd, "HW_DESC=EL7041-0052" + + +#- ################################################################# +#- Virtual axes +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_vax5_YCEN.yaml, AX_ID=${AX_NUM=12}" +${SCRIPTEXEC} ${ecmccfg_DIR}loadYamlAxis.cmd, "FILE=cfg/axis_vax6_YGAP.yaml, AX_ID=${AX_NUM=13}" + +#- ############################################################################# +#- Y Direction -- Axis groupings in preparation for kinematics PLC +ecmcConfigOrDie "Cfg.AddAxisGroup(realAxesY)" +ecmcConfigOrDie "Cfg.AddAxisToGroupByName(5,realAxesY)" +ecmcConfigOrDie "Cfg.AddAxisToGroupByName(6,realAxesY)" +ecmcConfig "GetAxisGroupIndexByName(realAxesY)" +epicsEnvSet(GRP_ID_RAX,${ECMC_CONFIG_RETURN_VAL=0}) + +ecmcConfigOrDie "Cfg.AddAxisGroup(virtualAxesY)" +ecmcConfigOrDie "Cfg.AddAxisToGroupByName(12,virtualAxesY)" +ecmcConfigOrDie "Cfg.AddAxisToGroupByName(13,virtualAxesY)" +ecmcConfig "GetAxisGroupIndexByName(virtualAxesY)" +epicsEnvSet(GRP_ID_VAX,${ECMC_CONFIG_RETURN_VAL=0}) + +#- PLCs with inverse kinematics (note the INC var including dirs to search for include files) +${SCRIPTEXEC} ${ecmccfg_DIR}loadPLCFile.cmd, "FILE=./cfg/axis_main.plc, PLC_ID=1, INC=.:${ecmc_master_slave_DIR}, PLC_MACROS='PLC_ID=1, AX_CEN=12, AX_GAP=13, AX_LO=5, AX_HI=6, GRP_ID_RA=${GRP_ID_RAX}, GRP_ID_VA=${GRP_ID_VAX}'" + +#- ################################################################# +#- apply the configuration +${SCRIPTEXEC} ${ecmccfg_DIR}applyConfig.cmd + +#- ################################################################# +#- go active +${SCRIPTEXEC} ${ecmccfg_DIR}setAppMode.cmd + +#- ############################################################################# +#- reset all errors +afterInit("ecmcConfigOrDie 'ControllerErrorReset()'") +ecmcConfigOrDie "Cfg.SetDiagAxisEnable(0)" + diff --git a/startup.cmd b/startup.cmd new file mode 100644 index 0000000..06bdcce --- /dev/null +++ b/startup.cmd @@ -0,0 +1,2 @@ +#- ###################### +# Loading master slave module....