public static string ToFunctionName(this FunctionTypeEnum functionType) { switch (functionType) { case FunctionTypeEnum.Identify: return("identify"); case FunctionTypeEnum.FunctionList: return("function_list"); case FunctionTypeEnum.Voltage: return("voltage"); case FunctionTypeEnum.Report: return("report"); case FunctionTypeEnum.OwList: return("ow_list"); case FunctionTypeEnum.OwDS18B20Temperature: return("ow_ds18b20_temperature"); case FunctionTypeEnum.OwDS18B20TemperaturePeriodical: return("ow_ds18b20_temperature_periodical"); case FunctionTypeEnum.Unknown: return(null); default: throw new ArgumentOutOfRangeException(nameof(functionType), functionType, "Value is out of range."); } }
public void Unserialize(GMDataReader reader) { Name = reader.ReadStringPointerObject(); FunctionType = (FunctionTypeEnum)reader.ReadUInt32(); Iterations = (ushort)reader.ReadUInt32(); Points = new GMList <Point>(); Points.Unserialize(reader); }
public FunctionType(int numericInputsCount, int logicInputsCount, int numericOutputsCount, int logicOutputsCount, FunctionTypeEnum sig) { this.numericInputsCount = numericInputsCount; this.numericOutputsCount = numericOutputsCount; this.logicInputsCount = logicInputsCount; this.logicOutputsCount = logicOutputsCount; this.signature = sig; }
private static void InternalHandleMessage(string clientID, int?moduleID, FunctionTypeEnum functionType, bool isQuery, string text, IReadOnlyMap <string, int> modules, IpiSensorNetConfiguration moduleConfiguration, IReadOnlyMap <FunctionTypeEnum, int> functionTypes, int?serialProcessID, IHubProxy hubProxy, Action <string> logger) { HandleMessage(clientID, moduleID, functionType, isQuery, text, modules, moduleConfiguration, functionTypes, hubProxy, logger); if (serialProcessID.HasValue) { Signal.Send(serialProcessID.Value, SignalTypeEnum.User1); } }
/// <summary> /// Create a new instance of a Function object and set the values for Name, Text and FunctionType. /// </summary> /// <param name="name"></param> /// <param name="text"></param> /// <param name="functionType"></param> public Function(string name, string text, FunctionTypeEnum functionType) { // Set the value for Name this.Name = name; // Set the value for Text this.Text = text; // Set the value for FunctionType this.FunctionType = functionType; }
public TestWorkspace(String workspaceName, FunctionTypeEnum functionType) { this.workspaceName = workspaceName; this.functionType = functionType; if (SettingFilesManager.modelSettingsExists(SettingFilesManager.SettingsFolderPath)) { modelSettings = SettingFilesManager.LoadModelSettings(SettingFilesManager.SettingsFolderPath); } else { modelSettings = new ModelSettings(); } }
public void Construct( List<int> layers, FunctionTypeEnum function, bool bias, int iterations, double learning, double inertia, ProblemTypeEnum problem, double error = 0.001) { Layers = layers; FunctionType = function; Bias = bias; IterationsCount = iterations; LearingCoefficient = learning; InertiaCoefficient = inertia; ProblemType = problem; AcceptedError = error; }
public void Construct( List <int> layers, FunctionTypeEnum function, bool bias, int iterations, double learning, double inertia, ProblemTypeEnum problem, double error = 0.001) { Layers = layers; FunctionType = function; Bias = bias; IterationsCount = iterations; LearingCoefficient = learning; InertiaCoefficient = inertia; ProblemType = problem; AcceptedError = error; }
/// <summary> /// Initializes a new instance of the <see cref="FunctionBarrier" /> class. /// </summary> /// <param name="functionType">Choose from a number of different calculation functions. (required).</param> /// <param name="networkAttributeName">Choose to filter by any network attribute defined in the system. (required).</param> /// <param name="_operator">Choose from a number of different operators (required).</param> /// <param name="value">Specific value of the input attribute type that, if discovered, will cause the termination.(string (numeric) (required).</param> /// <param name="useLocalValues">Calculates values in each direction as opposed to an overall global value..</param> public FunctionBarrier(FunctionTypeEnum functionType = default(FunctionTypeEnum), string networkAttributeName = default(string), OperatorEnum _operator = default(OperatorEnum), string value = default(string), bool?useLocalValues = default(bool?)) { // to ensure "functionType" is required (not null) if (functionType == null) { throw new InvalidDataException("functionType is a required property for FunctionBarrier and cannot be null"); } else { this.FunctionType = functionType; } // to ensure "networkAttributeName" is required (not null) if (networkAttributeName == null) { throw new InvalidDataException("networkAttributeName is a required property for FunctionBarrier and cannot be null"); } else { this.NetworkAttributeName = networkAttributeName; } // to ensure "_operator" is required (not null) if (_operator == null) { throw new InvalidDataException("_operator is a required property for FunctionBarrier and cannot be null"); } else { this.Operator = _operator; } // to ensure "value" is required (not null) if (value == null) { throw new InvalidDataException("value is a required property for FunctionBarrier and cannot be null"); } else { this.Value = value; } this.UseLocalValues = useLocalValues; }
/// <summary> /// Initializes a new instance of the <see cref="FunctionsInner" /> class. /// </summary> /// <param name="functionType">functionType (required).</param> /// <param name="networkAttributeName">networkAttributeName (required).</param> /// <param name="networkAttributeConditions">networkAttributeConditions.</param> public FunctionsInner(FunctionTypeEnum functionType = default(FunctionTypeEnum), string networkAttributeName = default(string), List <Object> networkAttributeConditions = default(List <Object>)) { // to ensure "functionType" is required (not null) if (functionType == null) { throw new InvalidDataException("functionType is a required property for FunctionsInner and cannot be null"); } else { this.FunctionType = functionType; } // to ensure "networkAttributeName" is required (not null) if (networkAttributeName == null) { throw new InvalidDataException("networkAttributeName is a required property for FunctionsInner and cannot be null"); } else { this.NetworkAttributeName = networkAttributeName; } this.NetworkAttributeConditions = networkAttributeConditions; }
internal static void HandleMessage(string clientID, int?moduleID, FunctionTypeEnum functionType, bool isQuery, string text, IReadOnlyMap <string, int> moduleAddresses, IpiSensorNetConfiguration moduleConfiguration, IReadOnlyMap <FunctionTypeEnum, int> functionTypes, IHubProxy hubProxy, Action <string> logger) { logger($"HandleMessage: Received message from ${clientID} to @{moduleID?.ToString() ?? "ALL"} - {functionType}{(text == null ? (isQuery ? "?" : String.Empty) : ":" + text)}"); if (moduleID.HasValue && !moduleAddresses.Reverse.ContainsKey(moduleID.Value)) { hubProxy.Invoke("error", clientID, $"Module #{moduleID.Value} does not exist."); logger($"HandleMessage: ERROR: Message not handled, module #{moduleID.Value} does not exist!"); return; } int messageID; using (var context = PiSensorNetDbContext.Connect(moduleConfiguration.ConnectionString)) { var message = new Message(functionTypes.Forward[functionType], isQuery) { ModuleID = moduleID, }; if (!isQuery) { message.Text = text; } context.Messages.Add(message); context.SaveChanges(); messageID = message.ID; } logger($"HandleMessage: Message handled to #{messageID}!"); // ~38ms }
public FunctionValue(FunctionTypeEnum type) : base(BaseValue.ValueTypeEnum.Func) { _functionType = type; }
public Function(FunctionTypeEnum functionType, bool isQueryable) { Name = functionType.ToFunctionName(); FunctionType = functionType; IsQueryable = isQueryable; }
public TestWorkspace LoadTestWorkspace(string testWorkspaceName) { XmlReaderSettings xmlSettings = new XmlReaderSettings(); xmlSettings.ValidationType = ValidationType.None; XmlReader workspaceReader = XmlReader.Create( GetWorkspaceInfoFilePath(testWorkspaceName), xmlSettings); FunctionTypeEnum functionType = FunctionTypeEnum.Continuous_Controller; TestWorkspace testWorkspace = null; while (workspaceReader.Read()) { if (workspaceReader.NodeType == XmlNodeType.Element && workspaceReader.Name == "FunctionType") { workspaceReader.Read(); functionType = (FunctionTypeEnum)Enum.Parse(typeof(FunctionTypeEnum), workspaceReader.Value, true); switch (functionType) { case FunctionTypeEnum.Continuous_Controller: testWorkspace = new CCTestWorkspace(testWorkspaceName); break; case FunctionTypeEnum.State_Based_Controller: testWorkspace = new SLTestWorkspace(testWorkspaceName); break; case FunctionTypeEnum.Input_Output: testWorkspace = new IOTestWorkspace(testWorkspaceName); break; } workspaceReader.Read(); } if (workspaceReader.NodeType == XmlNodeType.Element && workspaceReader.Name == "SimulationTime") { workspaceReader.Read(); testWorkspace.SetSimulationTime(Int16.Parse(workspaceReader.Value)); workspaceReader.Read(); } if (workspaceReader.NodeType == XmlNodeType.Element && workspaceReader.Name == "ModelRunningTime") { workspaceReader.Read(); testWorkspace.SetModelRunningTime(Int16.Parse(workspaceReader.Value)); workspaceReader.Read(); } } workspaceReader.Close(); switch (testWorkspace.functionType) { case FunctionTypeEnum.Continuous_Controller: testWorkspace.modelSettings = SettingFilesManager.LoadModelSettings( GetWorkspacePath(testWorkspaceName)); LoadCCTestWorkspace((CCTestWorkspace)testWorkspace); break; case FunctionTypeEnum.State_Based_Controller: testWorkspace.modelSettings = SettingFilesManager.LoadModelSettings( GetWorkspacePath(testWorkspaceName)); LoadSBTestWorkspace((SLTestWorkspace)testWorkspace); break; case FunctionTypeEnum.Input_Output: break; } return(testWorkspace); }
private static void InternalHandleMessage(string clientID, int?moduleID, FunctionTypeEnum functionType, bool isQuery, string text, Action <string> logger) { var message = $"<= @{moduleID?.ToString() ?? "eizik"} {functionType}{(isQuery ? "?" : (text != null ? ":" + text : String.Empty))}"; logger(message); }