Sign in to follow this  
Followers 0
RiverAmy

Communication question?

16 posts in this topic

I'm not sure how to ask my question, but I will try. I have a device that I'm communicating with and I'm asking a command and I want a response, but the problem is... I want to ask the command and get responses over and over before the next scan. For example, I am asking a device what's your status, then it will send me a response. in order to command my next steps, I need multiple responses about the status (before the next scan) Does this make any since? I'm using a ProSoft card and I understand how to get and recieve data. Just not over and over in one scan. thank you, Amy

Share this post


Link to post
Share on other sites
can you be more specific? maybe provide some part numbers? plc...? card...? ...? sure you can loop and execute same portion of code many times before continuing with program and finishing scan but why it has to be done in one scan?

Share this post


Link to post
Share on other sites
Because, I need to know for example... if i have an input and it is authorized then start pump, how i know this is i send a command to ask the device i'm communicating with over and over again until i see what i want...like the input. another exmaple, if i don't have have input, transaction and batch done then authorize the device i'm communicating with. in other words, I need to know what the operator had enter and when so i can control the pump or whatever they need. did that help?

Share this post


Link to post
Share on other sites
What you describe can happen over several scans. Keeep in mind that for most procesors a san takes less than 100 milliseconds. Sounds like you will want to use some data files to remember status from scan to scan.

Share this post


Link to post
Share on other sites
Amy, You said you weren't sure how to ask this... I'm getting the feeling that you are more at home with PC programming like VB or C++ than PLC ladder programming. If that is the case, perhaps the problem is just understanding the differences between the two. More detail on your hardware would be helpful. Which PLC are you using? Which Prosoft card? What network is this device communicating over? How fast can you poll the device? What is the device? Also, your problem description is a bit too focused. A more generalized description of what you are trying to do would put the problem in context. It sounds like you are working in some sort of batch process and you need to start and stop a pump in response to a condition sensed by the "device". So far it doesn't sound like it would require anything special. Set up the Prosoft card to poll the device at a reasonable rate and store the status in the PLC. Then treat it like normal I/O. Depending on the hardware and the network used, your PLC scan rate may be faster than you can poll the device. Provide more info and I'm sure you will get a more useful response. Good luck, Mike Ellis

Share this post


Link to post
Share on other sites
Is this the Prosoft that was going to the Microload? Like Mellis said, remember that the PLC is not a line by line code. Code that is set to be executed will be done each scan. If you need to do step by step logic you could use sequencers or some bit logic.

Share this post


Link to post
Share on other sites
Yes, it is the MicroLoad.net device. i'm testing on a 1756-L61 series A. the proSoft card is the MVI56-GSC. I'm testing over RS-232,but I will use RS-485 in the field. Mellis, I'm just controlling three pumps depending on the Meter's request for flow. I don't control the MicroLoad.net (Smith Meter) which is a controller that keeps the flow at a set point. for example all my MicroLoads will be set for 400 GPM (gallon per minute). My problem I'm having... is that i need to know the status of the MicroLoad.net over and over before i can do other steps. For example, I want to start the pump, but i need to keep checking the status of the ML to know when i see an output (the operator has started the batch) then i can start the chosen pump (the operator choose) and depending on how many ML are pumping from that pump then i can adjust the speed of the pump. I have programmed it like normal I/O saying send a question then wait for a response then do the next question only after you get a response from the previous question. i'm just stuck on the status question. i need to check it at all times. in my program i'm doing CMP if the response is this then do required task. You guys were right about the VB and C++, i was programming like that and realized that is not going to work. I'm not good with PLC's at all, but as long as my boss is being really nice about me learning... I won't give up. i think i will really like this when i get the hang of it. thank you for taking the time to help me. Amy

Share this post


Link to post
Share on other sites
Amy You can program your logic for the GSC to continuously read or read at a certain time. What are you wanting to do. I can probably get you some sample code.

Share this post


Link to post
Share on other sites
I want to ask a command and get responses (etc. status) over in over in one scan but after i have asked a couple of other commands first (to the ML). I have the gsc card set up to be continuous. i think maybe i'm asking my question wrong.

Share this post


Link to post
Share on other sites
I think we have a little bit of confusion in terms. In PLCs a program scan happens in a few milliseconds. Except in a few special applications which use periodic task, which this one does not need, the lower the scan time the better What I think you are looking for is some step logic or a sequencer. I think the sequencer will be a little too complicated but need a few more details. I would layout the steps that is must go through including which conditions must be true to go to the next step and what outputs must be turned on during each step. Post that information for us to look at Also look at THIS thread. Once you get past the humor it is actually full of information about step logic and sequencers. Pay special attention to Panic Modes example. I think it is what you are looking for. If you would rather try the sequencers look at the link in Post #2 in the thread.

Share this post


Link to post
Share on other sites
Amy - Perhaps you can clarify some things for us all to help you. Or maybe I am just thick headed and somebody else understands this already. 1. You have how many pumps in your system? - Three I believe? Piping One Line Diag might help. 2. Each Pump has a Meter or do you have three Meters all on a main header? 3. Does the Meter or you PLC control Pump Start and Stop? 4. Is the PLC adjusting Pump Speed after receiving an increase / decrease signal from meter?

Share this post


