pcdshub / pytmc

Generate EPICS IOCs and records from TwinCAT projects - along with many TwinCAT project tools
https://pcdshub.github.io/pytmc/
Other
10 stars 11 forks source link

ENH: link strings #268

Closed klauer closed 3 years ago

klauer commented 3 years ago

Background

link: allows for pytmc to generate records that push PV data into the PLC from other IOCs.

Status quo

pytmc currently supports linking numeric scalar values (with corresponding records that have the OMSL/DOL fields). This doesn't include strings.

This PR

I'm going to build up the PLC side of this before finalizing this PR and making it ready-for-review, as one may influence the other.

Pairs with https://github.com/pcdshub/lcls-twincat-general/pull/53

Example diff

pytmc master vs this PR

diff --git a/Untitled1.db b/Untitled1.db
index 4fafd46..a2799d9 100644
--- a/Untitled1.db
+++ b/Untitled1.db
@@ -63,17 +63,23 @@ record(waveform, "IOC:TEST:LINK2:EPICSLink_RBV") {
 record(waveform, "IOC:TEST:LINK2:EPICSLink") {
   # Internal variable used to monitor EPICS PV in PLC
   field(DESC, "Internal variable us...r EPICS PV in PLC")
-  field(SCAN, ".5 second")
   field(DTYP, "asynInt8ArrayOut")
   field(INP, "@asyn($(PORT),0,1)ADSPORT=851/MAIN.fbLinkedValue2.sPLCInternalValue=")
   field(FTVL, "CHAR")
-  field(DOL, "IOC:TEST:STRING CPP MS")
-  field(OMSL, "closed_loop")
   field(NELM, "80")
   info(autosaveFields_pass0, "VAL")
   info(archive, "VAL")
 }

+record(lso, "IOC:TEST:LINK2:EPICSLink:LSO") {
+  # Aux link record for MAIN.fbLinkedValue2.sPLCInternalValue
+  field(DESC, "Aux link record for ...sPLCInternalValue")
+  field(SCAN, ".5 second")
+  field(DOL, "IOC:TEST:STRING CPP MS")
+  field(OMSL, "closed_loop")
+  field(OUT, "IOC:TEST:LINK2:EPICSLink PP MS")
+}
+
 record(longin, "IOC:TEST:LINK2:EPICSLink:LinkSeverity_RBV") {
   # Internal variable used to monitor EPICS PV severity in PLC
   field(DESC, "Internal variable us...V severity in PLC")