Esempio n. 1
0
        public void RunToTime(ITime time, int outputLinkIndex)
        {
            lock (this)
            {
                if (_isBusy == false)
                {
                    //while(IsLater(time,_engineApiAccess.GetCurrentTime()))
                    while (IsLater(time, outputLinkIndex >= 0 ? ((SmartOutputLink)_smartOutputLinks[outputLinkIndex]).GetLastBufferedTime() : _engineApiAccess.GetCurrentTime()))
                    {
                        _isBusy = true;

                        //Update input links
                        foreach (SmartInputLink smartInputLink in _smartInputLinks)
                        {
                            smartInputLink.UpdateInput();
                        }

                        _isBusy = false;

                        //Perform Timestep
                        if (_engineApiAccess.PerformTimeStep())
                        {
                            //Update buffer with engine values, Time is timestamp
                            foreach (SmartOutputLink smartOutputLink in _smartOutputLinks)
                            {
                                smartOutputLink.UpdateBuffer();
                            }

                            SendEvent(EventType.DataChanged);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void SendSourceAfterGetValuesCallEvent(ITime time, string LinkID)
 {
     HydroNumerics.OpenMI.Sdk.Backbone.Event eventA = new HydroNumerics.OpenMI.Sdk.Backbone.Event(EventType.SourceAfterGetValuesCall);
     eventA.Description    = "GetValues(t = " + ITimeToString(time) + ", ";
     eventA.Description   += "LinkID: " + LinkID; //TODO: QS = " + _smartOutputLinkSet.GetLink(LinkID).SourceQuantity.ID + " ,QT = " + _smartOutputLinkSet.GetLink(LinkID).TargetQuantity.ID;
     eventA.Description   += ") <<<===";
     eventA.Sender         = this;
     eventA.SimulationTime = TimeToTimeStamp(_engineApiAccess.GetCurrentTime());
     eventA.SetAttribute("GetValues time argument : ", ITimeToString(time));
     SendEvent(eventA);
 }