Overview
Comment:Separate switch.m file for euler and implicit integration
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c3cb33a9b3cfa43f85991b7bc29c7bbc52ddbc8228f2a047a9e9a26bf111dd83
User & Date: gawthrop@users.sourceforge.net on 1998-10-01 16:05:34
Other Links: branch diff | manifest | tags
Context
1998-10-01
16:11:42
Implicit integration now handles switches check-in: c85f34cdf7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:05:34
Separate switch.m file for euler and implicit integration check-in: c3cb33a9b3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:02:01
Integration with switches handled separately fro Euler and Implicit. check-in: 7f5a5bd7d1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/switch_txt2m from [b75f922f5a] to [4e64889fa4].

1
2
3
4
5
6
7
8
9
10
11
12








13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: switch_txt2m

# Convert switch file from txt to m
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.










echo Creating  $1_switch.m
echo Creating  $1_switcha.m

# Find system constants
Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`

#Write some file headers
lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m

# Set states to zero
awk '{
  if ($1=="#"){
#    printf("for MTTi=1:%s\n", Nx)
#    printf("  mttxs(MTTi) = mttx(MTTi);\n")
#    printf("end;\n\n")
    printf("#== Switches set element of state vector to zero ==#\n")
  }
  else{
  printf("\n#== Switch: %s ==#\n",$1)

  printf("if ((%s==0.0)||((%s<0.0)&&mttx(%s)<=0.0)) \n", $1,$1,$2);
  printf("  mttx(%s)=0.0;\n", $2);
  printf("end;\n");
  }
}' Nx=$Nx < $1_switch.txt >> $1_switch.m

# Matrix version
#Write some file headers












>
>
>
>
>
>
>
>




















>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: switch_txt2m

# Convert switch file from txt to m
# P.J.Gawthrop May 1997
# Copyright (c) P.J.Gawthrop, 1997.


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################


echo Creating  $1_switch.m
echo Creating  $1_switcha.m

# Find system constants
Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'`

#Write some file headers
lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m

# Set states to zero
awk '{
  if ($1=="#"){
#    printf("for MTTi=1:%s\n", Nx)
#    printf("  mttxs(MTTi) = mttx(MTTi);\n")
#    printf("end;\n\n")
    printf("#== Switches set element of state vector to zero ==#\n")
  }
  else{
  printf("\n#== Switch: %s ==#\n",$1)
  printf("if (%s==0.0) \n", $1);
#  printf("if ((%s==0.0)||((%s<0.0)&&mttx(%s)<=0.0)) \n", $1,$1,$2);
  printf("  mttx(%s)=0.0;\n", $2);
  printf("end;\n");
  }
}' Nx=$Nx < $1_switch.txt >> $1_switch.m

# Matrix version
#Write some file headers


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]