コード例 #1
0
        private CurrentSwitchModel CreateCurrentSwitchModel(string name, string parameters)
        {
            var model = new CurrentSwitchModel(name);

            ApplyParameters(model, parameters);
            return(model);
        }
コード例 #2
0
        public override Context.Models.Model Generate(string id, string type, ParameterCollection parameters, ICircuitContext context)
        {
            switch (type.ToLower())
            {
                case "sw": var model = new VoltageSwitchModel(id);
                    SetParameters(context, model, parameters);
                    return new Context.Models.Model(id, model, model.Parameters);
                case "csw":
                    var model2 = new CurrentSwitchModel(id);
                    SetParameters(context, model2, parameters);
                    return new Context.Models.Model(id, model2, model2.Parameters);

                case "vswitch":
                    var vSwitchModel = new VSwitchModel(id);
                    SetParameters(context, vSwitchModel, parameters);
                    return new Context.Models.Model(id, vSwitchModel, vSwitchModel.Parameters);

                case "iswitch":
                    var iSwitchModel = new ISwitchModel(id);
                    SetParameters(context, iSwitchModel, parameters);
                    return new Context.Models.Model(id, iSwitchModel, iSwitchModel.Parameters);
            }

            return null;
        }
コード例 #3
0
        /// <summary>
        /// Create a voltage switch
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="pos">Positive node</param>
        /// <param name="neg">Negative node</param>
        /// <param name="contSource">Controlling source</param>
        /// <param name="modelName">Model name</param>
        /// <param name="modelParameters">Model parameters</param>
        /// <returns></returns>
        CurrentSwitch CreateCurrentSwitch(Identifier name, Identifier pos, Identifier neg, Identifier contSource, Identifier modelName, string modelParameters)
        {
            CurrentSwitchModel model = new CurrentSwitchModel(modelName);

            ApplyParameters(model, modelParameters);

            CurrentSwitch vsw = new CurrentSwitch(name, pos, neg, contSource);

            vsw.SetModel(model);
            return(vsw);
        }
コード例 #4
0
        /// <summary>
        /// Create a voltage switch
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="pos">Positive node</param>
        /// <param name="neg">Negative node</param>
        /// <param name="contSource">Controlling source</param>
        /// <param name="modelName">Model name</param>
        /// <param name="modelParameters">Model parameters</param>
        /// <returns></returns>
        CurrentSwitch CreateCurrentSwitch(string name, string pos, string neg, string contSource, string modelName, string modelParameters)
        {
            var model = new CurrentSwitchModel(modelName);

            ApplyParameters(model, modelParameters);

            var vsw = new CurrentSwitch(name, pos, neg, contSource);

            vsw.SetModel(model);
            return(vsw);
        }
コード例 #5
0
        public override SpiceSharp.Components.Model Generate(string id, string type, ParameterCollection parameters, ICircuitContext context)
        {
            SpiceSharp.Components.Model model = null;

            switch (type.ToLower())
            {
            case "sw": model = new VoltageSwitchModel(id); break;

            case "csw": model = new CurrentSwitchModel(id); break;

            case "vswitch": model = new VSwitchModel(id); break;

            case "iswitch": model = new ISwitchModel(id); break;
            }

            if (model != null)
            {
                SetParameters(context, model, parameters);
            }

            return(model);
        }