Jump to content

Recommended Posts

Posted

New to Seeq... trying different things to see what works and reached the point where I need to ask for help!

I have a temperature signal representing the temperature inside of a vessel. I'm wanting to modify this signal for a user determined time frame each day representing a potential temperature delta between a vessel and a level bridle. I was hoping to get help on the following items:

1) Is there a more efficient method of doing this? Wanting to have a code that can be easily updated for time frames & rate of increase.

2) I had to use .move(5h) to shift the signal to start at midnight. How do I get it to start at the beginning of each day every day?

3) For some reason during the 11pm hour (hour 23) there is a short blip with a magnitude equaling the total temperature increase over the user specified time and I can't figure out why. For Example, starting at 10am the new temperature will be 1.25F greater than the trended signal ($t). The temperature continues to increase 1.25F per hour until 6pm for a total increase of 10F over the 8-hour duration. The blip starting at 11pm represents a 10F increase over roughly 15 minutes and then a 10F decrease in roughly the same time period. 

Thanks in advance! 

Code is as follows:

$TimeToIncrease = 10 //hour of day temperature starts increasing
$TimeToStopIncrease = 18 //hour of day temperatu re stops increasing
$TimeToStopDecrease = 21 //hour of day temperature stops decreasing

$IncreaseMultiplier = 1.25°F //Rate of increase per hour
$DecreaseMultiplier = (($TimeToStopIncrease-$TimeToIncrease)*$IncreaseMultiplier/($TimeToStopDecrease-$TimeToStopIncrease)).SetUnits('F') //Calcualted rate of decrease per hour

$DayHours = (hours().toSignal('Hour',startkey()).within(days()).move(5h)) //Had to move 5 hours to start at midnight. Hours()=0 was 7pm without this. 

$Condition1 = ($DayHours >= $TimeToIncrease) And ($DayHours <=$TimeToStopIncrease)
$Condition2 = ($DayHours > $TimeToStopIncrease) And ($DayHours <=$TimeToStopDecrease)

$IncreaseTempSignal = $t+(($DayHours-$TimeToIncrease)*$IncreaseMultiplier).SetUnits('F')
$DecreaseTempSignal = $t+(($TimeToStopDecrease-$DayHours)*$DecreaseMultiplier).SetUnits('F')

$t
.splice($IncreaseTempSignal,$Condition1)
.splice($DecreaseTempSignal,$Condition2)

 

Temp Ambient Temp Variance Code.JPG

Temp Ambient Temp Variance Signal Trend.JPG

Posted

Hi Christopher,

regarding your points 2 and 3:

You can specify a timezone in the hours() and days() function. As Seeq uses the timezone of the server the start of the day might differ from the timezone you selected for displaying the data. You can see the difference here:
 image.thumb.png.6c2f9ac48da420293309375b23dfc8af.png

The spike at hour 23 is occuring because you created a signal that has the value of the hour at the beginning. Therefore it interpolates the values from 23 to 0 within that hour, so that the conditions you created apply and the calculated values are spliced into the original signal. A better approach would be using timesince(). This function calculates the amount of time that has passed since the beginning of the capsule:
image.thumb.png.15453eaf67cf741d0c9726157c2b958e.png

 

Changing your code in line 8 to 

$DayHours = timesince(days('<your timezone>'), 1h)

should resolve the spike and the need to shift the signal by 5 hours.

Regards,

Thorsten

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...