Example #1
0
Double_t KVINDRADBRun::GetTempsMort() const
{
   //Calculate temps mort for run from values of Gene dir, Gene MRQ and Gene TM, according to:
   //      T.M. = Gene TM / (Gene dir - Gene MRQ)
   //If Gene dir = Gene MRQ, temps mort = 0.
   //This can be compared to the value of GetTMpercent() (if present) which is the percentage value filled in the runsheet
   //during the experimental run.
   if (GetScaler("Gene DIRECT") == GetScaler("Gene MARQ")) {
      //if Gene MRQ == Gene Dir, temps mort 0
      return 0;
   }
   return (GetScaler("Gene TM") * 1.0 / (GetScaler("Gene DIRECT") - GetScaler("Gene MARQ")));
}
Example #2
0
int CGXDLMSRegister::SetValue(CGXDLMSSettings* settings, int index, CGXDLMSVariant& value)
{
    if (index == 1)
    {
        return SetLogicalName(this, value);
    }
    else if (index == 2)
    {
        if (m_Scaler != 0)
        {
            double val = GetScaler();
            val *= value.ToDouble();
            CGXDLMSVariant tmp(val);
            SetValue(tmp);
        }
        else
        {
            SetValue(value);
        }
    }
    else if (index == 3 && value.vt == DLMS_DATA_TYPE_STRUCTURE)
    {
        m_Scaler = value.Arr[0].ToInteger();
        m_Unit = value.Arr[1].ToInteger();
    }
    else
    {
        return ERROR_CODES_INVALID_PARAMETER;
    }
    return ERROR_CODES_OK;
}
int CGXDLMSRegister::SetValue(CGXDLMSSettings& settings, CGXDLMSValueEventArgs& e)
{
    if (e.GetIndex() == 1)
    {
        return SetLogicalName(this, e.GetValue());
    }
    else if (e.GetIndex() == 2)
    {
        if (m_Scaler != 0)
        {
            double val = GetScaler();
            val *= e.GetValue().ToDouble();
            CGXDLMSVariant tmp(val);
            SetValue(tmp);
        }
        else
        {
            SetValue(e.GetValue());
        }
    }
    else if (e.GetIndex() == 3 && e.GetValue().vt == DLMS_DATA_TYPE_STRUCTURE)
    {
        m_Scaler = e.GetValue().Arr[0].ToInteger();
        m_Unit = e.GetValue().Arr[1].ToInteger();
    }
    else
    {
        return DLMS_ERROR_CODE_INVALID_PARAMETER;
    }
    return DLMS_ERROR_CODE_OK;
}
void CGXDLMSDemandRegister::GetValues(vector<string>& values)
{
	values.clear();
	string ln;
	GetLogicalName(ln);
	values.push_back(ln);	
	values.push_back(m_CurrentAvarageValue.ToString());
	values.push_back(m_LastAvarageValue.ToString());
	string str = "Scaler: ";
	//if there is no fractal part.
	double s = GetScaler();
	if (s - (long)s == 0)
	{
		str += CGXDLMSVariant((long)s).ToString();
	}
	else
	{
		str += CGXDLMSVariant(s).ToString();
	}	
	str += " Unit: ";
	str += CGXDLMSConverter::GetUnitAsString(m_Unit);
	values.push_back(str);
	values.push_back(m_Status.ToString());
	values.push_back(m_CaptureTime.ToString());
	values.push_back(m_StartTimeCurrent.ToString());	
	values.push_back(CGXDLMSVariant(m_Period).ToString());
	values.push_back(CGXDLMSVariant(m_NumberOfPeriods).ToString());
}
Example #5
0
CIwSVec2 MapBackground::GetPosition()
{
	CIwSVec2 position;

	GetScaler()->LocationToPosition(gLocation, &position);

	return position;
}
Example #6
0
Double_t KVINDRADBRun::GetNIncidentIons(Double_t Q_apres_cible,
                                        Double_t Coul_par_top) const
{
   //Calculate total number of incident beam particles during run, based on measured integrated beam current
   //Arguments:
   //      Q_apres_cible = (average) charge state of projectile ions AFTER passage through target
   //      Coul_par_top = calibration of Faraday current integrator (default: 1.e-10 Coul/top)
   //      Note (from sect_effic.f):
   //**** Etalonnage de l'integrateur en 1993: voir cahier 4 page 87.
   //***  Si l'oscillateur interne du trigger est a 169 Hz, on a 10**(-10) Cb/top.
   //***  si c'est 160 Hz, on a 1.0610*(10**(-10)).

   return GetScaler("Faraday 1") * Coul_par_top / (TMath::Qe() * Q_apres_cible);
}
Example #7
0
void CGXDLMSRegister::GetValues(std::vector<std::string>& values)
{
    values.clear();
    std::string ln;
    GetLogicalName(ln);
    values.push_back(ln);
    values.push_back(m_Value.ToString());
    std::string str = "Scaler: ";
    double s = GetScaler();
    //if there is no fractal part.
    if (s - (long)s == 0)
    {
        str += CGXDLMSVariant((long)s).ToString();
    }
    else
    {
        str += CGXDLMSVariant(s).ToString();
    }
    str += " Unit: ";
    str += CGXDLMSConverter::GetUnitAsString(m_Unit);
    values.push_back(str);
}
int CGXDLMSDemandRegister::SetValue(int index, CGXDLMSVariant& value)
{
	if (index == 1)
	{
		if (value.vt != DLMS_DATA_TYPE_OCTET_STRING || value.GetSize() != 6)
		{
			return ERROR_CODES_INVALID_PARAMETER;
		}
		memcpy(m_LN, &value.byteArr[0], 6);
		return ERROR_CODES_OK;
	}
    else if (index == 2)
    {
		if (m_Scaler != 0)
		{
			SetCurrentAvarageValue(CGXDLMSVariant(value.ToDouble() * m_Scaler));
		}
		else
		{
			SetCurrentAvarageValue(value);
		}
    }
    else if (index == 3)
    {
		if (m_Scaler != 0)
		{
			SetLastAvarageValue(CGXDLMSVariant(value.ToDouble() * GetScaler()));
		}
		else
		{
			SetLastAvarageValue(value);
		}        
    }
    else if (index == 4)
    {
		m_Scaler = value.Arr[0].bVal;
		m_Unit = value.Arr[1].bVal;
    }
    else if (index == 5)
    {
		SetStatus(value.lVal);    
    }
    else if (index == 6)
    {
		CGXDLMSVariant tmp;
		CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_DATETIME, tmp);            
		SetCaptureTime(tmp.dateTime);
    }
    else if (index == 7)
    {
        CGXDLMSVariant tmp;
		CGXDLMSClient::ChangeType(value.byteArr, DLMS_DATA_TYPE_DATETIME, tmp);
        SetStartTimeCurrent(tmp.dateTime);
    }
    else if (index == 8)
    {
		SetPeriod(value.ulVal);
    }   
    else if (index == 9)
    {
        SetNumberOfPeriods(value.lVal);			
    }   
	else
	{
		return ERROR_CODES_INVALID_PARAMETER;
	}
	return ERROR_CODES_OK;
}
Example #9
0
bool MapBackground::CalculatePosition(bool forceDownload)
{
	bool downLoad = forceDownload;

	if (g_bScaledMode)
	{
		gLocation.m_Longitude = gScaledModeScaler->GetCenterLongitude();
		gLocation.m_Latitude = gScaledModeScaler->GetCenterLatitude();
	}

	if (gError == S3E_RESULT_SUCCESS)
	{
		if (g_bInitialLoad)
		{
			g_bInitialLoad = false;
			downLoad = true;
		}

		double	dLat = gPrevLocation.m_Latitude - gLocation.m_Latitude;
		double	dLng = gPrevLocation.m_Longitude - gLocation.m_Longitude;

		if (dLat < 0)
		{
			dLat = -dLat;
		}
		if (dLng < 0)
		{
			dLng = -dLng;
		}

		CIwSVec2 curPos, prevPos;

		GetScaler()->LocationToPosition(gLocation, &curPos);
		GetScaler()->LocationToPosition(gPrevLocation, &prevPos);

		if (ABS(prevPos.y - curPos.y) > Iw2DGetSurfaceHeight() / 4)
		{
			downLoad = true;
		}
		else if (ABS(prevPos.x - curPos.x) > Iw2DGetSurfaceWidth() / 4)
		{
			downLoad = true;
		}

		//if ((dLat > 0.00050 || dLng  > 0.00050))
		//{
		//	downLoad = true;		
		//}
	}
	else
	{
		gLocation.m_Latitude = 51;
		gLocation.m_Longitude = -0.1;
		
		double	dLat = gPrevLocation.m_Latitude - gLocation.m_Latitude;
		double	dLng = gPrevLocation.m_Longitude - gLocation.m_Longitude;

		if (dLat < 0)
		{
			dLat = -dLat;
		}
		if (dLng < 0)
		{
			dLng = -dLng;
		}

		if (g_bInitialLoad)
		{
			downLoad = true;
			g_bInitialLoad = false;
		}

		if ((dLat > 0.00001 || dLng  > 0.00001))
		{
			downLoad = true;		
		}
	}

	bool updateView = false;
	if (g_newZoom != g_actualZoom)
	{
		g_bLocationChanged = true;
		g_tempZoom = g_actualZoom;
		g_actualZoom = g_newZoom;
		downLoad = true;
	}

	if (g_tempZoom < g_actualZoom)
	{
		g_tempZoom += .05;

		if (g_tempZoom > g_actualZoom)
		{
			g_tempZoom = g_actualZoom;
		}
		g_bLocationChanged = true;
		downLoad = true;
	}
	if (g_tempZoom > g_actualZoom)
	{
		g_tempZoom -= .05;

		if (g_tempZoom < g_actualZoom)
		{
			g_tempZoom = g_actualZoom;
		}
		g_bLocationChanged = true;
		downLoad = true;
	}

	if (downLoad)
	{
		gPrevLocation = gLocation;
	}

	return downLoad;
}