Eeschema: Adding new source types in SPICE model

NEW: Adds support in eeschema for three new source types
used in .TRAN simulation: single frequency FM, AM, and random.
This commit is contained in:
Sylwester Kocjan 2020-03-23 16:49:21 +00:00 committed by Seth Hillbrand
parent cc47062b17
commit c7daca1e78
5 changed files with 12383 additions and 8736 deletions

View File

@ -79,6 +79,15 @@ static const std::vector<SPICE_MODEL_INFO> modelTypes =
};
enum TRRANDOM_TYPE
{
TRRANDOM_UNIFORM = 0,
TRRANDOM_GAUSSIAN = 1,
TRRANDOM_EXPONENTIAL = 2,
TRRANDOM_POISSON = 3,
};
// Returns index of an entry in modelTypes array (above) corresponding to a Spice primitive
static int getModelTypeIdx( char aPrimitive )
{
@ -150,10 +159,35 @@ void DIALOG_SPICE_MODEL::Init()
m_expFallDelay->SetValidator( m_spiceEmptyValidator );
m_expFallConst->SetValidator( m_spiceEmptyValidator );
m_fmOffset->SetValidator( m_spiceEmptyValidator );
m_fmAmplitude->SetValidator( m_spiceEmptyValidator );
m_fmFcarrier->SetValidator( m_spiceEmptyValidator );
m_fmModIndex->SetValidator( m_spiceEmptyValidator );
m_fmFsignal->SetValidator( m_spiceEmptyValidator );
m_fmPhaseC->SetValidator( m_spiceEmptyValidator );
m_fmPhaseS->SetValidator( m_spiceEmptyValidator );
m_amAmplitude->SetValidator( m_spiceEmptyValidator );
m_amOffset->SetValidator( m_spiceEmptyValidator );
m_amModulatingFreq->SetValidator( m_spiceEmptyValidator );
m_amCarrierFreq->SetValidator( m_spiceEmptyValidator );
m_amSignalDelay->SetValidator( m_spiceEmptyValidator );
m_amPhase->SetValidator( m_spiceEmptyValidator );
m_rnTS->SetValidator( m_spiceEmptyValidator );
m_rnTD->SetValidator( m_spiceEmptyValidator );
m_rnParam1->SetValidator( m_spiceEmptyValidator );
m_rnParam2->SetValidator( m_spiceEmptyValidator );
m_pwlTimeCol = m_pwlValList->AppendColumn( "Time [s]", wxLIST_FORMAT_LEFT, 100 );
m_pwlValueCol = m_pwlValList->AppendColumn( "Value [V/A]", wxLIST_FORMAT_LEFT, 100 );
m_sdbSizerOK->SetDefault();
// Hide pages that aren't fully implemented yet
// wxPanel::Hide() isn't enough on some platforms
m_powerNotebook->RemovePage( m_powerNotebook->FindPage( m_pwrTransNoise ) );
m_powerNotebook->RemovePage( m_powerNotebook->FindPage( m_pwrExtData ) );
}
@ -385,8 +419,6 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
return false;
}
}
else if( tkn == "ac" )
{
// AC magnitude
@ -411,8 +443,6 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
continue; // perhaps another directive
}
}
else if( tkn == "pulse" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrPulse ) );
@ -432,8 +462,6 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
genericReqParamsCount = 2;
genericControls = { m_sinOffset, m_sinAmplitude, m_sinFreq, m_sinDelay, m_sinDampFactor };
}
else if( tkn == "exp" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrExp ) );
@ -443,8 +471,6 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
genericControls = { m_expInit, m_expPulsed,
m_expRiseDelay, m_expRiseConst, m_expFallDelay, m_expFallConst };
}
else if( tkn == "pwl" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrPwl ) );
@ -467,8 +493,46 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
return false;
}
}
else if( tkn == "sffm" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrFm ) );
genericProcessing = true;
genericReqParamsCount = 4;
genericControls = { m_fmOffset, m_fmAmplitude, m_fmFcarrier, m_fmModIndex, m_fmFsignal,
m_fmFsignal, m_fmPhaseC, m_fmPhaseS };
}
else if( tkn == "am" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrAm ) );
genericProcessing = true;
genericReqParamsCount = 5;
genericControls = { m_amAmplitude, m_amOffset, m_amModulatingFreq, m_amCarrierFreq,
m_amSignalDelay, m_amPhase };
}
else if( tkn == "trrandom" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrRandom ) );
// first token will configure drop-down list
if( !tokenizer.HasMoreTokens() )
return false;
tkn = tokenizer.GetNextToken().Lower();
long type;
if( !tkn.ToLong( &type ) )
return false;
m_rnType->SetSelection( type - 1 );
wxCommandEvent dummy;
onRandomSourceType( dummy );
// remaining parameters can be handled in generic way
genericProcessing = true;
genericReqParamsCount = 4;
genericControls = { m_rnTS, m_rnTD, m_rnParam1, m_rnParam2 };
}
else
{
// Unhandled power source type
@ -476,7 +540,6 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
return false;
}
if( genericProcessing )
{
try
@ -553,38 +616,32 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
return false;
genericProcessing = true;
trans += "pulse";
trans += "pulse(";
genericReqParamsCount = 2;
genericControls = { m_pulseInit, m_pulseNominal, m_pulseDelay,
m_pulseRise, m_pulseFall, m_pulseWidth, m_pulsePeriod };
}
else if( page == m_pwrSin )
{
if( !m_pwrSin->Validate() )
return false;
genericProcessing = true;
trans += "sin";
trans += "sin(";
genericReqParamsCount = 2;
genericControls = { m_sinOffset, m_sinAmplitude, m_sinFreq, m_sinDelay, m_sinDampFactor };
}
else if( page == m_pwrExp )
{
if( !m_pwrExp->Validate() )
return false;
genericProcessing = true;
trans += "exp";
trans += "exp(";
genericReqParamsCount = 2;
genericControls = { m_expInit, m_expPulsed,
m_expRiseDelay, m_expRiseConst, m_expFallDelay, m_expFallConst };
}
else if( page == m_pwrPwl )
{
if( m_pwlValList->GetItemCount() > 0 )
@ -601,11 +658,43 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
trans += ")";
}
}
else if( page == m_pwrFm )
{
if( !m_pwrFm->Validate() )
return false;
genericProcessing = true;
trans += "sffm(";
genericReqParamsCount = 4;
genericControls = { m_fmOffset, m_fmAmplitude, m_fmFcarrier, m_fmModIndex, m_fmFsignal,
m_fmFsignal, m_fmPhaseC, m_fmPhaseS };
}
else if( page == m_pwrAm )
{
if( !m_pwrAm->Validate() )
return false;
genericProcessing = true;
trans += "am(";
genericReqParamsCount = 5;
genericControls = { m_amAmplitude, m_amOffset, m_amModulatingFreq, m_amCarrierFreq,
m_amSignalDelay, m_amPhase };
}
else if( page == m_pwrRandom )
{
if( !m_pwrRandom->Validate() )
return false;
// first parameter must be retrieved from drop-down list selection
trans += "trrandom(";
trans.Append( wxString::Format( wxT( "%i " ), ( m_rnType->GetSelection() + 1 ) ) );
genericProcessing = true;
genericReqParamsCount = 4;
genericControls = { m_rnTS, m_rnTD, m_rnParam1, m_rnParam2 };
}
if( genericProcessing )
{
trans += "(";
auto first_empty = std::find_if( genericControls.begin(), genericControls.end(), empty );
auto first_not_empty = std::find_if( genericControls.begin(), genericControls.end(),
[]( const wxTextCtrl* c ){ return !empty( c ); } );
@ -885,6 +974,41 @@ void DIALOG_SPICE_MODEL::onPwlRemove( wxCommandEvent& event )
}
void DIALOG_SPICE_MODEL::onRandomSourceType( wxCommandEvent& event )
{
switch( m_rnType->GetSelection() )
{
case TRRANDOM_UNIFORM:
// uniform white noise
m_rnParam1Text->SetLabel( _( "Range:" ) );
m_rnParam2Text->SetLabel( _( "Offset:" ) );
break;
case TRRANDOM_GAUSSIAN:
// Gaussian
m_rnParam1Text->SetLabel( _( "Standard deviation:" ) );
m_rnParam2Text->SetLabel( _( "Mean:" ) );
break;
case TRRANDOM_EXPONENTIAL:
// exponential
m_rnParam1Text->SetLabel( _( "Mean:" ) );
m_rnParam2Text->SetLabel( _( "Offset:" ) );
break;
case TRRANDOM_POISSON:
// Poisson
m_rnParam1Text->SetLabel( _( "Lambda:" ) );
m_rnParam2Text->SetLabel( _( "Offset:" ) );
break;
default:
wxFAIL_MSG( _( "type of random generator for source is invalid" ) );
break;
}
}
SPICE_PRIMITIVE DIALOG_SPICE_MODEL::MODEL::parseModelType( const wxString& aValue )
{
wxCHECK( !aValue.IsEmpty(), SP_UNKNOWN );

View File

@ -112,6 +112,7 @@ private:
void onModelSelected( wxCommandEvent& event ) override;
void onPwlAdd( wxCommandEvent& event ) override;
void onPwlRemove( wxCommandEvent& event ) override;
void onRandomSourceType( wxCommandEvent& event ) override;
///> Edited component
SCH_COMPONENT& m_component;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version v3.8.0)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -653,10 +653,177 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i
m_pwrFm = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_pwrFm->Hide();
wxFlexGridSizer* fgSizer11;
fgSizer11 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer11->AddGrowableCol( 1 );
fgSizer11->SetFlexibleDirection( wxBOTH );
fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText138 = new wxStaticText( m_pwrFm, wxID_ANY, _("Offset:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText138->Wrap( -1 );
fgSizer11->Add( m_staticText138, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmOffset = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_fmOffset->SetMinSize( wxSize( 100,-1 ) );
fgSizer11->Add( m_fmOffset, 0, wxALL|wxEXPAND, 5 );
m_staticText1311 = new wxStaticText( m_pwrFm, wxID_ANY, _("Volts/Amps"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1311->Wrap( -1 );
fgSizer11->Add( m_staticText1311, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText141 = new wxStaticText( m_pwrFm, wxID_ANY, _("Amplitude:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText141->Wrap( -1 );
fgSizer11->Add( m_staticText141, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmAmplitude = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_fmAmplitude, 0, wxALL|wxEXPAND, 5 );
m_staticText1321 = new wxStaticText( m_pwrFm, wxID_ANY, _("Volts/Amps"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1321->Wrap( -1 );
fgSizer11->Add( m_staticText1321, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText151 = new wxStaticText( m_pwrFm, wxID_ANY, _("Carrier frequency:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText151->Wrap( -1 );
fgSizer11->Add( m_staticText151, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmFcarrier = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_fmFcarrier, 0, wxALL|wxEXPAND, 5 );
m_staticText1331 = new wxStaticText( m_pwrFm, wxID_ANY, _("Hertz"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1331->Wrap( -1 );
fgSizer11->Add( m_staticText1331, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText161 = new wxStaticText( m_pwrFm, wxID_ANY, _("Modulation index:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText161->Wrap( -1 );
fgSizer11->Add( m_staticText161, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmModIndex = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_fmModIndex, 0, wxALL|wxEXPAND, 5 );
m_staticText1341 = new wxStaticText( m_pwrFm, wxID_ANY, _("-"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1341->Wrap( -1 );
fgSizer11->Add( m_staticText1341, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText171 = new wxStaticText( m_pwrFm, wxID_ANY, _("Signal frequency:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText171->Wrap( -1 );
fgSizer11->Add( m_staticText171, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmFsignal = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_fmFsignal, 0, wxALL|wxEXPAND, 5 );
m_staticText1351 = new wxStaticText( m_pwrFm, wxID_ANY, _("Hertz"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1351->Wrap( -1 );
fgSizer11->Add( m_staticText1351, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText181 = new wxStaticText( m_pwrFm, wxID_ANY, _("Carrier phase:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText181->Wrap( -1 );
fgSizer11->Add( m_staticText181, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmPhaseC = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_fmPhaseC, 0, wxALL|wxEXPAND, 5 );
m_staticText1361 = new wxStaticText( m_pwrFm, wxID_ANY, _("degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1361->Wrap( -1 );
fgSizer11->Add( m_staticText1361, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText201 = new wxStaticText( m_pwrFm, wxID_ANY, _("Signal phase:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText201->Wrap( -1 );
fgSizer11->Add( m_staticText201, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_fmPhaseS = new wxTextCtrl( m_pwrFm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_fmPhaseS, 0, wxALL|wxEXPAND, 5 );
m_staticText1371 = new wxStaticText( m_pwrFm, wxID_ANY, _("degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1371->Wrap( -1 );
fgSizer11->Add( m_staticText1371, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_pwrFm->SetSizer( fgSizer11 );
m_pwrFm->Layout();
fgSizer11->Fit( m_pwrFm );
m_powerNotebook->AddPage( m_pwrFm, _("FM"), false );
m_pwrAm = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_pwrAm->Hide();
wxFlexGridSizer* fgSizer12;
fgSizer12 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer12->AddGrowableCol( 1 );
fgSizer12->SetFlexibleDirection( wxBOTH );
fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1381 = new wxStaticText( m_pwrAm, wxID_ANY, _("Amplitude:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1381->Wrap( -1 );
fgSizer12->Add( m_staticText1381, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_amAmplitude = new wxTextCtrl( m_pwrAm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_amAmplitude->SetMinSize( wxSize( 100,-1 ) );
fgSizer12->Add( m_amAmplitude, 0, wxALL|wxEXPAND, 5 );
m_staticText13111 = new wxStaticText( m_pwrAm, wxID_ANY, _("Volts/Amps"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13111->Wrap( -1 );
fgSizer12->Add( m_staticText13111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText1411 = new wxStaticText( m_pwrAm, wxID_ANY, _("Offset:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1411->Wrap( -1 );
fgSizer12->Add( m_staticText1411, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_amOffset = new wxTextCtrl( m_pwrAm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer12->Add( m_amOffset, 0, wxALL|wxEXPAND, 5 );
m_staticText13211 = new wxStaticText( m_pwrAm, wxID_ANY, _("Volts/Amps"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13211->Wrap( -1 );
fgSizer12->Add( m_staticText13211, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText1511 = new wxStaticText( m_pwrAm, wxID_ANY, _("Modulating frequency:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1511->Wrap( -1 );
fgSizer12->Add( m_staticText1511, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_amModulatingFreq = new wxTextCtrl( m_pwrAm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer12->Add( m_amModulatingFreq, 0, wxALL|wxEXPAND, 5 );
m_staticText13311 = new wxStaticText( m_pwrAm, wxID_ANY, _("Hertz"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13311->Wrap( -1 );
fgSizer12->Add( m_staticText13311, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText1611 = new wxStaticText( m_pwrAm, wxID_ANY, _("Carrier frequency:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1611->Wrap( -1 );
fgSizer12->Add( m_staticText1611, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_amCarrierFreq = new wxTextCtrl( m_pwrAm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer12->Add( m_amCarrierFreq, 0, wxALL|wxEXPAND, 5 );
m_staticText13411 = new wxStaticText( m_pwrAm, wxID_ANY, _("Hertz"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13411->Wrap( -1 );
fgSizer12->Add( m_staticText13411, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText1711 = new wxStaticText( m_pwrAm, wxID_ANY, _("Signal delay:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1711->Wrap( -1 );
fgSizer12->Add( m_staticText1711, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_amSignalDelay = new wxTextCtrl( m_pwrAm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer12->Add( m_amSignalDelay, 0, wxALL|wxEXPAND, 5 );
m_staticText13511 = new wxStaticText( m_pwrAm, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13511->Wrap( -1 );
fgSizer12->Add( m_staticText13511, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText1811 = new wxStaticText( m_pwrAm, wxID_ANY, _("Carrier phase:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1811->Wrap( -1 );
fgSizer12->Add( m_staticText1811, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_amPhase = new wxTextCtrl( m_pwrAm, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer12->Add( m_amPhase, 0, wxALL|wxEXPAND, 5 );
m_staticText13611 = new wxStaticText( m_pwrAm, wxID_ANY, _("degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13611->Wrap( -1 );
fgSizer12->Add( m_staticText13611, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_pwrAm->SetSizer( fgSizer12 );
m_pwrAm->Layout();
fgSizer12->Fit( m_pwrAm );
m_powerNotebook->AddPage( m_pwrAm, _("AM"), false );
m_pwrTransNoise = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_pwrTransNoise->Hide();
@ -665,6 +832,71 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i
m_pwrRandom = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_pwrRandom->Hide();
wxFlexGridSizer* fgSizer13;
fgSizer13 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer13->AddGrowableCol( 1 );
fgSizer13->SetFlexibleDirection( wxBOTH );
fgSizer13->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText27111 = new wxStaticText( m_pwrRandom, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText27111->Wrap( -1 );
fgSizer13->Add( m_staticText27111, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_rnTypeChoices[] = { _("Uniform"), _("Gaussian"), _("Exponential"), _("Poisson") };
int m_rnTypeNChoices = sizeof( m_rnTypeChoices ) / sizeof( wxString );
m_rnType = new wxChoice( m_pwrRandom, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_rnTypeNChoices, m_rnTypeChoices, 0 );
m_rnType->SetSelection( 0 );
fgSizer13->Add( m_rnType, 0, wxALL|wxEXPAND, 5 );
fgSizer13->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticText26711 = new wxStaticText( m_pwrRandom, wxID_ANY, _("Individual value duration:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText26711->Wrap( -1 );
fgSizer13->Add( m_staticText26711, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rnTS = new wxTextCtrl( m_pwrRandom, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer13->Add( m_rnTS, 0, wxALL|wxEXPAND, 5 );
m_staticText262111 = new wxStaticText( m_pwrRandom, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText262111->Wrap( -1 );
fgSizer13->Add( m_staticText262111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_staticText28111 = new wxStaticText( m_pwrRandom, wxID_ANY, _("Time delay:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText28111->Wrap( -1 );
fgSizer13->Add( m_staticText28111, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rnTD = new wxTextCtrl( m_pwrRandom, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer13->Add( m_rnTD, 0, wxALL|wxEXPAND, 5 );
m_staticText263111 = new wxStaticText( m_pwrRandom, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText263111->Wrap( -1 );
fgSizer13->Add( m_staticText263111, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
m_rnParam1Text = new wxStaticText( m_pwrRandom, wxID_ANY, _("Range:"), wxDefaultPosition, wxDefaultSize, 0 );
m_rnParam1Text->Wrap( -1 );
fgSizer13->Add( m_rnParam1Text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rnParam1 = new wxTextCtrl( m_pwrRandom, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer13->Add( m_rnParam1, 0, wxALL|wxEXPAND, 5 );
fgSizer13->Add( 0, 0, 1, wxEXPAND, 5 );
m_rnParam2Text = new wxStaticText( m_pwrRandom, wxID_ANY, _("Offset:"), wxDefaultPosition, wxDefaultSize, 0 );
m_rnParam2Text->Wrap( -1 );
fgSizer13->Add( m_rnParam2Text, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_rnParam2 = new wxTextCtrl( m_pwrRandom, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer13->Add( m_rnParam2, 0, wxALL|wxEXPAND, 5 );
fgSizer13->Add( 0, 0, 1, wxEXPAND, 5 );
m_pwrRandom->SetSizer( fgSizer13 );
m_pwrRandom->Layout();
fgSizer13->Fit( m_pwrRandom );
m_powerNotebook->AddPage( m_pwrRandom, _("Random"), false );
m_pwrExtData = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_pwrExtData->Hide();
@ -735,6 +967,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i
m_modelName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onModelSelected ), NULL, this );
m_pwlAddButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onPwlAdd ), NULL, this );
m_pwlRemoveBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onPwlRemove ), NULL, this );
m_rnType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onRandomSourceType ), NULL, this );
}
DIALOG_SPICE_MODEL_BASE::~DIALOG_SPICE_MODEL_BASE()
@ -746,5 +979,6 @@ DIALOG_SPICE_MODEL_BASE::~DIALOG_SPICE_MODEL_BASE()
m_modelName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onModelSelected ), NULL, this );
m_pwlAddButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onPwlAdd ), NULL, this );
m_pwlRemoveBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onPwlRemove ), NULL, this );
m_rnType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onRandomSourceType ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version v3.8.0)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -29,6 +29,7 @@
#include <wx/stc/stc.h>
#include <wx/statbox.h>
#include <wx/listctrl.h>
#include <wx/choice.h>
#include <wx/notebook.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
@ -171,9 +172,60 @@ class DIALOG_SPICE_MODEL_BASE : public DIALOG_SHIM
wxListCtrl* m_pwlValList;
wxButton* m_pwlRemoveBtn;
wxPanel* m_pwrFm;
wxStaticText* m_staticText138;
wxTextCtrl* m_fmOffset;
wxStaticText* m_staticText1311;
wxStaticText* m_staticText141;
wxTextCtrl* m_fmAmplitude;
wxStaticText* m_staticText1321;
wxStaticText* m_staticText151;
wxTextCtrl* m_fmFcarrier;
wxStaticText* m_staticText1331;
wxStaticText* m_staticText161;
wxTextCtrl* m_fmModIndex;
wxStaticText* m_staticText1341;
wxStaticText* m_staticText171;
wxTextCtrl* m_fmFsignal;
wxStaticText* m_staticText1351;
wxStaticText* m_staticText181;
wxTextCtrl* m_fmPhaseC;
wxStaticText* m_staticText1361;
wxStaticText* m_staticText201;
wxTextCtrl* m_fmPhaseS;
wxStaticText* m_staticText1371;
wxPanel* m_pwrAm;
wxStaticText* m_staticText1381;
wxTextCtrl* m_amAmplitude;
wxStaticText* m_staticText13111;
wxStaticText* m_staticText1411;
wxTextCtrl* m_amOffset;
wxStaticText* m_staticText13211;
wxStaticText* m_staticText1511;
wxTextCtrl* m_amModulatingFreq;
wxStaticText* m_staticText13311;
wxStaticText* m_staticText1611;
wxTextCtrl* m_amCarrierFreq;
wxStaticText* m_staticText13411;
wxStaticText* m_staticText1711;
wxTextCtrl* m_amSignalDelay;
wxStaticText* m_staticText13511;
wxStaticText* m_staticText1811;
wxTextCtrl* m_amPhase;
wxStaticText* m_staticText13611;
wxPanel* m_pwrTransNoise;
wxPanel* m_pwrRandom;
wxStaticText* m_staticText27111;
wxChoice* m_rnType;
wxStaticText* m_staticText26711;
wxTextCtrl* m_rnTS;
wxStaticText* m_staticText262111;
wxStaticText* m_staticText28111;
wxTextCtrl* m_rnTD;
wxStaticText* m_staticText263111;
wxStaticText* m_rnParam1Text;
wxTextCtrl* m_rnParam1;
wxStaticText* m_rnParam2Text;
wxTextCtrl* m_rnParam2;
wxPanel* m_pwrExtData;
wxRadioBox* m_pwrType;
wxStaticLine* m_staticline2;
@ -191,6 +243,7 @@ class DIALOG_SPICE_MODEL_BASE : public DIALOG_SHIM
virtual void onModelSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void onPwlAdd( wxCommandEvent& event ) { event.Skip(); }
virtual void onPwlRemove( wxCommandEvent& event ) { event.Skip(); }
virtual void onRandomSourceType( wxCommandEvent& event ) { event.Skip(); }
public: