2

I have one "Thermal Mass" block in Simulink, which represents a thermal mass, which is the ability of a material or combination of materials to store internal energy. In this standard block of Simulink, the initial temperature must be entered. Only one signal can be connected to the block. The source code of the block looks like following:

component mass
% Thermal Mass
% The block represents a thermal mass, which is the ability of a material 
% or combination of materials to store internal energy. The property is
% characterized by mass of the material and its specific heat.
%
% The block has one thermal conserving port. 
% The block positive direction is from its port towards the block. This
% means that the heat flow is positive if it flows into the block.

% Copyright 2005-2013 The MathWorks, Inc.

nodes
    M = foundation.thermal.thermal; % :top
end

parameters
    mass = { 1, 'kg' };              % Mass
    sp_heat = { 447, 'J/(kg*K)' };   % Specific heat
end

variables
    Q = { 0, 'J/s' }; % Heat flow
end

variables(Conversion=absolute)
    T = { 300, 'K' }; % Temperature
end

function setup
    % Parameter range checking
    if mass <= 0
        pm_error('simscape:GreaterThanZero','Mass')
    end
    if sp_heat <= 0
        pm_error('simscape:GreaterThanZero','Specific heat')
    end
end

branches
    Q : M.Q -> *;
end

equations
    T == M.T;
    Q == mass * sp_heat * T.der;
    assert(T>0, 'Temperature must be greater than absolute zero')
end

end

I would like to build another component, whose initial temperature can come from another block, so that it can be also calculated somewhere else. So, one input parameter and everything else should be the same. I am new to Simulink and don't know much about the domains. Any idea, how this can be done?

Thank you!

Phil Goddard
  • 10,571
  • 1
  • 16
  • 28
Huve
  • 49
  • 5

2 Answers2

0

Parameters entered on a Simulink block are usually utilized for initial values and tuning of block behavior. While newer versions of Simulink will allow you to tune some parameters during simulation, others will be locked down and un-modifiable. This may mean that you need to first execute a model to calculate the initial value for your Thermal Mass, and then start up a second simulation using that temperature as an initial value.

I believe the Simulink help on how to control block parameters will be useful. Depending on the specific design of your model, different techniques found here may be more or less applicable, but generally speaking I know of 2 easy and simple ways to accomplish modifying a mask value.

  1. Set the value to a variable in your Matlab base workspace.
  2. Place the block inside a Masked subsystem. The mask can be used to define a variable that accessible to all the blocks inside it.
Jared
  • 61
  • 6
0

This is not possible, while you can execute some pre-processing to determine initial temperature you can not have this as an input from other blocks.

The workaround described by Jared is probably what you're looking for.

It's actually pretty rare to need to do this, if you tell us why you'r looking to set this up, we may be able to help.

ngautier
  • 86
  • 3