Beispiel #1
0
void LFO::Process(UnsignedType SampleCount) 
{
	UnsignedType type = m_Type->Value();
	FloatType freq =m_Freq->Value();
	FloatType Incr, CyclePos, Pos;

	CyclePos = StateValue(m_CyclePosInd)->AsFloat;

	for (UnsignedType n=0; n<SampleCount; n++) 
	{
		Incr = freq * (DEFAULT_TABLE_LEN / (FloatType)SampleRate());

		// Raw Output
		CyclePos = AdjustPos (CyclePos + Incr);
		SetOutput (output[0], n, (*ClassObject()->Table(type))[CyclePos]);

		// 'Cosine' Output
		Pos = AdjustPos (CyclePos + (DEFAULT_TABLE_LEN * 0.25f));
		SetOutput (output[1], n, (*ClassObject()->Table(type))[Pos]);

		// Inverted Output
		Pos = AdjustPos (DEFAULT_TABLE_LEN - CyclePos);
		SetOutput (output[2], n, (*ClassObject()->Table(type))[Pos]);
	}
}
Beispiel #2
0
//------------------------------------------------------------------------------
void DoPowerBurst(char number)
{	// Mini-routine to deliver Power Burst[number] from the RX packet
	// ATTENTION, number is one-based for better readability
    if ((command1.field.PPM_PWM == 1) && (number == 2))
    	SetOutput(&P1OUT, P1_TXCT, HIGH, BLCtimes.usToff, USEC, HALT);
    	
    SetOutput(&P1OUT, P1_TXCT, LOW, aLFpacket.usPowerBurst[number-1], MSEC, HALT);
      
}
Beispiel #3
0
//------------------------------------------------------------------------------
void WriteModeControlByte(unsigned char byte)
{
	// 	Write the Mode Control Byte (MCW) for the TMS3705.
	//	Bit time is 128USEC.
	
	unsigned int shift;	
	
	for (shift = 0x01; shift <= 0x80; shift <<= 1)
	{
		if (byte & shift)
			SetOutput(&P1OUT, P1_TXCT, HIGH, 128, USEC, HALT);	// High bit
		else
			SetOutput(&P1OUT, P1_TXCT, LOW,  128, USEC, HALT);	// Low bit
	}
}
Beispiel #4
0
bool FGWaypoint::Run(void )
{
  double target_latitude = target_latitude_pNode->getDoubleValue() * target_latitude_unit;
  double target_longitude = target_longitude_pNode->getDoubleValue() * target_longitude_unit;
  double source_latitude = source_latitude_pNode->getDoubleValue() * source_latitude_unit;
  double source_longitude = source_longitude_pNode->getDoubleValue() * source_longitude_unit;
  FGLocation source(source_longitude, source_latitude, radius);

  if (WaypointType == eHeading) {     // Calculate Heading
    double heading_to_waypoint_rad = source.GetHeadingTo(target_longitude,
                                                         target_latitude);

    double heading_to_waypoint = 0;
    if (eUnit == eDeg) heading_to_waypoint = heading_to_waypoint_rad * radtodeg;
    else               heading_to_waypoint = heading_to_waypoint_rad;

    Output = heading_to_waypoint;

  } else {                            // Calculate Distance
    double wp_distance = source.GetDistanceTo(target_longitude, target_latitude);

    if (eUnit == eMeters) {
      Output = FeetToMeters(wp_distance);
    } else {
      Output = wp_distance;
    }
  }

  Clip();
  if (IsOutput) SetOutput();

  return true;
}
Beispiel #5
0
bool FGSwitch::Run(void )
{
  bool pass = false;
  double default_output=0.0;

  for (unsigned int i=0; i<tests.size(); i++) {
    if (tests[i]->Default) {
      default_output = tests[i]->GetValue();
    } else {
      pass = tests[i]->condition->Evaluate();
    }

    if (pass) {
      Output = tests[i]->GetValue();
      break;
    }
  }
  
  if (!pass) Output = default_output;

  if (delay != 0) Delay();
  Clip();
  if (IsOutput) SetOutput();

  return true;
}
void
Written_Reference::Set(string __name, FADA_Index* __index, Quast* __anti, Quast* __out){
SetName(__name);
SetIndex(__index);
SetAnti(__anti);
SetOutput(__out);
}
/**
 * @brief Creates logical tile(s) after scanning index.
 * @return true on success, false otherwise.
 */
