Unexpected Comparator Output Showing Invalid/Garbage Values in ScopeView

Hi Team,

I am trying to use a simple Comparator with Multilevel Detection block, configured as shown in the attached screenshot:

uL = 5.22
uH = 5.70
yL = 0
yM = 1
yH = 0

Based on this configuration, I expect the output to behave as a binary signal and remain limited to values 0 or 1.

However, when I monitor the comparator output (AR_Trigger.y) in ScopeView, I observe seemingly random/garbage values ranging approximately between -2.2E9 and +2.2E9, as shown in the attached ScopeView capture.

Since I am only using a comparator block with fixed output levels, I would expect a clean binary output instead of the observed behavior.

Could someone please help me understand:

1.Whether I am missing any configuration required for the comparator output?
2.If there are any signal type conversion requirements before sending the signal to ScopeView?



The configuration screenshot and ScopeView output are attached for reference.

As I need to discuss this data with internal review panel, I’m observing it in the recorded data.

hey @RAVITEJA,

Your values go up to around ±2.1E9, which is basically the max for a 32-bit integer (2,147,483,647). I don’t think a comparator set to 0/1/0 can actually output that, so maybe it’s not the block itself? it looks more like the recording is reading something weird.

Some things I’d try:

  • check if the u input on AR_Trigger is actually connected. in your screenshot the block is selected so i can’t really tell

  • look at AR_Trigger.y live in ScopeView instead of the recorded file, just to see if it’s the same

also your .ecf and sensor file both have a * in the title, so there are unsaved changes. if you added AR_Trigger.y to the recording after you last generated the code, you might need to save, regenerate and record again. i had to do that once and it fixed my weird values haha

What do you get when you check it live? Also, is the input going into u actually between 5.22 and 5.7? that way we’ll know if it’s the model or the recording

Hi @Jakub,

1.When I monitor the ARTrigger.u input, I see the expected ramp signal (since the input is based on time). However, the corresponding ARTrigger.y output appears to contain out-of-range values.
2.I verified the signal during live simulation, and it behaves correctly. However, as part of the validation process, I need to record and preserve the results for review purposes. Therefore, relying solely on live observations during meetings is not a practical option.
3.While debugging the issue, I captured the model snippet shown earlier. For the test runs, both the .ecf model and the corresponding .csv sensor file were saved.
4.I also investigated whether the issue could be due to the same signal being recorded multiple times, as I have observed similar out-of-range values in such cases before. After reviewing the sensor configuration, I confirmed that this is not the case.
5.As part of troubleshooting, I cleared the code generation directory and performed a fresh Analyze → Generate Code → Run sequence. Unfortunately, the issue still persists.

Is there anything else you would recommend checking or any additional diagnostics that could help identify the root cause?

hmmm if it looks fine live and only goes weird in the recording, i think that rules out the comparator logic. in your new screenshot u ramps from 0 to 10 like it should, but y is garbage for the whole 10 s, even before u reaches 5.22, when it should just be 0. so it’s not the block flipping wrong, it’s the recording.

Have you treid using OpRecInfo? It gives you the signal names and types, so you can see if AR_Trigger.y got saved as a different data type than the other signals. As a quick diagnostic test, put a Gain of 1 after AR_Trigger and record that output instead. If that one records properly, it’s probably something with how the comparator output gets logged.