Overview
Comment:Changed <= to < in switchopen.m
Removed switch.m generation - redundant
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 829afee0b85a190ef317053f04d580ab417858ee77a6ef60777535e1d8fd2eab
User & Date: gawthrop@users.sourceforge.net on 1999-04-20 00:55:40.000
Other Links: branch diff | manifest | tags
Context
1999-04-20
00:58:22
Set open-switch states to zero check-in: 2865e210b6 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
00:55:40
Changed <= to < in switchopen.m
Removed switch.m generation - redundant
check-in: 829afee0b8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-04-02
07:17:37
Upped version to 3.6 -- the new implicit solver with switches check-in: e8f09cce8a user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
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
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


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




## Revision 1.6  1998/10/01 18:20:50  peterg
## Split up the three if conditions on the switch and state value into
## three separate ifs. This is because p2c seems to generate incorrect
## code id just the one if is used (???).
##
## Revision 1.5  1998/10/01 16:05:34  peterg
## Separate switch.m file for euler and implicit integration
##
###############################################################


echo Creating  $1_switch.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("#== Switches set element of state vector to zero ==#\n")
  }

  else{
  printf("\n#== Switch: %s ==#\n",$1)
  printf("if (%s==0.0) \n", $1);
  printf("  mttx(%s)=0.0;\n", $2);
  printf("end;\n");
  printf("if (%s<0.0)\n",$1);
  printf("  if (mttx(%s)<=0.0)\n",$2);
  printf("    mttx(%s)=0.0;\n", $2);
  printf("  end;\n");
  printf("end;\n");

  }

}' Nx=$Nx < $1_switch.txt >> $1_switch.m

## Set index version
echo Creating  $1_switchopen.m

#Write some file headers
lang_header $1 switchopen m 'mttx' '[open]' > $1_switchopen.m

# Set states to zero
awk '{
  if ($1=="#"){
    printf("#== open - boolean vector of open switches ==#\n")
    printf("[open] = zero_vector(%i); # Default to not open\n", Nx);
    
  }
  else{
  printf("\n#== Switch: %s ==#\n",$1)
  printf("if (%s==0.0) \n", $1);
  printf("  open(%s) = 1;\n", $2);
  printf("end;\n");
  printf("if (%s<0.0)\n",$1);
  printf("  if (mttx(%s)<=0.0)\n",$2);
  printf("    open(%s) = 1;\n", $2);
  printf("  end;\n");
  printf("end;\n");

  }
}' Nx=$Nx < $1_switch.txt >> $1_switchopen.m








>
>
>
>











<






>

|
|
|
<
>
|
|
|
|
|
|
|
|
|
|

<
>
|




















|







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
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1999/04/02 06:30:37  peterg
## New _switchopen
## Removed switcha
##
## Revision 1.6  1998/10/01 18:20:50  peterg
## Split up the three if conditions on the switch and state value into
## three separate ifs. This is because p2c seems to generate incorrect
## code id just the one if is used (???).
##
## Revision 1.5  1998/10/01 16:05:34  peterg
## Separate switch.m file for euler and implicit integration
##
###############################################################



# 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

#echo Creating  $1_switch.m
# Set states to zero
# awk '{
#   if ($1=="#"){
#     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("  mttx(%s)=0.0;\n", $2);
#   printf("end;\n");
#   printf("if (%s<0.0)\n",$1);
#   printf("  if (mttx(%s)<=0.0)\n",$2);
#   printf("    mttx(%s)=0.0;\n", $2);
#   printf("  end;\n");
#   printf("end;\n");


#   }
# }' Nx=$Nx < $1_switch.txt >> $1_switch.m

## Set index version
echo Creating  $1_switchopen.m

#Write some file headers
lang_header $1 switchopen m 'mttx' '[open]' > $1_switchopen.m

# Set states to zero
awk '{
  if ($1=="#"){
    printf("#== open - boolean vector of open switches ==#\n")
    printf("[open] = zero_vector(%i); # Default to not open\n", Nx);
    
  }
  else{
  printf("\n#== Switch: %s ==#\n",$1)
  printf("if (%s==0.0) \n", $1);
  printf("  open(%s) = 1;\n", $2);
  printf("end;\n");
  printf("if (%s<0.0)\n",$1);
  printf("  if (mttx(%s)<0.0)\n",$2);
  printf("    open(%s) = 1;\n", $2);
  printf("  end;\n");
  printf("end;\n");

  }
}' Nx=$Nx < $1_switch.txt >> $1_switchopen.m

︙︙

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