/// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinitions _propDefs = schema.PropertyDefinitions;

            IPropertyDefinition pd;

            pd             = _propDefs.AddStateProperty(MyStrings.TableIndexName);
            pd.Description = "References the State Property used to select the SimioTable row";
            pd.Required    = false;

            pd             = _propDefs.AddExpressionProperty(MyStrings.TableRowCountName, "0");
            pd.Description = "An Expression containing # of rows in the SimioTable";
            pd.Required    = false;

            // A repeat group of states to read into
            IRepeatGroupPropertyDefinition columns = _propDefs.AddRepeatGroupProperty(MyStrings.TableColumnMappingsName);

            columns.Description = "The RepeatGroup mapping expressions to the Table columns";

            pd             = columns.PropertyDefinitions.AddStringProperty(MyStrings.ColumnMapNameName, "");
            pd.Description = "Column Name Map";

            pd             = columns.PropertyDefinitions.AddStateProperty(MyStrings.ColumnMapStateName);
            pd.Description = "Set if the column is a State";

            pd             = columns.PropertyDefinitions.AddExpressionProperty(MyStrings.ColumnMapExpressionName, "");
            pd.Description = "Set if the column is an Expression";

            pd             = columns.PropertyDefinitions.AddExpressionProperty(MyStrings.ColumnMapPropertyName, "");
            pd.Description = "Set if the column is a Property";
        }
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinition pd;

            pd = schema.PropertyDefinitions.AddRealProperty("CorrelationCoefficient", 0.4);
            schema.ElementFunctions.AddSimpleRealNumberFunction("Process", "Returns \"Autoregressiv To Anything\" numbers with the given Correlationcoefficients.", new SimioSimpleRealNumberFunc(ArtaProcess));
        }
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// This is called from Simio when you select "User Defined" on the ??? tab.,
        /// or when you have these elements already defined in the project.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinition pd = schema.PropertyDefinitions.AddStringProperty("ServerUrl", string.Empty);

            pd.DisplayName = "MQTT Server URL";
            pd.Description = "The address of the MQTT Server (e.g. localhost for a local server, such as Mosquitto)";
            pd.Required    = true;

            pd             = schema.PropertyDefinitions.AddStringProperty("ServerPort", "1883");
            pd.DisplayName = "MQTT Server Port";
            pd.Description = "Internet port number used by MQTT Server. Default is 1883";
            pd.Required    = true;

            // An optional Simio Event can be added to this Mqtt Connection element
            IEventDefinition ed;

            ed             = schema.EventDefinitions.AddEvent("MqttEvent");
            ed.Description = "An event owned by this element";

            IStateDefinition sd = schema.StateDefinitions.AddStringState("Topic");

            sd.DisplayName = "MQTT Topic";
            sd.Description = "The received MQTT topic";
            sd.AutoResetWhenStatisticsCleared = false;

            sd             = schema.StateDefinitions.AddStringState("Payload");
            sd.DisplayName = "MQTT Payload";
            sd.Description = "The received MQTT Payload";
            sd.AutoResetWhenStatisticsCleared = false;
        }
Exemple #4
0
        public static readonly Guid MY_ID = new Guid("{4A0F816D-FB62-4E62-B22A-332D38B461C6}"); //Feb2020/dth

        /// <summary>
        /// Method called that defines the schema (property, display name, description, ...) for the element.
        /// This will show on the Simio UI
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinition pd = schema.PropertyDefinitions.AddStringProperty("ExcelWorkbook", String.Empty);

            pd.DisplayName = "Excel Workbook";
            pd.Description = "Path and name to Excel workbook.";
            pd.Required    = true;
        }
        public TextNodeElement(IElementSchema schema)
        {
            // todo checks

            _attributes = new Dictionary <string, string>();
            this.Schema = schema;
            this.Name   = this.Schema.ElementName;
        }
Exemple #6
0
        public IComplexElement Deserialize(IElementSchema schema, XmlDocument document)
        {
            // todo checks
            var documentElement = document.DocumentElement;

            var element = this.DeserializeComplexElement(schema, documentElement);

            return(element);
        }
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinition pd = schema.PropertyDefinitions.AddStringProperty("FilePath", String.Empty);

            pd.Description = "The name of the file path for output.";

            pd             = schema.PropertyDefinitions.AddBooleanProperty("OutputToFile");
            pd.Description = "If true, append table information to file each time step is executed";
        }
