Stephen

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Stephen

  • Rank
    Newbie
  1. Stephen

    Workspace Window

    This link is broken.
  2. Stephen

    Filling a table component with an exported file

    OK, I tried putting the sortTime() right after the read... complains of 'no time parm' or something. Then I put it right after the 'messages.time = '... it did not complain, but the past values are still listed in ascending order, top-down. The picture looks exactly as above. I guess I need a reverse sortTime().
  3. Stephen

    Filling a table component with an exported file

    Thanks! Very Perl-like... I'll try it and let you know.
  4. Stephen

    Filling a table component with an exported file

    Here's a picture.
  5. I'm supporting an application that writes system messages to a file using an export. The messages are also added to a table component that reflects a v.channel that contains all the entries. When the application is started the export file is read and stuffed into the table. The problem is that the startup stuff is entered backwards... time goes backwards for all past entries. New system messages ("Restart' etc) appear in proper chronological order, with the most recent at the top. Here's some code: <> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ Sequence.loadMessages, Priority: 5 - Acquisition // pass name of export set used to write, and the name of the destination v channel (with v.). For example: // loadMessages("message_export","v.SYSTEM_MESSAGES") function loadMessages(string exportName, string destination) try private handle = evaluate("file.Open(export." + exportName + ".strFileName,1,0,0,1)") file.Read(handle) // read header private theTime = file.ReadDelim(handle, 0, ",", chr(10), -1) file.SeekToBegin(handle) file.Read(handle) // read header private string messages = file.ReadDelim(handle,1,",",chr(10),-1,1) messages.time = (theTime - 365*70 - 19) * 86400 execute(destination + ' = "START OF MESSAGES "') execute(destination + ".AddValue(messages)") file.Close(handle) catch() ? strLastError endcatch function add_service_Message(string message) v.service_messages.addvalue(formatdateTime("%c", systime()) + ": " + message) delay(.01) beginexport(service_export) endfunction </> Is there a way to invert the row order of the array 'messages'? Is there a way to read the file from the bottom? Not seeing an easy way out here. __ Steve .
  6. Stephen

    Alarm on comm timeout/cable unplug

    while(1) lamp_update() delay(0.1) private In0 try In0 = Device.ClickDevice.ReadCoilStatus(0,0xF066,1) catch() Click_PLC_Comm_Alm = 1 endcatch env_CommErr.AddValue(In0[0][0]) delay(0.1) private In = Device.ClickDevice.ReadHoldingS32(0,10,4) etc etc... </> So ideally I'd like to spin on that first read until the device comes back... there is a device Write() in LampUpdate(), but it doesn't seem to cause an alarm. I tried putting a 'contine' inside the catch but that didn't help. Thanks for your help, the other solution is elegant (for the H2) and I understand how to implement it.
  7. I'm working on a facilities monitoring installation... I need to alarm if LAN cables (Modbus TCP) are disconnected. I have one set of channels (the Click PLC) being polled in a sequence. I can try-catch a timeout and flag this error... but the sequence bombs and has to be restarted after the cable is re-plugged. At least I know there's a problem. The other set of channels (the H2 generator) is polled by the normal channel-device loop. I've tried comparing GetTime(mychan[0]) == GetTime(mychan[2]) and it seems that the channel is not updated when a timeout occurs... which I fully support as normal. Is there a graceful way to set an alarm on a channel timeout? Is there a way to catch a timeout and spin until the read is made OK, without bombing the sequence? TIA.
  8. I recently discovered that if you leave the software in Edit Mode and change to Runtime Mode then Edit Mode is still in force... if you want to push a button (our example was to ack an alarm) then you have to know to use the Control key. I had to read section 7.4 in the User Guide to find this information... not sure that an operator would be required to know this. I did search on this topic before posting (first post here). Should this remain unchanged? Should all programmers be told *never* to leave it in Edit Mode? Should all operators be told that if you're trying to press a button and it won't press, you have to hold Control when clicking? It would seem a simple matter to turn off Edit Mode automatically when switching to Runtime... is that not an easy fix? Even with the Dev key pulled Edit Mode was still in force. Thanks for your time.