Unit Testing

Do you have sufficient testing support using WC?

  • yes, absolutely

    Votes: 0 0.0%
  • yes, but could be more

    Votes: 2 66.7%
  • rather no

    Votes: 0 0.0%
  • no, not at all

    Votes: 1 33.3%

  • Total voters
    3

Efried

Active Member
The emulation software I wrote in python (quick and dirty), now has been ported to python 3.4 and is capable of comparing the frequency for different cases. Here is an example overlapping the best case (no Temp. sensor errors) with some random errors expressed through sensor status 0. You can see how often what PLC code is executed and if the sensor errors lead to Emails notifying (see caption).
The intention of the software is not to replace WC boards but allowing to test them (i.e the code).
 

Attachments

  • frequenz_vgl.png
    frequenz_vgl.png
    116.5 KB · Views: 14
It is not clear to me what you are indicating with your chart.
 
Are you looking at the number of times each instruction is executed in your emulation of the PLC program?
 
CAI_Support said:
I don't think your software can test WC board.  At best, it can test your own PLC code.
exactly, unit testing is defined as software testing method ;-) In my case the unit is one WC program. The next step could be to test it together with other WCs and the server side software (in my case php) requiring PHP emulation. But criticizing my posting you triggered another idea. Let's emulate the code, record variables of the emulated operation and of the real operation and compare both. To be able to do that, I should introduce SimPy to my emulator....
If somebody is interested joining me on this trip, I'd be delighted shedding work. The emulator code is in its infancy so not much more than some credits should remind of this when you plan going public with the product, preferably via github.
 
LarrylLix said:
It is not clear to me what you are indicating with your chart.
 
Are you looking at the number of times each instruction is executed in your emulation of the PLC program?
 
 
exactly, the above chart shows the difference in line calls between two scenarios. But you may also have a look at the time domain, showing the variables over time- here for one variant and coarse time interval.
Finally yet importantly you may do correlation between variables, OPs etc.
Cross-correlations:
IOP ['VAR1', 'VAR2', 'VAR3', 'VAR4', 'VAR5', 'VAR6', 'VAR7', 'VAR8']
OP1: -0.27 -0.41 -0.01 -0.03 -0.08 -0.03 -0.03 -0.03
OP2: 0.41 0.47 0.03 0.02 0.06 -0.03 -0.03 -0.03
OP3: nan nan nan nan nan nan nan nan
OP4: nan nan nan nan nan nan nan nan
OP5: 0.0 0.11 0.11 0.03 -0.04 0.03 0.03 0.03
OP6: 0.0 0.11 0.11 0.03 -0.04 0.03 0.03 0.03
OP7: nan nan nan nan nan nan nan nan
OP8: nan nan nan nan nan nan nan nan
 
This means that VAR2 is influencing much OP1 and OP2 as intended in opposite direction. I'm still searching a construct how to bind that results to the code logic automatically.
 

Attachments

  • vars.jpg
    vars.jpg
    116.9 KB · Views: 11
A software taking some GUI form and generating PLC code could be useful, like Allen-Bradley's ladder diagram editor.  However, just run through your software over your own PLC code is not really useful for most users.  They need first write their own PLC code. 
 
In another word, helping generate PLC code is useful. Analyzing others' PLC code is not very useful, because your software can never be sophisticated enough to understand users' intention in their own code.
 
A slow speed single-stepped control emulator with a screen full of VARs IPs and OPs looking like the PLC architecture, so that users can self-train could be invaluable.
 
A large single step,  step over 10, 20, 100, or n opcodes, user button. Maybe some "look back" PLC architecture "look back"/replay controls to see what changed back a step or two to VARS, IPs, OPs.
 
Of course IPs, OPs and all emulated points would need to be settable with up/down increments/decrements and absolute overwrites.
 
Ambitious? I would love to do it but not have  that kind of time. I would need to learn python first but that is coming, maybe.
 
Larry,
 
That will require that software knows exactly how WC8 working with each PLC instruction exactly. For example, how each TTL output does, how each DS2438 current register does, What if the power line disconnected to 1-wire bus. 
 
Basically, what Larry thinks is single step PLC debugger. That I don't think is easy to do this external software. You can add large delay after each PLC line code to make it step one line every few seconds. 
 
I wrote a Pascal to assembly code once. Integer only math (there was no math coprocessors then). I called it "Rascal" and it was a great project to write in assembly code. Scrapped it once compilers became available for under $5-10K and I changed to Intel processors (YUK!) but the code got me job creating Point of Sale terminal networks.
 
This shouldn't be that big of a deal with high level languages available today. OTOH...yeah right! Got an extra two years of your life to burn? :wacko:
 
LarrylLix said:
A slow speed single-stepped control emulator with a screen full of VARs IPs and OPs looking like the PLC architecture, so that users can self-train could be invaluable.
 
A large single step,  step over 10, 20, 100, or n opcodes, user button. Maybe some "look back" PLC architecture "look back"/replay controls to see what changed back a step or two to VARS, IPs, OPs.
 
Of course IPs, OPs and all emulated points would need to be settable with up/down increments/decrements and absolute overwrites.
 
Ambitious? I would love to do it but not have  that kind of time. I would need to learn python first but that is coming, maybe.
 
Thanks for the hint- I will implement the step-through ASAP - but need some break ;-(
 
CAI_Support said:
A software taking some GUI form and generating PLC code could be useful, like Allen-Bradley's ladder diagram editor.  However, just run through your software over your own PLC code is not really useful for most users.  They need first write their own PLC code. 
 
In another word, helping generate PLC code is useful. Analyzing others' PLC code is not very useful, because your software can never be sophisticated enough to understand users' intention in their own code.
 
 
Ok, but this is something different - code generators. Please have a look at Scratch - may be something like this is possible for the WC.
http://www.pcduino.com/scratch-runs-on-pcduino/
Meanwhile I have made some step back asking only for minor improvements in the usability and testability of the code- see poll above.
 
Back
Top