AnsweredAssumed Answered

VRF-Gating_Data_Flow

Question asked by VRFuser on Jun 11, 1998
send q VRF-Gating_Data_Flow vrf ww damer@mse.ufl.edu

from: Greg Goebel / HP-MXD
      gvg@lvld.hp.com / 800-452-4844
      website:  ftp://fcext3.external.hp.com/dist/mxd/index.html
to:   VRF-Drew Amery
date: Friday, 12 June 1998 1116 MDT

> Date: Fri, 12 Jun 1998 10:08:34 -0400
> To: "HPvee reflector" <hpvxd_xc@hpislsup.lvld.hp.com>
> From: Drew Amery <damer@mse.ufl.edu>
> Subject: Simple data flow problem
>
> I have a simple pressure monitoring program that I am
> throwing together on the side in Vee 4.01 for a friend. 
> I haven't been able to figure out how to do one feature. I
> know it is probably very simple, but I thought I would ask
> the experts.  Q: I need to have a toggle switch turn on and off
> a data stream to a disk file.  The data stream is a pressure
> reading in PSI that is continously displayed on a chart. I want
> the user to toggle the data stream on and off to the disk. 
> How to I do this?
>
> Thanks
>
> Drew Amery
> damer@mail.mse.ufl.edu 


* Regarding switching a data stream on or off to a file ... consider the
following program as a "toy" version of a data-acquisition program:

   +-------+
   | Until |
   | Break +--+
   +-------+  |
              |
         +----+----+      +------------+
         | Random  +----->| Stripchart |
         | Number  |      +------------+
         +---------+  
                      
Now suppose you want to gate the same data to a file.  You can do this with
three objects:
                          
   +-------+
   | Until |
   | Break +--+
   +-------+  |
              |
         +----+----+      +------------+
         | Random  +--+-->| Stripchart |
         | Number  |  |   +------------+
         +---------+  |
                |       +---------------+
                      |       |               |
                      +-------|--+   +--------+---------+
                |       |  |   |  Demultiplexer   |
                +-----+----+  |  |   +------+--+--------+
          | Vertical |  |  +-->| Data |  | Addr 0 |   +---------+
          | Rocker   +--|----->| Addr |  | Addr 1 +-->| To File |
          +-----+----+  |      +------+--+--------+   +---------+
                |       |
                +-------+

The demultiplexer either gates the data off to the To File object, or to
the "bit bucket" ("nowhere"), depending on the setting of the Vertical
Rocker switch.  I'm not entirely sure wiring the Rocker to the Demultiplexer
via the Sequence-In Sequence-Out pins is necessary, but it hurts nothing
and makes me feel a bit more secure.

I've included an example ... it uses a Logging Alphanumeric, not a To File,
to make the effect more visible, but the principle is the same.

[<>] gvg

