tmtsoftware / icd

ICD - Interface Control Document Management
Other
12 stars 5 forks source link

icdwebserver: HCD commands/events not rendered if unused by other components #59

Closed edwardchapin closed 6 years ago

edwardchapin commented 6 years ago

When an assembly is created that publishes events and accepts commands, icdwebserver will render them in the normal subsystem view, regardless of whether another subsystem subscribes to them, or sends the commands that it accepts.

This does not seem to be the case for HCDs. None of the received commands, nor published events appear in the web view unless explicitly used by another software component. This is also true for alarms (which should never be monitored by another assembly/hcd/sequencer anyway, as they are intended for human operators).

abrighton commented 6 years ago

If a target subsystem is selected, the output is filtered to only display items that the target subsystem subscribes to or uses. Otherwise everything should be displayed. Do you have a specific example? (I suppose this should be changed for alarms, so that they are always displayed.)

edwardchapin commented 6 years ago

First, ingest the current NFIRAOS model files on the master branch (just pushed a bunch of changes yesterday).

Then, separately, ingest the following model files:

component-model.conf:

subsystem = NFIRAOS
component = grio
componentType = HCD
modelVersion = "1.0"

title = Galil Remote IO (GRIO) HCD
prefix = ao.nfiraos.grio

description = """The Galil Remote I/O (GRIO) HCD is responsible for controlling and monitoring the state of Galil Remote I/O 47xxx famiy Programmable Logic Controllers (PLC). These devices are used throughout NFIRAOS wherever basic analog-to-digital converters (ADC) or digital-to-analog converters (DAC) are needed. Each unit has a number of independently-controlled analog and opto-isolated digital and output channels, as well as optional Pulse Width Modulated (PWM) output channels (with details depending on the precise model)."""

command-model.conf:

subsystem = NFIRAOS
component = grio

description = GRIO HCD commands.

receive = [
 {
    name            = init
    description     = """Request Command.

Initialize the assembly and read configuration files. The configuration name must be specified if a configuration version is specified.

If configName and configVersion are not specified in the input, then the default configuration name and version will be used. If only configName is specified in the input, then the default version for the specified configName will be used. If only configVersion is specified in the input, then an error is returned.

Precondition:
<ul>
<li> none
</ul>
Execution:
<ul>
<li> state.cmd = BUSY
</ul>
At Completion:
<ul>
<li> state.cmd = READY
</ul>"""
    args = [
       {
        name        = configName
        description = Name of the configuration file to get from the TMT Configuration Service
        type        = string
      }
      {
        name        = configVersion
        description = Version of the configuration file to get from the TMT Configuration Service
        type        = string
      }
    ]

  }

  {
    name            = setBit
    description     = """Set bit on one of the digital output channels.

*Discrete Command.*

Precondition:
<ul>
<li> state.cmd != UNINITIALIZED
</ul>
Execution:
<ul>
<li> state.cmd = BUSY
</ul>
At Completion:
<ul>
<li> state.cmd = READY
</ul>"""
    args = [
      {
        name        = channel
        description = which digital output channel to set
        type        = integer
      }
    ]
  }

  {
    name            = clearBit
    description     = """Clear bit on one of the digital output channels.

*Discrete Command.*

Precondition:
<ul>
<li> state.cmd != UNINITIALIZED
</ul>
Execution:
<ul>
<li> state.cmd = BUSY
</ul>
At Completion:
<ul>
<li> state.cmd = READY
</ul>"""
    args = [
      {
        name        = channel
        description = which digital output channel to clear
        type        = integer
      }
    ]
  }

  {
    name            = readVoltage
    description     = """Read voltage on one of the analog input channels

*Discrete Command.*

Precondition:
<ul>
<li> state.cmd != UNINITIALIZED
</ul>
Execution:
<ul>
<li> state.cmd = BUSY
</ul>
At Completion:
<ul>
<li> state.cmd = READY
</ul>"""
    args = [
      {
        name        = channel
        description = which analog input channel to read
        type        = integer
      }
    ]
  }

  {
    name            = setPwm
    description     = """Set duty cycle and activate one of the PWM output channels

*Discrete Command.*

Precondition:
<ul>
<li> state.cmd != UNINITIALIZED
</ul>
Execution:
<ul>
<li> state.cmd = BUSY
</ul>
At Completion:
<ul>
<li> state.cmd = READY
</ul>"""
    args = [
      {
        name        = channel
        description = which PWM output channel to set
        type        = integer
      }
      {
        name        = dutyCycle
        description = channel duty cycle
        type        = integer
        minimum     = 0
        maximum     = 100

      }
    ]
  }
]

and publish-model.conf:

subsystem = NFIRAOS
component = grio

publish {
  events = [
    {
      name            = state
      description     = GRIO HCD state
      attributes      = [
        {
          name        = cmd
          description = GRIO HCD state
          enum        = [ UNINITIALIZED, READY, BUSY ]
        }
      ]
    }

    {
      name            = analogIn
      description     = Change in state for one of the analog inputs
      attributes      = [
        {
          name        = channel
          description = which analog input channel had a state change
          type        = integer
        }
        {
          name        = value
          description = the new value
          type        = float
        }
      ]
    }

    {
      name            = digitalOut
      description     = Change in state for one of the digital outputs
      attributes      = [
        {
          name        = channel
          description = which digital output channel had a state change
          type        = integer
        }
        {
          name        = value
          description = the new value
          type        = boolean
        }
      ]
    }

    {
      name            = pwmOut
      description     = Change in state for one of PWM outputs
      attributes      = [
        {
          name        = channel
          description = which PWM output channel had a state change
          type        = integer
        }
        {
          name        = isActive
          description = is the channel currently active
          type        = boolean
        }
        {
          name        = dutyCycle
          description = the new duty cycle
          type        = integer
        }
      ]
    }
  ] 

  #alarms = [
  #]

}

In the web view for the NFIRAOS target subsystem I only see the grio component description, none of the commands nor published items. If I make another component send the command or subscribe to the events, they appear (just to emphasize: I am not using the ICD view).

edwardchapin commented 6 years ago

Ah, I now realize that the behaviour is indeed the same for assemblies and HCDs. If an assembly accepts commands, but no ingested component sends them, they also don't get rendered. Shouldn't all of the component information get shown, regardless, in the subsystem view?

edwardchapin commented 6 years ago

One more thing: the commands/events don't appear in the NFIRAOS subsystem view in icdwebserver as described above, but if I click on "PDF" it gives me a PDF with the full API documented. I feel this is what we should see in the browser.

abrighton commented 6 years ago

I think the problem may be due to a small change I pushed last time that caused the results to be filtered even in the subsystem view (rather than only the ICD view). I reverted the change and pushed to the master branch. Please try with that and see if the problem is fixed.

abrighton commented 6 years ago

This was only an issue in the web app, not the pdf generating part. It should work now.

edwardchapin commented 6 years ago

Thanks, that fixes it for me.