Link to post
Share on other sites
Sorry about that, #1& #2... I have 9 Microload devices w/ each ML controlling the flow to one railcar. i have three tanks that i can pump from. each of the tanks have their own VFD( three pumps). all the tanks are on the same line suppling product to the railcars. #3...the plc will control the VFDs, but the operator at the railcar will enter which pump they want and they will enter a batch and then press start. when it is started i want to keep checking the status so that i can see when that input (start button) has been pressed by the operator. So, i can then start my pump for that tank the operator has just picked. #4...yes the PLC will control the VFDs depending on how many ML are pumping from the chosen pump. so if two operators (two ML) have chosen the first tank then i will adjust the speed of that pump. i do request the flow rate of the ML so that i know how much flow is going to the railcars. each ML will be set for 400 gpm.

Share this post


Link to post
Share on other sites
Here are the steps that i want to do... step 1 Send Display text to ML "Enter Tank" step 2 Send Display text to ML " " (this is just a blank line) step 3 Send Display text to ML "Tank 9" step 4 Send Display text to ML "Tank 12" step 5 Send Display text to ML "Tank 14" step 6 Send a command that allows the operator to choose which tank they want to pump from step 7 Send a command that reads the keypad (so i know which tank the operator has chosen) step 8 put a timer for 90 seconds (this is just how long it takes to go to the enter batch screen) step 9 Send a command to authorize the ML. see note* step 10 (here is my problem) send a command to check the status over and over till i see an input returned. also, i'm checking for the Note sections below* oh, i forgot it takes about 250 mSeconds to get the response back from the ML device. I'm thinking that i will need more timers. see note * send a RQ command to Request flow rate of chosen ML. then add anyother ML that are on the chosen pump. I will control the VFDs according to the info i get, i will use the Read Keypad to know which tank they want to pump from then when it's started (input true) i will add 400 gpm to the set point of a PID (inside PLC). and the same for when the stop is ture i will subtract teh 400 gpm from the PID. I request the flow rate from the MLs so that i know how much flow i'm sending and what i should be sending so i can adjust the PID too. all the following info. comes from that status command of the ML... * Note. i will only start the pump if the authorize command is true and the input (start) is true. I will only do the authorize command if input is not true, keypad data pending is not true and tansaction and batch done are not true. i will stop the pump only if i have authorize true, input not true, and if one of these are true...(transaction and batch done, or transaction in progress and batch done, or keypad data pending. I hope i'm explaining what i'm doing o.k. thanks for all the help Amy

Share this post


Link to post
Share on other sites
Looking at this veeerrrry simply... Why don't you just set up a timer say for 1 or 2 seconds. Then send the command to check the input whenever the timer finishes...every 1 or 2 seconds. When you see your input returned from the request disable the timer and do your steps, when those steps are complete re-enable the timer to again send request commnad and then watch for your input. Is this along the lines of what you are asking...?? I think most of us are a little confused with your question, I think we may be reading in to it a little to much.

Share this post


Link to post
Share on other sites
I think most of my problems are coming from the ProSoft card...I can't test this theory till i get the prosoft card to quit asking the same question over and over...i just got my equipment a couple of days ago and i started testing it and today i realized my problem... the card is asking the same question (the first one sent) over and over instead of asking the next step...i didn't know that was my problem till i looked at what the ML was receiving. i'm not sure how to fix this yet. I'll try what you are telling me when i get this fixed...thanks so much for you help. Amy

Share this post


Link to post
Share on other sites
Amy - It will take some time to mock up some kernel code, but here are my general thoughts now reading what you have written. I suggest the following approach. 1. Create a UDT {User Data Type} called ML_Info_Structure. And then create tags called ML1 thru ML9 of type ML_Info_Structure. Or create an array of ML_Info_Structure with 10 entries. 2. The elements of the UDT ML_info_Structure would be the following. A. Step_Number type DINT B. Text1 type STRING "Enter Tank" C. Text2 type STRING "" D. Text3 type STRING "Tank 9" E. Text4 type STRING "Tank 12" F. Text5 type STRING "Tank 14" G. Text6 type STRING Command String to Select Tank H. Text7 type STRING Command String to Read Select tank I. Text8 type STRING Command String to Authorize the ML J. Enter_Batch_Delay Type TIMER K ML_Authorized Type BOOL L. RQ_Status_Flag Type DINT - { 1= Sending RQ, 2 = Waiting RQ, 3 = Receiving RQ } M. Last_Flow Rate Type DINT N. Pump_Selected Type DINT 3. Create a UDT called Pump_Info_Structure. And then create tags called Pump9, Pump 12 and Pump14 of type Pump_Info_Structure or create an array of Pump_Info_structure with 15 entries. 4. The elements of the Pump_Info_structure would,be the following: A. Pump_Start type BOOL B. Pump_Stop type BOOL C. Pump_Running type BOOL D. PID_Setpoint Type DINT E. PID_Control_Variable Type DINT F. Pump_Fault Type DINT [VFD Fault Integer from VFD} 5. For actual program I would create two subroutines one called ML_Sequence and one called Pump_Sequence. You will need to call ML_Sequence for each ML and then Call Pump_Sequence for each pump.. 6. You will also need a Data Structure and Subroutine for the Prosoft Card communication. Hope this is clear and helps. Edited by BobLfoot

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0