Loading ...
Sorry, an error occurred while loading the content.
 

Arithmetic on tabular data, how?

Expand Messages
  • Thomas Tornblom
    Greetings. I m using some simple ploticus scripts to generate graphs from temperature and energy meter data: http://spiff.hax.se/log.html I would like plot the
    Message 1 of 3 , Nov 1, 2005
      Greetings.

      I'm using some simple ploticus scripts to generate graphs from temperature and
      energy meter data:

      http://spiff.hax.se/log.html

      I would like plot the difference between two of the temps, input and output
      temps from a heatpump, and multiply that difference with a contant, which will
      be a simple approximation of the output power of the heat pump, and also divide
      that number with the current power consumption into the heatpump, which will
      give the COP (Coefficient Of Performance).

      Here's the script generating the second graph, which plots two of the temp
      fields I'm interested in doing arithmetic on:
      ---
      #proc page

      #proc getdata
      file: /export/home/thomas/logger/log.out
      fieldnameheader: yes

      #proc areadef
      title: Värmekretstemp (°C)
      titledetails: size=14 align=C
      rectangle: 1 1 8 4
      xscaletype: time hh:mm:ss
      xrange: 00:00:00 23:59:59
      yautorange: datafield=RK-fram,RK-retur,VP->VVB,VP->Ack,VVB/Ack->VP nearest=10

      #proc xaxis
      stubs: inc 2 hours
      minorticinc: 30 minutes
      stubformat: hh

      #proc yaxis
      stubs: inc 10
      gridskip: min
      ticincrement: 100 1000

      #proc curvefit
      maxinpoints: 1500
      xfield: time
      yfield: RK-fram
      linedetails: color=blue width=.5
      legendlabel: RK fram

      #proc curvefit
      maxinpoints: 1500
      xfield: time
      yfield: RK-retur
      linedetails: color=red width=.5
      legendlabel: RK retur

      #proc curvefit
      maxinpoints: 1500
      xfield: time
      yfield: VP->VVB
      linedetails: color=green width=.5
      legendlabel: VP->VVB

      #proc curvefit
      maxinpoints: 1500
      xfield: time
      yfield: VP->Ack
      linedetails: color=orange width=.5
      legendlabel: VP->Ack

      #proc curvefit
      maxinpoints: 1500
      xfield: time
      yfield: VVB/Ack->VP
      linedetails: color=black width=.5
      legendlabel: VVB/Ack->VP

      #proc legend
      location: max-1 max
      seglen: 0.2
      ---

      How do I generate and plot the difference of the two temps "VP->Ack" and
      "VVB/Ack->VP"?

      Thanks,
      Thomas
    • Stephen C. Grubb
      Thomas, you should be able to use a filter in #proc getdata to compute a difference between two fields. your field names are problematic in that they contain
      Message 2 of 3 , Nov 2, 2005
        Thomas,

        you should be able to use a filter in #proc getdata to compute a
        difference between two fields.

        your field names are problematic in that they contain symbols such as '-',
        '/' . Although the docs say you can use just about any alphanumeric
        characters in your field names, in order to perform arithmetic on the
        fields you'd be best off sticking with letters, digits, and underscore.

        assuming you use different names, you should be able to use something like
        this to compute the difference:

        #proc getdata
        file: ...
        fieldnameheader: yes
        showresults: yes
        filter:
        ##set DIFF = $arith( @@VPACK-@@VVBACKVP )
        ##print @@VVPACK @@VVBACKVP @@DIFF ....


        - Steve



        On Tue, 1 Nov 2005, Thomas Tornblom wrote:

        > Greetings.
        >
        > I'm using some simple ploticus scripts to generate graphs from temperature and
        > energy meter data:
        >
        > http://spiff.hax.se/log.html
        >
        > I would like plot the difference between two of the temps, input and output
        > temps from a heatpump, and multiply that difference with a contant, which will
        > be a simple approximation of the output power of the heat pump, and also divide
        > that number with the current power consumption into the heatpump, which will
        > give the COP (Coefficient Of Performance).
        >
        > Here's the script generating the second graph, which plots two of the temp
        > fields I'm interested in doing arithmetic on:
        > ---
        > #proc page
        >
        > #proc getdata
        > file: /export/home/thomas/logger/log.out
        > fieldnameheader: yes
        >
        > #proc areadef
        > title: Värmekretstemp (°C)
        > titledetails: size=14 align=C
        > rectangle: 1 1 8 4
        > xscaletype: time hh:mm:ss
        > xrange: 00:00:00 23:59:59
        > yautorange: datafield=RK-fram,RK-retur,VP->VVB,VP->Ack,VVB/Ack->VP nearest=10
        >
        > #proc xaxis
        > stubs: inc 2 hours
        > minorticinc: 30 minutes
        > stubformat: hh
        >
        > #proc yaxis
        > stubs: inc 10
        > gridskip: min
        > ticincrement: 100 1000
        >
        > #proc curvefit
        > maxinpoints: 1500
        > xfield: time
        > yfield: RK-fram
        > linedetails: color=blue width=.5
        > legendlabel: RK fram
        >
        > #proc curvefit
        > maxinpoints: 1500
        > xfield: time
        > yfield: RK-retur
        > linedetails: color=red width=.5
        > legendlabel: RK retur
        >
        > #proc curvefit
        > maxinpoints: 1500
        > xfield: time
        > yfield: VP->VVB
        > linedetails: color=green width=.5
        > legendlabel: VP->VVB
        >
        > #proc curvefit
        > maxinpoints: 1500
        > xfield: time
        > yfield: VP->Ack
        > linedetails: color=orange width=.5
        > legendlabel: VP->Ack
        >
        > #proc curvefit
        > maxinpoints: 1500
        > xfield: time
        > yfield: VVB/Ack->VP
        > linedetails: color=black width=.5
        > legendlabel: VVB/Ack->VP
        >
        > #proc legend
        > location: max-1 max
        > seglen: 0.2
        > ---
        >
        > How do I generate and plot the difference of the two temps "VP->Ack" and
        > "VVB/Ack->VP"?
        >
        > Thanks,
        > Thomas
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >


        Stephen C. Grubb scg@... x-6633
        Scientific Software Engineer, The Jackson Laboratory
        600 Main Street Bar Harbor, Maine 04609 USA
      • Thomas Tornblom
        ... Thanks Steve. I woked around the problem by using an awk script to preprocess the data and then plot the output. As I needed some conditionals also I
        Message 3 of 3 , Nov 2, 2005
          > To: ploticus@yahoogroups.com
          > From: "Stephen C. Grubb" <scg@...>
          > Date: Wed, 2 Nov 2005 08:32:16 -0500 (EST)
          > Subject: Re: [ploticus] Arithmetic on tabular data, how?
          >
          > Thomas,
          >
          > you should be able to use a filter in #proc getdata to compute a
          > difference between two fields.
          >
          > your field names are problematic in that they contain symbols such as '-',
          > '/' . Although the docs say you can use just about any alphanumeric
          > characters in your field names, in order to perform arithmetic on the
          > fields you'd be best off sticking with letters, digits, and underscore.
          >
          > assuming you use different names, you should be able to use something like
          > this to compute the difference:
          >
          > #proc getdata
          > file: ...
          > fieldnameheader: yes
          > showresults: yes
          > filter:
          > ##set DIFF = $arith( @@VPACK-@@VVBACKVP )
          > ##print @@VVPACK @@VVBACKVP @@DIFF ....
          >
          >
          > - Steve

          Thanks Steve.

          I woked around the problem by using an awk script to preprocess the data and
          then plot the output. As I needed some conditionals also I figured awk is
          probably a better tool for this :-)

          Cheers,
          Thomas

          >
          >
          >
          > On Tue, 1 Nov 2005, Thomas Tornblom wrote:
          >
          > > Greetings.
          > >
          > > I'm using some simple ploticus scripts to generate graphs from temperature
          and
          > > energy meter data:
          > >
          > > http://spiff.hax.se/log.html
          > >
          > > I would like plot the difference between two of the temps, input and output
          > > temps from a heatpump, and multiply that difference with a contant, which
          will
          > > be a simple approximation of the output power of the heat pump, and also
          divide
          > > that number with the current power consumption into the heatpump, which will
          > > give the COP (Coefficient Of Performance).
          > >
          > > Here's the script generating the second graph, which plots two of the temp
          > > fields I'm interested in doing arithmetic on:
          > > ---
          > > #proc page
          > >
          > > #proc getdata
          > > file: /export/home/thomas/logger/log.out
          > > fieldnameheader: yes
          > >
          > > #proc areadef
          > > title: Värmekretstemp (°C)
          > > titledetails: size=14 align=C
          > > rectangle: 1 1 8 4
          > > xscaletype: time hh:mm:ss
          > > xrange: 00:00:00 23:59:59
          > > yautorange: datafield=RK-fram,RK-retur,VP->VVB,VP->Ack,VVB/Ack->VP
          nearest=10
          > >
          > > #proc xaxis
          > > stubs: inc 2 hours
          > > minorticinc: 30 minutes
          > > stubformat: hh
          > >
          > > #proc yaxis
          > > stubs: inc 10
          > > gridskip: min
          > > ticincrement: 100 1000
          > >
          > > #proc curvefit
          > > maxinpoints: 1500
          > > xfield: time
          > > yfield: RK-fram
          > > linedetails: color=blue width=.5
          > > legendlabel: RK fram
          > >
          > > #proc curvefit
          > > maxinpoints: 1500
          > > xfield: time
          > > yfield: RK-retur
          > > linedetails: color=red width=.5
          > > legendlabel: RK retur
          > >
          > > #proc curvefit
          > > maxinpoints: 1500
          > > xfield: time
          > > yfield: VP->VVB
          > > linedetails: color=green width=.5
          > > legendlabel: VP->VVB
          > >
          > > #proc curvefit
          > > maxinpoints: 1500
          > > xfield: time
          > > yfield: VP->Ack
          > > linedetails: color=orange width=.5
          > > legendlabel: VP->Ack
          > >
          > > #proc curvefit
          > > maxinpoints: 1500
          > > xfield: time
          > > yfield: VVB/Ack->VP
          > > linedetails: color=black width=.5
          > > legendlabel: VVB/Ack->VP
          > >
          > > #proc legend
          > > location: max-1 max
          > > seglen: 0.2
          > > ---
          > >
          > > How do I generate and plot the difference of the two temps "VP->Ack" and
          > > "VVB/Ack->VP"?
          > >
          > > Thanks,
          > > Thomas
          > >
          > >
          > >
          > >
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          >
          >
          > Stephen C. Grubb scg@... x-6633
          > Scientific Software Engineer, The Jackson Laboratory
          > 600 Main Street Bar Harbor, Maine 04609 USA
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >
          > !DSPAM:4368bff227718116145615!
          >

          Real life: Thomas Törnblom Email: Thomas.Tornblom@...
          Snail mail: Banvallsvägen 14 Phone: +46 18 290 290
          S - 754 40 Uppsala, Sweden Cellular: +46 70 261 1372
        Your message has been successfully submitted and would be delivered to recipients shortly.