ISISComputingGroup / IBEX

Top level repository for IBEX stories
5 stars 2 forks source link

Danfysik IOC: Changes to the current and voltage values for display and setting #1597

Closed KathrynBaker closed 8 years ago

KathrynBaker commented 8 years ago

As a user of the Danfysik IOC I want to be able to read the current and voltage in the correct units, and set the current in the same unit as I read it. I also want to be able to read the current from the 8800 model, as at present this isn't possible as this value isn't on the correct A to D converter.

Changes to make: In EPICS\support\danfysikMps8000\master\danfysikMps8000App\protocol\dfkp.proto add the following:

adcv {
   out "ADCV";
   in "%d";
}

In EPICS\ioc\master\DFKPS\DFKPS-IOC-01App\Db\DFKPS_8800_status.db add the following:

record(ao, "$(P)SIM:RAW"){
    field(DTYP, "Soft Channel")
    field(EGU, "A")
}
alias("$(P)SIM:CURR", "$(P)SIM:RAW:SP")
alias("$(P)SIM:CURR", "$(P)SIM:RAW")

record(ai, "$(P)RAW")
{
    field(DESC, "ADC Channel 8")
    field(DTYP, "stream")
    field(INP,  "@dfkps.proto adcv $(port) 0")
    field(SCAN, "1 second")
    field(LOLO, "-999999.5")
    field(HIHI, "99999.5")
    field(LLSV, "MAJOR")
    field(HHSV, "MAJOR")
    field(HOPR, "100000")
    field(LOPR, "0")
    field(PREC, "0")
    field(FLNK, "$(P)CURR")
    field(SIML, "$(P)SIM")
    field(SIOL, "$(P)SIM:RAW")
    field(SDIS, "$(P)DISABLE")
    field(EGU, "A")
    info(INTEREST, "HIGH")
    info(archive, "VAL")
}

record(calcout, "$(P)CURR")
{
    field(DESC, "Convert Raw Val to Current")
    field(CALC, "A * $(FRI)")
    field(INPA, "$(P)RAW")
    field(FLNK, "$(P)FIELD:PRECALIB")
    field(EGU, "A")
    info(INTEREST, "HIGH")
    info(archive, "VAL")
}
alias("$(P)CURR", "$(P)CURR:RBV")

Note that this uses a RAW record to read in, and the new item in the protocol file to get the current, and uses a multiplier to convert the value that was read back into the desired magnitude for use as the CURR value

In EPICS\ioc\master\DFKPS\DFKPS-IOC-01App\Db\DFKPS_8000_status.db add the following:

record(ao, "$(P)SIM:RAW"){
    field(DTYP, "Soft Channel")
    field(EGU, "A")
}
alias("$(P)SIM:CURR", "$(P)SIM:RAW:SP")
alias("$(P)SIM:CURR", "$(P)SIM:RAW")

record(ai, "$(P)RAW")
{
    field(DESC, "ADC Channel 8")
    field(DTYP, "stream")
    field(INP,  "@dfkps_common.proto adc(8) $(port) 0")
    field(SCAN, "1 second")
    field(LOLO, "-999999.5")
    field(HIHI, "99999.5")
    field(LLSV, "MAJOR")
    field(HHSV, "MAJOR")
    field(HOPR, "100000")
    field(LOPR, "0")
    field(PREC, "0")
    field(FLNK, "$(P)CURR")
    field(SIML, "$(P)SIM")
    field(SIOL, "$(P)SIM:RAW")
    field(SDIS, "$(P)DISABLE")
    field(EGU, "A")
    info(INTEREST, "HIGH")
    info(archive, "VAL")
}

record(calcout, "$(P)CURR")
{
    field(DESC, "Convert Raw Val to Current")
    field(CALC, "A * $(FRI)")
    field(INPA, "$(P)RAW")
    field(FLNK, "$(P)FIELD:PRECALIB")
    field(EGU, "A")
    info(INTEREST, "HIGH")
    info(archive, "VAL")
}
alias("$(P)CURR", "$(P)CURR:RBV")

The above supplies the conversion of units using a multiplier but still uses the old adc read from the common protocol files

In EPICS\ioc\master\DFKPS\DFKPS-IOC-01App\Db\DFKPS_common.db:

record(calcout, "$(P)VOLT")
{
    field(DESC, "Convert Raw Val to VOLTAGE")
    field(CALC, "A * $(FRV)")
    field(INPA, "$(P)VRAW")
    field(EGU, "V")
    info(INTEREST, "HIGH")
    info(archive, "VAL")
}

In EPICS\ioc\master\DFKPS\iocBoot\iocDFKPS-IOC-01\st-8800.cmd add FRI=$(FACTOR_READ_I=1) to the dbLoadRecords

In EPICS\ioc\master\DFKPS\iocBoot\iocDFKPS-IOC-01\st-8800.cmd add FRI=$(FACTOR_READ_I=1) to the dbLoadRecords

In EPICS\ioc\master\DFKPS\iocBoot\iocDFKPS-IOC-01\st-common.cmd for the first and unquialified dbLoadRecords, change the existing FAC=$(FACTOR) to FWI=$(FACTOR_WRITE_I=1000) and add FRV=$(FACTOR_READ_V=1) and VADC=$(VADC=2)

KathrynBaker commented 8 years ago

This is probably best tested by looking at NDEMUONFE, as these changes are all in place there already.

Pull requests: https://github.com/ISISComputingGroup/EPICS-danfysikMps8000/pull/3 https://github.com/ISISComputingGroup/EPICS-ioc/pull/76