Author Topic: Flow control in modem  (Read 12580 times)

peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Flow control in modem
« on: March 18, 2008, 06:50:22 AM »
Hi There,

I have 5  pcs T100MD888 connected to Fargo Telecom Mobile modems and one Windows server also connected to a Fargo Telecom Mobile modem. All modems are running at 9600 Baud
Once per day or when the DM[] variable reaches a threshold, each plc Modem dials the server modem and dumps the DM[]  ( in a padded format) and reads the RTC.

I use the Trilogi server version 2.0 and  the standard dial modem function supplied by Trilogi.

When sending  the data to the modem it is converted  ? on the fly? to text with zeros being padded and some hyphens and commas are added  as date and field delimiters and a CR for every 10 values in the DM.
Each Record is 10 positions in the DM as follows:
DM[1] = Date, DM[2] = Month, DM[3] = Year, DM[4] = Hour, DM[5] = Minute, DM[6] = Second, DM[7] = Value, DM[8] = ID, DM[9] = Value, DM[10] = Spare,

i.e if the DM Variable looks like this
18 3 2008 9 14 26 1 139 0
18 3 2008 9  9 26 2 139 0
18 3 2008 9  9 26 3 139 0
18 3 2008 9  9 26 1 139 0

it will be sent as records like this

18-03-2008,09:14:26,1,139,0 [CR]
18-03-2008,09:09:26,2,139,0 [CR]
18-03-2008,09:09:26,3,139,0 [CR]
18-03-2008,09:09:26,1,139,0 [CR]

This works and has been working fine for more that 12 months, as long as the DM[] is not filled beyond DM[1500]
If there is more data then some data is lost , not much just a comma or a few characters, but of course enough to corrupt data., and messing up the import rutine on the server
Until now I have solved it by sending data as soon as the DM[] variable reaches 1400 positions.
But now I will be installing at a site where the DM[] will fill up completely 2-3 times a day. So I have to solve the problem., because dialing up 5-10 times per day is to expensive, and the PLC is blocked during the process

I now guess the corruption is due to a buffer overflow I therefore introduced a 400 ms pause  for every 50 records being sent, by adding the following in my ?send and format data? procedure

If Y MOD 500= 1 then
Delay 400
End if

This actually works ( have tried  filling up the DM[] to positions 3840 10 times and transferring data), but prolongs the transfer time by 3 seconds in which the PLC is inactive

But I am worried about using the Delay function, would it be better to make at For Next loop to create a pause in the flow or is there another way of reducing the speed of dataflow?

/PeterH


support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Flow control in modem
« Reply #1 on: March 18, 2008, 04:28:35 PM »
The buffer overflow you mention is likely a limitation in the data modem ability to store the characters.

Instead of sending all the DM data in a single custom function,
why don't you use a 0.1s clock pulse to trigger a custom function that each time would only send a limited number of bytes to the modem. You could use a variable to keep track of the last DM index. That way the PLC is not blocked sitting there waiting to send all the data before proceeding to the next ladder rung. You will solve the problem of overflowing the buffer in the modem and at the same time the PLC is still able to process I/O and act on them.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Re:Flow control in modem
« Reply #2 on: March 19, 2008, 02:35:26 AM »
Thanks good idea, but would I then risk the modem hanging up before  I have dumped the whole contenst of the DM Variable?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Flow control in modem
« Reply #3 on: March 19, 2008, 11:38:05 AM »
Why would the modem hangs up on its own? You are only giving a 0.1s windows between batch of data that you upload via the modem and there is no reason why the modem would simply cut off within such a short time.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

peterh_DK

  • Newbie
  • Posts: 37
    • View Profile
Re:Flow control in modem
« Reply #4 on: April 23, 2008, 01:52:26 PM »
Well I decided on a "go between."

Within the custfunction I make a pause for 400 ms after every 50 records.

This has been working flawlessly for some weeks now.

Thanks for the advice