From b572c6f1dcb2449c3241649fa21f7cc648063b66 Mon Sep 17 00:00:00 2001 From: Karthik Saravanan Date: Mon, 20 May 2024 05:51:23 +0000 Subject: [PATCH 1/5] Testing --- Test/DoublePendulumInitTip.mo | 92 +++++++++++++++++++++++++++++++++++ Test/package.order | 3 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 Test/DoublePendulumInitTip.mo diff --git a/Test/DoublePendulumInitTip.mo b/Test/DoublePendulumInitTip.mo new file mode 100644 index 0000000..b91eeff --- /dev/null +++ b/Test/DoublePendulumInitTip.mo @@ -0,0 +1,92 @@ +within Test; + +model DoublePendulumInitTip + "Demonstrate how to initialize a double pendulum so that its tip starts at a predefined position" + extends .Modelica.Icons.Example; + inner .Modelica.Mechanics.MultiBody.World world annotation (Placement( + transformation(extent={{-100,-10},{-80,10}}))); + .Modelica.Mechanics.MultiBody.Joints.Revolute revolute1(useAxisFlange=true) + annotation (Placement(transformation(extent={{-60,-10},{-40,10}}))); + .Modelica.Mechanics.Rotational.Components.Damper damper(d=0.1) + annotation (Placement(transformation(extent={{-60,30},{-40,50}}))); + .Modelica.Mechanics.MultiBody.Parts.BodyBox boxBody1(r={0.5,0,0}, width=0.06) + annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); + .Modelica.Mechanics.MultiBody.Joints.Revolute revolute2(phi(start=.Modelica.Constants.pi/2)) + annotation (Placement(transformation(extent={{20,-10},{40,10}}))); + .Modelica.Mechanics.MultiBody.Parts.BodyBox boxBody2(r={0.5,0,0}, width=0.06) + annotation (Placement(transformation(extent={{60,-10},{80,10}}))); + .Modelica.Mechanics.MultiBody.Joints.FreeMotionScalarInit freeMotionScalarInit( + use_r=true, + r_rel_a_1(start=0.7, fixed=true), + r_rel_a_2(start=0.3, fixed=true), + use_v=true, + v_rel_a_1(fixed=true), + v_rel_a_2(fixed=true)) + annotation (Placement(transformation(extent={{-20,-50},{0,-30}}))); +equation + connect(damper.flange_b,revolute1. axis) annotation (Line(points={{-40,40},{-40,20},{-50,20},{-50,10}})); + connect(revolute1.support,damper. flange_a) annotation (Line(points={{-56,10},{-56,20},{-60,20},{-60,40}})); + connect(revolute1.frame_b,boxBody1. frame_a) + annotation (Line( + points={{-40,0},{-20,0}}, + color={95,95,95}, + thickness=0.5)); + connect(revolute2.frame_b,boxBody2. frame_a) + annotation (Line( + points={{40,0},{60,0}}, + color={95,95,95}, + thickness=0.5)); + connect(boxBody1.frame_b,revolute2. frame_a) + annotation (Line( + points={{0,0},{20,0}}, + color={95,95,95}, + thickness=0.5)); + connect(world.frame_b,revolute1. frame_a) + annotation (Line( + points={{-80,0},{-60,0}}, + color={95,95,95}, + thickness=0.5)); + connect(world.frame_b, freeMotionScalarInit.frame_a) annotation (Line( + points={{-80,0},{-70,0},{-70,-40},{-20,-40}}, + color={95,95,95}, + thickness=0.5)); + connect(freeMotionScalarInit.frame_b, boxBody2.frame_b) annotation (Line( + points={{0,-40},{90,-40},{90,0},{80,0}}, + color={95,95,95}, + thickness=0.5)); + annotation ( + experiment(StopTime=5), + Documentation(info=" +

+This example demonstrates at hand of a double pendulum, +how non-standard initialization can be defined: +The absolute position of the pendulum tip, and its absolute speed +shall be initially defined. This can be performed with the +Joints.FreeMotionScalarInit +joint that allows to initialize individual elements of its relative vectors. +In this case, the x-, and y-coordinates of the relative position vector +(visualized by the yellow arrow in the figure below) and of its +derivative shall have a defined value at initial time. +The configuration of the double pendulum at the initial time is +shown below, where the tip position is required to have the coordinates +x=0.7, y=0.3. +

+

+Setting only the tip's start position results in an ambiguous initialization since +two valid solutions for revolute1.phi and revolute2.phi exist. +Moreover, the calculated angles revolute1.phi and revolute2.phi +can be a multiple of expected solution phi1 and phi2, +

+ +

+To clearly indicate the preferred solution, guess initial angles can be additionally given. +In this example, it is simply done by revolute2.phi.start = Modelica.Constants.pi/2. +

+
+ +
+")); +end DoublePendulumInitTip; diff --git a/Test/package.order b/Test/package.order index acd275c..768d879 100644 --- a/Test/package.order +++ b/Test/package.order @@ -1 +1,2 @@ -DoublePendulum \ No newline at end of file +DoublePendulum +DoublePendulumInitTip \ No newline at end of file From f3f053f80d9d1977d050014ab2f64946bc27279f Mon Sep 17 00:00:00 2001 From: Karthik Saravanan Date: Fri, 24 May 2024 04:41:00 +0000 Subject: [PATCH 2/5] ignore --- .impact/project.json | 17 ++++++ .../Rotational/Examples/First/Metadata.json | 3 ++ .../Examples/First/experiment_1.json | 53 +++++++++++++++++++ .../Test/Unnamed/Metadata.json | 3 ++ .../Test/Unnamed/experiment_1.json | 53 +++++++++++++++++++ Test/Unnamed.mo | 10 ++++ ...{DoublePendulum.mo => Version1_20thmay.mo} | 4 +- Test/package.order | 5 +- 8 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json create mode 100644 Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json create mode 100644 Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json create mode 100644 Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json create mode 100644 Test/Unnamed.mo rename Test/{DoublePendulum.mo => Version1_20thmay.mo} (98%) diff --git a/.impact/project.json b/.impact/project.json index 3d65b88..3445f6d 100644 --- a/.impact/project.json +++ b/.impact/project.json @@ -1,7 +1,24 @@ { "name": "Gitdemo", "format": "1.0.0", + "version": "1.0.0", "dependencies": [ + { + "name": "Electrification", + "versionSpecifier": "1.10.0+build.22" + }, + { + "name": "FuelCell", + "versionSpecifier": "1.17.0+build.31" + }, + { + "name": "Modelon", + "versionSpecifier": "4.3.0+build.20" + }, + { + "name": "VehicleDynamics", + "versionSpecifier": "4.3.0+build.66" + }, { "name": "Modelica", "versionSpecifier": "4.0.0" diff --git a/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json b/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json new file mode 100644 index 0000000..615498d --- /dev/null +++ b/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json @@ -0,0 +1,3 @@ +{ + "defaultExperimentId" : "6ae65714-d53f-436d-9a2d-9955b5cf755e" +} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json b/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json new file mode 100644 index 0000000..cc87a3b --- /dev/null +++ b/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json @@ -0,0 +1,53 @@ +{ + "version" : "2", + "id" : "6ae65714-d53f-436d-9a2d-9955b5cf755e", + "experiment" : { + "base" : { + "analysis" : { + "variableFilters" : [ ], + "selectedType" : "dynamic", + "choices" : [ { + "type" : "dynamic", + "parameters" : { + "final_time" : 1, + "interval" : 0.001, + "start_time" : 0 + }, + "simulationOptions" : { + "dynamic_diagnostics" : false, + "ncp" : 500 + }, + "solverOptions" : { + "store_event_points" : true + }, + "compilerOptions" : { + "c_compiler" : "gcc", + "generate_html_diagnostics" : false, + "include_protected_variables" : false + }, + "runtimeOptions" : { } + } ], + "expansion" : { + "discreteAlgorithm" : { + "noOfSamples" : 0, + "seed" : 0 + }, + "continuousAlgorithm" : { + "type" : "SOBOL", + "noOfSamples" : 10, + "seed" : 0 + } + } + }, + "modifiers" : { + "initializeFrom" : "", + "variables" : [ ] + } + } + }, + "metadata" : { + "created" : "2024-05-23 11:20:48.208905085", + "lastModified" : "2024-05-23 11:20:48.208905085", + "name" : "Experiment 1" + } +} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json b/Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json new file mode 100644 index 0000000..50b8e14 --- /dev/null +++ b/Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json @@ -0,0 +1,3 @@ +{ + "defaultExperimentId" : "525e3d1b-96d8-4138-a815-e562f294b816" +} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json b/Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json new file mode 100644 index 0000000..f9d6af7 --- /dev/null +++ b/Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json @@ -0,0 +1,53 @@ +{ + "version" : "2", + "id" : "525e3d1b-96d8-4138-a815-e562f294b816", + "experiment" : { + "base" : { + "analysis" : { + "variableFilters" : [ ], + "selectedType" : "dynamic", + "choices" : [ { + "type" : "dynamic", + "parameters" : { + "final_time" : 10, + "interval" : 0.002, + "start_time" : 0 + }, + "simulationOptions" : { + "dynamic_diagnostics" : false, + "ncp" : 500 + }, + "solverOptions" : { + "store_event_points" : true + }, + "compilerOptions" : { + "c_compiler" : "gcc", + "generate_html_diagnostics" : false, + "include_protected_variables" : false + }, + "runtimeOptions" : { } + } ], + "expansion" : { + "discreteAlgorithm" : { + "noOfSamples" : 0, + "seed" : 0 + }, + "continuousAlgorithm" : { + "type" : "SOBOL", + "noOfSamples" : 10, + "seed" : 0 + } + } + }, + "modifiers" : { + "initializeFrom" : "", + "variables" : [ ] + } + } + }, + "metadata" : { + "created" : "2024-05-23 11:41:02.145870166", + "lastModified" : "2024-05-23T11:41:19.413712736Z", + "name" : "Experiment 1" + } +} \ No newline at end of file diff --git a/Test/Unnamed.mo b/Test/Unnamed.mo new file mode 100644 index 0000000..75150f5 --- /dev/null +++ b/Test/Unnamed.mo @@ -0,0 +1,10 @@ +within Test; +model Unnamed + .Modelica.Mechanics.Translational.Components.SpringDamper springDamper(c = 10,d = 5,s_rel0 = 0.1) annotation(Placement(transformation(extent = {{-10.0,-10.0},{10.0,10.0}},origin = {0.0,0.0},rotation = -90.0))); + .Modelica.Mechanics.Translational.Components.Fixed fixed annotation(Placement(transformation(extent = {{-10.0,-10.0},{10.0,10.0}},origin = {-0.2222222222222321,37.77777777777778},rotation = -180.0))); + .Modelica.Mechanics.Translational.Components.Mass mass(m = 5) annotation(Placement(transformation(extent = {{-10.0,-10.0},{10.0,10.0}},origin = {-0.22222222222221077,-56.22222222222223},rotation = -90.0))); +equation + connect(fixed.flange,springDamper.flange_a) annotation(Line(points = {{-0.2222222222222321,37.77777777777803},{-0.2222222222222321,10},{-2.220446049250313e-15,10}},color = {0,127,0})); + connect(springDamper.flange_b,mass.flange_a) annotation(Line(points = {{2.220446049250313e-15,-10},{-0.22222222222221344,-10},{-0.22222222222221344,-46.22222222222213}},color = {0,127,0})); + annotation(Icon(coordinateSystem(preserveAspectRatio = false,extent = {{-100.0,-100.0},{100.0,100.0}}),graphics = {Rectangle(lineColor={0,0,0},fillColor={230,230,230},fillPattern=FillPattern.Solid,extent={{-100.0,-100.0},{100.0,100.0}}),Text(lineColor={0,0,255},extent={{-150,150},{150,110}},textString="%name")})); +end Unnamed; diff --git a/Test/DoublePendulum.mo b/Test/Version1_20thmay.mo similarity index 98% rename from Test/DoublePendulum.mo rename to Test/Version1_20thmay.mo index 81504af..ed105ec 100644 --- a/Test/DoublePendulum.mo +++ b/Test/Version1_20thmay.mo @@ -1,6 +1,6 @@ within Test; -model DoublePendulum +model Version1_20thmay "Simple double pendulum with two revolute joints and two bodies" extends .Modelica.Icons.Example; @@ -58,4 +58,4 @@ object to false to switch off animation of all components. alt=\"model Examples.Elementary.DoublePendulum\"> ")); -end DoublePendulum; +end Version1_20thmay; diff --git a/Test/package.order b/Test/package.order index 768d879..9624dd4 100644 --- a/Test/package.order +++ b/Test/package.order @@ -1,2 +1,3 @@ -DoublePendulum -DoublePendulumInitTip \ No newline at end of file +Version1_20thmay +DoublePendulumInitTip +Unnamed \ No newline at end of file From 57d5f978e399173853066d4390ec9c243b423d44 Mon Sep 17 00:00:00 2001 From: Karthik Saravanan Date: Fri, 24 May 2024 04:54:42 +0000 Subject: [PATCH 3/5] IgnoreIt --- Test/{DoublePendulumInitTip.mo => DoublePendulumInitTip1.mo} | 4 ++-- Test/package.order | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename Test/{DoublePendulumInitTip.mo => DoublePendulumInitTip1.mo} (98%) diff --git a/Test/DoublePendulumInitTip.mo b/Test/DoublePendulumInitTip1.mo similarity index 98% rename from Test/DoublePendulumInitTip.mo rename to Test/DoublePendulumInitTip1.mo index b91eeff..acdbbc5 100644 --- a/Test/DoublePendulumInitTip.mo +++ b/Test/DoublePendulumInitTip1.mo @@ -1,6 +1,6 @@ within Test; -model DoublePendulumInitTip +model DoublePendulumInitTip1 "Demonstrate how to initialize a double pendulum so that its tip starts at a predefined position" extends .Modelica.Icons.Example; inner .Modelica.Mechanics.MultiBody.World world annotation (Placement( @@ -89,4 +89,4 @@ In this example, it is simply done by revolute2.phi.start = Mode ")); -end DoublePendulumInitTip; +end DoublePendulumInitTip1; diff --git a/Test/package.order b/Test/package.order index 9624dd4..7af5194 100644 --- a/Test/package.order +++ b/Test/package.order @@ -1,3 +1,3 @@ Version1_20thmay -DoublePendulumInitTip +DoublePendulumInitTip1 Unnamed \ No newline at end of file From ab523289da66943d2330dd8ede9e5ebbe35e1d20 Mon Sep 17 00:00:00 2001 From: Karthik Saravanan Date: Thu, 4 Jul 2024 13:51:59 +0530 Subject: [PATCH 4/5] Delete all --- .gitignore | 1 - .impact/project.json | 73 --------------- .../Rotational/Examples/First/Metadata.json | 3 - .../Examples/First/experiment_1.json | 53 ----------- .../Test/Unnamed/Metadata.json | 3 - .../Test/Unnamed/experiment_1.json | 53 ----------- Test/DoublePendulumInitTip1.mo | 92 ------------------- Test/Unnamed.mo | 10 -- Test/Version1_20thmay.mo | 61 ------------ Test/package.mo | 3 - Test/package.order | 3 - 11 files changed, 355 deletions(-) delete mode 100644 .gitignore delete mode 100644 .impact/project.json delete mode 100644 Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json delete mode 100644 Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json delete mode 100644 Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json delete mode 100644 Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json delete mode 100644 Test/DoublePendulumInitTip1.mo delete mode 100644 Test/Unnamed.mo delete mode 100644 Test/Version1_20thmay.mo delete mode 100644 Test/package.mo delete mode 100644 Test/package.order diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d62d5e0..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -**/*.ipynb_checkpoints/ diff --git a/.impact/project.json b/.impact/project.json deleted file mode 100644 index 3445f6d..0000000 --- a/.impact/project.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "Gitdemo", - "format": "1.0.0", - "version": "1.0.0", - "dependencies": [ - { - "name": "Electrification", - "versionSpecifier": "1.10.0+build.22" - }, - { - "name": "FuelCell", - "versionSpecifier": "1.17.0+build.31" - }, - { - "name": "Modelon", - "versionSpecifier": "4.3.0+build.20" - }, - { - "name": "VehicleDynamics", - "versionSpecifier": "4.3.0+build.66" - }, - { - "name": "Modelica", - "versionSpecifier": "4.0.0" - } - ], - "content": [ - { - "relpath": "Resources/Views", - "contentType": "VIEWS", - "defaultDisabled": false, - "id": "d049e25f59784e9dbdb3c20787f96d28" - }, - { - "relpath": "Resources/Favorites", - "contentType": "FAVORITES", - "defaultDisabled": false, - "id": "aec8e400200c449d8b85a62a04bfd30e" - }, - { - "relpath": "Resources/CustomFunctions", - "contentType": "CUSTOM_FUNCTIONS", - "defaultDisabled": false, - "id": "406f14bcf0914ae5a7f298d7ca23dc94" - }, - { - "relpath": "Resources/Custom", - "contentType": "GENERIC", - "defaultDisabled": false, - "id": "3e90195b07f6455fa38dd2dd168b8209" - }, - { - "relpath": "ReferenceResults", - "contentType": "REFERENCE_RESULTS", - "defaultDisabled": false, - "id": "8ae62e121ce54595981e0a806cf7b6f6" - }, - { - "relpath": "Resources/ExperimentDefinitions", - "contentType": "EXPERIMENT_DEFINITIONS", - "defaultDisabled": false, - "id": "642bdb01133c42b8a7d46f0f8386e48e" - }, - { - "relpath": "Test", - "contentType": "MODELICA", - "name": "Test", - "defaultDisabled": false, - "id": "438ad9f417f141b79910fd749a9a9ec1" - } - ], - "executionOptions": [] -} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json b/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json deleted file mode 100644 index 615498d..0000000 --- a/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/Metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "defaultExperimentId" : "6ae65714-d53f-436d-9a2d-9955b5cf755e" -} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json b/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json deleted file mode 100644 index cc87a3b..0000000 --- a/Resources/ExperimentDefinitions/Modelica/Mechanics/Rotational/Examples/First/experiment_1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "version" : "2", - "id" : "6ae65714-d53f-436d-9a2d-9955b5cf755e", - "experiment" : { - "base" : { - "analysis" : { - "variableFilters" : [ ], - "selectedType" : "dynamic", - "choices" : [ { - "type" : "dynamic", - "parameters" : { - "final_time" : 1, - "interval" : 0.001, - "start_time" : 0 - }, - "simulationOptions" : { - "dynamic_diagnostics" : false, - "ncp" : 500 - }, - "solverOptions" : { - "store_event_points" : true - }, - "compilerOptions" : { - "c_compiler" : "gcc", - "generate_html_diagnostics" : false, - "include_protected_variables" : false - }, - "runtimeOptions" : { } - } ], - "expansion" : { - "discreteAlgorithm" : { - "noOfSamples" : 0, - "seed" : 0 - }, - "continuousAlgorithm" : { - "type" : "SOBOL", - "noOfSamples" : 10, - "seed" : 0 - } - } - }, - "modifiers" : { - "initializeFrom" : "", - "variables" : [ ] - } - } - }, - "metadata" : { - "created" : "2024-05-23 11:20:48.208905085", - "lastModified" : "2024-05-23 11:20:48.208905085", - "name" : "Experiment 1" - } -} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json b/Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json deleted file mode 100644 index 50b8e14..0000000 --- a/Resources/ExperimentDefinitions/Test/Unnamed/Metadata.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "defaultExperimentId" : "525e3d1b-96d8-4138-a815-e562f294b816" -} \ No newline at end of file diff --git a/Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json b/Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json deleted file mode 100644 index f9d6af7..0000000 --- a/Resources/ExperimentDefinitions/Test/Unnamed/experiment_1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "version" : "2", - "id" : "525e3d1b-96d8-4138-a815-e562f294b816", - "experiment" : { - "base" : { - "analysis" : { - "variableFilters" : [ ], - "selectedType" : "dynamic", - "choices" : [ { - "type" : "dynamic", - "parameters" : { - "final_time" : 10, - "interval" : 0.002, - "start_time" : 0 - }, - "simulationOptions" : { - "dynamic_diagnostics" : false, - "ncp" : 500 - }, - "solverOptions" : { - "store_event_points" : true - }, - "compilerOptions" : { - "c_compiler" : "gcc", - "generate_html_diagnostics" : false, - "include_protected_variables" : false - }, - "runtimeOptions" : { } - } ], - "expansion" : { - "discreteAlgorithm" : { - "noOfSamples" : 0, - "seed" : 0 - }, - "continuousAlgorithm" : { - "type" : "SOBOL", - "noOfSamples" : 10, - "seed" : 0 - } - } - }, - "modifiers" : { - "initializeFrom" : "", - "variables" : [ ] - } - } - }, - "metadata" : { - "created" : "2024-05-23 11:41:02.145870166", - "lastModified" : "2024-05-23T11:41:19.413712736Z", - "name" : "Experiment 1" - } -} \ No newline at end of file diff --git a/Test/DoublePendulumInitTip1.mo b/Test/DoublePendulumInitTip1.mo deleted file mode 100644 index acdbbc5..0000000 --- a/Test/DoublePendulumInitTip1.mo +++ /dev/null @@ -1,92 +0,0 @@ -within Test; - -model DoublePendulumInitTip1 - "Demonstrate how to initialize a double pendulum so that its tip starts at a predefined position" - extends .Modelica.Icons.Example; - inner .Modelica.Mechanics.MultiBody.World world annotation (Placement( - transformation(extent={{-100,-10},{-80,10}}))); - .Modelica.Mechanics.MultiBody.Joints.Revolute revolute1(useAxisFlange=true) - annotation (Placement(transformation(extent={{-60,-10},{-40,10}}))); - .Modelica.Mechanics.Rotational.Components.Damper damper(d=0.1) - annotation (Placement(transformation(extent={{-60,30},{-40,50}}))); - .Modelica.Mechanics.MultiBody.Parts.BodyBox boxBody1(r={0.5,0,0}, width=0.06) - annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); - .Modelica.Mechanics.MultiBody.Joints.Revolute revolute2(phi(start=.Modelica.Constants.pi/2)) - annotation (Placement(transformation(extent={{20,-10},{40,10}}))); - .Modelica.Mechanics.MultiBody.Parts.BodyBox boxBody2(r={0.5,0,0}, width=0.06) - annotation (Placement(transformation(extent={{60,-10},{80,10}}))); - .Modelica.Mechanics.MultiBody.Joints.FreeMotionScalarInit freeMotionScalarInit( - use_r=true, - r_rel_a_1(start=0.7, fixed=true), - r_rel_a_2(start=0.3, fixed=true), - use_v=true, - v_rel_a_1(fixed=true), - v_rel_a_2(fixed=true)) - annotation (Placement(transformation(extent={{-20,-50},{0,-30}}))); -equation - connect(damper.flange_b,revolute1. axis) annotation (Line(points={{-40,40},{-40,20},{-50,20},{-50,10}})); - connect(revolute1.support,damper. flange_a) annotation (Line(points={{-56,10},{-56,20},{-60,20},{-60,40}})); - connect(revolute1.frame_b,boxBody1. frame_a) - annotation (Line( - points={{-40,0},{-20,0}}, - color={95,95,95}, - thickness=0.5)); - connect(revolute2.frame_b,boxBody2. frame_a) - annotation (Line( - points={{40,0},{60,0}}, - color={95,95,95}, - thickness=0.5)); - connect(boxBody1.frame_b,revolute2. frame_a) - annotation (Line( - points={{0,0},{20,0}}, - color={95,95,95}, - thickness=0.5)); - connect(world.frame_b,revolute1. frame_a) - annotation (Line( - points={{-80,0},{-60,0}}, - color={95,95,95}, - thickness=0.5)); - connect(world.frame_b, freeMotionScalarInit.frame_a) annotation (Line( - points={{-80,0},{-70,0},{-70,-40},{-20,-40}}, - color={95,95,95}, - thickness=0.5)); - connect(freeMotionScalarInit.frame_b, boxBody2.frame_b) annotation (Line( - points={{0,-40},{90,-40},{90,0},{80,0}}, - color={95,95,95}, - thickness=0.5)); - annotation ( - experiment(StopTime=5), - Documentation(info=" -

-This example demonstrates at hand of a double pendulum, -how non-standard initialization can be defined: -The absolute position of the pendulum tip, and its absolute speed -shall be initially defined. This can be performed with the -Joints.FreeMotionScalarInit -joint that allows to initialize individual elements of its relative vectors. -In this case, the x-, and y-coordinates of the relative position vector -(visualized by the yellow arrow in the figure below) and of its -derivative shall have a defined value at initial time. -The configuration of the double pendulum at the initial time is -shown below, where the tip position is required to have the coordinates -x=0.7, y=0.3. -

-

-Setting only the tip's start position results in an ambiguous initialization since -two valid solutions for revolute1.phi and revolute2.phi exist. -Moreover, the calculated angles revolute1.phi and revolute2.phi -can be a multiple of expected solution phi1 and phi2, -

-
    -
  • revolute1.phi(k1) = phi1 + 2 π k1,
  • -
  • revolute2.phi(k2) = phi2 + 2 π k2.
  • -
-

-To clearly indicate the preferred solution, guess initial angles can be additionally given. -In this example, it is simply done by revolute2.phi.start = Modelica.Constants.pi/2. -

-
- -
-")); -end DoublePendulumInitTip1; diff --git a/Test/Unnamed.mo b/Test/Unnamed.mo deleted file mode 100644 index 75150f5..0000000 --- a/Test/Unnamed.mo +++ /dev/null @@ -1,10 +0,0 @@ -within Test; -model Unnamed - .Modelica.Mechanics.Translational.Components.SpringDamper springDamper(c = 10,d = 5,s_rel0 = 0.1) annotation(Placement(transformation(extent = {{-10.0,-10.0},{10.0,10.0}},origin = {0.0,0.0},rotation = -90.0))); - .Modelica.Mechanics.Translational.Components.Fixed fixed annotation(Placement(transformation(extent = {{-10.0,-10.0},{10.0,10.0}},origin = {-0.2222222222222321,37.77777777777778},rotation = -180.0))); - .Modelica.Mechanics.Translational.Components.Mass mass(m = 5) annotation(Placement(transformation(extent = {{-10.0,-10.0},{10.0,10.0}},origin = {-0.22222222222221077,-56.22222222222223},rotation = -90.0))); -equation - connect(fixed.flange,springDamper.flange_a) annotation(Line(points = {{-0.2222222222222321,37.77777777777803},{-0.2222222222222321,10},{-2.220446049250313e-15,10}},color = {0,127,0})); - connect(springDamper.flange_b,mass.flange_a) annotation(Line(points = {{2.220446049250313e-15,-10},{-0.22222222222221344,-10},{-0.22222222222221344,-46.22222222222213}},color = {0,127,0})); - annotation(Icon(coordinateSystem(preserveAspectRatio = false,extent = {{-100.0,-100.0},{100.0,100.0}}),graphics = {Rectangle(lineColor={0,0,0},fillColor={230,230,230},fillPattern=FillPattern.Solid,extent={{-100.0,-100.0},{100.0,100.0}}),Text(lineColor={0,0,255},extent={{-150,150},{150,110}},textString="%name")})); -end Unnamed; diff --git a/Test/Version1_20thmay.mo b/Test/Version1_20thmay.mo deleted file mode 100644 index ed105ec..0000000 --- a/Test/Version1_20thmay.mo +++ /dev/null @@ -1,61 +0,0 @@ -within Test; - -model Version1_20thmay - "Simple double pendulum with two revolute joints and two bodies" - - extends .Modelica.Icons.Example; - inner .Modelica.Mechanics.MultiBody.World world annotation (Placement( - transformation(extent={{-100,-10},{-80,10}}))); - .Modelica.Mechanics.MultiBody.Joints.Revolute revolute1(useAxisFlange=true,phi(fixed=true), - w(fixed=true)) annotation (Placement(transformation(extent={{-60,-10},{-40,10}}))); - .Modelica.Mechanics.Rotational.Components.Damper damper( - d=0.1) - annotation (Placement(transformation(extent={{-60,30},{-40,50}}))); - .Modelica.Mechanics.MultiBody.Parts.BodyBox boxBody1(r={0.5,0,0}, width=0.06) - annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); - .Modelica.Mechanics.MultiBody.Joints.Revolute revolute2(phi(fixed=true), w( - fixed=true)) annotation (Placement(transformation(extent={{20,-10},{40,10}}))); - .Modelica.Mechanics.MultiBody.Parts.BodyBox boxBody2(r={0.5,0,0}, width=0.06) - annotation (Placement(transformation(extent={{60,-10},{80,10}}))); -equation - - connect(damper.flange_b, revolute1.axis) annotation (Line(points={{-40,40},{-40,20},{-50,20},{-50,10}})); - connect(revolute1.support, damper.flange_a) annotation (Line(points={{-56,10},{-56,20},{-60,20},{-60,40}})); - connect(revolute1.frame_b, boxBody1.frame_a) - annotation (Line( - points={{-40,0},{-20,0}}, - color={95,95,95}, - thickness=0.5)); - connect(revolute2.frame_b, boxBody2.frame_a) - annotation (Line( - points={{40,0},{60,0}}, - color={95,95,95}, - thickness=0.5)); - connect(boxBody1.frame_b, revolute2.frame_a) - annotation (Line( - points={{0,0},{20,0}}, - color={95,95,95}, - thickness=0.5)); - connect(world.frame_b, revolute1.frame_a) - annotation (Line( - points={{-80,0},{-60,0}}, - color={95,95,95}, - thickness=0.5)); - annotation ( - experiment(StopTime=3), - Documentation(info=" -

-This example demonstrates that by using joint and body -elements animation is automatically available. Also the revolute -joints are animated. Note, that animation of every component -can be switched of by setting the first parameter animation -to false or by setting enableAnimation in the world -object to false to switch off animation of all components. -

- -
- -
-")); -end Version1_20thmay; diff --git a/Test/package.mo b/Test/package.mo deleted file mode 100644 index b54aa93..0000000 --- a/Test/package.mo +++ /dev/null @@ -1,3 +0,0 @@ -package Test extends .Modelica.Icons.Package; - annotation(uses(Modelica(version = "4.0.0"))); -end Test; \ No newline at end of file diff --git a/Test/package.order b/Test/package.order deleted file mode 100644 index 7af5194..0000000 --- a/Test/package.order +++ /dev/null @@ -1,3 +0,0 @@ -Version1_20thmay -DoublePendulumInitTip1 -Unnamed \ No newline at end of file From d5f60a0c3f6384bdb63fac1b495bbd1aa11b2ad1 Mon Sep 17 00:00:00 2001 From: Karthik Saravanan Date: Thu, 4 Jul 2024 09:15:36 +0000 Subject: [PATCH 5/5] Testing --- .impact/project.json | 20 ++++++++ TestPackage/SignConvention.mo | 92 +++++++++++++++++++++++++++++++++++ TestPackage/package.mo | 3 ++ TestPackage/package.order | 1 + 4 files changed, 116 insertions(+) create mode 100644 .impact/project.json create mode 100644 TestPackage/SignConvention.mo create mode 100644 TestPackage/package.mo create mode 100644 TestPackage/package.order diff --git a/.impact/project.json b/.impact/project.json new file mode 100644 index 0000000..4b20ae4 --- /dev/null +++ b/.impact/project.json @@ -0,0 +1,20 @@ +{ + "name": "Modelonexamples_10", + "format": "1.0.0", + "dependencies": [ + { + "name": "Modelica", + "versionSpecifier": "4.0.0" + } + ], + "content": [ + { + "relpath": "TestPackage", + "contentType": "MODELICA", + "name": "TestPackage", + "defaultDisabled": false, + "id": "77d3ee4fbe1743f5b16633a829e027de" + } + ], + "executionOptions": [] +} \ No newline at end of file diff --git a/TestPackage/SignConvention.mo b/TestPackage/SignConvention.mo new file mode 100644 index 0000000..63a35e3 --- /dev/null +++ b/TestPackage/SignConvention.mo @@ -0,0 +1,92 @@ +within TestPackage; + +model SignConvention "Examples for the used sign conventions" + extends .Modelica.Icons.Example; + .Modelica.Mechanics.Translational.Components.Mass mass1( + L=1, + s(fixed=true), + v(fixed=true), + m=1) annotation (Placement(transformation(extent={{40,60},{60,80}}))); + .Modelica.Mechanics.Translational.Sources.Force force1 annotation (Placement(transformation( + extent={{0,60},{20,80}}))); + .Modelica.Blocks.Sources.Constant constant1(k=1) annotation (Placement( + transformation(extent={{-40,60},{-20,80}}))); + .Modelica.Mechanics.Translational.Components.Mass mass2( + L=1, + s(fixed=true), + v(fixed=true), + m=1) annotation (Placement(transformation(extent={{40,0},{60,20}}))); + .Modelica.Mechanics.Translational.Sources.Force force2 annotation (Placement(transformation( + extent={{0,20},{20,40}}))); + .Modelica.Blocks.Sources.Constant constant2(k=1) annotation (Placement( + transformation(extent={{-40,20},{-20,40}}))); + .Modelica.Mechanics.Translational.Components.Mass mass3( + L=1, + s(fixed=true), + v(fixed=true), + m=1) annotation (Placement(transformation(extent={{-40,-40},{-20,-20}}))); + .Modelica.Mechanics.Translational.Sources.Force force3(useSupport=false) + annotation (Placement( + transformation(extent={{20,-40},{0,-20}}))); + .Modelica.Blocks.Sources.Constant constant3(k=1) annotation (Placement( + transformation(extent={{60,-40},{40,-20}}))); + .Modelica.Mechanics.Translational.Components.Fixed fixed + annotation (Placement(transformation(extent={{0,-60},{20,-40}}))); +equation + connect(constant1.y, force1.f) + annotation (Line(points={{-19,70},{-2,70}}, color={0,0,127})); + connect(constant2.y, force2.f) + annotation (Line(points={{-19,30},{-2,30}}, color={0,0,127})); + connect(constant3.y, force3.f) + annotation (Line(points={{39,-30},{22,-30}}, color={0,0,127})); + connect(force1.flange, mass1.flange_a) annotation (Line( + points={{20,70},{40,70}}, color={0,127,0})); + connect(force2.flange, mass2.flange_b) annotation (Line( + points={{20,30},{70,30},{70,10},{60,10}}, color={0,127,0})); + connect(mass3.flange_b, force3.flange) annotation (Line( + points={{-20,-30},{0,-30}}, color={0,127,0})); + connect(fixed.flange, force3.support) annotation (Line( + points={{10,-50},{10,-40}}, color={0,127,0})); + annotation ( + Documentation(info=" +

+If all arrows point in the same direction, a positive force +results in a positive acceleration a, velocity v and position s. +

+

+For a force of 1 N and a mass of 1 kg this leads to +

+
+a = 1 m/s2
+v = 1 m/s after 1 s (SlidingMass1.v)
+s = 0.5 m after 1 s (SlidingMass1.s)
+
+

+The acceleration is not available for plotting. +

+

+System 1) and 2) are equivalent. It doesn't matter whether the +force pushes at flange_a in system 1 or pulls at flange_b in system 2. +

