PDA

View Full Version : Modsoft woes


pauly
October 31st, 2008, 03:19 AM
I am trying to decipher an existing Modicon Modsoft program, the program is very large and I am having real difficulties in deciphering the code. I have attached an example section of code which I think is some sort of ramp function,contact 1821 is I think pulsing which adds, and thus ramps, the value in 405541. The rest I think is limiting because I think the SUB block is being used as acompare function. If there are any Modsoft experts veiwing I would really appreciate some feedback on my assumptions and any ideas as to the best way of translating this into Unity Pro.I am on a very tight schedule and starting to panic so ANY help/advice would be great. Thanks in advance

http://www.plctalk.net/qanda/uploads/modsoft.JPG

Sparkz
October 31st, 2008, 05:11 AM
Hi Pauly,

Man, are you in some serious ...! ;-) Back in 2003, I had to struggle through the same in the tires & rims dept at the Belgian GM plant.

The famous SUB instruction not only performs the subtraction, it also powers one of the 3 taps on the right of the instruction block, depending on the result of the subtraction:
result > 0 / result = 0 / result < 0.

It's also very often used just to move a value from one location to another if the center value = 0.

I'm no Modsoft expert by far, but it seems to me that the network has an integrating function, depending on 001821 and, like you said, limited to a minumum and a maximum value.

GeoffC
October 31st, 2008, 05:49 AM
I would start with a blank piece of paper. Write a functional description of how the process should work. Break it down into small functional units, defining operation, fault conditions, alarms, etc. Then write the new program. This will result in a much better program than if you just convert the existing code.
I have converted many old programs, with the most successful being the ones I did not even look at the old code (a blast furnace charging and material handling system). And the conversions that cause the most pain are the ones when a rung for rung conversion is specified, usually because the customer believes this to be the low risk method (it's not)

PeterW
October 31st, 2008, 06:04 AM
I am trying to decipher an existing Modicon Modsoft program, the program is very large and I am having real difficulties in deciphering the code. I have attached an example section of code which I think is some sort of ramp function,contact 1821 is I think pulsing which adds, and thus ramps, the value in 405541. The rest I think is limiting because I think the SUB block is being used as acompare function. If there are any Modsoft experts veiwing I would really appreciate some feedback on my assumptions and any ideas as to the best way of translating this into Unity Pro.I am on a very tight schedule and starting to panic so ANY help/advice would be great. Thanks in advance

http://www.plctalk.net/qanda/uploads/modsoft.JPG

If coil 01872 is ON, Compare register 405540 with 2030.

If reg 405540 is less than 2030, then move the contents of reg 405540 into reg 40001.

If reg 405540 is greater than or equal to 2030, then compare it ro reg 405541.

If reg 405540 is less than reg 405541, then move the contents of 405540 into 405541 and 40001, if the value is greater than 3359, then move 3359 into reg 40001.

If reg 405540 is greater than reg 405541 and coil 01821 is on, then add 10 to reg 405541 and then move 405541 into reg 40001, if the value is greater than 3359, then move 3359 into reg 40001.



note 405500 is a dummy reg for comparison instructions.

chud
October 31st, 2008, 06:47 AM
You can convert this program to with pl7 pro and then convert it from there to unity. If there is an old xbt involved you should have some transfer blocks for messaging to the xbt. These blocks normally give you hasles in converting.

Jim Dungar
October 31st, 2008, 08:14 AM
984 Ladder Logic does not have a dedicated function block for comparing register values, because the SUB function can be used for this task. As Sparkz said, many programmers found it was easy to use the single SUB function rather than using separate compare and move commands.

curlyandshemp
October 31st, 2008, 08:19 AM
984 Ladder Logic does not have a dedicated function block for comparing register values, because the SUB function can be used for this task. As Sparkz said, many programmers found it was easy to use the single SUB function rather than using separate compare and move commands.

Also there is no move instruction, that is why many times an ADD 40001 with 0 and place in 40002

pauly
October 31st, 2008, 01:05 PM
Thanks for the replies I thought the same as GeoffC, forget the old code and rewrite but the old code is all we have as far as a spec is concerned. Nothing else. Our sales people think this is enough but I have been tearing my hair out trying to see what the PLC actually does. It's not just me is it? There hundreds and hundreds of lines of code like this in this project and it is difficult isn't it?

PeterW
October 31st, 2008, 02:16 PM
Does the code have tag descriptors and/or network descriptors? or is the only copy you have an upload?

Very difficult without descriptors, some modicon code can look mind boggling, especially when its just box after box (usually where its setting up constants or control words for other parts of the code).

BTW where in South Wales, from Port Talbot myself, very confusing here, I can see the sun.

pauly
November 2nd, 2008, 12:24 PM
There are no rung comments at all, the variables have comments albeit not nescessarily the correct ones. Again thanks for taking the time to reply.

Jim Dungar
November 2nd, 2008, 02:12 PM
Also there is no move instruction, that is why many times an ADD 40001 with 0 and place in 40002

And all these years I thought BLKM was a move instruction.

ADD instructions tend to end the instruction line. SUB functions can easily be expanded on, which is why they are much more common.

MikeB
November 2nd, 2008, 09:39 PM
A very typical 984LL network...brings back memories from many years ago. Get to know the instructions and you need to always check vertical shorts to see exactly what the power flow is doing.
Typically the original programmer has proably used 405500 thoughout the program for SUB commands as a TEST block. Also SUB usually used for MOVE of a single word...and sometimes is actually used for a subtraction.
BLKM usually for muliple words or going from bits to word and vice versa.
400001 is proably an analog output, check in traffic cop for analog IO words configuration. When you have MULT and DIV blocks things get a little more fun as double words come into play...just write out the equations with both word addresses shown.
If you have a network with a timer sitting there with nothing connected to the input then your original programmer is sneakily using its output as a way of getting power into the middle of a network...I was never guilty of doing this..maybe once!!

remember word assignments:
0xxxxx coils and digital outputs
1xxxxx digital inputs
3xxxxx analog inputs
4xxxxx analog outputs and internal words

dogleg43
November 3rd, 2008, 08:51 AM
I believe a SUB block was often used to move data around because its scan rate was faster or more efficient than using a BLKM to perform the same function.

A lot of people don't like the Modicons because of the way logic scans but you could sure put a lot of functionality into one rung. To me this makes troubleshooting a little easier.