﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2012	FrontEnd generate wrong record constructor function for records with constants	Jens Frenkel	Mahder Alemseged Gebremedhin	"For the models 

Modelica.Electrical.Spice3.Examples.FourInverters 
Modelica.Electrical.Spice3.Examples.InvertersApartRecord
Modelica.Electrical.Spice3.Examples.InvertersExtendedModel
Modelica.Electrical.Spice3.Examples.Nor
Modelica.Electrical.Spice3.Examples.Oscillator
Modelica.Electrical.Spice3.Examples.Spice3BenchmarkDifferentialPair
Modelica.Electrical.Spice3.Examples.Inverter

of MSL3.2.1

codegeneration fails to hand over records of constants because the record constructor funktion has no paramater values in declaration


For example the record

{{{
record SpiceConstants ""General constants of SPICE simulator""
  extends Modelica.Icons.Record;
  constant Real EPSSIL =     (11.7 * 8.854214871e-12);
  constant Real EPSOX =      3.453133e-11;
  constant SI.Charge CHARGE =     (1.6021918e-19);
  constant SI.Temp_K CONSTCtoK =  (273.15);
  constant SI.HeatCapacity CONSTboltz = (1.3806226e-23); // J/K
  constant SI.Temp_K REFTEMP =    300.15;  /* 27 deg C */

  constant Real CONSTroot2 =  sqrt(2.0);
  constant Real CONSTvt0(   final unit= ""(J/K)/(A.s)"") = Modelica.Constants.k * Modelica.SIunits.Conversions.from_degC(27)  / CHARGE; // deg C
  constant Real CONSTKoverQ(  final unit= ""(J/K)/(A.s)"")= Modelica.Constants.k / CHARGE;
  constant Real CONSTe =      exp(1.0);

  // options

  constant SI.Conductance CKTgmin =         1e-12;
  constant SI.Temp_K CKTnomTemp =      300.15;
  constant SI.Temp_K CKTtemp =         300.15;
  constant SI.Area CKTdefaultMosAD = 0.0;
  constant SI.Area CKTdefaultMosAS = 0.0;
  constant SI.Length CKTdefaultMosL =  100e-6;
  constant SI.Length CKTdefaultMosW =  100e-6;
  constant Real CKTreltol =       1e-10;
  constant Real CKTabstol =       1e-15;
  constant Real CKTvolttol =      1e-10;
  constant Real CKTtemptol =      1e-3;
 annotation (Documentation(info=""<html>
<p>General constants used by SPICE</p>
<p>The package Internal is not for user access. There all function, records and data are stored, that are needed for the semiconductor models of the package Semiconductors.</p>
</html>""));
end SpiceConstants;
}}}

get the following record function

{{{
Modelica_Electrical_Spice3_Internal_SpiceConstants_rettype
omc_Modelica_Electrical_Spice3_Internal_SpiceConstants()
{
  Modelica_Electrical_Spice3_Internal_SpiceConstants_rettype tmp1;
  struct Modelica_Electrical_Spice3_Internal_SpiceConstants tmp2;
  tmp1.c1 = tmp2;
  return tmp1;
}
}}}

and the call

{{{
  cc = Mos.mosCalcNoBypassCode(
    m,
    m_type,
    c2,
    p,
    C,
    vp,
    m_bInit,
    {G.v, B.v, Dinternal, Sinternal});
}}}

with 

{{{
  tmp55 = omc_Modelica_Electrical_Spice3_Internal_SpiceConstants(0.00000000010359431399069999, 0.00000000003453133, 0.00000000000000000016021918, 273.15, 0.000000000000000000000013806226, 300.15, 1.4142135623730951, 2.718281828459045, 0.000000000001, 300.15, 300.15, 0.0, 0.0, 0.0001, 0.0001, 0.0000000001, 0.000000000000001, 0.0000000001, 0.001, 0.025864709055120616, 0.0000861726105451295);
}}}

will fail because the elements of tmp55 are not set.

"	enhancement	closed	normal	1.9.0	Frontend	trunk	fixed	constant record to functions	christian.schubert@…