Exemple #8
0
        public ComplexElement(IElementSchema schema)
        {
            // todo checks

            this.Schema = schema;
            this.Name   = this.Schema.ElementName;
            _attributes = new Dictionary <string, string>();
            _children   = new ElementList(this);
        }
Exemple #9
0
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            // Example of how to add a property definition to the element.
            IPropertyDefinition pd;

            pd             = schema.PropertyDefinitions.AddRealProperty("Port", 5000);
            pd.DisplayName = "Port";
            pd.Description = "The port number to use for the agent connection";
            pd.Required    = true;
        }
Exemple #10
0
        private IComplexElement DeserializeComplexElement(IElementSchema schema, XmlElement xmlElement)
        {
            if (typeof(ComplexElement).IsAssignableFrom(schema.ElementType))
            {
                var ctor = schema.ElementType.GetConstructor(new[] { typeof(IElementSchema) });
                if (ctor == null)
                {
                    throw new NotImplementedException();
                }

                IComplexElement element = (IComplexElement)ctor.Invoke(new object[] { schema });

                // attributes
                foreach (XmlAttribute xmlElementAttribute in xmlElement.Attributes)
                {
                    element.SetAttribute(xmlElementAttribute.Name, xmlElementAttribute.Value);
                }

                // child elements
                foreach (var xmlChildNode in xmlElement.ChildNodes)
                {
                    if (xmlChildNode is XmlComment)
                    {
                        continue;
                    }

                    if (xmlChildNode is XmlElement xmlChildElement)
                    {
                        var childSchema = schema.GetChildElement(xmlChildElement.Name);

                        if (childSchema.ContainsTextNode())
                        {
                            ITextNodeElement childElement = this.DeserializeTextNodeElement(childSchema, xmlChildElement);

                            ((ElementList)(element.Children)).Add(childElement, false);
                        }
                        else
                        {
                            var childElement = this.DeserializeComplexElement(childSchema, xmlChildElement);
                            ((ElementList)(element.Children)).Add(childElement, false);
                        }
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                }

                return(element);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemple #11
0
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            // Example of how to add a state definition to the element.
            IStateDefinition sd;

            sd             = schema.StateDefinitions.AddState("MyState");
            sd.Description = "A state owned by this element";

            // Example of how to add an event definition to the element.
            IEventDefinition ed;

            ed             = schema.EventDefinitions.AddEvent("MyEvent");
            ed.Description = "An event owned by this element";
        }
Exemple #12
0
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinition pd;

            pd             = schema.PropertyDefinitions.AddStringProperty("ArtaDistributionProperty", "NormalDistribution");
            pd.DisplayName = "Distribution";
            pd.Required    = true;

            pd             = schema.PropertyDefinitions.AddRealProperty("CorrelationCoefficent1", 0.4);
            pd.DisplayName = "Correlationcoefficent 1";


            pd             = schema.PropertyDefinitions.AddRealProperty("CorrelationCoefficent2", 0.8);
            pd.DisplayName = "Correlationcoefficient 2";

            pd = schema.PropertyDefinitions.AddRealProperty("ArtaRun", 1.0);
        }
Exemple #13
0
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// This is called from Simio when you select "User Defined" on the ??? tab.,
        /// or when you have these elements already defined in the project.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            IPropertyDefinition pd = schema.PropertyDefinitions.AddStringProperty("ServerUrl", string.Empty);

            pd.DisplayName = "MQTT Server URL";
            pd.Description = "The address of the MQTT Server (e.g. localhost for a local server, such as Mosquitto)";
            pd.Required    = true;

            pd             = schema.PropertyDefinitions.AddStringProperty("ServerPort", "1883");
            pd.DisplayName = "MQTT Server Port";
            pd.Description = "Internet port number used by MQTT Server. Default is 1883";
            pd.Required    = true;

            pd             = schema.PropertyDefinitions.AddStringProperty("StatusTopic", "MqttSample1/Status");
            pd.DisplayName = "MQTT Status Topic";
            pd.Description = "This is the topic published to for Status, such as Start";
            pd.Required    = true;
        }
