Fronius Interface Card Easy C/Linux Program

I have created a C program for Linux (and other Posix variants I imagine) which pulls data from the Fronius Interface Card Easy. It supports both delimited (CSV-style) output and human readable output and supports reporting on either the current data, the day's data, the total (lifetime) data, or a combination of all current, day, and total.

It is published over at SourceForge:

http://sourceforge.net/projects/fslurp/

Comments

  • mike95490
    mike95490 Solar Expert Posts: 9,583 ✭✭✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    Cool. I don't have a Fronius, but I'm sure there are many folks that will like it. (the sw/)
    Powerfab top of pole PV mount | Listeroid 6/1 w/st5 gen head | XW6048 inverter/chgr | Iota 48V/15A charger | Morningstar 60A MPPT | 48V, 800A NiFe Battery (in series)| 15, Evergreen 205w "12V" PV array on pole | Midnight ePanel | Grundfos 10 SO5-9 with 3 wire Franklin Electric motor (1/2hp 240V 1ph ) on a timer for 3 hr noontime run - Runs off PV ||
    || Midnight Classic 200 | 10, Evergreen 200w in a 160VOC array ||
    || VEC1093 12V Charger | Maha C401 aa/aaa Charger | SureSine | Sunsaver MPPT 15A

    solar: http://tinyurl.com/LMR-Solar
    gen: http://tinyurl.com/LMR-Lister ,

  • Roderick
    Roderick Solar Expert Posts: 253 ✭✭
    Re: Fronius Interface Card Easy C/Linux Program
    amosnomor wrote: »
    I have created a C program for Linux (and other Posix variants I imagine) which pulls data from the Fronius Interface Card Easy. It supports both delimited (CSV-style) output and human readable output and supports reporting on either the current data, the day's data, the total (lifetime) data, or a combination of all current, day, and total.

    It is published over at SourceForge:

    http://sourceforge.net/projects/fslurp/

    Great! Did you plan to publish open source, too?
  • amosnomor
    amosnomor Registered Users Posts: 9
    Re: Fronius Interface Card Easy C/Linux Program
    Roderick wrote: »
    Great! Did you plan to publish open source, too?

    It already ready is! The download from SourceForge is a tar file containing all of the source, along with the following license:
    /*
     * Permission to use, copy, modify, distribute, and sell this software and its
     * documentation for any purpose is hereby granted without fee, provided that
     * the above copyright notice appear in all copies and that both that
     * copyright notice and this permission notice appear in supporting
     * documentation.  No representations are made about the suitability of this
     * software for any purpose.  It is provided "as is" without express or 
     * implied warranty.
     */
    

    I hope that someone finds it useful. This one of the few places I found this topic being discussed when researching data collection for the Fronius inverters.
  • tallgirl
    tallgirl Solar Expert Posts: 413 ✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    You might want to use a canned license, such as the BSD or GNU / GPL licenses.

    With a home-grown license, people are far more likely to use the code as an instruction guide and re-implement it, rather than using your code under license and giving you credit. Not that getting credit is a good thing -- I have open source code that's 20+ years old and only recently have people stopped pestering me about it ...
  • autoxsteve
    autoxsteve Solar Expert Posts: 114 ✭✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    this is neat. I'd like to use it but have NO CLUE as to how to compile/run a .tgz file.

    Do I need a compiler, extractor, ?
  • amosnomor
    amosnomor Registered Users Posts: 9
    Re: Fronius Interface Card Easy C/Linux Program
    autoxsteve wrote: »
    this is neat. I'd like to use it but have NO CLUE as to how to compile/run a .tgz file.

    Do I need a compiler, extractor, ?

    This software is currently only for Linux (and probably Posix) systems. It has a dependency on the Unix serial i/o programming model.

    A tgz file is a standard archive format (like zip) from that environment. You extract it using the tar program (tar xzf archiveFile.tgz). Extracted, it is a set of source files, including a makefile. From there, assuming that you have GNU make and the GNU compiler, gcc, installed, you run make at the command line.

    But perhaps you aren't a Linux user. Would it be useful if I also published it in a zip archive format?
  • dwh
    dwh Solar Expert Posts: 1,341 ✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program
    amosnomor wrote: »
    But perhaps you aren't a Linux user. Would it be useful if I also published it in a zip archive format?

    I doubt it.

    Being a GNU/Linux user myself (since 1993) I would say that unless he has the ability to compile it there isn't any point. I.e., if he's using Windows, and gets the source as a .zip file, but can't compile it...

    I can see releasing a compiled binary for Windows or Mac as a .zip file, but I wouldn't bother with Linux source code.
  • autoxsteve
    autoxsteve Solar Expert Posts: 114 ✭✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    I am not presently running Linux, I am running windows XP Professional. Maybe I can re-compile it to run on windows....

    I'll see what I can try.
  • System2
    System2 Posts: 6,290 admin
    Re: Fronius Interface Card Easy C/Linux Program

    Hi amosnomor

    Your programm is exactly what I need! Great!

    I have a Fronius IG Plus 50 converter in my new system, which went online on 30.10.2009

    Now I want to add the ability to log the data and visualize it on my homepage.

    My concept looks like this right now:
    - Fronius Interface Card easy -> providing an RS232 interface
    - RS232 over Ethernet system -> interfacing to a virtual COM Port on my Linux Houseserver (which I assemble and setup right now :-)

    - Query the data from the IG plus and store in local MySQL database
    - sync the local MySQL database with the MySQL database on my homepage
    - visualize the data using PHP


    So your software covers a major part of the concept. Great!

    Is it possible for you, to alter/extend your software in a way, that it can write the data into a MySQL database?

    Greetings from Germany
    Micha
  • amosnomor
    amosnomor Registered Users Posts: 9
    Re: Fronius Interface Card Easy C/Linux Program
    dd2mic wrote: »
    Hi amosnomor
    Hello Micha
    Now I want to add the ability to log the data and visualize it on my homepage.

    My concept looks like this right now:
    - Fronius Interface Card easy -> providing an RS232 interface
    - RS232 over Ethernet system -> interfacing to a virtual COM Port on my Linux Houseserver (which I assemble and setup right now :-)
    You might find it less expensive, and easier, to run the RS232 line all the way to the Linux box.
    Is it possible for you, to alter/extend your software in a way, that it can write the data into a MySQL database?
    This tool was designed following the Unix idea that it should only do one thing. In this case, collect data. But because post-processing this data is a very common use case, the output can be generated in a CSV-style. This allows for easy loading into a database.

    For example, here one of several types of data samples that fslurp cam emit, using CSV output:
    Time,Power now,AC current now,AC voltage now,AC frequency now,DC current now,DC voltage now
    Mon Oct 26 13:00:01 2009,2931,11.77,249,59.98,8.10,380
    

    Once you have a MySQL table created this data can be loaded using the load data command. mysqlimport provides a command line shortcut for doing this.
  • System2
    System2 Posts: 6,290 admin
    Re: Fronius Interface Card Easy C/Linux Program

    Hello amosnomor
    amosnomor wrote: »
    You might find it less expensive, and easier, to run the RS232 line all the way to the Linux box.
    Yes. In the end you are right. The cable run is round about 40m from the IGplus to my linux server. That can easily be handled by a direct RS232 line.
    And the system becomes more failsave as well :-) (No switch, RSadapter)
    amosnomor wrote: »
    But because post-processing this data is a very common use case, the output can be generated in a CSV-style. This allows for easy loading into a database.
    So the approach is using some kind of pipeing method?
    Output of your programm to input of programm which writes it do the db. OK.

    What I want to avoid is an exchange via a temp file, due to hdd usage.
    (Your programm is writing to temp file. Other programm is reading this file )
    amosnomor wrote: »
    data can be loaded using the load data command. mysqlimport provides a command line shortcut for doing this.
    This sounds good. I 'll have a look at it in the following days.

    Mny tnx so far
    Micha
  • amosnomor
    amosnomor Registered Users Posts: 9
    Re: Fronius Interface Card Easy C/Linux Program
    dd2mic wrote: »
    Hello amosnomor
    So the approach is using some kind of pipeing method?
    Output of your programm to input of programm which writes it do the db. OK.
    In the successful case fslurp writes its output to stdout and returns 0. In the failure case diagnostic output is written to stderr and a non-0 value is returned. This is standard behavior for a Unix command line tool and works as exptected with pipes.

    At the moment, for my system, I am collecting this data to files with a cron job similar to the attached cron.txt file. Then once a day another job runs which extracts today's data from the files, and generates plots.
  • dwh
    dwh Solar Expert Posts: 1,341 ✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    Opening that file must surely be interesting for Windows users. Here's a "windofied" version for the curious. Unnecessary I know, but what the hey.
  • Knickohr
    Knickohr Registered Users Posts: 6
    Re: Fronius Interface Card Easy C/Linux Program

    Hi,

    I downloaded the fslurp and compiled it on a NSLU2 with uNSLUng. I'm getting some errors :

    # make
    gcc -Wall -lm -o fslurp main.c comm.c display.c fetch.c globals.c inverters.c utils.c
    display.c: In function `getValue':
    display.c:47: warning: comparison is always false due to limited range of data type
    display.c:68: warning: comparison is always false due to limited range of data type
    display.c: In function `getThousandsValue':
    display.c:93: warning: comparison is always false due to limited range of data type
    display.c:116: warning: comparison is always false due to limited range of data type
    display.c: In function `getHoursValue':
    display.c:141: warning: comparison is always false due to limited range of data type

    Is this a problem of my small linux slug or a known bug ?

    Thomas
  • BB.
    BB. Super Moderators, Administrators Posts: 33,431 admin
    Re: Fronius Interface Card Easy C/Linux Program

    Thomas,

    You might try sending an Email (via the contact member link under the poster's name)... He has not been back here since October of 2009.

    -Bill
    Near San Francisco California: 3.5kWatt Grid Tied Solar power system+small backup genset
  • Knickohr
    Knickohr Registered Users Posts: 6
    Re: Fronius Interface Card Easy C/Linux Program

    Hi Bill,

    I think, I have fixed the error for my own :

    I declare the exponent variable as signed char, not as char.

    Compiler ends without any error.

    But I will send an eMail too.

    Remark :

    GREAT, IT WORKS :cool:

    # /root/fslurp-0.5/fslurp -b 9600 -p /dev/ttyUSB0 -v
    writeBytes(getVersion)
    0x80 0x80 0x80 00 00 00 0x1 0x1
    readBytes(7)
    readBytes(5)
    0x80 0x80 0x80 0x4 00 00 0x1 0x2 0x1 0x3 00 0xb
    writeBytes(getActiveInverterNumber)
    0x80 0x80 0x80 00 00 00 0x4 0x4
    readBytes(7)
    readBytes(1)
    0x80 0x80 0x80 00 00 00 0x4 0x4
    /root/fslurp-0.5/fslurp ERROR: No active inverter found.

    Now, it's nightime in Germany, so my Inverter is offline, but the Inferface Card responds.

    Thomas
  • BB.
    BB. Super Moderators, Administrators Posts: 33,431 admin
    Re: Fronius Interface Card Easy C/Linux Program

    Glad to be of help! ;)

    Have fun.
    -Bill
    Near San Francisco California: 3.5kWatt Grid Tied Solar power system+small backup genset
  • Knickohr
    Knickohr Registered Users Posts: 6
    Re: Fronius Interface Card Easy C/Linux Program

    Now, it's online :

    http://www.sternhimmel-ueber-ulm.de/solaris.htm

    And a handy iPhone web-app :

    http://www.sternhimmel-ueber-ulm.de/wetter/solaris-m.htm

    Thanks for the application ;)

    Thomas
  • BB.
    BB. Super Moderators, Administrators Posts: 33,431 admin
    Re: Fronius Interface Card Easy C/Linux Program

    Looks very nice... English translation through Google for those of us who are language impaired. :blush:

    Looks like there may be some divide by Zero issues ("Overflow")
    aktuelle Einspeisespannung :overflow V 
    aktueller Einspeisestrom :overflow A 
    aktuelle Anlagenspannung :211 V 
    aktueller Anlagenstrom :overflow A 
    letzte Aktualisierung :Mon Mar 8 01:24:04 2010
    

    -Bill
    Near San Francisco California: 3.5kWatt Grid Tied Solar power system+small backup genset
  • Knickohr
    Knickohr Registered Users Posts: 6
    Re: Fronius Interface Card Easy C/Linux Program

    Hi.

    More debugging.

    Adding a Timeout in comm.c

    // FIX THIS, DS: add timeout

    for (totalBytesRead = 0; totalBytesRead < numBytesToRead; )
    {
    alarm(5);
    bytesRead = read(
    InverterFileDesc,
    buffer + totalBytesRead,
    numBytesToRead - totalBytesRead);
    alarm(0);

    I have major problems with the communication. Not every request from/to the card works. I think, this are syncronisation problems on the RS232-USB converter.

    There is also a minor bug in converting the currents and frequency. Will try to fix this.

    Thomas
  • Knickohr
    Knickohr Registered Users Posts: 6
    Re: Fronius Interface Card Easy C/Linux Program

    Good Morning (in Germany ;) )

    Due some problems with the communication, sometimes the RS232 doesn't syncronise, I add a "sleep" in the comm.c

    if (tcsetattr(InverterFileDesc, TCSANOW, &termio) == -1)
    {
    dieMessage(
    EXIT_COMM_FAILURE,
    "tcsetattr failed: %s\n",
    strerror(errno));
    }
    system("/opt/bin/sleep 2");
    }

    I think, the initalization of the comm-port need a little, before requesting the data from the card. Until now, I have no problems with the communications.

    Thomas
  • amosnomor
    amosnomor Registered Users Posts: 9
    Re: Fronius Interface Card Easy C/Linux Program

    Hello. I just got back from several weeks away without email.

    As for the communications problems that you are having, have you tried reducing the baud rate?
  • Knickohr
    Knickohr Registered Users Posts: 6
    Re: Fronius Interface Card Easy C/Linux Program

    Hello.

    Yes, this was the first thing, that I've tried. I've also found, that on the GND of the RS232, there is a potential of about 50 Volts. It's only a potential, no current flowing. I think, it's static electricity or something else. I grounded the far end (on the server, not on the Interface card). Maybe this also cause in communication problems.

    The best way is, to use isolated RS232-cables. Something like that :
    https://iftools.com/iso232/index.de.php

    This type use an FTDI-chipset. There are drivers for nearly all Linux-distributions available 8)

    Thomas
  • System2
    System2 Posts: 6,290 admin
    Re: Fronius Interface Card Easy C/Linux Program

    Hy there

    i'm trying to get my fronius/fslurp running.

    Unfortunatelly i get an error message:

    "writeBytes(getVersion)
    0x80 0x80 0x80 00 00 00 0x1 0x1
    readBytes(7)
    ./fslurp ERROR: byte 0 of the start field invalid: 0
    "

    has anyone an idea what to do?

    When i try to get in contact via windows and Fronius SolarAccess all works fine, so i think it is an configuration issue.

    Greetings
    Stefan
  • amosnomor
    amosnomor Registered Users Posts: 9
    Re: Fronius Interface Card Easy C/Linux Program
    Hy there

    i'm trying to get my fronius/fslurp running.

    Unfortunatelly i get an error message:

    "writeBytes(getVersion)
    0x80 0x80 0x80 00 00 00 0x1 0x1
    readBytes(7)
    ./fslurp ERROR: byte 0 of the start field invalid: 0
    "

    has anyone an idea what to do?

    When i try to get in contact via windows and Fronius SolarAccess all works fine, so i think it is an configuration issue.

    Greetings
    Stefan

    Try reducing the baud rate with the -b option. -b 4800 for example.
  • solarvic
    solarvic Solar Expert Posts: 1,071 ✭✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    Tampa solar. I read some of your posts and complaints about your froniusinverters. Your manual must be different than mune. service cose on my manual states that225 no grid voltage detected. description as soon as grid conditions have returned to admissible range, inverter resumes feeding power into the grid. Most of the error codes in the 220 ranges indicate you don,t have the right configuration of your panels. So what panels are you using and how many strings. I think it is possible you don,t have the panel strings configured correctly. I don,t think you need to change any voltages on the inverter. Takes 170 voc to get the inverter to invert. mpp voltage range 150-400 vdc. Inverter will still operate over 400 vdc but might overheat if you have it in sun ect. I have a ig-2000 and a ig-3000. I never had any problems with them. Also have an ig-plus which I like better because it doesn,t hunt as much as the ig units and can operate at a 100 volt higher than the lg units can. :Dsolarvic:D
  • tampasolar
    tampasolar Registered Users Posts: 65 ✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    Dear Solarvic:

    My system has 3 months on the grid, flawless. Only one hiccup in 90 days.

    I have added a Xantrex xw4548 inverter with mppt60 to my system.

    The xantrex claim is that I can attach the output of a grid-tie inv to the output of the xantrex inv.
    It works, excess current flows into the battery. This is all outlined in Xantrex documents. This is all working smoothly with normal load changes.

    When my well pump kicks in this "off-grid scenario", the ig5100 kicks out for 5 minutes. This is not unexpected but could most likely be avoided if I increased the size of the voltage window on the ig5100. The Fronius manual spec allows for much wider voltage swings, just no clear way on how to change the Fronius value in the supplied operating manual.

    There is no panel wiring issue. It's the surge current of a 1 hp motor that hits on one of two cycles at turn on. The xw output is softer than the utility grid.

    Again, do I need to spend more $$$ with Fronius for a com card, just to achieve the settings the manual outlines?

    Have a nice night.
    hybrid: xw6848 pro with two mppt60, 6 kw pv
    17 cell 280ah LiFePO4 storage  14 kw
    gridtie: sunny boy sma 2x 5k
    gridtie: fronius ag5100 5k
    Gateway / Insight Local
    xw4548 backup
  • solarvic
    solarvic Solar Expert Posts: 1,071 ✭✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    So you are ac coupled. I plan on ac coupling my magnum inverter with one of my fronius inverters. as soon as it gets warmer and dryer in Pa. Gt inverters are real sensitive with following the 60 cycles. With that big of power surge don,t you think it is more a problem with the cycles changing enough to make the gt shut down? I have a 3/4 hp 220 vac pump and probably have lessons to learn. If I have the same problem I have a grunfus pump ready. I just figured I was going to wait for the 220v pump to fail before I put the new pump in. Did you call fronius and ask them if they have an idea of your problem. I found them to be very helpfull when I called them. I don,t know about your card problem but maybe one of the more knowledgeable guys might be able to give you some sugestions but I think the cycles might change with that large of a surge requirement? Might have to live with it or get another pump like a grunfus that has a soft start. :Dsolarvic:D
  • solarvic
    solarvic Solar Expert Posts: 1,071 ✭✭✭✭
    Re: Fronius Interface Card Easy C/Linux Program

    Thinking more about your pump. Can you wire the pump from the grid on its own circuit so it won,t give a power surge requirement from your inverters? The way I have my magnum inverter set up is all grid power used in my house goes thru the pass thru of my magnum inverter. When I grid tie I might have the same problem you have. Won,t know till I try it. If I do I think I could wire pump direct from the grid, or else just install the grunfos sqflex pump I already bought. It doesn,t have the large surge needed to start it. think it is suposed to use about 200 watt extra while starting. T had one of my fronius inverters over 400 vdc imput before and didn,t have any problems but I took a couple panels off before we got cold weather as I was afraid of surpassing the 500 vdc limit. So I can,t see how you would be changing the configuration on your gt inverter anyway. The 150 thru 400 vdc range is where it is suposed to be most efficient . when you operate above that voltage inverter will derate itself if it overheats. I still think it is the cycles swing when you need the power surge to start the pump that turns of your fronius not the voltage. :Dsolarvic:D