(saveFormat "2.3")
(date "Thu 26/Feb/2004 20:17:50 ")
(veerev "6.2")
(platform "PC")
(execMode v6)
(filterNAN 0)
(workspaceStackingOrder M)
(SaveCF no)
(device 0 ROOTCONTEXT
(properties
(trigMode rad)
(nextID 19)
(popupTitleText "Bin Sort Example")
(popupMoveable 1)
(popupTitleTextColor "Black")
(popupTitleBackgroundColor "Gray")
(deleteGlobals 0))
(deviceList
(UserFunctions
(nextID 2)
(context 0
(properties
(name "measResist")
(trigMode deg)
(nextID 2))
(interface
(output 1
(type data)
(name "Res")
(lock constraints)
(optional yes)))
(deviceList
(device 0 HPIDSTATE
(properties
(name "dvm (3478A)"))
(interface
(output 1
(name "READING")
(tag "READING")
(optional yes))
(output 2
(type exception)
(name "Error")
(lock name constraints)
(optional yes)))
(implementation
(filename "hp3478a.cid")
(driver "dvm")
(state
(idComp
(name "FUNCTION")
(typeStr "Enum")
(state "Valid")
(value "OHM2"))
(idComp
(name "ARANGE")
(typeStr "Enum")
(state "Valid")
(value "ON"))
(idComp
(name "RANGE")
(typeStr "Real")
(state "Dontcare")
(value 0))
(idComp
(name "NDIG")
(typeStr "Real")
(state "Valid")
(value 3.5))
(idComp
(name "TRIGGER")
(typeStr "Enum")
(state "Valid")
(value "SINGLE"))
(idComp
(name "AZERO")
(typeStr "Enum")
(state "Valid")
(value "ON"))
(idComp
(name "DISPLAY_STRING")
(typeStr "Enum")
(state "Valid")
(value "NORMAL"))
(idComp
(name "DISPLAYED_STRING")
(typeStr "Text")
(state "Valid")
(value "            "))
(idComp
(name "MASK")
(typeStr "Int16")
(state "Valid")
(value 0))
(idComp
(name "ERROR")
(typeStr "Int16")
(state "Invalid")
(value 0)))))
(device 1 FORMULA
(properties
(name "round(x)")
(expr 1 "round(x)"))
(interface
(input 1
(name "X")
(optional yes))
(output 1
(name "Result")
(tag "Result")
(lock name constraints)
(optional yes))))
(configuration
(connect D0:1 D1:1)
(connect D1:1 O1:1)))
(contextCarrier
(active detail)
(detail
(extent 502 278)
(anchorPt 162 149)
(configuration
(devCarrierFor 0
(active open)
(icon
(extent 110 0)
(iconImage "inst.icn"))
(open
(extent 214 215)
(visiblePanels 3 "DISPL" "HP3478A" "MENUA"))
(terminals on)
(pinCenter -20 0))
(devCarrierFor 1
(active icon)
(icon
(extent 110 25))
(open)
(terminals on)
(pinCenter 250 -60))
(connect D0:1 D1:1
(points 2 159 -60 192 -60))
(connect D1:1 O1:1
(points 4 307 -60 320 -60 320 -11 339 -11)))
(stackingOrder 1 0))))
(context 1
(properties
(name "simResist")
(trigMode deg)
(nextID 2))
(interface
(output 1
(type data)
(name "Res")
(lock constraints)
(optional yes)))
(deviceList
(device 0 RANDOMNUMBER
(properties
(lowerLimit 100)
(upperLimit 400))
(interface
(output 1
(name "Rand Val")
(lock name constraints))))
(device 1 FORMULA
(properties
(name "round(x)")
(expr 1 "round(x)"))
(interface
(input 1
(name "X")
(optional yes))
(output 1
(name "Result")
(tag "Result")
(lock name constraints)
(optional yes))))
(configuration
(connect D0:1 D1:1)
(connect D1:1 O1:1)))
(contextCarrier
(active detail)
(detail
(extent 374 180)
(anchorPt 143 70)
(configuration
(devCarrierFor 0
(active open)
(icon
(extent 127 25))
(open
(extent 157 60))
(terminals on)
(pinCenter -20 0))
(devCarrierFor 1
(active icon)
(icon
(extent 110 25))
(open
(extent 106 62))
(terminals on)
(pinCenter 149 60))
(connect D0:1 D1:1
(points 6 131 0 159 0 159 40 79 40 79 60 91 60))
(connect D1:1 O1:1
(points 4 206 60 219 60 219 17 230 17)))
(stackingOrder 0 1)))))
(device 0 SEQUENCER
(properties
(name "Test Value & Tolerance")
(transactions 3
"test1 LOGEN TESTEX:globalOhms \tPTOLEX: 2 LT nom GT 2 \tPASSOP TRTN:[nom, 2] \t"
"test2 LOGEN TESTEX:globalOhms \tPTOLEX: 5 LT nom GT 5 \tPASSOP TRTN:[nom, 5] \t"
"test3 LOGEN TESTEX:globalOhms \tPTOLEX: 10 LT nom GT 10 \tPASSOP TRTN:[nom, 10] \tFAILOP TERR:10 "
))
(interface
(input 1
(name "nom")
(optional yes))
(output 1
(name "Return")
(tag "Return")
(lock name constraints)
(optional yes))
(output 2
(type exception)
(name "Error")
(lock name constraints)
(optional yes)))
(implementation
(logfields "name" "pass" "result")))
(device 1 TEXTDISPLAY
(properties
(name "Bin Sort"))
(interface
(input 1
(name "Data"))))
(device 2 BREAK)
(device 3 CONSTANT
(properties
(name "Real"))
(interface
(output 1
(name "Real")
(lock name constraints)))
(implementation
(value Real
(numDims 1)
(size 5)
(data  [ 330 270 220 180 150 ]))
(initValue Real
(data  0))))
(device 4 FORCOUNT
(properties
(count 5))
(interface
(input 1
(name "Count")
(tag "Count")
(requires
(datatype Int32)
(shape "Scalar"))
(lock constraints)
(optional yes)
(buffer YES))
(output 1
(name "Count")
(lock name constraints))))
(device 5 FORMULA
(properties
(expr 1 "R[i]"))
(interface
(input 1
(name "i")
(optional yes))
(input 2
(name "R")
(optional yes))
(output 1
(name "Result")
(tag "Result")
(lock name constraints)
(optional yes))))
(device 6 TOGLOBAL
(properties
(globalName "globalOhms"))
(interface
(input 1
(name "Data")
(tag "Data"))))
(device 7 TEXTDISPLAY
(properties
(name "Measured R"))
(interface
(input 1
(name "Data"))))
(device 8 FORMULA
(properties
(name "totSize(x)")
(expr 1 "totSize(x)"))
(interface
(input 1
(name "X")
(optional yes))
(output 1
(name "Result")
(tag "Result")
(lock name constraints)
(optional yes))))
(device 9 SEQUENCER
(properties
(name "Test Bounds")
(transactions 2
"test1 LOGEN TESTEX:simResist() \tLIMITEX: 0 GE min(a)*.9 \tFAILOP TERR:0 "
"test2 LOGEN TESTEX:test1.result \tLIMITEX: 0 LE max(a)*1.1 \tPASSOP TRTN:thistest.result \tFAILOP TERR:1 "
))
(interface
(input 1
(name "A")
(optional yes))
(output 1
(name "Return")
(tag "Return")
(lock name constraints)
(optional yes))
(output 2
(type exception)
(name "Error")
(lock name constraints)
(optional yes)))
(implementation
(logfields "name" "pass" "result")))
(device 10 TOSTRING
(properties
(transactions 1 "WRITE TEXT a[0], \" Ohm,  \", a[1], \"%\" EOL"))
(interface
(input 1
(name "A")
(optional yes))
(output 1
(name "result")
(lock name constraints)))
(implementation
(attr iopath string write "string"
(readTerm "\n")
(fs " ")
(eol "\n")
(multiField fullSyntax)
(arrayFormat block))))
(device 11 CONTEXT
(properties
(name "Error Condition")
(trigMode rad)
(nextID 5)
(popupMoveable 1))
(interface
(input 1
(name "A")
(optional yes)))
(deviceList
(device 0 LITERALCONSTANT
(interface
(output 1
(name "Text")
(lock name constraints)))
(implementation
(value Text
(data  "Out of Range: LOW"))
(initValue Text
(data  ""))))
(device 1 LITERALCONSTANT
(interface
(output 1
(name "Text")
(lock name constraints)))
(implementation
(value Text
(data  "Out of Range: HIGH"))
(initValue Text
(data  ""))))
(device 2 TEXTDISPLAY
(properties
(name "Out of Range"))
(interface
(input 1
(name "Data"))))
(device 3 CONFIRM25
(interface
(output 1
(name "Go")
(lock name constraints)))
(implementation))
(device 4 FORMULA
(properties
(expr 1 "(A==0 ? B : C)"))
(interface
(input 1
(name "A")
(optional yes))
(input 2
(name "B")
(optional yes))
(input 3
(name "C")
(optional yes))
(output 1
(name "Result")
(tag "Result")
(lock name constraints)
(optional yes))))
(configuration
(connect D4:1 D2:1)
(connect I1:1 D4:1)
(connect D0:1 D4:2)
(connect D1:1 D4:3))
(ShowOnExecPanel
(relativeOrigin 371 263)))
(contextCarrier
(active detail)
(panel
(extent 276 135)
(widget 2 detail
(relativeOrigin 25 67)
(title off)
(borderStyle flat)
(extent 225 42))
(widget 3 detail
(relativeOrigin 104 14)
(title off)
(borderStyle flat)
(extent 58 37)))
(detail
(extent 423 354)
(anchorPt 56 167)
(configuration
(devCarrierFor 0
(active icon)
(icon
(extent 46 25))
(open
(extent 167 33))
(pinCenter 0 0))
(devCarrierFor 1
(active icon)
(icon
(extent 46 25))
(open
(extent 174 28))
(pinCenter 0 50))
(devCarrierFor 2
(active open)
(icon
(extent 118 0))
(open
(extent 225 42))
(pinCenter 220 150))
(devCarrierFor 3
(active open)
(icon
(extent 32 15))
(open
(extent 58 37))
(title off)
(pinCenter 0 -130))
(devCarrierFor 4
(active open)
(icon
(iconImage "formula.icn"))
(open
(extent 160 154))
(terminals on)
(pinCenter 185 -30))
(connect D4:1 D2:1
(points 6 317 -30 360 -30 360 70 90 70 90 150 105 150))
(connect I1:1 D4:1
(points 4 -56 9 -40 9 -40 -80 72 -80))
(connect D0:1 D4:2
(points 4 25 0 40 0 40 -30 72 -30))
(connect D1:1 D4:3
(points 4 25 50 40 50 40 20 72 20)))
(stackingOrder 4 0 1 2 3))))
(device 12 BREAK)
(device 15 CONTEXT
(properties
(name "Press For")
(description2 10 "This User Object is the outermost \"context\""
"for the InfoAbout help device.  Within this"
"device is the pop-up panel containing the info"
"Notepad.  If all you can see is a device with"
"\"Press For\", you should double-click the left"
"mouse button on the Press For to restore the"
"Panel View of the device.  To see how this device"
"operates, click on the Info About button first,"
"then press the Detail button in the \"Press For\"" "title bar.")
(trigMode deg)
(nextID 4))
(deviceList
(device 0 TOGGLE25
(properties
(name "Info About")
(description2 17 "This is a toggle device with the name changed to"
"reflect it\'s function.  The output of the device"
"is \"0\" when the button is up, and \"1\" when the" "button is down.  " ""
"A Reset Control Input terminal has been added to"
"to always pop the button back out after showing"
"the pop-up help (Info About This Example) User" "Object." ""
"The Toggle has set the \"AutoExecute\" option to let"
"it operate even when the RUN button in the title"
"bar has not been pressed.  Note, however, that"
"AutoExecute only works when no other threads are"
"operating, either from their Start buttons or from" "the RUN button." "")
(autoTrigger 1))
(interface
(input 1
(type control)
(name "Reset")
(lock name constraints)
(optional yes))
(output 1
(lock name constraints)))
(implementation
(value Int32
(data  0))
(initValue Int32
(data  0))))
(device 2 CONTEXT
(properties
(name "Info About This Example")
(description2 10 "This is a User Object that has both a detail view"
"and a Panel view.  If this device is visible as"
"an icon, you must double-click the left mouse"
"button to \"open up\" the non-iconic view." ""
"Since the User Object has both a Panel and Detail"
"view, when you double-click on the icon, you will"
"first see the Panel view.  To see the components"
"of the User Object, press the Detail button in"
"the \"Info About This Example\" title bar.")
(trigMode deg)
(nextID 2)
(popupMoveable 1))
(deviceList
(device 0 NOTE
(properties
(name "NotePad")
(description2 11 "This notepad is displayed as a Show on Execute"
"panel to present the information to the reader." ""
"It has been \"Added to Panel\" of the \"Info About"
"This Example\" user object, thus it is not "
"necessary to keep it as an open device inside the"
"Detail view; you can edit the notepad from the"
"Panel view of this User Object.  You can also"
"set/clear the \"Enable Edit\" flag in this Notepad\'s"
"Object Menu to keep the pop-up notepad from being" "altered by the user.")
(text2 44
"PURPOSE:  Shows how to use the Sequencer object to solve a simple bin sort"
"    problem." "" "USER INPUT REQUIRED:  Press \"Run\"." "" "EXPLANATION:"
"\tIn the old days, carbon resistors were manufactured by a rather "
"    imprecise process, and then tested, sorted and marked.  The trick was"
"    that the standard resistance values (for example, 220, 270 and 330 ohms)"
"    were chosen to overlap at the 10 percent tolerance.  Thus, you didn\'t"
"    have to throw any resistors away.  This model sorts the resistors into"
"    the proper bins based on the value and the tolerance." ""
"\tThis example uses two Sequencer objects.  The first one (labeled Test"
"    Bounds)checks for the extreme limits and rejects any resistors which "
"    do not fit in any bin.  The first test calls a User Function, simResist,"
"    to get the value of the resistor.  The second test uses the result from"
"    the first test rather than calling simResist again.  Calling simResist"
"    a second time would get a different resistor value which is not what "
"    we want.  The result of the test, the resistance, is put on the Return"
"    output terminal and is stored in a global variable for later use. The"
"    Real array in the upper left corner of the model contains five elements,"
"\teach representing a standard resistance value.  The list of values is"
"    extensible due to the use of totSize().  " ""
"\tThe second Sequencer is inside a loop which indexes down the list of"
"    nominal resistor values.  The three transactions in the Sequencer"
"    labeled Test Value & Tolerance each call the global variable, "
"    globalOhms, to get the resistance value.  They test the resistance"
"    against the nominal value which is input from the array and a tolerance."
"    If the test passes, the real array of the nominal value and the tolerance"
"    (e.g. [220 2]) is output.  The To String formats it for display." ""
"\tNote that we are not using the Log output terminal in either Sequencer,"
"    so we\'ve deleted it to speed up execution." ""
"\tIf you want to see the flow of this program, try running it a few times "
"    with Edit ==> Animation turned on." ""
"\tThere is also a User Function, measResist(), which can measure the"
"    resistance, instead of simulating it.  If you have a HP 3478A Digital"
"    Voltmeter, just connect it to your HP-IB, change the FORMULA field in"
"    test1 to the expression measResist(), turn Live Mode On, and run the"
"    program.")))
(device 1 CONFIRM25
(properties
(name "DONE")
(description2 7 "This tiny \"thread\" begins running when the "
"enclosing UserObject is executed.  When the user"
"acknowledges the OK/DONE button, there is nothing"
"left to execute, so the thread ends.  Since there"
"are not other threads running, the User Object"
"is completed and will exit, removing the Show on" "Execute pop-up display."))
(interface
(output 1
(name "Go")
(lock name constraints)))
(implementation))
(configuration)
(ShowOnExecPanel
(relativeOrigin 4 2)))
(contextCarrier
(active detail)
(panel
(extent 831 512)
(widget 0 detail
(relativeOrigin 5 3)
(title off)
(borderStyle flat)
(extent 820 465)
(editing disabled))
(widget 1 detail
(relativeOrigin 383 474)
(title off)
(borderStyle flat)
(extent 65 33)))
(detail
(extent 866 520)
(anchorPt 433 270)
(configuration
(devCarrierFor 0
(active icon)
(icon
(extent 78 25))
(open
(extent 848 437)
(editing disabled))
(pinCenter 0 0))
(devCarrierFor 1
(active open)
(icon
(extent 45 15))
(open
(extent 58 37))
(title off)
(pinCenter 0 70)))
(stackingOrder 1 0))))
(device 3 IFTHENELSE
(properties
(name "!= 0")
(description2 5 "If no threads are running, the Toggle can generate"
"it\'s output data whenever the button is changed"
"(using the Toggle\'s AutoExecute mode).  In this"
"case, either the User Object is executed or the"
"Autoexecute sequence terminates.")
(cases 1 "a!=0"))
(interface
(input 1
(name "A")
(optional yes))
(output 1
(name "Then")
(lock name constraints))
(output 2
(name "Else")
(lock name constraints))))
(configuration
(connect D1:0 D0:1)
(connect D2:1 D1:0)
(connect D0:1 D2:1)))
(contextCarrier
(active panel)
(panel
(extent 293 73)
(widget 0 detail
(relativeOrigin 101 16)
(title off)
(borderStyle flat)
(extent 114 39)
(scaled on)
(format button)))
(detail
(extent 912 591)
(anchorPt 256 245)
(configuration
(devCarrierFor 0
(active open)
(icon
(extent 81 15))
(open
(extent 114 39)
(scaled on)
(format button))
(title off)
(pinCenter 0 0))
(devCarrierFor 2
(active icon)
(icon
(extent 217 25))
(open
(extent 831 512)
(carbonCopy))
(bg "Light Blue Gray")
(pinCenter 170 100))
(devCarrierFor 3
(active icon)
(icon
(extent 46 25))
(open
(extent 73 64))
(terminals on)
(pinCenter 140 0))
(connect D1:0 D0:1
(points 5 170 115 170 140 -80 140 -80 0 -60 0))
(connect D2:1 D1:0
(points 5 165 -10 190 -10 190 40 170 40 170 85))
(connect D0:1 D2:1
(points 2 59 0 114 0)))
(stackingOrder 0 2 1))))
(device 18 NOTE
(properties
(name "Warranty Disclaimer")
(text2 4 "This example is provided as an illustration"
"\"as is\", and Agilent Technologies makes"
"no warranty of any kind with regard to this" "example.")))
(configuration
(connect D5:1 D0:1)
(connect D10:1 D1:1)
(connect D1:0 D2:0)
(connect D9:0 D4:0)
(connect D8:1 D4:1)
(connect D4:1 D5:1)
(connect D3:1 D5:2)
(connect D9:1 D6:1)
(connect D9:1 D7:1)
(connect D3:1 D8:1)
(connect D3:1 D9:1)
(connect D0:1 D10:1)
(connect D9:2 D11:1)
(connect D11:0 D12:0)))
(contextCarrier
(wndOrigin 2 2)
(wndState res)
(active detail)
(detail
(extent 900 447)
(anchorPt 279 505)
(configuration
(devCarrierFor 0
(active open)
(icon
(extent 208 0))
(open
(extent 308 105))
(terminals on)
(pinCenter -5 0))
(devCarrierFor 1
(active open)
(icon
(extent 110 0))
(open
(extent 180 39))
(pinCenter 470 -30))
(devCarrierFor 2
(active icon)
(icon
(extent 78 25))
(open)
(terminals on)
(pinCenter 470 30))
(devCarrierFor 3
(active open)
(icon)
(open
(extent 167 127)
(showFormat real))
(pinCenter -190 -410))
(devCarrierFor 4
(active open)
(icon
(iconImage "loop.icn"))
(open
(extent 150 36))
(pinCenter 40 -280))
(devCarrierFor 5
(active open)
(icon
(extent 78 64)
(iconImage "formula.icn"))
(open
(extent 63 91))
(terminals on)
(pinCenter -140 -150))
(devCarrierFor 6
(active open)
(icon
(extent 110 25))
(open
(extent 124 59))
(terminals on)
(pinCenter 525 -140))
(devCarrierFor 7
(active open)
(icon
(extent 110 0))
(open
(extent 180 39))
(pinCenter 510 -240))
(devCarrierFor 8
(active icon)
(icon
(extent 110 25))
(open)
(terminals on)
(pinCenter -150 -280))
(devCarrierFor 9
(active open)
(icon
(extent 110 34))
(open
(extent 308 107))
(terminals on)
(pinCenter 130 -410))
(devCarrierFor 10
(active icon)
(icon
(extent 110 25))
(open
(extent 308 107))
(terminals on)
(pinCenter 290 -30))
(devCarrierFor 11
(active icon)
(icon
(extent 145 25))
(open
(extent 276 135)
(carbonCopy))
(terminals on)
(bg "Light Blue Gray")
(pinCenter 290 -300))
(devCarrierFor 12
(active icon)
(icon
(extent 78 25))
(open)
(terminals on)
(pinCenter 290 -250))
(devCarrierFor 15
(active open)
(icon
(extent 110 25))
(open
(extent 293 73)
(carbonCopy))
(bg "Light Blue Gray")
(pinCenter 560 -430))
(devCarrierFor 18
(active icon)
(icon
(extent 338 48)
(iconImage "disclaim.icn")
(label off))
(open
(extent 410 78)
(editing enabled))
(pinCenter 580 -340))
(connect D5:1 D0:1
(points 6 -56 -150 -40 -150 -40 -240 -220 -240 -220 0 -202 0))
(connect D10:1 D1:1
(points 2 347 -30 377 -30))
(connect D1:0 D2:0
(points 2 470 -8 470 15))
(connect D9:0 D4:0
(points 4 140 -354 140 -330 40 -330 40 -319))
(connect D8:1 D4:1
(points 2 -93 -280 -38 -280))
(connect D4:1 D5:1
(points 10 117 -280 140 -280 140 -240 -30 -240 -30 -250 -60 -250 -60 -310 -230
-310 -230 -170 -204 -170))
(connect D3:1 D5:2
(points 6 -104 -410 -80 -410 -80 -320 -240 -320 -240 -130 -204 -130))
(connect D9:1 D6:1
(points 4 336 -440 390 -440 390 -140 420 -140))
(connect D9:1 D7:1
(points 4 336 -440 390 -440 390 -240 417 -240))
(connect D3:1 D8:1
(points 6 -104 -410 -80 -410 -80 -320 -240 -320 -240 -280 -208 -280))
(connect D3:1 D9:1
(points 2 -104 -410 -57 -410))
(connect D0:1 D10:1
(points 2 201 -30 232 -30))
(connect D9:2 D11:1
(points 6 336 -380 360 -380 360 -330 200 -330 200 -300 215 -300))
(connect D11:0 D12:0
(points 2 290 -285 290 -265)))
(stackingOrder 3 8 4 11 12 9 13 6 7 5 0 10 1 2 14))
(numberFormats
(realFormat standard)
(realSigDigits 4)
(realRadixSpec 4)
(integerBase decimal))))