--------------------------------- cut here ----------------------------------
#! D:VW/vee -r
(saveFormat "1.2")
(date "Fri 12/Jun/1998")
(SaveCF "no")
(filterNAN 0)
(component 0 "ROOTCONTEXT"
(name "Untitled")
(interface
)
(implementation
  (locked no)
  (trigMode deg)
  (nextID 9)
  (component 0 "TOGGLE25"
   (name "V. Rocker")
   (interface
    (sequence in)
    (sequence out)
    (output 1
     (name "Toggle")
     (lock name constraints)
    )
   )
   (implementation
    (component value Int32
     (data  1     )
    )
    (component initValue Int32
     (data  0     )
    )
   )
   (views
    (icon
    )
    (detail
     (origin 306 297)
     (extent 68 67)
     (scaled off)
     (showTitle on)
     (format vpaddle)
    )
    (title off)
    (active detail)
   )
  )
  (component 1 "REPEATUNTILBREAK"
   (interface
    (sequence in)
    (sequence out)
    (output 1
     (name "Continuous")
     (lock name constraints)
    )
   )
   (implementation
   )
   (views
    (icon
     (origin 33 104)
     (extent 74 52)
     (iconImage "loop.icn")
    )
    (detail
    )
    (terminals on)
    (active icon)
   )
  )
  (component 2 "RANDOMNUMBER"
   (interface
    (sequence in)
    (sequence out)
    (output 1
     (name "Rand Val")
     (lock name constraints)
    )
   )
   (implementation
    (component lowerLimit 0)
    (component upperLimit 1)
   )
   (views
    (icon
     (origin 82 192)
     (extent 116 16)
    )
    (detail
    )
    (terminals on)
    (active icon)
   )
  )
  (component 3 "YPLOT"
   (name "Strip Chart")
   (subType "Strip")
   (interface
    (sequence in)
    (sequence out)
    (input 1
     (name "Trace1")
     (lock constraints)
    )
   )
   (implementation
    (component clearAtPrerun 1)
    (component clearAtActivate 1)
    (component tracePin 1)
    (component graphMode strip)
    (component bufferSize 10000)
   )
   (views
    (icon
     (iconImage "display.icn")
    )
    (detail
     (origin 462 64)
     (extent 296 272)
     (displayMode scrollGraph)
     (graphType cartesian)
     (gridType off)
     (scale 0
      (name "Y name")
      (domainName "X name")
      (pen 9)
      (show 1)
      (range 0 1 4 linear)
     )
     (domain 0 20.00000000000026 4 linear)
     (trace 0 onScale 0
      (name "Trace1")
      (pen 4)
      (lineType 1)
      (pointType 0)
     )
     (stepSize 1)
     (trackingEnabled 1)
    )
    (active detail)
   )
  )
  (component 4 "SCROLLINGTEXTDISPLAY"
   (interface
    (sequence in)
    (sequence out)
    (input 1
     (name "Data")
    )
   )
   (implementation
    (component clearAtPrerun 1)
    (component clearAtActivate 1)
   )
   (views
    (icon
    )
    (detail
     (origin 464 374)
     (extent 192 172)
     (bufferSize 256)
    )
    (active detail)
   )
  )
  (component 5 "DEMULTIPLEXER"
   (interface
    (sequence in)
    (sequence out)
    (input 1
     (name "Data")
     (lock name constraints)
    )
    (input 2
     (name "Addr")
     (requires
      (datatype Int32)
      (shape "Scalar")
     )
     (lock name constraints)
    )
    (output 1
     (name "Addr 0")
     (lock name constraints)
    )
    (output 2
     (name "Addr 1")
     (lock name constraints)
     (optional yes)
    )
   )
   (implementation
   )
   (views
    (icon
     (origin 404 478)
     (extent 93 25)
    )
    (detail
     (origin 316 445)
     (extent 39 50)
    )
    (terminals on)
    (active detail)
   )
  )
  (component 6 "LABEL"
   (name "Gating Data")
   (interface
    (sequence in)
    (sequence out)
   )
   (implementation
    (component labelValue "Gating Data")
   )
   (views
    (icon
     (extent 83 0)
    )
    (detail
     (origin 51 249)
     (extent 158 42)
     (just c)
    )
    (title off)
    (active detail)
    (font "Arial" 26 bold)
   )
  )
  (component 8 "NOTE"
   (interface
   )
   (implementation
    (component text 23 5
    
     Gating Data Example / v1.0 / 12 jun 98 / gvg
    
     This little example shows how to gate a data
     stream on and off.  It generates random data to
     shove into a Stripchart as a dummy measurement
     application; the same data stream is fed through
     a Demultiplexer that directs it either to a
     Logging Alphanumeric or off into nowhere, depending
     on the settings of a Vertical Rocker.
    
     The original user request was to put the gated
     data stream into a file, but the Logging
     Alphanumeric makes this easier to see, and a
     To File can be swapped with the Logging Alphanumeric
     easily enough.
    
     I'm not sure it is necessary to wire the
     Sequence-Out pin of the Rocker to the
     Demultiplexer, but it causes no harm and
     ensures correct seqeuencing.
    
     [<>] gvg
    )
   )
   (views
    (icon
     (origin 286 104)
     (extent 68 52)
     (iconImage "notepad.icn")
    )
    (detail
     (origin 142 111)
     (extent 457 459)
     (editing enabled)
    )
    (active icon)
   )
  )
  (configuration
   (connect D2:1 D0:0)
   (connect D1:1 D2:0)
   (connect D2:1 D3:1)
   (connect D5:2 D4:1)
   (connect D0:0 D5:0)
   (connect D2:1 D5:1)
   (connect D0:1 D5:2)
  )
)
(views
  (panel
   (origin 0 24)
   (extent 1024 690)
   (widget 3 detail
    (title on)
    (borderStyle flat)
    (origin 32 134)
    (extent 296 272)
    (displayMode scrollGraph)
    (graphType cartesian)
    (gridType off)
    (scale 0
     (name "Y name")
     (domainName "X name")
     (pen 9)
     (show 1)
     (range 0 1 4 linear)
    )
    (domain 0 20.00000000000023 4 linear)
    (trace 0 onScale 0
     (name "Trace1")
     (pen 4)
     (lineType 1)
     (pointType 0)
    )
    (stepSize 1)
    (trackingEnabled 1)
   )
   (widget 4 detail
    (title on)
    (borderStyle flat)
    (origin 352 234)
    (extent 192 172)
    (bufferSize 256)
   )
   (widget 0 detail
    (title off)
    (borderStyle flat)
    (origin 352 116)
    (extent 76 76)
    (scaled off)
    (showTitle on)
    (format vpaddle)
   )
  )
  (detail
   (origin 0 24)
   (extent 1024 690)
   (configuration
    (connect D2:1 D0:0
     (Point 200 200)
     (Point 340 200)
     (Point 340 294)
    )
    (connect D1:1 D2:0
     (Point 109 130)
     (Point 140 130)
     (Point 140 189)
    )
    (connect D2:1 D3:1
     (Point 200 200)
     (Point 459 200)
    )
    (connect D5:2 D4:1
     (Point 407 480)
     (Point 430 480)
     (Point 430 460)
     (Point 461 460)
    )
    (connect D0:0 D5:0
     (Point 340 366)
     (Point 340 424)
    )
    (connect D2:1 D5:1
     (Point 200 200)
     (Point 240 200)
     (Point 240 460)
     (Point 273 460)
    )
    (connect D0:1 D5:2
     (Point 376 330)
     (Point 400 330)
     (Point 400 390)
     (Point 250 390)
     (Point 250 480)
     (Point 273 480)
    )
   )
   (stackingOrder 3 2 7 0 5 4 1 6)
  )
  (active detail)
  (numberFormats
   (realFormat standard)
   (realSigDigits 4)
   (realRadixSpec 4)
   (integerBase decimal)
  )
)
)
--------------------------------- cut here ----------------------------------

Outcomes