Skip to content

Commit

Permalink
add device and vlvcc for all includers of valveIlk
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Apr 9, 2024
1 parent 69039c6 commit 9f21373
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 50 deletions.
8 changes: 5 additions & 3 deletions src/vdct2template/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ def convert(folder: Path, builder_txt: str):
warning = False
targets = list(folder.glob("*.vdb"))

print(f"converting vdb files in {folder}\n ...")

for target in targets:
expansion = Expansion(target, folder)
if expansion.parse_expands() > 0:
print(f"writing expansion {expansion.template_path}")
print(f"writing expansion {expansion.template_path.name}")
expansion.template_path.write_text(expansion.text)

for file, text in expansion.process_includes():
print(f"writing template {file}")
print(f"writing template {file.name}")
file.write_text(text)
if file.name in builder_txt:
warning = True
Expand All @@ -42,5 +44,5 @@ def convert(folder: Path, builder_txt: str):
warning |= Expansion.validate_includes()

if warning:
print(" WARNINGS DETECTED: check above for details.")
print("\n WARNINGS DETECTED: check above for details.")
exit(1)
6 changes: 4 additions & 2 deletions tests/data/dlsPLC_fastValve.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}

expand("dlsPLC_valveGilk.vdb", valveGilk) {
Expand All @@ -154,8 +156,8 @@ record(bi, "$(device):MODE") {

# #########################################################################
# Which interlocks to show on gui
#
record(bi, "$(device):SHOWILK")
#
record(bi, "$(device):SHOWILK")
{
field(DESC, "Which interlocks to display")
field(DTYP, "Soft Channel")
Expand Down
20 changes: 11 additions & 9 deletions tests/data/dlsPLC_feFastValve.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}

expand("dlsPLC_fastvalveGilk.vdb", valveGilk) {
Expand All @@ -134,8 +136,8 @@ record(bi, "$(device):MODE") {

# #########################################################################
# Which interlocks to show on gui
#
record(bi, "$(device):SHOWILK")
#
record(bi, "$(device):SHOWILK")
{
field(DESC, "Which interlocks to display")
field(DTYP, "Soft Channel")
Expand All @@ -147,23 +149,23 @@ record(bi, "$(device):SHOWILK")

# #########################################################################
# How many interlocks for Full and Partial Arm
#
record(ai, "$(device):FARMBITS")
#
record(ai, "$(device):FARMBITS")
{
field(DESC, "Number of Full Arm interlocks")
field(DTYP, "Soft Channel")
field(PINI, "YES")
field(INP, "$(farmbits=16)")
}
record(ai, "$(device):PARMBITS")
record(ai, "$(device):PARMBITS")
{
field(DESC, "Number of Partial Arm interlocks")
field(DTYP, "Soft Channel")
field(PINI, "YES")
field(INP, "$(parmbits=16)")
}


# #########################################################################
# Override :DONECALC in dlsPLC_valveCtrl.template
# as fe fast valve does not follow standard valve CON/LASTCON/STA pattern.
Expand All @@ -172,12 +174,12 @@ record(ai, "$(device):PARMBITS")
# continue.
#
# IJG: 9th Dec. 2013
#
#record(calcout, "$(device):DONECALC")
#
#record(calcout, "$(device):DONECALC")
# {
# field(CALC, "1=1?0:1")
# }


#! Further lines contain data used by VisualDCT
#! View(0,0,1.0)
Expand Down
2 changes: 2 additions & 0 deletions tests/data/dlsPLC_genericDevice.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}


Expand Down
2 changes: 2 additions & 0 deletions tests/data/dlsPLC_interlock.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}

#! Further lines contain data used by VisualDCT
Expand Down
22 changes: 12 additions & 10 deletions tests/data/dlsPLC_leakValve.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# % gui, $(name=), edmembed, vacuumValve-embed.edl, device=$(device),box-label=$(desc=$(device))

# This tells the gui that we don't have debounce records
record(ai, "$(device):HASDEBOUNCE")
record(ai, "$(device):HASDEBOUNCE")
{
field(VAL, "0")
field(PINI, "YES")
Expand Down Expand Up @@ -119,6 +119,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}

expand("dlsPLC_valveGilk.vdb", valveGilk) {
Expand All @@ -142,15 +144,15 @@ record(stringin, "$(device):PAIREDIMG")
field(VAL,"$(img)")
}

record(ai, "$(device):CURRENTP")
record(ai, "$(device):CURRENTP")
{
field(DTYP, "Soft Channel")
field(INP, "$(img):P CP MS")
}

# NB: the OUT field is generated by :TARGETPOUT (below)
# at run time.
record(ao, "$(device):SETTARGETP")
record(ao, "$(device):SETTARGETP")
{
field(DTYP, "asynFloat64")
field(OUT, "@asyn($(port), $(addr_decade)4, $(timeout=0)) FINS_DM_WRITE_32")
Expand All @@ -164,18 +166,18 @@ record(ao, "$(device):SETTARGETP")

# ############################################################################
# Target Pressure
#
#
# % archiver 10 Monitor
# % controldesk Target Pressure readback
record(ai, "$(device):TARGETP")
record(ai, "$(device):TARGETP")
{
field(DESC, "Target Pressure")
field(DTYP, "Soft Channel")
field(PREC, "$(prec=1)")
field(INP, "$(device):GETTARGETP.VAL MS")
}

record(subArray, "$(device):GETTARGETP")
record(subArray, "$(device):GETTARGETP")
{
field(DESC, "Get Target Pressure")
field(DTYP, "Soft Channel")
Expand All @@ -184,16 +186,16 @@ record(subArray, "$(device):GETTARGETP")
field(MALM, "100")
}

# Target Pressure is in DM$(addr)+4. Calc the index into the
# Target Pressure is in DM$(addr)+4. Calc the index into the
# century record
record(calcout, "$(device):TARGETPINDX")
record(calcout, "$(device):TARGETPINDX")
{
field(CALC, "$(addr_decade)%10+4")
field(OUT, "$(device):GETTARGETP.INDX PP")
field(PINI, "YES")
}

# TARGETP is in DM$(addr)+4. Calc the inp link to the
# TARGETP is in DM$(addr)+4. Calc the inp link to the
# century record. Needs to be done after PINI, so note
# the flnk
record(scalcout, "$(device):TARGETPINP")
Expand All @@ -206,7 +208,7 @@ record(scalcout, "$(device):TARGETPINP")
}

# Disable the scalcout record so we don't keep writing values
record(ao, "$(device):TARGETPINPDIS")
record(ao, "$(device):TARGETPINPDIS")
{
field(VAL, "1")
field(OUT, "$(device):TARGETPINP.DISA")
Expand Down
28 changes: 15 additions & 13 deletions tests/data/dlsPLC_mpsPermit.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# ilk0 ... ilk15 - interlock descriptions


expand("dlsPLC_valveIlk.vdb", valveIlk)
expand("dlsPLC_valveIlk.vdb", valveIlk)
{
macro(DIR, "$(EMPTY=)")
macro(ILK, "6")
Expand All @@ -40,6 +40,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk)
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}


Expand Down Expand Up @@ -90,7 +92,7 @@ record(bi, "$(device):MODE")
field(ONAM, "Service")
}

record(subArray, "$(device):GETSTA")
record(subArray, "$(device):GETSTA")
{
field(DESC, "Get status")
field(DTYP, "Soft Channel")
Expand All @@ -99,19 +101,19 @@ record(subArray, "$(device):GETSTA")
field(MALM, "100")
}

# STA is in DM$(addr)+2. Calc the index into the
# STA is in DM$(addr)+2. Calc the index into the
# century record
record(calcout, "$(device):STAINDX")
record(calcout, "$(device):STAINDX")
{
field(CALC, "$(addr)%100+2")
field(OUT, "$(device):GETSTA.INDX PP")
field(PINI, "YES")
}

# STA is in DM$(addr)+3. Calc the inp link to the
# STA is in DM$(addr)+3. Calc the inp link to the
# century record. Needs to be done after PINI, so note
# the flnk
record(scalcout, "$(device):STAINP")
record(scalcout, "$(device):STAINP")
{
field(CALC, "PRINTF(AA,FLOOR($(addr)/100))")
field(AA, "$(vlvcc):DM%dXX CP MS")
Expand All @@ -121,14 +123,14 @@ record(scalcout, "$(device):STAINP")
}

# Disable the scalcout record so we don't keep writing values
record(ao, "$(device):STAINPDIS")
record(ao, "$(device):STAINPDIS")
{
field(VAL, "1")
field(OUT, "$(device):STAINP.DISA")
}


record(subArray, "$(device):GETMODSTA")
record(subArray, "$(device):GETMODSTA")
{
field(DESC, "Get mode")
field(DTYP, "Soft Channel")
Expand All @@ -137,19 +139,19 @@ record(subArray, "$(device):GETMODSTA")
field(MALM, "100")
}

# STA is in DM$(addr)+5. Calc the index into the
# STA is in DM$(addr)+5. Calc the index into the
# century record
record(calcout, "$(device):MODSTAINDX")
record(calcout, "$(device):MODSTAINDX")
{
field(CALC, "$(addr)%100+5")
field(OUT, "$(device):GETMODSTA.INDX PP")
field(PINI, "YES")
}

# STA is in DM$(addr)+5. Calc the inp link to the
# STA is in DM$(addr)+5. Calc the inp link to the
# century record. Needs to be done after PINI, so note
# the flnk
record(scalcout, "$(device):MODSTAINP")
record(scalcout, "$(device):MODSTAINP")
{
field(CALC, "PRINTF(AA,FLOOR($(addr)/100))")
field(AA, "$(vlvcc):DM%dXX CP MS")
Expand All @@ -159,7 +161,7 @@ record(scalcout, "$(device):MODSTAINP")
}

# Disable the scalcout record so we don't keep writing values
record(ao, "$(device):MODSTAINPDIS")
record(ao, "$(device):MODSTAINPDIS")
{
field(VAL, "1")
field(OUT, "$(device):MODSTAINP.DISA")
Expand Down
2 changes: 2 additions & 0 deletions tests/data/dlsPLC_vacPump.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}

# Operational/Service Mode
Expand Down
2 changes: 2 additions & 0 deletions tests/data/dlsPLC_vacValve.vdb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ expand("dlsPLC_valveIlk.vdb", valveIlk) {
macro(ilk13, "$(ilk13=unused)")
macro(ilk14, "$(ilk14=unused)")
macro(ilk15, "$(ilk15=unused)")
macro(vlvcc, "$(vlvcc)")
macro(device, "$(device)")
}

expand("dlsPLC_valveGilk.vdb", valveGilk) {
Expand Down
Loading

0 comments on commit 9f21373

Please sign in to comment.