Ignore:
Timestamp:
05/15/04 16:46:27 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc

    r2615 r4076  
    22
    33#include <iostream>
     4
     5#include "MString.h"
    46
    57using namespace std;
     
    5355    }
    5456
    55     cout << "Zd/Az: " << zd << "/" << az << "   ";
    56     cout << "Ra/Dec: " << ra << "/" << dec << "   ";
    57     cout << "Temp: " << temp << "'C   ";
    58     cout << "Hum: " << hum << "%   ";
    59     cout << "SolRad: " << solar << "W/m²   ";
    60     cout << "Wind: " << wind << "km/h" << endl;
    61 
    6257    fHumidity = hum;
    6358    fTemperature = temp;
    6459    fSolarRadiation = solar;
    6560    fWindSpeed = wind;
     61
     62    cout << "Zd/Az: " << zd << "/" << az << "  ";
     63    cout << "Ra/Dec: " << ra/15 << "h/" << dec << "  ";
     64    cout << "SolRad: " << solar << "W/m²" << endl;
    6665
    6766    fComStat = kCmdReceived;
     
    8685}
    8786
    88 bool MCeCoCom::Send(const char *str)
     87bool MCeCoCom::Send(const char *cmd, const char *str)
    8988{
    9089    MTime t;
     
    10099    fT.GetTime(h2, m2, s2, ms2);
    101100
    102     const char *msg =
    103         Form("%s "
     101    MString msg;
     102    msg.Print("%s "
    104103             "%02d %04d %02d %02d %02d %02d %02d %03d "
    105104             "%02d %04d %02d %02d %02d %02d %02d %03d "
    106              "%s\n", (const char*)fCommand,
     105             "%s\n", cmd,
    107106             fStatus,  y1, mon1, d1, h1, m1, s1, ms1,
    108107             fComStat, y2, mon2, d2, h2, m2, s2, ms2,
     
    113112    return rc;
    114113}
     114
     115TString MCeCoCom::GetWeather() const
     116{
     117    if (fSolarRadiation<0 || (double)MTime(-1)-(double)fT>11)
     118        return "";
     119
     120    MString str;
     121    return str.Print("Temp: %.1f'C  Hum: %.1f%%  Wind: %.1fkm/h",
     122                     fTemperature, fHumidity, fWindSpeed);
     123}
     124
     125Int_t MCeCoCom::GetWeatherStatus() const
     126{
     127    if (fSolarRadiation<0 || (double)MTime(-1)-(double)fT>11)
     128        return 0;
     129
     130    Int_t rc = 0;
     131    if (fHumidity>80)
     132        rc++;
     133    if (fWindSpeed>20)
     134        rc++;
     135    if (fWindSpeed>30)
     136        rc++;
     137    if (fWindSpeed>50)
     138        rc++;
     139
     140    return rc;
     141}
Note: See TracChangeset for help on using the changeset viewer.