bool IndexScanExecutor::DExecute() {
  LOG_TRACE("Index Scan executor :: 0 child");

  if (!done_) {
    if (index_->GetIndexType() == INDEX_CONSTRAINT_TYPE_PRIMARY_KEY) {
      auto status = ExecPrimaryIndexLookup();
      if (status == false) return false;
    } else {
      auto status = ExecSecondaryIndexLookup();
      if (status == false) return false;
    }
  }
  // Already performed the index lookup
  PL_ASSERT(done_);

  while (result_itr_ < result_.size()) {  // Avoid returning empty tiles
    if (result_[result_itr_]->GetTupleCount() == 0) {
      result_itr_++;
      continue;
    } else {
      SetOutput(result_[result_itr_]);
      result_itr_++;
      return true;
    }

  }  // end while

  return false;
}
Beispiel #8
0
void ComponentWAV::Evaluate(int timestamp)
{
  UPDATE_TIMESTAMP();
  float v = m_wav.GetSample(m_index);
  m_index = (m_index + 1) % m_wav.GetSampleCount();
  SetOutput(0, v);
}
	void CGypsyMothStability::ExecuteWithoutGeneration()
	{
		//Set global class variables
		CGypsyMoth::SetApplyMortality(false);

		bool bViability = true;

		CGMEggParam eggParamTmp = m_eggParam;

		for (size_t y = 0; y < m_weather.GetNbYears() - 1 && bViability; y++)
		{
			//CTPeriod p(m_weather[y].GetFirstTRef(), m_weather[y + 1].GetLastTRef());
			CTPeriod p(m_weather[y].GetEntireTPeriod(CTM::DAILY).Begin(), m_weather[y + 1].GetEntireTPeriod(CTM::DAILY).End());

			//simulate developement
			CGypsyMoth gypsyMoth(m_hatchModelType, eggParamTmp);
			gypsyMoth.SimulateDeveloppement(m_weather, p);

			bViability = gypsyMoth.GetViabilityFlag();
			eggParamTmp.m_ovipDate = gypsyMoth.GetNewOvipDate();;
		}

		//Output data
		COutputVector stat(1, CTRef(0, 0, 0, 0, CTM(CTRef::ANNUAL, CTRef::OVERALL_YEARS)));
		stat[0][0] = bViability ? 1 : 0;
		SetOutput(stat);


	}
Beispiel #10
0
bool FGSwitch::Run(void )
{
  bool pass = false;
  double default_output=0.0;

  for (unsigned int i=0; i<tests.size(); i++) {
    if (tests[i]->Logic == eDefault) {
      default_output = tests[i]->GetValue();
    } else if (tests[i]->Logic == eAND) {
      pass = true;
      for (unsigned int j=0; j<tests[i]->conditions.size(); j++) {
        if (!tests[i]->conditions[j]->Evaluate()) pass = false;
      }
    } else if (tests[i]->Logic == eOR) {
      pass = false;
      for (unsigned int j=0; j<tests[i]->conditions.size(); j++) {
        if (tests[i]->conditions[j]->Evaluate()) pass = true;
      }
    } else {
      cerr << "Invalid logic test" << endl;
    }

    if (pass) {
      Output = tests[i]->GetValue();
      break;
    }
  }
  
  if (!pass) Output = default_output;

  Clip();
  if (IsOutput) SetOutput();

  return true;
}
/**
 * @brief Creates logical tile(s) after scanning index.
 * @return true on success, false otherwise.
 */
