Mod-RsSim icon indicating copy to clipboard operation
Mod-RsSim copied to clipboard

Generalize CSV importer code

Open zaphodikus opened this issue 5 years ago • 4 comments

The CSV importer always imports 16 value, and they are "float" , for some reason no support for importing anything else, it's a bit useless, since each float is 64 bit, blegh!

#96b731284a8481a852f9321425078dcdae22731f

Change the implementation to import 16 registers as plain text values 0-65535 CSV file must have no BOM mark, and be this format, with 17 values, the 1st value is register number, the 1st line of file is totally ignored.

address,value,value,value,value 40001,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16

zaphodikus avatar May 16 '20 16:05 zaphodikus

I suppose the other 15 values will be placed in the next 15 registers after 40001?As in the first value is the starting register number?

DovahX avatar May 16 '20 16:05 DovahX

Correction #1 - the 1st row in the CSV file is a heading, it get ignored. Correction #2 - the 1st column is also ignored, it's just descriptive text I had not documented this fact too well.

Have added a dialog to allow you to change the CSV import setting only :

View post on imgur.com

There is no code behind this yet, just the Dialog GUI works and looks like I want it to for now. Will release a build 8.22 once I write the code behind to implement the logic.

zaphodikus avatar May 17 '20 17:05 zaphodikus

Binaries will be published on the site, just as before. I had to sort out some upgrading and certificate pain, but www.plcsimulator.org is the place to grab a binary once I implement a CSV generalised parse function.

zaphodikus avatar May 20 '20 10:05 zaphodikus

Hmm further code inspection - requires a complete rewrite of the CSV importer code. the code imports a "integer", followed by 16 "double-float". Which is a bit weird and means the CSV data for each column differs. Will require implementing a new importer and a factory pattern, perhaps breaking the old importer. Alternately might be easier to rewrite it the way I think it should work, and not take time to generalize. I'm going to go down the pattern route, which means writing some unit tests.

zaphodikus avatar May 20 '20 20:05 zaphodikus