For Programmers: Free Programming Magazines  


Home > Archive > Matlab > June 2007 > Help with zero crossing problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help with zero crossing problem
Charles Alleman

2007-06-29, 7:14 pm

I need some help with an updated model that has several zero crossing
that are not being evaluated. I have an older model that worked
correctly, but it used an embedded function to perform some logic.
The updated model removed the embedded function and used 'if' and
'while' blocks to perform the logic. However, when running the
updated model, several zero crossing are not being evaluated. The
blocks being used are Detect Change and Hit Crossing blocks. One
Detect Change block works in the updated model but another one does
not. The following is a zero crossing listing with the old model and
with the updated model from both R2006b and R2007a.

Any help to get the zero crossings work would be appreciated.

Old Model with R2007a[color=darkred]
0 0:5:0 R,F RelationalOperator
'RouteProfileVer2_01/PowerMode/DelayTimer/Detect Change'
1 0:9:0 R,F RelationalOperator
'RouteProfileVer2_01/BrakeMode/DelayTimer/Detect Change'
2 0:42:0 R,F RelationalOperator
'RouteProfileVer2_01/PowerMode/PowerRateLimiter/Relational Operator'
3 0:48:0 R,F Switch
'RouteProfileVer2_01/BrakeMode/SpeedTaper/Switch1'
4 0:61:0 R,F RelationalOperator
'RouteProfileVer2_01/BrakeMode/BrakeRateLimiter/Relational Operator'
5 0:64:0 R,F MinMax 'RouteProfileVer2_01/BrakeMode/MinMax'
7 0:77:0 R,F RelationalOperator
'RouteProfileVer2_01/ModeSelector/Detect Change'
8 0:79:0 R,F RelationalOperator
'RouteProfileVer2_01/ModeSelector/Detect Change1'
9 0:80:0 R,F HitCross 'RouteProfileVer2_01/ModeSelector/Hit
Crossing'
10 0:80:1 R,F

Updated Model with R2006b[color=darkred]
0 0:6:0 R,F RelationalOperator
'RouteProfileVer2_02b/BrakeMode/DelayTimer/Detect Change'
1 0:21:0 R,F RelationalOperator
'RouteProfileVer2_02b/PowerMode/DelayTimer/Detect Change'
2 0:55:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
Check/StationBraking Status/If'
3 0:115:0 R,F RelationalOperator
'RouteProfileVer2_02b/PowerMode/PowerRateLimiter/Relational Operator'
4 0:120:0 R,F Switch
'RouteProfileVer2_02b/BrakeMode/SpeedTaper/Switch1'
5 0:134:0 R,F RelationalOperator
'RouteProfileVer2_02b/BrakeMode/BrakeRateLimiter/Relational Operator'
6 0:137:0 R,F MinMax 'RouteProfileVer2_02b/BrakeMode/MinMax'
7 0:176:0 R,F RelationalOperator
'RouteProfileVer2_02b/ModeSelector/Detect Change'
8 52:4:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
Check/StationBraking Status/If Action Subsystem1/If'
9 52:7:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
Check/StationBraking Status/If Action Subsystem1/If1'
10 41:2:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Speed Limit
Check/DistanceToSpeedLimit Determination/If Action Subsystem1/If'

Updated Model with R2007a[color=darkred]
0 0:6:0 R,F RelationalOperator
'RouteProfileVer2_02b/BrakeMode/DelayTimer/Detect Change'
1 0:21:0 R,F RelationalOperator
'RouteProfileVer2_02b/PowerMode/DelayTimer/Detect Change'
2 0:55:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
Check/StationBraking Status/If'
3 0:115:0 R,F RelationalOperator
'RouteProfileVer2_02b/PowerMode/PowerRateLimiter/Relational Operator'
4 0:120:0 R,F Switch
'RouteProfileVer2_02b/BrakeMode/SpeedTaper/Switch1'
5 0:134:0 R,F RelationalOperator
'RouteProfileVer2_02b/BrakeMode/BrakeRateLimiter/Relational Operator'
6 0:137:0 R,F MinMax 'RouteProfileVer2_02b/BrakeMode/MinMax'
8 0:176:0 R,F RelationalOperator
'RouteProfileVer2_02b/ModeSelector/Detect Change'
11 52:4:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
Check/StationBraking Status/If Action Subsystem1/If'
12 52:7:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
Check/StationBraking Status/If Action Subsystem1/If1'
13 41:2:0 R,F If
'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Speed Limit C
NZTideMan

2007-06-29, 7:14 pm