bool IndexScanExecutor::DExecute() {
    LOG_INFO("Index Scan executor :: 0 child");

    if (!done_) {
        auto status = ExecIndexLookup();
        if (status == false) return false;
        ExecPredication();
        ExecProjection();
    }

    // Already performed the index lookup
    assert(done_);

    while (result_itr < result.size()) {  // Avoid returning empty tiles
        if (result[result_itr]->GetTupleCount() == 0) {
            result_itr++;
            continue;
        } else {
            SetOutput(result[result_itr]);
            result_itr++;
            return true;
        }

    }  // end while

    return false;
}
Beispiel #12
0
void FGSensor::ProcessSensorSignal(void)
{
  Output = Input; // perfect sensor

  // Degrade signal as specified

  if (fail_stuck) {
    Output = PreviousOutput;
  } else if (fcs->GetTrimStatus()) {
    if (lag != 0.0)            {PreviousOutput = Output;    PreviousInput  = Input;}
    if (drift_rate != 0.0)     drift = 0;
    if (gain != 0.0)           Gain();      // models a finite gain
    if (bias != 0.0)           Bias();      // models a finite bias

    if (delay != 0)            for (int i=0; i<delay; i++) output_array[i] = Output;

    Clip();
  } else {
    if (lag != 0.0)            Lag();       // models sensor lag and filter
    if (noise_variance != 0.0) Noise();     // models noise
    if (drift_rate != 0.0)     Drift();     // models drift over time
    if (gain != 0.0)           Gain();      // models a finite gain
    if (bias != 0.0)           Bias();      // models a finite bias

    if (delay != 0)            Delay();     // models system signal transport latencies

    if (fail_low)  Output = -HUGE_VAL;
    if (fail_high) Output =  HUGE_VAL;

    if (bits != 0)             Quantize();  // models quantization degradation

    Clip();
  }
  if (IsOutput) SetOutput();
}
void SPI_setup(void)
{
    /* Disable chip select */
    SetOutput(SDF_CS);
#ifdef SPI_MASTER_0_ENABLE
    spi_master_hw_instance_t spi_master_instance = SPI_MASTER_0;
#elif defined(SPI_MASTER_1_ENABLE)
    spi_master_hw_instance_t spi_master_instance = SPI_MASTER_1;
#endif
//    spi_master_event_handler_t spi_master_event_handler = spi_master_0_event_handler;

    uint32_t err_code = NRF_SUCCESS;

    // Configure SPI master.
    spi_master_config_t spi_config = SPI_MASTER_INIT_DEFAULT;

    switch (spi_master_instance)
    {
        #ifdef SPI_MASTER_0_ENABLE
        case SPI_MASTER_0:
        {
            spi_config.SPI_Pin_SCK  = SCK; //SPIM0_SCK_PIN;
            spi_config.SPI_Pin_MISO = DIN; //SPIM0_MISO_PIN;
            spi_config.SPI_Pin_MOSI = DOUT; //SPIM0_MOSI_PIN;
            spi_config.SPI_Pin_SS   = SPI_PIN_DISCONNECTED; //SPIM0_SS_PIN; //SDF_CS
        }
        break;
        #endif /* SPI_MASTER_0_ENABLE */

        #ifdef SPI_MASTER_1_ENABLE
        case SPI_MASTER_1:
        {
            spi_config.SPI_Pin_SCK  = SCK; //SPIM1_SCK_PIN;
            spi_config.SPI_Pin_MISO = DIN; //SPIM1_MISO_PIN;
            spi_config.SPI_Pin_MOSI = DOUT; //SPIM1_MOSI_PIN;
            spi_config.SPI_Pin_SS   = SPI_PIN_DISCONNECTED; //SPIM1_SS_PIN; //SDF_CS
        }
        break;
        #endif /* SPI_MASTER_1_ENABLE */

        default:
            break;
    }

    spi_config.SPI_PriorityIRQ = APP_IRQ_PRIORITY_LOW;
    spi_config.SPI_CONFIG_ORDER = SPI_CONFIG_ORDER_MsbFirst;
    spi_config.SPI_CONFIG_CPOL = SPI_CONFIG_CPOL_ActiveLow;
    spi_config.SPI_CONFIG_CPHA = SPI_CONFIG_CPHA_Trailing;

    err_code = spi_master_open(spi_master_instance, &spi_config);
    APP_ERROR_CHECK(err_code);

#ifdef SPI_MASTER_0_ENABLE
    // Register event handler for SPI master.
    spi_master_evt_handler_reg(spi_master_instance, spi_master_0_event_handler);
#elif defined(SPI_MASTER_1_ENABLE)
    // Register event handler for SPI master.
    spi_master_evt_handler_reg(spi_master_instance, spi_master_1_event_handler);
#endif
}
Beispiel #14
0
void ComponentTimer::Evaluate(int timestamp)
{
  UPDATE_TIMESTAMP();
  while (m_range > 0.0 && m_timer.getElapsedTimeInSec() > m_range)
    m_timer.modifyElapsedTime(-m_range * 1000 * 1000);
  SetOutput(0, m_timer.getElapsedTimeInSec());
}
Beispiel #15
0
// Init():
//  Initializes the instance.  If it is already initialized, this
//   will clear and re-initialize it.  This mainly just initializes
//   scene-specific variables
void FreeKey::Init( const char *_source_name, const char *_output_name ) {
  SetSource( _source_name );
  SetOutput( _output_name );

  display_tree      = false;
  items_processed   = 0;
  lights_processed  = 0;
  bones_processed   = 0;

  item_list.Flush();
  groups.Flush();
  scene.Clear();
  scene.SetSceneName( source_name );

  // Interface-level settings
  zoom              =   1.0;
  name_scroll       =   0;
  time_scroll       =   0.0;
  display_min       =   0.0;
  display_max       =   2.0;
  current_time      =   0.0;
  current_item      =  -1;
  item_top          =   0;
  current_group     =   0;
}
//This method is call to compute solution
ERMsg CYHSSModel::OnExecuteDaily()
{
    ERMsg msg;

    //	if (!m_weather.IsHourly() )
    //m_weather.ComputeHourlyVariables();

    static const double THRESHOLD = 0;

    CDegreeDays DD(CDegreeDays::DAILY_AVERAGE, THRESHOLD);


    CYHSSStatVector stat(m_weather.GetEntireTPeriod(CTM(CTM::DAILY)));

    for (size_t y = 0; y < m_weather.size(); y++)
    {
        CTPeriod p = m_weather[y].GetEntireTPeriod();

        double tot_adult[366] = { 0 };
        double dd = 0;
        double cum_adult = 0;

        for (size_t jd = 0; jd < 90; jd++)
        {
            CTRef TRef = p.Begin() + jd;
            stat[TRef][O_L1] = 100;
            stat[TRef][O_AI] = 1;
        }

        for (size_t jd = 89; jd < m_weather[y].GetNbDays(); jd++)
        {
            CTRef TRef = p.Begin() + jd;
            const CWeatherDay& wDay = m_weather.GetDay(TRef);
            dd += DD.GetDD(wDay);

            double freq[9] = { 0 };
            double ai = ComputeStageFrequencies(dd, freq);

            //		adults alive
            tot_adult[jd] = freq[0];
            cum_adult += (tot_adult[jd] - tot_adult[jd - m_adultLongevity]) / m_adultLongevity;


            stat[TRef][O_DEGREE_DAY] = dd;

            stat[TRef][O_ADULT] = freq[0];
            stat[TRef][O_TRAP_CATCH] = cum_adult;

            for (size_t i = 0; i < 6; i++)
                stat[TRef][O_L1 + i] = freq[i + 3];

            stat[TRef][O_AI] = ai;
        }
    }

    SetOutput(stat);

    return msg;
}
void sensor_init(void) {

  nrf_gpio_cfg_output(SDI_TXEN);
  ClrOutput(SDI_TXEN);

  nrf_gpio_cfg_output(V5EN);
  SetOutput(V5EN);

  SetOutput(SDI_TXEN);

  sensor_ppi_init();


  hardware_init();
//  __enable_irq();
//
//  NRF_PPI->CHEN = 0;
}
Beispiel #18
0
struct binaryTree * LeftHeavyTree1(){
	struct binaryTree * tree = create_node(1);
	insert(tree, 2, LEFT);
	insert(tree, 3, LEFT);
	insert(tree, 4, LEFT);
	insert(tree, 5, LEFT);
	SetOutput("54321", "12345", "54321");
	return tree;
}
//-------------------------------------------------------------------------
mafVMEOutput *medVMEPolylineGraph::GetOutput()
//-------------------------------------------------------------------------
{
	// allocate the right type of output on demand
	if (m_Output==NULL)
	{
		SetOutput(mafVMEOutputPolyline::New()); // create the output
	}
	return m_Output;
}
Beispiel #20
0
bool FGSensor::Run(void)
{
    Input = InputNodes[0]->getDoubleValue() * InputSigns[0];

    ProcessSensorSignal();

    if (IsOutput) SetOutput();

    return true;
}
Beispiel #21
0
void led2_task(uint_32 initial_data)
{
  int value = 0;
  printf("\n led2 task \n");
  while (TRUE)
    {
      _time_delay(2222);
      SetOutput(2,value);
      value = value^1;
    }
}
Beispiel #22
0
void led3_task(uint_32 initial_data)
{
  int value = 0;
  printf("\n led3 task \n");
  while (TRUE)
    {
      _time_delay(3333);
      SetOutput(3,value);
      value = value^1;
    }
}
Beispiel #23
0
struct binaryTree * SampleTree1()
{
	struct binaryTree * tree = create_node(1);
	ClearOutput();
	insert(tree, 2, LEFT);
	insert(tree, 3, RIGHT);
	insert(tree, 4, LEFT);
	insert(tree, 5, RIGHT);
	SetOutput("42135", "12435", "42531");
	return tree;
}
Beispiel #24
0
/*TASK*-----------------------------------------------------
 *
 * Task Name : led1_task
 * Comments :
 * This task toggles the LED1 every 1111 milliseconds
 *
 *END*-----------------------------------------------------*/
