1 | package TestConvertStateSelectAttribute3
|
---|
2 | model Test
|
---|
3 | TestConvertStateSelectAttribute3.ModelUp modelUp(stateSelectOne = StateSelect.always, stateSelectTwo = StateSelect.prefer) annotation(
|
---|
4 | Placement(visible = true, transformation(origin = {-18, -2}, extent = {{-36, -36}, {36, 36}}, rotation = 0)));
|
---|
5 | inner Modelica.Mechanics.MultiBody.World world(n = {0, 0, -1}) annotation(
|
---|
6 | Placement(transformation(extent = {{108, -34}, {88, -14}})));
|
---|
7 | Modelica.Mechanics.MultiBody.Parts.Body body(r_CM = {0, 0, 0}, m = 1, I_11 = 0.1, I_22 = 0.1, I_33 = 0.1) annotation(
|
---|
8 | Placement(transformation(extent = {{-66, -12}, {-86, 8}})));
|
---|
9 | equation
|
---|
10 | connect(world.frame_b, modelUp.frame_a) annotation(
|
---|
11 | Line(points = {{88, -24}, {30, -24}, {30, -23.6}, {18, -23.6}}, color = {95, 95, 95}, thickness = 0.5));
|
---|
12 | connect(modelUp.frame_b, body.frame_a) annotation(
|
---|
13 | Line(points = {{-54, -2}, {-66, -2}}, color = {95, 95, 95}, thickness = 0.5));
|
---|
14 | annotation(
|
---|
15 | Icon(coordinateSystem(initialScale = 0.1)),
|
---|
16 | experiment(StopTime = 60, Interval = 0.001, Tolerance = 1e-06),
|
---|
17 | __Dymola_experimentFlags(Advanced(EvaluateAlsoTop = false, GenerateVariableDependencies = true, OutputModelicaCode = false), Evaluate = true, OutputCPUtime = true, OutputFlatModelica = false));
|
---|
18 | end Test;
|
---|
19 |
|
---|
20 | model ModelUp
|
---|
21 | import SI = Modelica.SIunits;
|
---|
22 | Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a annotation(
|
---|
23 | Placement(visible = true, transformation(origin = {100, -60}, extent = {{-16, -16}, {16, 16}}, rotation = 0), iconTransformation(origin = {100, -60}, extent = {{-16, -16}, {16, 16}}, rotation = 0)));
|
---|
24 | Modelica.Mechanics.MultiBody.Interfaces.Frame_b frame_b annotation(
|
---|
25 | Placement(visible = true, transformation(origin = {-100, 1.77636e-15}, extent = {{-14, -14}, {14, 14}}, rotation = 0), iconTransformation(origin = {-100, 1.77636e-15}, extent = {{-14, -14}, {14, 14}}, rotation = 0)));
|
---|
26 | parameter StateSelect stateSelectOne = StateSelect.prefer annotation(
|
---|
27 | Evaluate = true,
|
---|
28 | Dialog(tab = "Advanced"));
|
---|
29 | parameter StateSelect stateSelectTwo = StateSelect.prefer annotation(
|
---|
30 | Evaluate = true,
|
---|
31 | Dialog(tab = "Advanced"));
|
---|
32 | parameter Boolean externalSteering = true;
|
---|
33 | // components
|
---|
34 | TestConvertStateSelectAttribute3.ModelDown modelDown(stateSelectU = {stateSelectOne, stateSelectTwo}) annotation(
|
---|
35 | Placement(transformation(extent = {{-20, -10}, {-40, 10}})));
|
---|
36 | equation
|
---|
37 | modelDown.u[2] = 0;
|
---|
38 | connect(frame_b, modelDown.frame_b) annotation(
|
---|
39 | Line(points = {{-100, 0}, {-40, 0}}, color = {95, 95, 95}, thickness = 0.5));
|
---|
40 | connect(modelDown.frame_a, frame_a) annotation(
|
---|
41 | Line(points = {{-20, 0}, {102, 0}, {102, -60}, {100, -60}}));
|
---|
42 | annotation(
|
---|
43 | Diagram(graphics = {Bitmap(extent = {{-10, 12}, {-10, 12}}), Bitmap(extent = {{18, 60}, {18, 60}})}, coordinateSystem(initialScale = 0.1)));
|
---|
44 | end ModelUp;
|
---|
45 |
|
---|
46 | model ModelDown
|
---|
47 | extends Modelica.Mechanics.MultiBody.Interfaces.PartialElementaryJoint;
|
---|
48 | parameter StateSelect stateSelectU[2] = fill(StateSelect.prefer, 2);
|
---|
49 | parameter StateSelect stateSelectLambda[2] = fill(StateSelect.avoid, 2);
|
---|
50 | Real u[2](stateSelect = stateSelectU, each fixed = false);
|
---|
51 | Real lambda[2](stateSelect = stateSelectLambda, each fixed = false);
|
---|
52 | annotation(
|
---|
53 | Icon(coordinateSystem(initialScale = 0.1)),
|
---|
54 | experiment(StartTime = 0, StopTime = 5, Tolerance = 1e-6, Interval = 0.01));
|
---|
55 | end ModelDown;
|
---|
56 | annotation(
|
---|
57 | uses(Modelica(version = "3.2.3")));
|
---|
58 |
|
---|
59 | end TestConvertStateSelectAttribute3;
|
---|