+It is of course possible to ignore the arrows and connect the models +in an arbitrary way. But then it is hard see in what direction the +force acts. +

+In the third system the two arrows are opposed which means that the +force acts in the opposite direction (in the same direction as in +the two other examples). +

+"), + Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, + {100,100}}),graphics={Text( + extent={{-100,80},{-82,60}}, + textString="1)", + lineColor={0,0,255}),Text( + extent={{-100,40},{-82,20}}, + textString="2)", + lineColor={0,0,255}),Text( + extent={{-100,-20},{-82,-40}}, + textString="3)", + lineColor={0,0,255})}), + experiment(StopTime=1.0, Interval=0.001)); +end SignConvention; diff --git a/TestPackage/package.mo b/TestPackage/package.mo new file mode 100644 index 0000000..3b80a77 --- /dev/null +++ b/TestPackage/package.mo @@ -0,0 +1,3 @@ +package TestPackage extends .Modelica.Icons.Package; + annotation(uses(Modelica(version = "4.0.0"))); +end TestPackage; \ No newline at end of file diff --git a/TestPackage/package.order b/TestPackage/package.order new file mode 100644 index 0000000..8047e14 --- /dev/null +++ b/TestPackage/package.order @@ -0,0 +1 @@ +SignConvention \ No newline at end of file