Menu

AsciiFileReader linking issue

Help
Andrey
2012-05-21
2013-04-25
  • Andrey

    Andrey - 2012-05-21

    Hi OATC

    To start with OpenMI I take a simplest AsciiFileReader example.
    Everything work pretty well, but after linking and save composition, Editor stopped with System.NullReferenceException:

            static oprConnectionDecorator Decorators(UIConnection connection, DirectoryInfo oprPath, out List<UIOutputItem> allAdaptersInConnection)
            {
                allAdaptersInConnection = new List<UIOutputItem>();

                UIOutputItem adapter;

                foreach (UIConnection.Link link in connection.Links)
                {
                    adapter = link.Source;

                    while (adapter != null && adapter.IExchangeItem is ITimeSpaceAdaptedOutput)
                    {
                        if (!allAdaptersInConnection.Contains(adapter))
                            allAdaptersInConnection.Add(adapter);

                        adapter = adapter.Parent;                                       

                        HERE      adapter.Parent = NULL

    Could you direct me how to solve the problem?

    With regards,
    Andrey.

     
  • Andrey

    Andrey - 2012-05-24

    Hi all!

    Could somebody provide some very simple example of components based on the abstract ILinkableComponent (please, without any wrapper) interface.

    Let they be so easy that just transfer one double value of predefined type from source to target both of them with the absolutely same element and time set (one idbased element and one timestamp), i.e. without any additional operation.

    With regards,
    Andrey

     
  • Andrey

    Andrey - 2012-05-28

    Andrey,

    It seems to be obvious that to solve problem with AsciiFileReader you must implement IExchangeItem instead of ITimeInterpolator, which is only data buffer and does not support “data exchange” functionality.

    regards :)

     
  • Andrey

    Andrey - 2012-05-29

    Ok, I try to use Output and Input classes from Oatc.OpenMI.Sdk.Backbone. Everything go well until composition RUN. This time an error comes from Output implementation:

           public virtual void AddConsumer(IBaseInput consumer)
            {
                ITimeSpaceInput timeSpaceConsumer = consumer as ITimeSpaceInput;
                if (timeSpaceConsumer == null)
                    throw new ArgumentException("Must be a ITimeSpaceInput - may need to add adaptor");
                // Create list of consumers
                if (_consumers == null)
                {
                    _consumers = new List<ITimeSpaceInput>();
                }
                // consumer should not be already added
                if (_consumers.Contains(timeSpaceConsumer))
                {
                    throw new Exception("consumer \"" + consumer.Caption +
                        "\" has already been added to \"" + Caption);
                }
    

    Consumer (Input) already been added… yes this is really so, but what this mean??? Editor two times (after main menu save and run) repeat principally the same doings and in the RUN form its stopped there.

    Could somebody say what I do wrong or how I should implement Output exchange item to address this problem?

     

Log in to post a comment.