Exemple #14
0
        private ITextNodeElement DeserializeTextNodeElement(IElementSchema schema, XmlElement xmlElement)
        {
            var childXmlNodes = xmlElement.ChildNodes.Cast <XmlNode>().ToList();

            // todo: copy-pasting; merge cases 'count == 0' and 'count == 1'

            if (childXmlNodes.Count == 0)
            {
                ITextNodeElement textNodeElement = new TextNodeElement(schema);

                foreach (XmlAttribute xmlElementAttribute in xmlElement.Attributes)
                {
                    textNodeElement.SetAttribute(xmlElementAttribute.Name, xmlElementAttribute.Value);
                }

                return(textNodeElement);
            }

            if (childXmlNodes.Count != 1)
            {
                throw new NotImplementedException();
            }

            if (childXmlNodes.Single() is XmlText xmlText)
            {
                ITextNodeElement textNodeElement = new TextNodeElement(schema);
                textNodeElement.Value = xmlText.Value;

                foreach (XmlAttribute xmlElementAttribute in xmlElement.Attributes)
                {
                    textNodeElement.SetAttribute(xmlElementAttribute.Name, xmlElementAttribute.Value);
                }

                return(textNodeElement);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            // Example of how to add a property definition to the element.
            IPropertyDefinition pd;

            // Add the connector element property definition to this Element
            pd             = schema.PropertyDefinitions.AddElementProperty("MqttServer", MqttSubscribeConnectorDefinition.MY_ID);
            pd.DisplayName = "MQTT Server";
            pd.Description = "The MQTT address of the server(broker). For example, localhost:1883. Default port is 1883.";
            pd.Required    = true;

            // The MQTT Topic, which looks like this: foo/bar
            pd             = schema.PropertyDefinitions.AddStringProperty("Topic", "MqttSample1/MySubscribedActions");
            pd.DisplayName = "MQTT Topic";
            pd.Description = "The MQTT Topic we are subscribing to (e.g. 'MqttSample1/MySubscribedActions'";
            pd.Required    = true;

            // Example of how to add a state definition to the element.
            IStateDefinition sd;

            sd             = schema.StateDefinitions.AddStringState("Payload");
            sd.DisplayName = "MQTT Payload";
            sd.Description = "Where the subscribed MQTT's topic's payload data is placed";

            // Create Simio Events that can be fired when an MQTT message is received.
            // For this implementation, there are up to three of these.
            IEventDefinition ed;

            ed             = schema.EventDefinitions.AddEvent("OnMqttReceivedEvent1");
            ed.Description = "Event1 that will be Fired upon receipt of MQTT Topic message";
            EventDefList.Add(ed);

            ed             = schema.EventDefinitions.AddEvent("OnMqttReceivedEvent2");
            ed.Description = "Event2 that will be Fired upon receipt of MQTT Topic message";
            EventDefList.Add(ed);

            ed             = schema.EventDefinitions.AddEvent("OnMqttReceivedEvent3");
            ed.Description = "Event3 that will be Fired upon receipt of MQTT Topic message";
            EventDefList.Add(ed);
        }
        /// <summary>
        /// Method called that defines the property, state, and event schema for the element.
        /// </summary>
        public void DefineSchema(IElementSchema schema)
        {
            // Example of how to add a property definition to the element.
            IPropertyDefinition pd;

            pd             = schema.PropertyDefinitions.AddExpressionProperty("MyExpression", "0.0");
            pd.DisplayName = "My Expression";
            pd.Description = "An expression property for this element.";
            pd.Required    = true;

            // Example of how to add a state definition to the element.
            IStateDefinition sd;

            sd             = schema.StateDefinitions.AddState("MyState");
            sd.Description = "A state owned by this element";

            // Example of how to add an event definition to the element.
            IEventDefinition ed;

            ed             = schema.EventDefinitions.AddEvent("MyEvent");
            ed.Description = "An event owned by this element";
        }
 public PackageReference(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #18
0
 public VisualStudio(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #19
0
 public WebProjectProperties(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #20
0
 public File(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #21
0
        public static bool ContainsTextNode(this IElementSchema elementSchema)
        {
            // todo checks

            return(elementSchema.ElementType == typeof(TextNodeElement));
        }
Exemple #22
0
 public Dependencies(IElementSchema schema)
     : base(schema)
 {
 }
 public FlavorProperties(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #24
0
 public Reference(IElementSchema schema)
     : base(schema)
 {
 }
        public void AddChildElement(IElementSchema childElementSchema)
        {
            // todo checks

            _childSchemas.Add(childElementSchema.ElementName, childElementSchema);
        }
Exemple #26
0
 public Import(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #27
0
 public Project(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #28
0
 public Metadata(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #29
0
 public Group(IElementSchema schema)
     : base(schema)
 {
 }
Exemple #30
0
 /// <summary>
 /// Method called that defines the property, state, and event schema for the element.
 /// </summary>
 public void DefineSchema(IElementSchema schema)
 {
     IPropertyDefinition pd = schema.PropertyDefinitions.AddStringProperty("Nada", String.Empty);
 }