On Jun 30, 5:31 am, "Charles Alleman" <calle...@wabtec.com> wrote:
> I need some help with an updated model that has several zero crossing
> that are not being evaluated. I have an older model that worked
> correctly, but it used an embedded function to perform some logic.
> The updated model removed the embedded function and used 'if' and
> 'while' blocks to perform the logic. However, when running the
> updated model, several zero crossing are not being evaluated. The
> blocks being used are Detect Change and Hit Crossing blocks. One
> Detect Change block works in the updated model but another one does
> not. The following is a zero crossing listing with the old model and
> with the updated model from both R2006b and R2007a.
>
> Any help to get the zero crossings work would be appreciated.
>
> Old Model with R2007a>> zclist
>
> 0 0:5:0 R,F RelationalOperator
> 'RouteProfileVer2_01/PowerMode/DelayTimer/Detect Change'
> 1 0:9:0 R,F RelationalOperator
> 'RouteProfileVer2_01/BrakeMode/DelayTimer/Detect Change'
> 2 0:42:0 R,F RelationalOperator
> 'RouteProfileVer2_01/PowerMode/PowerRateLimiter/Relational Operator'
> 3 0:48:0 R,F Switch
> 'RouteProfileVer2_01/BrakeMode/SpeedTaper/Switch1'
> 4 0:61:0 R,F RelationalOperator
> 'RouteProfileVer2_01/BrakeMode/BrakeRateLimiter/Relational Operator'
> 5 0:64:0 R,F MinMax 'RouteProfileVer2_01/BrakeMode/MinMax'
> 7 0:77:0 R,F RelationalOperator
> 'RouteProfileVer2_01/ModeSelector/Detect Change'
> 8 0:79:0 R,F RelationalOperator
> 'RouteProfileVer2_01/ModeSelector/Detect Change1'
> 9 0:80:0 R,F HitCross 'RouteProfileVer2_01/ModeSelector/Hit
> Crossing'
> 10 0:80:1 R,F
>
> Updated Model with R2006b>> zclist
>
> 0 0:6:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/BrakeMode/DelayTimer/Detect Change'
> 1 0:21:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/PowerMode/DelayTimer/Detect Change'
> 2 0:55:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
> Check/StationBraking Status/If'
> 3 0:115:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/PowerMode/PowerRateLimiter/Relational Operator'
> 4 0:120:0 R,F Switch
> 'RouteProfileVer2_02b/BrakeMode/SpeedTaper/Switch1'
> 5 0:134:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/BrakeMode/BrakeRateLimiter/Relational Operator'
> 6 0:137:0 R,F MinMax 'RouteProfileVer2_02b/BrakeMode/MinMax'
> 7 0:176:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/ModeSelector/Detect Change'
> 8 52:4:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
> Check/StationBraking Status/If Action Subsystem1/If'
> 9 52:7:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
> Check/StationBraking Status/If Action Subsystem1/If1'
> 10 41:2:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Speed Limit
> Check/DistanceToSpeedLimit Determination/If Action Subsystem1/If'
>
> Updated Model with R2007a>> zclist
>
> 0 0:6:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/BrakeMode/DelayTimer/Detect Change'
> 1 0:21:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/PowerMode/DelayTimer/Detect Change'
> 2 0:55:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
> Check/StationBraking Status/If'
> 3 0:115:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/PowerMode/PowerRateLimiter/Relational Operator'
> 4 0:120:0 R,F Switch
> 'RouteProfileVer2_02b/BrakeMode/SpeedTaper/Switch1'
> 5 0:134:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/BrakeMode/BrakeRateLimiter/Relational Operator'
> 6 0:137:0 R,F MinMax 'RouteProfileVer2_02b/BrakeMode/MinMax'
> 8 0:176:0 R,F RelationalOperator
> 'RouteProfileVer2_02b/ModeSelector/Detect Change'
> 11 52:4:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
> Check/StationBraking Status/If Action Subsystem1/If'
> 12 52:7:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Station
> Check/StationBraking Status/If Action Subsystem1/If1'
> 13 41:2:0 R,F If
> 'RouteProfileVer2_02b/ModeSelector/ModeDetermination/Speed Limit C


I can't follow what you are talking about.
Detecting zero crossings is a one-liner:
indx=find(y(1:end-1).*y(2:end) < 0);
It's what you do after finding them that gets complicated.......

Charles Alleman

2007-06-29, 7:14 pm

NZTideMan wrote:
>
>
> On Jun 30, 5:31 am, "Charles Alleman" <calle...@wabtec.com>

wrote:
> crossing
> logic.
and[color=darkred]
The[color=darkred]
One[color=darkred]
> does
model[color=darkred]
> and
> Operator'
> Operator'
> Operator'
> Operator'
Limit[color=darkred]
Subsystem1/If'[color=darkred]
> Operator'
> Operator'
Limit[color=darkred]
> C
>
> I can't follow what you are talking about.
> Detecting zero crossings is a one-liner:
> indx=find(y(1:end-1).*y(2:end) < 0);
> It's what you do after finding them that gets complicated.......
>
>


The problem seems to be with Simulink. The output of some logic
determinations is fed to a Relation Operator to compare it to the
previous steps value using a Memory block. The output of the Relation
Operator block is terminated, but the enable zero crossing is
selected. When the Relation Operator changes state the time step dot
not change to find the exact time of the change as the other zero
crossings detections do.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com