Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Change parameters from variable window

Change parameters from variable window

I have the following block model in OpenModelica:

Code:


block BalancedTruncation_statespace
  // Output generated from the Model Reduction Abaqus plugin - Balanced Truncation
  // Model using 1 inputs 2 outputs, 11 balanced truncation modes and none damping
  // The following modes have been used: 0, 1, 3, 4, 6, 7, 11, 13, 14, 15, 16, 24
  // Damping values:
  parameter Real alpha = 0.0;
  parameter Real beta = 0.0;
  parameter Real gamma = 0.0;
  parameter Real[2] eigenvalues = {0.0975123271346, 0.11357691884 };
  parameter Real[2] dampingVector = (-alpha) .- beta*eigenvalues .- gamma*sqrt(eigenvalues);
  // Matrix definitions:
  parameter Real[4, 4] reduced_A= [0.0-dampingVector[1], 0.0, 0.0, 0.0, ;
                                      0.0, -5.56990794865e-16-dampingVector[2], -0.312269640851, 9.35455645406e-10;
                                      0.0, 0.312269636167, 5.61522790426e-16-dampingVector[3], -9.0456562993e-10;
                                      0.0, -2.84746651439e-09, 5.36805242974e-09, -3.98671015413e-14-dampingVector[4]];
  parameter Real[4, 1] reduced_B= [0.0;
                                     0.00577911820642;
                                     -0.00577911939778;
                                     0.00297840412761];
  parameter Real[2, 4] reduced_C= [0.0342287458479, -0.00409670926149, -0.00409670846545, 0.00210768986047;
                                     0.0342287458479, -0.00407617395616, -0.00407617309651, 0.00210444036295];
  parameter Real[2, 1] reduced_D= [0.0;
                                    0.0];

Modelica.Blocks.Continuous.StateSpace BalancedTruncationModel (A = reduced_A, B = reduced_B, C = reduced_C, D = reduced_D, initType = Modelica.Blocks.Types.Init.NoInit)  annotation(
    Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    // From Field Data: CUR:CUR1  at part instance ASSEMBLY element 7 whole element
  Modelica.Blocks.Interfaces.RealInput reduced_Input_1 annotation(
    Placement(visible = true, transformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    // From Field Data: U:U2  at part instance ARM-1 node 13
  Modelica.Blocks.Interfaces.RealOutput reduced_Output_1 annotation(
    Placement(visible = true, transformation(origin = {80, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {80, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    // From Field Data: U:U2  at part instance ARM-1 node 14
  Modelica.Blocks.Interfaces.RealOutput reduced_Output_2 annotation(
    Placement(visible = true, transformation(origin = {80, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {80, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(reduced_Input_1, BalancedTruncationModel.u[1]) annotation(
    Line(points = {{-80, 0}, {-40, 0}, {-40, 0}, {12, 0}}, color = {0, 0, 127}, thickness = 0.5));
  connect(BalancedTruncationModel.y[1], reduced_Output_1) annotation(
    Line(points = {{12, 0}, {40, 0}, {40, 20}, {80, 20}}, color = {0, 0, 127}, thickness = 0.5));
  connect(BalancedTruncationModel.y[2], reduced_Output_2) annotation(
    Line(points = {{12, 0}, {40, 0}, {40, -20}, {80, -20}}, color = {0, 0, 127}, thickness = 0.5));
end BalancedTruncation_statespace;

The code, mainly the matrices have been reduced in size for readability. My problem now is the following: I can simulate this model using some values for alpha beta and gamma. However, I am unable to change their values from the variable browser in the plotting pane and then re-simulate the model. I would like to be able to do this, in a similar way as I can change the input value and re-simulate the model. 

Is this possible at all, and if so, what should I do?

Edited by: jvandeweg - May-15-20 06:57:04

Re: Change parameters from variable window

Which OM version did you use? It works on OpenModelica v1.14.0-dev-26586-geb59bf2b38 .

Re: Change parameters from variable window

I use OM v1.14.1

There are 0 guests and 0 other users also viewing this topic
You are here: