
Thorsten Vogt
Super Seeqer-
Posts
150 -
Joined
-
Last visited
-
Days Won
46
Thorsten Vogt last won the day on May 9
Thorsten Vogt had the most liked content!
Personal Information
-
Company
Werusys GmbH & Co. KG
-
Level of Seeq User
Seeq Advanced
Recent Profile Visitors
3,039 profile views
Thorsten Vogt's Achievements
-
Hello, Seeq does not have a direct way to format strings. However you can use a regular expression to prefix values less then 10 with a leading "0". Just change the last line in the formula to this: $capsule.setProperty('Hours', $hours.toString().replace("/^(\\d{1})$/", "0$1") + ":" + $minutes.floor().toString().replace("/^(\\d{1})$/", "0$1") + ":" + $seconds.toString().replace("/^(\\d{1})$/", "0$1")) The RegEx in the replace function will search for one digit numbers and replace them with the original value prefixed with a leading 0. If the number contains more then one digit it will keep the original value: Regards, Thorsten
-
Hello, you could do this by creating a transform and calculating the values inside it. In my example I am using the duration() method to get the duration of the capsule. You might need to change this to get the value from your property. $condition.removeLongerThan(1mo).transform($capsule -> { //Calculate total hours $totalHours = $capsule.duration().convertUnits('h').setUnits('') $hoursFraction = $totalHours - $totalHours.floor() $hours = ($totalHours - $hoursFraction).floor() //Calculate minutes $minutes = $hoursFraction * 60 $minutesFraction = $minutes - $minutes.floor() //Calculate seconds $seconds = ($minutesFraction * 60).round(0) //Set property by buildung a string $capsule.setProperty('Hours', $hours.toString() + ":" + $minutes.floor().toString() + ":" + $seconds.toString()) }) Regards, Thorsten
-
Hi Akos, if I understood the code correctly it returns "Signal_2" everytime "Signal_1" is below 30, otherwise "Signal_1" will be returned. In Seeq you could use $signal1.splice($signal2, $signal1 < 30) for that. You may also have a look at this post: Regards, Thorsten
-
Hi Margarida, you can use the following settings in the request body: { "unitOfMeasure": "string", "value": "{\"type\":\"formula\",\"advancedParametersCollapsed\":true,\"helpShown\":false}" } If you want to switch back to the UI tool you should save your previous value somewhere, so you could reuse this in the POST request. Regards, Thorsten
-
Hi Margarida, as a workaround you can use the REST API to convert an element to a formula. Each item has a property called "UIConfig" that stores the information which user interface should be used when editing the element. You can use the endpoint /items/{id}/properties/{propertyName} to update (POST) or remove (DELETE) it. However you should be careful using the API, as you may break things. Both removing and updating the property had the effect that Seeq is opening the formula editor instead of the UI tool. Regards, Thorsten
-
Hi Sophie, the function duration() can only be applied on capsules, not on conditions. You can calculate the duration for each capsule of the condition using the "Signal from Condition" tool. The resulting value can be used within a formula to multiply it by a scalar as you intended. When using the "Signal from condition" Tool you can always have a look at the formula the tool is creating in the background or duplicate it to a formula that you may use for further calculations. This is a good starting point for the more advanced use of the formula language. Regards, Thorsten
-
Hi Margarida, removing the statistic from the Scorecard Metric will show the raw value of the signal and setting thresholds will display the bounds as a shaded area. I am not quite sure if this works in Capsule View, so you may switch back to Calendar or Chaing View for that: Regards, Thorsten
-
Hi Margarida, you get two values because of the condition. The first value is calculated when the time signal is increasing and equals 47, the second value when the value decreases to 0 at the end, running through 47 again. The endKey() puts the value at the end of the condition you used for identification ($time == 47), which results in a single point in time. To get the value to the end of the condition you could try to use the following formula: $signal.aggregate(startValue(), ($time >= 47).removeLongerThan(1wk), endkey()) This will get a capsule starting at $time == 47 up to the end of the batch. StartValue() gets the value at the start of the capsule which is put at the end of the capsule using endKey(). Regards, Thorsten
-
If I understood you correctly you would have one value for the blue and one value for the orange signal foreach batch, right? If you have the values available inside the batch itself you could try to bring them to the batch start. In the following example I have two values at two different phases inside a batch: You can create a new signal that gets the average value for each of the signals and puts it on the batch start: Changing to XY Plot displays a value for the batch: Extending the timeframe shows values for the other batches as well: Regards, Thorsten
-
Hi MArgarida, the XY-Plot creates a point for every timestamp that exists on the signals. As your signals do not share the same timeframe nothing is displayed on the chart. It cannot calculate a value on the blue signal when values on the orange one exist and vice versa. Also I think it will be hard to get a correlation between one value (the blue signal) and multiple values (the orange signal). I would start by creating a calculation (e.g. average) for the orange signal and move that result and the value for the blue signal on one timestamp (e.g. the start of the batch). Regards, Thorsten
-
API Call with C# in order to retrieve signals
Thorsten Vogt replied to Acerion12's topic in General Seeq Discussions
I don't know your exact requirements, but I guess for quering hourly values for 30 signals once a day a for loop is a good start. You can try the Microsoft.Data.Analysis Package (https://www.nuget.org/packages/Microsoft.Data.Analysis/). It contains a DataFrame class, which is similar to a Pandas DataFrame. I modified the example from above making use of the DataFrame class and filtering on rows where the value is greater than 100: List<DateTime> keys = new List<DateTime>(); List<double> values = new List<double>(); do { samples = signalsApi.GetSamples(signalId, start, end, null, null, null, null, null, offset, numberOfItems); foreach (Seeq.Sdk.Model.SampleOutputV1 sample in samples.Samples) { keys.Add((DateTime)sample.Key); values.Add((double)sample.Value); } offset += numberOfItems; } while (!string.IsNullOrEmpty(samples.Next)); Microsoft.Data.Analysis.DataFrameColumn[] columns = { new Microsoft.Data.Analysis.PrimitiveDataFrameColumn<DateTime>("Key", keys), new Microsoft.Data.Analysis.PrimitiveDataFrameColumn<double>("Value", values) }; Microsoft.Data.Analysis.DataFrame df = new Microsoft.Data.Analysis.DataFrame(columns); df = df.Filter(df["Value"].ElementwiseGreaterThan(100)); foreach (Microsoft.Data.Analysis.DataFrameRow row in df.Rows) Console.WriteLine("{0} : {1}", row[0], row[1]); -
API Call with C# in order to retrieve signals
Thorsten Vogt replied to Acerion12's topic in General Seeq Discussions
Hi Acerion12, I am not quite sure what you mean with getting a signal limited by date range. So I created a quick-and-dirty example to get a signal by its ID and also retrieve its samples over a specific date range. The query will only return 40 samples for each call. Seeq.Sdk.Client.ApiClient client = new Seeq.Sdk.Client.ApiClient("https://<YOUR SERVER>/api"); Seeq.Sdk.Api.AuthApi authApi = new Seeq.Sdk.Api.AuthApi(client); authApi.Login(new Seeq.Sdk.Model.AuthInputV1 { Username = "<YOUR ACCESSKEY>", Password = "<YOUR PASSWORD FOR THE ACCESSKEY>" }); string signalId = "14E630B3-E615-4B84-9EE3-4B685D5A3938"; Seeq.Sdk.Api.SignalsApi signalsApi = new Seeq.Sdk.Api.SignalsApi(client); Seeq.Sdk.Model.SignalOutputV1 signal = signalsApi.GetSignal(signalId); Console.WriteLine("Signal: {0}", signal.Name); string start = DateTime.Now.AddDays(-3).ToUniversalTime().ToString("o"); string end = DateTime.Now.AddDays(-2).ToUniversalTime().ToString("o"); int offset = 0; int numberOfItems = 40; Seeq.Sdk.Model.GetSamplesOutputV1 samples; do { samples = signalsApi.GetSamples(signalId, start, end, null, null, null, null, null, offset, numberOfItems); foreach (Seeq.Sdk.Model.SampleOutputV1 sample in samples.Samples) Console.WriteLine("{0} : {1}", sample.Key, sample.Value); offset += numberOfItems; } while (!string.IsNullOrEmpty(samples.Next)); client.Logout(); Does this answer your question? Regards, Thorsten -
Creating Formulas in Seeq using Seeq Data Lab
Thorsten Vogt replied to Martin Pieronek's topic in Seeq Data Lab
Hi Martin, yes, this is possible with SDL. Here is an example: # Search for signals signals = spy.search({"Name":"cdt158*"}) Result: metadata = signals.copy() # Specify new Name by creating one based on the Original Name metadata["OriginalName"] = metadata["Name"] metadata["Name"] = "Derivative of " + metadata["Name"] # Attach column with Seeq Formula metadata["Formula"] = "$signal.derivative()" # Attach column with parameters for the Formula metadata["Formula Parameters"] = "$signal =" + metadata["ID"] # Remove ID Column, otherwise Seeq will try to update the original signal and not create a new one metadata = metadata.drop(columns=["ID", "OriginalName"]) The metadata DataFrame looks like this: # Push metadata to Seeq spy.push(metadata=metadata, worksheet="METADATA") When opening the link that spy.push generated, you can view the results within Workbench: Let me know it this works for you. Regards, Thorsten