Jump to content

Thorsten Vogt

Super Seeqer
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Thorsten Vogt

  1. Hello, you might want to check the following way: As you need to specify which is the first capsule you want to start with you need to define a bounding condition. In my example I use a monthly condition to do the calculation: Next I created a signal that puts the value 1 at the start of each capsule: $condition.removeLongerThan(40h).toSamples($c -> sample($c.startKey(), 1), 0s) This signal is used to build the running sum of these values: The calculated value can be used to extend the original condition with a property containing the capsule number during each month: $condition.removeLongerThan(1d).setProperty('Capsule Number', $count, startValue()) Then two new conditions can be created to include only capsules with odd and even capsule numbers: $conditionWithCount.keep($c -> ($c.property('Capsule Number')/2)-floor($c.property('Capsule Number')/2) > 0) $conditionWithCount.keep($c -> ($c.property('Capsule Number')/2)-floor($c.property('Capsule Number')/2) == 0) A composite condition can be used to join the odd and even ones: Hope this helps. Regards, Thorsten
  2. Hi Kevin, you can use the Formula tool to calculate the value. The function setUnits sets the unit of the resulting signal to m³. Regards, Thorsten
  3. Hi, you can do this by using splice(). The following example takes 10 as the default value and changes the part of the signal to 15 or 22 based on the value of the batch id. If the lot number you mentioned is a property of the capsule you imported you might need to convert it to a signal using toSignal() and the property name that is used to store the lot number: Or filter for capsules that contain the lot number using keep() on the condition: You can check your capsules for existing properties by having a look at the Capsules Pane. When clicking the "Add Column" icon you are able to choose the properties from the dropdownlist of available properties. The name of the property can be used in the functions mentioned above. Regards, Thorsten
  4. Hello Bill, if you do not have Data Lab than you can use the REST API of Seeq. I created an example using Powershell: $baseurl = "https://myseeqinstance" $headers = @{ "accept" = "application/vnd.seeq.v1+json" "Content-Type" = "application/vnd.seeq.v1+json" } $body = @{ "authProviderClass" = "Auth" "authProviderId" = "Seeq" "code" = $null "password" = "<password>" "state" = $null "username" = "<username>" } | ConvertTo-Json $url = $baseurl + "/api/auth/login" $response = Invoke-WebRequest -Method Post -Uri $url -Headers $headers -body $body $headers = @{ "accept" = "application/vnd.seeq.v1+json" "x-sq-auth" = $response.Headers.'x-sq-auth' } $url = $baseurl + "/api/users?sortOrder=email%20asc&offset=0&limit=200" $response = Invoke-RestMethod -Method Get -Uri $url -Headers $headers $selectedAttributes = $response.users | Select-Object -Property firstname, lastname, email $selectedAttributes | Export-Csv -Path "userlist.csv" -NoTypeInformation The script uses the /auth/login endpoint to authenticate the user and retrieves the list of users (limited to 200) using the /users endpoint. You would need to replace the value in the first line with the URL of your Seeq system (eg. https://mycompany.seeq.site) and specify the credentials by replacing <password> and <username> inside the script. The list of users will be written to the file userlist.csv inside the directory from which the powershell script is run. Let me know if this works for you. Regards, Thorsten
  5. Hi Brian, you can use the timesince() function for this: years('CET').timesince(1h, $uptime.inverse()) The example above creates a signal representing the running amount of hours for each year putting a sample every 1 hour. The last parameter specifies that periods where the uptime condition is not met are excluded from the calculation. In the follwowing screenshot you can see the signal is only increasing if a capsule for my uptime condition exists, otherwise the value does not change. Furthermore the value will be reset to 0 at January 1st every year: Does this answer your question? Regards, Thorsten
  6. Hi Dayyan, instead of months() you can use the periods() function: periods(6mo, 6mo, '2023-01-01', 'CET') The code above creates a capsules with a duration of 6 months every 6 months using the CET timezone. The timestamp specifies the origin that the capsules should be aligned to. Regards, Thorsten
  7. Hi Alex, maybe one workaround you could try is creating capsules for the discrete signal using $signal.tocapsules(). The capsules do not have duration, but will contain the value of the signal in a capsule property. Then export the Condition using OData and use the OData Capsule Summary Table Endpoint. I do not have Power BI, but when loading the data to Excel I can see the start of the capsule and the corresponding value. So this might be the information you can use. Regards, Thorsten
  8. Hello Bill, one way I can think of is using a little python script inside Seeq Data Lab: import seeq.sdk as sdk import pandas as pd user_api = sdk.UsersApi(spy.client) userlist = user_api.get_users() users = list() for user in userlist.users: users.append({"Username": user.username, "First Name": user.first_name, "Last Name": user.last_name, "Directory": user.datasource_name}) pd.DataFrame(users).to_excel("userlist.xlsx") You might need to run pip install openpyxl first and restart the kernel, if you get an error message that the package could not be found. The Excel file will appear in the rootfolder of your DataLab project and can be downloaded from there. I tested the script on R61, so I am not sure if you need to modify it a bit to get it working with R58. Regards, Thorsten
  9. Hi Jason, this might be due to uncertainty. You may have a look at this post: Regards, Thorsten
  10. Hi Swapnil, you can calculate the average for these periods using the runningAggregate function. I created the 12 hour periods with the following formula: periods(12h, 12h, '2023-01-01T08:00:00', 'CET') This condition is then used inside the aggregation of the signal: $signal.runningAggregate(average(), $periods) The result will be the average value of the signal that resets at the beginning of each capsule: I am not sure what you want to display in the table? Just the last value for the current period? Regards, Thorsten
  11. Hi Saha, from your example it seems you want to filter your signal for a specific value to create a condition. In general it is easier to do this using a Value Search. The syntax you want to use only works on conditions, but you are using it on a signal. Therefore you get the syntax error. Can you provide some more details on what you are trying to achieve? Regards, Thorsten
  12. When using condition() you need to specify a maximum capsule duration. 10d means 10 days. I could have shortened this to 1 day in my example, as the capsule only captures the 19th of August. Regards, Thorsten
  13. Hi Jason, you need to specify the date in an ISO 8601 format, then it should work. In the following example I am creating a condition with one capsule from Aug 19th to Aug 20th using UTC+2 timezone: condition(10d, capsule('2023-08-19T00:00:00+02:00', '2023-08-20T00:00:00+02:00')) Regards, Thorsten
  14. Hi Pat, I think "$condition" in the formula is the parameter you are searching for: In Data Lab you should be able to access it via the "Formula Parmeters" column of the data frame: Regards, Thorsten
  15. Hi Tyler, you can change this by clicking the Headers-Button that allows you to adjust the Date Format token: A reference of available tokens can be reached by clicking the ?-Icon, which redirects to https://momentjs.com/docs/#/displaying/. On that page you see the tokens with examples: Regards, Thorsten
  16. Hi Jacob. you can use the within() function to include only the portions of the signal while the condition appears and then use this signal in your calculations: Regards, Thorsten
  17. Hi Johannes, maybe one quick way you could try: First you can move the signal by a longer period than the 90 minutes to make sure the value of the signal is present at the timestamp of the whole hour. Here I used $signal.move(-100min) Next you can resample the moved signal: $movedSignal.resample(1h) Regards, Thorsten
  18. Hi Pat, that is interesting. When writing the posts above I had tested changing the UIConfig property back and forth with a Value Search and ran into problems: UIConfig is set to "value-search": After changing to "formula" Seeq displays the formula editor when editing the tool: When changing the property back to "value-search" the Value Search tool has no configuration: I just tested this with a daily periodic condition with specific days selected which gave the same results. A prediction that does not have the default values set behaves the same: After changing "UIConfig" to "formula" and back to "prediction" the regression method in the UI has changed to OLS instead of Ridge Regression. although in formula it still uses the regressionModelRidge() function: Executing the tool changes the formula to use regressionModelOLS(). My conclusion: I would not rely on converting a formula back to a tool as long as you do not know the exact parameters for the tool and therefore have the complete UIConfig string. Seeq seems not be able to extract these from the formula. Regards, Thorsten
  19. Hi Augustin, you can overwrite the UOM using the function setUnits(). However it expects a unit that is known to Seeq, so you might not be able to use "acfm". If it stands for "Actual cubic feet per minute" you might want to try "cf/min" instead. $t.setunits('cf/min') Does this work for you? Regards, Thorsten
  20. Hi Emre, one way to achieve this would be counting the conditions and multiply them with you constant. This signal is then added to the other signal: $signal.setMaxInterpolation(20d).runningdelta().runningSum(months('CET')) + $conditionA.aggregate(count(), $conditionA, startKey(), 0s).runningCount(months('CET')).toStep(30d) * 3 The second term of the formula will calculate the number of capsules during each capsule (which is 1) and put that as a discrete value to the start of the capsule. This value will be summed up during the month, transformed to a step signal and multiplied with the constant. The screenshot shows the previous calculation (red) together with the new calculation (blue). Condition A is represented by the green capsules. Regards, Thorsten
  21. Hi Emre, you could try to sum up the running deltas for each months: $signal.setMaxInterpolation(20d).runningdelta().runningSum(months('CET')) Regards, Thorsten
  22. Hi Johannes, there is no direct way to do this in workbench, but you can use the API to do this. I would suggest testing this first, before applying this to your condition. More information can be found in this post: Regards, Thorsten
  23. 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
  24. 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
  25. 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
  • Create New...