void led1_task(uint_32 initial_data)
{
  int value = 0;
  printf("\n led1 task \n");
  while (TRUE)
    {
      _time_delay(1111);
      SetOutput(1,value);
      value = value^1;
    }
}
Beispiel #25
0
void led4_task(uint_32 initial_data)
{
  int value = 0;
  printf("\n led4 task \n");
  while (TRUE)
    {
      _time_delay(4444);
      SetOutput(4,value);
      value = value^1;
    }
}
Beispiel #26
0
bool WinFrame::ExecExpr(const std::string& expr)
{
    /* If expression is empty -> show information */
    if (expr.empty())
        ShowIntro();
    else if (expr == "exit")
    {
        /* Clear input to avoid storing "exit" in the config-file */
        SetInput("");
        Close();
    }
    else if (expr == "demo")
        ShowDemo();
    else if (expr == "const")
        ShowConstants();
    else if (expr == "clear")
    {
        constantsSet_.constants.clear();
        constantsSet_.ResetStd();
        ShowConstants();
    }
    else
    {
        /* Setup compute mode */
        Ac::ComputeMode mode;
        mode.degree = GetOptionDegree();

        /* Show status message */
        SetOutput("computing ...");

#ifdef AC_MULTI_THREADED

        /* Wait until previous thread has successfully terminated */
        if (computing_)
            return false;
        JoinThread();

#endif

        /* Compute expression */
#ifdef AC_MULTI_THREADED

        computing_ = true;
        thread_ = std::unique_ptr<std::thread>(new std::thread(&WinFrame::ComputeThreadProc, this, expr, mode));

#else

        ComputeThreadProc(expr.ToStdString(), mode);

#endif
    }

    return true;
}
Beispiel #27
0
bool FGFilter::Run(void)
{
  double test = 0.0;

  if (Initialize) {

    PreviousOutput1 = PreviousInput1 = Output = Input;
    Initialize = false;

  } else {

    Input = InputNodes[0]->getDoubleValue() * InputSigns[0];
    
    if (DynamicFilter) CalculateDynamicFilters();
    
    switch (FilterType) {
      case eLag:
        Output = Input * ca + PreviousInput1 * ca + PreviousOutput1 * cb;
        break;
      case eLeadLag:
        Output = Input * ca + PreviousInput1 * cb + PreviousOutput1 * cc;
        break;
      case eOrder2:
        Output = Input * ca + PreviousInput1 * cb + PreviousInput2 * cc
                            - PreviousOutput1 * cd - PreviousOutput2 * ce;
        break;
      case eWashout:
        Output = Input * ca - PreviousInput1 * ca + PreviousOutput1 * cb;
        break;
      case eIntegrator:
        if (Trigger != 0) {
          test = Trigger->getDoubleValue();
          if (fabs(test) > 0.000001) {
            Input  = PreviousInput1 = PreviousInput2 = 0.0;
          }
        }
        Output = Input * ca + PreviousInput1 * ca + PreviousOutput1;
        break;
      case eUnknown:
        break;
    }

  }

  PreviousOutput2 = PreviousOutput1;
  PreviousOutput1 = Output;
  PreviousInput2  = PreviousInput1;
  PreviousInput1  = Input;

  Clip();
  if (IsOutput) SetOutput();

  return true;
}
Beispiel #28
0
////////////////////////////////////////////////////////////////////////////
// popis experimentu ...
//
main()
{
  SetOutput("3telesa.dat");
  _Print("# Model obØhu dru§ice kolem soustavy dvou tØles v C++/SIMLIB \n");
  Init(0, 300);                   // inicializace experimentu
  InitGraphics();
  SetStep(1e-12,0.01);
  SetAccuracy(1e-14);             // je nutn  vysok  pýesnost
  Run();                          // simulace
  DoneGraphics();
  return 0;
}
Beispiel #29
0
TEST_F(ArrayChangeInformationFilter_test, vtkAssignAttribute_CorrectNumberOfComponentsPassedDownstream)
{
    inAttr->SetNumberOfComponents(3);
    inAttr->SetNumberOfTuples(17);
    for (vtkIdType i = 0; i < inAttr->GetNumberOfValues(); ++i)
    {
        inAttr->SetValue(i, static_cast<float>(i));
    }
    auto inImage = vtkSmartPointer<vtkImageData>::New();
    inImage->GetPointData()->SetScalars(inAttr);
    inImage->SetExtent(0, 0, 2, 18, 3, 3);

    auto infoSource = vtkSmartPointer<InformationSource>::New();
    infoSource->SetOutput(inImage);

    vtkDataObject::SetActiveAttributeInfo(infoSource->GetOutInfo(),
        vtkDataObject::FIELD_ASSOCIATION_POINTS,
        vtkDataSetAttributes::SCALARS,
        inAttr->GetName(),
        inAttr->GetDataType(),
        inAttr->GetNumberOfComponents(),
        static_cast<int>(inAttr->GetNumberOfTuples()));

    filter->SetAttributeLocation(ArrayChangeInformationFilter::POINT_DATA);
    filter->SetAttributeType(vtkDataSetAttributes::SCALARS);
    filter->SetInputConnection(infoSource->GetOutputPort());
    filter->EnableRenameOff();
    filter->EnableSetUnitOff();

    auto assignToVectors = vtkSmartPointer<vtkAssignAttribute>::New();
    assignToVectors->SetInputConnection(filter->GetOutputPort());
    assignToVectors->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS,
        vtkAssignAttribute::POINT_DATA);

    auto reassignScalars = vtkSmartPointer<vtkAssignAttribute>::New();
    reassignScalars->SetInputConnection(assignToVectors->GetOutputPort());
    reassignScalars->Assign(vtkDataSetAttributes::VECTORS, vtkDataSetAttributes::SCALARS,
        vtkAssignAttribute::POINT_DATA);

    auto normalize = vtkSmartPointer<vtkImageNormalize>::New();
    normalize->SetInputConnection(reassignScalars->GetOutputPort());
    normalize->SetEnableSMP(false);
    normalize->SetNumberOfThreads(1);

    // before patching (VTK 7.1+) vtkAssignAttribute, this would cause segmentation faults
    normalize->Update();
    auto outImg = normalize->GetOutput();
    auto outScalars = outImg->GetPointData()->GetScalars();

    ASSERT_EQ(inAttr->GetNumberOfComponents(), outScalars->GetNumberOfComponents());
    ASSERT_EQ(inAttr->GetNumberOfTuples(), outScalars->GetNumberOfTuples());
}
	void CGypsyMothStability::ExecuteWithGeneration()
	{
		//Set global class variables
		CGypsyMoth::SetApplyMortality(false);


		std::vector<bool> bViability(m_weather.GetNbYears() - 1, false);

		for (size_t y = 0; y < m_weather.GetNbYears() - 1; y++)
		{
			//init parameter and ovipisition for the current year
			CGMEggParam eggParamTmp = m_eggParam;
			eggParamTmp.m_ovipDate.m_year = m_weather[y].GetTRef().GetYear();

			bViability[y] = true;
			bool bStabilized = false;

			for (int g = 0; g < m_nbGenerations&& bViability[y] && !bStabilized; g++)
			{
				CTPeriod p(m_weather[y].GetEntireTPeriod(CTM::DAILY).Begin(), m_weather[y + 1].GetEntireTPeriod(CTM::DAILY).End());
				//simulate developement
				CGypsyMoth gypsyMoth(m_hatchModelType, eggParamTmp);
				gypsyMoth.SimulateDeveloppement(m_weather, p);


				if (gypsyMoth.GetViabilityFlag())
				{
					//Get stability and new oviposition date
					CTRef newOvipDate = gypsyMoth.GetNewOvipDate();
					bStabilized = newOvipDate.GetJDay() == eggParamTmp.m_ovipDate.GetJDay();
					eggParamTmp.m_ovipDate.SetJDay(newOvipDate.GetJDay());
				}
				else
				{
					//the model for this year is not viable
					bViability[y] = false;
				}
			}
		}

		//compute viability
		int nbValid = 0;
		for (size_t i = 0; i < bViability.size(); i++)
			if (bViability[i])
				nbValid++;

		COutputVector stat(1, CTRef(0, 0, 0, 0, CTM(CTRef::ANNUAL, CTRef::OVERALL_YEARS) ));
		stat[0][0] = (double)nbValid / bViability.size();
		SetOutput(stat);


	}