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
  • Index
  • » Users
  • » mariomar
  • » Profile

Posts

Posts

Feb-14-13 21:07:51
Category: Programming

Hello

Right now I'm starting with the programming in modelica, but I have some issues defining parameters, because what I want to do is to first giv some parameters to a formula and then with the result of that equatin define a new parameter. the problem is shown here:

class Resistor_cond
  parameter Real num = 2;
  parameter Real L = 1.5;
  parameter Real W = 0.008;
  parameter Real H = 0.1;
  parameter Real k_bar = 385;
  parameter Real nodes = 15;

  Real R,L_1(start = 1);
equation
  if num == 0 then
    L / (4 * (nodes - 1)) = L_1;
    L_1 / (H * W * k_bar) = R;
    G=1/R;
   
  elseif num == 1 then
    L_1 = (3 * L) / (4 * (nodes - 1));
    R = L_1 / (H * W * k_bar);
    G=1/R;
   
  elseif num == 2 then
    L_1 = L / (nodes - 1);
    R = L_1 / (H * W * k_bar);
    G=1/R;

  end if;

parameter Real G(start = 0, unit = "K/W")=1/R;


end Resistor_cond;


I want to convert the variable G into a parameter in order to put it as a parameter for a thermal resistance.

Thank you very much un advance

  • Index
  • » Users
  • » mariomar
  • » Profile
You are here: