Skip to content

Commit

Permalink
periodic update from internal development
Browse files Browse the repository at this point in the history
  • Loading branch information
greenwoodms06 committed Sep 10, 2019
1 parent 2336416 commit c53758a
Show file tree
Hide file tree
Showing 3,739 changed files with 38,373 additions and 16,151 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 0 additions & 4 deletions TRANSFORM/Blocks/DataTable.mo
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
within TRANSFORM.Blocks;
block DataTable
"Generate a Real table"

extends Modelica.Blocks.Icons.Block;

parameter Real table[:, :]=fill(
0,
0,
2) "Table matrix for Real parameters";

annotation (
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}}), graphics={ Text(
Expand Down Expand Up @@ -47,5 +44,4 @@ block DataTable
1.5, 5;
2, 6];</pre>
</html>"));

end DataTable;
4 changes: 0 additions & 4 deletions TRANSFORM/Blocks/DataTable_Inputs.mo
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
within TRANSFORM.Blocks;
block DataTable_Inputs
"Generate a Real table of potentially time dependent values"

extends Modelica.Blocks.Icons.Block;

input Real table[:, :]=fill(
0,
0,
2) "Table matrix for Real parameters" annotation(Dialog(group="Inputs"));

annotation (
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}}), graphics={ Text(
Expand Down Expand Up @@ -47,5 +44,4 @@ block DataTable_Inputs
1.5, 5;
2, 6];</pre>
</html>"));

end DataTable_Inputs;
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Examples/ExponentialDecay_Test.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within TRANSFORM.Blocks.Examples;
model ExponentialDecay_Test
extends TRANSFORM.Icons.Example;

ExponentialDecay exponentialDecay(
startTime=0.1,
offset=5,
Expand Down
2 changes: 0 additions & 2 deletions TRANSFORM/Blocks/Examples/IntegratorWithReset.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ model IntegratorWithReset "Test model for integrator with reset"
extends TRANSFORM.Icons.Example;
Modelica.Blocks.Sources.Constant cons(k=10) "Constant as source term"
annotation (Placement(transformation(extent={{-60,60},{-40,80}})));

TRANSFORM.Blocks.IntegratorWithReset intWitRes1(
y_start=5, reset=TRANSFORM.Types.Reset.Parameter,
k=0.5,
y_reset=2) "Integrator with reset"
annotation (Placement(transformation(extent={{-10,20},{10,40}})));

TRANSFORM.Blocks.IntegratorWithReset intWitRes2(
y_reset=10,
y_start=-5,
Expand Down
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Examples/MFBS_Test.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within TRANSFORM.Blocks.Examples;
model MFBS_Test
extends TRANSFORM.Icons.Example;

Noise.MFBS sequencer(
startTime=0.5,
offset=1,
Expand Down
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Examples/OffTimer.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within TRANSFORM.Blocks.Examples;
model OffTimer "Example model for off timer"
extends TRANSFORM.Icons.Example;

Modelica.Blocks.Sources.BooleanPulse booleanPulse(period=0.2)
annotation (Placement(transformation(extent={{-80,0},{-60,20}})));
TRANSFORM.Blocks.OffTimer offTim1
Expand Down
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Examples/PRBS_Test.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within TRANSFORM.Blocks.Examples;
model PRBS_Test
extends TRANSFORM.Icons.Example;

TRANSFORM.Blocks.Noise.PRBS sequencer(
freqHz=10,
offset=1,
Expand Down
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Examples/PRTS_Test.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within TRANSFORM.Blocks.Examples;
model PRTS_Test
extends TRANSFORM.Icons.Example;

Noise.PRTS sequencer(
freqHz=10,
startTime=0.5,
Expand Down
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Examples/package.mo
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
within TRANSFORM.Blocks;
package Examples
extends Icons.ExamplesPackage;

end Examples;
4 changes: 0 additions & 4 deletions TRANSFORM/Blocks/ExponentialDecay.mo
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
within TRANSFORM.Blocks;
model ExponentialDecay "Generate a exponential decay signal"

parameter SI.DecayConstant lambda=1 "Decay constant";
parameter Real offset=0 "Offset of output signal";
parameter Real frac = 0 "Fraction of offset for y(inf)";
parameter SI.Time startTime=0 "Output = offset for time < startTime";
extends Modelica.Blocks.Interfaces.SO;

equation

//y = offset*(if time < startTime then 1 else Modelica.Math.exp(-lambda*(time-startTime)));
//y = shift + (offset-shift)*(if time < startTime then 1 else Modelica.Math.exp(-lambda*(time-startTime)));
//y = frac*offset + (1-frac)*offset*(if time < startTime then 1 else Modelica.Math.exp(-lambda*(time-startTime)));
y = offset*(frac + (1-frac)*(if time < startTime then 1 else Modelica.Math.exp(-lambda*(time-startTime))));

annotation (
Icon(coordinateSystem(
preserveAspectRatio=true,
Expand Down
4 changes: 0 additions & 4 deletions TRANSFORM/Blocks/IntegerTable.mo
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
within TRANSFORM.Blocks;
block IntegerTable "Generate an Integer table"

extends Modelica.Blocks.Icons.IntegerBlock;

parameter Integer table[:, :]=fill(
0,
0,
2) "Table matrix for Integer parameters";

annotation (
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}}), graphics={ Text(
Expand Down Expand Up @@ -46,5 +43,4 @@ block IntegerTable "Generate an Integer table"
1, 5;
2, 6];</pre>
</html>"));

end IntegerTable;
14 changes: 0 additions & 14 deletions TRANSFORM/Blocks/IntegratorWithReset.mo
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
within TRANSFORM.Blocks;
block IntegratorWithReset "Output the integral of the input signal"
extends Modelica.Blocks.Interfaces.SISO(y(start=y_start));

parameter Real k(unit="1")=1 "Integrator gain";

/* InitialState is the default, because it was the default in Modelica 2.2
and therefore this setting is backward compatible
*/
parameter Modelica.Blocks.Types.Init initType=Modelica.Blocks.Types.Init.InitialState
"Type of initialization (1: no init, 2: steady state, 3,4: initial output)"
annotation(Evaluate=true,
Dialog(group="Initialization"));

parameter Real y_start=0 "Initial or guess value of output (= state)"
annotation (Dialog(group="Initialization"));

parameter TRANSFORM.Types.Reset reset = TRANSFORM.Types.Reset.Disabled
"Type of integrator reset";

parameter Real y_reset = 0
"Value to which integrator is reset, used if reset = TRANSFORM.Types.Reset.Parameter"
annotation(Evaluate=true,
Dialog(
enable=reset == TRANSFORM.Types.Reset.Parameter,
group="Integrator reset"));

Modelica.Blocks.Interfaces.RealInput y_reset_in if
reset == TRANSFORM.Types.Reset.Input
"Input signal for state to which integrator is reset, enabled if reset = TRANSFORM.Types.Reset.Input"
annotation (Placement(transformation(extent={{-140,-100},{-100,-60}})));

Modelica.Blocks.Interfaces.BooleanInput trigger if
reset <> TRANSFORM.Types.Reset.Disabled
"Resets the integrator output when trigger becomes true"
Expand All @@ -42,37 +35,30 @@ protected
Modelica.Blocks.Interfaces.RealInput y_reset_internal
"Internal connector for integrator reset"
annotation(Evaluate=true);

Modelica.Blocks.Interfaces.BooleanInput trigger_internal
"Needed to use conditional connector trigger";

initial equation
if initType == Modelica.Blocks.Types.Init.SteadyState then
der(y) = 0;
elseif initType == Modelica.Blocks.Types.Init.InitialState or
initType == Modelica.Blocks.Types.Init.InitialOutput then
y = y_start;
end if;

equation
der(y) = k*u;

// Equations for integrator reset
connect(trigger, trigger_internal);
connect(y_reset_in, y_reset_internal);

if reset <> TRANSFORM.Types.Reset.Input then
y_reset_internal = y_reset;
end if;

if reset == TRANSFORM.Types.Reset.Disabled then
trigger_internal = false;
else
when trigger_internal then
reinit(y, y_reset_internal);
end when;
end if;

annotation (
defaultComponentName="intWitRes",
Documentation(info="<html>
Expand Down
12 changes: 0 additions & 12 deletions TRANSFORM/Blocks/Noise/MFBS.mo
Original file line number Diff line number Diff line change
@@ -1,52 +1,40 @@
within TRANSFORM.Blocks.Noise;
model MFBS

parameter Real amplitude=1 "Amplitude of signal";
parameter SI.Time period "Period for repeating sequence";
parameter Real offset=0 "Offset of output signal";
parameter SI.Time startTime=0 "Output = offset for time < startTime";
extends Modelica.Blocks.Interfaces.SO;

parameter Real bias = 0 "Bias from nominal middle value of signal" annotation (Dialog(group="Sequence"));
parameter Integer use_SetWeight = 1 "Select predefined weight or set weights manually" annotation (Dialog(group="Sequence"),choices(choice=1 "x_a: for low frequency systems", choice=2 "x_b: most efficient/uniform amplitudes",choice=3 "x_c: for high frequency systems"));
parameter Real weights[:]=if use_SetWeight == 1 then {1,1,1,1,1,1,1} elseif use_SetWeight == 2 then {1,-1,1,-1,1,-1,1} elseif use_SetWeight == 3 then {0.5,1,1,1.2,1.8,1.8,2} else fill(0,1) "Sequence weighting" annotation (Dialog(group="Sequence"));
parameter Integer harmonics[size(weights, 1)]={1,2,4,8,16,32,64} "Sequence harmonics. size(harmonics) = size(weights)" annotation (Dialog(group="Sequence"));

final parameter SI.Time mls_t[:]= TRANSFORM.Math.max_len_seq__sine_time(weights, harmonics, bias);
final parameter Real mls0 = mls_t[end];

protected
Real dy;
Integer i(start=0);
Integer j(start=0);
SI.Time tseq(start=0);

initial equation
dy = amplitude*mls0;

algorithm
when sample(startTime, period) then
j :=j + 1;
i := 0;
end when;

when tseq/period >= mls_t[i+1] then
i := i + 1;
dy := amplitude*(mls0 + (if mod(i, 2) == 0 then 0 else bias-mls0));
end when;

equation

assert(sum(weights) > 0 and sum(harmonics) > 0, "Unsupported weights and/or harmonics sequences specified");

if time < startTime then
tseq = 0;
else
tseq = time - startTime - (j - 1)*period;
end if;

y = offset + (if time < startTime then 0 else dy);

annotation (
defaultComponentName="sequencer",
Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Expand Down
5 changes: 0 additions & 5 deletions TRANSFORM/Blocks/Noise/MFBS_old.mo
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
within TRANSFORM.Blocks.Noise;
model MFBS_old
extends TRANSFORM.Icons.ObsoleteModel;

parameter Real amplitude=1 "Amplitude of signal";
parameter SI.Time period "Period for repeating sequence";
parameter Real offset=0 "Offset of output signal";
parameter SI.Time startTime=0 "Output = offset for time < startTime";
extends Modelica.Blocks.Interfaces.SO;

parameter Integer weights[:]={1,1,1,1,1,1,1};
parameter Integer harmonics[size(weights, 1)]={1,2,4,8,16,32,64};
final parameter Real mls[integer(max(harmonics)^2)]=
TRANSFORM.Math.max_len_seq_sine(weights, harmonics);
protected
Real dy;
Real i(start=1);

algorithm
when sample(startTime, period/size(mls,1)) then
i := if i + 1 > integer(max(harmonics)^2) then 1 else i + 1;
dy := amplitude*mls[integer(i)];
end when;

equation
y = offset + (if time < startTime then 0 else dy);

annotation (defaultComponentName="sequencer",
Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Line(points={{-80,68},{-80,-80}}, color={192,192,192}),
Expand Down
9 changes: 0 additions & 9 deletions TRANSFORM/Blocks/Noise/PRBS.mo
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
within TRANSFORM.Blocks.Noise;
model PRBS

parameter Real amplitude=1 "Amplitude of signal";
parameter SI.Frequency freqHz(start=1) "Frequency of signal";
parameter Real offset=0 "Offset of output signal";
parameter SI.Time startTime=0 "Output = offset for time < startTime";
extends Modelica.Blocks.Interfaces.SO;

parameter Real bias = 0 "Bias from nominal middle value of signal" annotation (Dialog(group="Sequence"));
parameter Integer nBits = 3 "Sequence bit length"
annotation(Dialog(group="Sequence"),
Expand Down Expand Up @@ -44,26 +42,19 @@ model PRBS
elseif nBits == 14 then {1,1,1,0,0,0,0,0,0,0,0,0,1,0,1}
elseif nBits == 15 then {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1}
else fill(0,nBits+1) "Generator for sequence. size(generator) = nBits+1" annotation (Dialog(group="Sequence"));

final parameter Real mls[integer(2^nBits - 1)]=
TRANSFORM.Math.max_len_seq(seed,generator, bias);

protected
Real dy;
Real i(start=1);

algorithm
when sample(startTime, 1/freqHz) then
dy := amplitude*mls[integer(i)];
i := if i + 1 > integer(2^nBits - 1) then 1 else i + 1;
end when;

equation

assert(sum(generator) > 0, "Unsupported nBits and/or generator sequence specified");

y = offset + (if time < startTime then 0 else dy);

annotation (
defaultComponentName="sequencer",
Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Expand Down
8 changes: 0 additions & 8 deletions TRANSFORM/Blocks/Noise/PRTS.mo
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
within TRANSFORM.Blocks.Noise;
model PRTS

parameter Real amplitude=1 "Amplitude of signal";
parameter SI.Frequency freqHz(start=1) "Frequency of signal";
parameter Real offset=0 "Offset of output signal";
parameter SI.Time startTime=0 "Output = offset for time < startTime";
extends Modelica.Blocks.Interfaces.SO;

parameter Real bias = 0 "Bias from nominal middle value of signal" annotation (Dialog(group="Sequence"));
parameter Integer nBits = 3 "Sequence bit length"
annotation(Dialog(group="Sequence"),
Expand All @@ -28,25 +26,19 @@ model PRTS
elseif nBits == 7 then {2,1,1,1,1,1,2}
elseif nBits == 8 then {2,1,2,1,2,1,1,1}
else fill(0,nBits) "Generator for sequence. size(generator) = nBits" annotation (Dialog(group="Sequence"));

final parameter Real mls[integer(3^nBits - 1)]=
TRANSFORM.Math.max_len_seq_ternary(seed, generator, bias);
protected
Real dy;
Real i(start=1);

algorithm
when sample(startTime, 1/freqHz) then
dy := amplitude*mls[integer(i)];
i := if i + 1 > integer(3^nBits - 1) then 1 else i + 1;
end when;

equation

assert(sum(generator) > 0, "Unsupported nBits and/or generator sequence specified");

y = offset + (if time < startTime then 0 else dy);

annotation (defaultComponentName="sequencer",
Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Line(points={{-80,68},{-80,-80}}, color={192,192,192}),
Expand Down
1 change: 0 additions & 1 deletion TRANSFORM/Blocks/Noise/package.mo
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
within TRANSFORM.Blocks;
package Noise

end Noise;
2 changes: 0 additions & 2 deletions TRANSFORM/Blocks/OffTimer.mo
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
within TRANSFORM.Blocks;
model OffTimer "Records the time since the input changed to false"
extends Modelica.Blocks.Interfaces.partialBooleanBlockIcon;

Modelica.Blocks.Interfaces.BooleanInput u "Connector of Boolean input signal"
annotation (Placement(transformation(
extent={{-140,-20},{-100,20}})));
Modelica.Blocks.Interfaces.RealOutput y "Connector of Real output signal"
annotation (Placement(transformation(extent={{100,-10},{120,10}})));

protected
discrete Modelica.SIunits.Time entryTime "Time instant when u became true";
initial equation
Expand Down
Loading

0 comments on commit c53758a

Please sign in to comment.