Spice model editor dialog
This commit is contained in:
parent
3e2061158e
commit
246a43baf0
|
@ -186,6 +186,8 @@ set( EESCHEMA_SRCS
|
|||
sim/netlist_exporter_pspice_sim.cpp
|
||||
dialogs/dialog_sim_settings.cpp
|
||||
dialogs/dialog_sim_settings_base.cpp
|
||||
dialogs/dialog_spice_model.cpp
|
||||
dialogs/dialog_spice_model_base.cpp
|
||||
|
||||
netlist_exporters/netlist_exporter.cpp
|
||||
netlist_exporters/netlist_exporter_cadstar.cpp
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <sch_validators.h>
|
||||
|
||||
#include <dialog_edit_component_in_schematic_fbp.h>
|
||||
#include <dialog_spice_model.h>
|
||||
#include <netlist_exporter_pspice.h>
|
||||
|
||||
|
||||
|
@ -135,7 +136,7 @@ private:
|
|||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
void EditSpiceFields( wxCommandEvent& event );
|
||||
void EditSpiceModel( wxCommandEvent& event ) override;
|
||||
|
||||
SCH_FIELD* findField( const wxString& aFieldName );
|
||||
|
||||
|
@ -287,30 +288,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSelectChipName( wxCommandEvent& event
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::EditSpiceFields( wxCommandEvent& event )
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::EditSpiceModel( wxCommandEvent& event )
|
||||
{
|
||||
for( const auto& fieldName : NETLIST_EXPORTER_PSPICE::GetSpiceFields() )
|
||||
{
|
||||
SCH_FIELD* schField = findField( fieldName );
|
||||
// @todo move everything to the bottom, so the fields are grouped and in the same order?
|
||||
|
||||
// Do not modify the existing value, just add missing fields with default values
|
||||
if( schField == NULL )
|
||||
{
|
||||
unsigned fieldNdx = m_FieldsBuf.size();
|
||||
SCH_FIELD newField( wxPoint(), fieldNdx, m_cmp, fieldName );
|
||||
newField.SetOrientation( m_FieldsBuf[REFERENCE].GetOrientation() );
|
||||
m_FieldsBuf.push_back( newField );
|
||||
schField = &m_FieldsBuf.back();
|
||||
}
|
||||
|
||||
if( schField->GetText().IsEmpty() )
|
||||
{
|
||||
schField->SetText( NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( fieldName, m_cmp,
|
||||
NET_USE_X_PREFIX | NET_ADJUST_INCLUDE_PATHS | NET_ADJUST_PASSIVE_VALS ) );
|
||||
}
|
||||
}
|
||||
setSelectedFieldNdx( 0 );
|
||||
DIALOG_SPICE_MODEL dialog( this, *m_cmp, m_FieldsBuf );
|
||||
|
||||
if( dialog.ShowModal() == wxID_OK )
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
|
|||
|
||||
m_staticline1 = new wxStaticLine( optionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
optionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
spiceFieldsButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Add Spice fields"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
spiceFieldsButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Edit Spice model"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
optionsSizer->Add( spiceFieldsButton, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
defaultsButton = new wxButton( optionsSizer->GetStaticBox(), wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
@ -296,7 +295,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
|
|||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnInitDlg ) );
|
||||
m_buttonTestChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this );
|
||||
m_buttonSelectChipName->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this );
|
||||
spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::EditSpiceFields ), NULL, this );
|
||||
spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::EditSpiceModel ), NULL, this );
|
||||
defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
|
||||
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
|
||||
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
|
||||
|
@ -315,7 +314,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
|
|||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnInitDlg ) );
|
||||
m_buttonTestChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnTestChipName ), NULL, this );
|
||||
m_buttonSelectChipName->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSelectChipName ), NULL, this );
|
||||
spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::EditSpiceFields ), NULL, this );
|
||||
spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::EditSpiceModel ), NULL, this );
|
||||
defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this );
|
||||
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
|
||||
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
|
||||
|
|
|
@ -1312,7 +1312,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Add Spice fields</property>
|
||||
<property name="label">Edit Spice model</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -1341,7 +1341,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">EditSpiceFields</event>
|
||||
<event name="OnButtonClick">EditSpiceModel</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
|
|
|
@ -89,7 +89,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
|
|||
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnTestChipName( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSelectChipName( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void EditSpiceFields( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void EditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -0,0 +1,611 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "dialog_spice_model.h"
|
||||
#include <netlist_exporters/netlist_exporter_pspice.h>
|
||||
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
// Helper function to shorten conditions
|
||||
static bool empty( const wxTextCtrl* aCtrl )
|
||||
{
|
||||
return aCtrl->GetValue().IsEmpty();
|
||||
}
|
||||
|
||||
|
||||
// Function to sort PWL values list
|
||||
static int wxCALLBACK comparePwlValues( wxIntPtr aItem1, wxIntPtr aItem2, wxIntPtr WXUNUSED( aSortData ) )
|
||||
{
|
||||
float* t1 = reinterpret_cast<float*>( &aItem1 );
|
||||
float* t2 = reinterpret_cast<float*>( &aItem2 );
|
||||
|
||||
if( *t1 > *t2 )
|
||||
return 1;
|
||||
|
||||
if( *t1 < *t2 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aComponent, SCH_FIELDS& aFields )
|
||||
: DIALOG_SPICE_MODEL_BASE( aParent ), m_component( aComponent ), m_fields( aFields )
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
// TODO validators
|
||||
|
||||
|
||||
bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
||||
{
|
||||
if( !DIALOG_SPICE_MODEL_BASE::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
wxWindow* page = m_notebook->GetCurrentPage();
|
||||
|
||||
// Passive
|
||||
if( page == m_passive )
|
||||
{
|
||||
switch( m_pasType->GetSelection() )
|
||||
{
|
||||
case 0: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_RESISTOR; break;
|
||||
case 1: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_CAPACITOR; break;
|
||||
case 2: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_INDUCTOR; break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( false, "Unhandled passive type" );
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
m_fieldsTmp[SPICE_MODEL] = m_pasValue->GetValue();
|
||||
}
|
||||
|
||||
|
||||
// Semiconductor
|
||||
else if( page == m_semiconductor )
|
||||
{
|
||||
switch( m_semiType->GetSelection() )
|
||||
{
|
||||
case 0: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_DIODE; break;
|
||||
case 1: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_BJT; break;
|
||||
case 2: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_MOSFET; break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( false, "Unhandled semiconductor type" );
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
m_fieldsTmp[SPICE_MODEL] = m_semiModel->GetValue();
|
||||
|
||||
if( !empty( m_semiLib ) )
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = m_semiLib->GetValue();
|
||||
}
|
||||
|
||||
|
||||
// Integrated circuit
|
||||
else if( page == m_ic )
|
||||
{
|
||||
m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_SUBCKT;
|
||||
m_fieldsTmp[SPICE_MODEL] = m_icModel->GetValue();
|
||||
|
||||
if( !empty( m_icLib ) )
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = m_icLib->GetValue();
|
||||
}
|
||||
|
||||
|
||||
// Power source
|
||||
else if( page == m_power )
|
||||
{
|
||||
wxString model;
|
||||
|
||||
if( !generatePowerSource( model ) )
|
||||
return false;
|
||||
|
||||
m_fieldsTmp[SPICE_PRIMITIVE] = (char)( m_pwrType->GetSelection() ? SP_ISOURCE : SP_VSOURCE );
|
||||
m_fieldsTmp[SPICE_MODEL] = model;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( false, "Unhandled model type" );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fieldsTmp[SPICE_ENABLED] = !m_disabled->GetValue() ? "Y" : "N"; // note bool inversion
|
||||
m_fieldsTmp[SPICE_NODE_SEQUENCE] = m_nodeSeqCheck->IsChecked() ? m_nodeSeqVal->GetValue() : "";
|
||||
|
||||
// Apply the settings
|
||||
for( int i = 0; i < SPICE_FIELD_END; ++i )
|
||||
{
|
||||
if( m_fieldsTmp.count( (SPICE_FIELD) i ) > 0 && !m_fieldsTmp.at( i ).IsEmpty() )
|
||||
{
|
||||
getField( i ).SetText( m_fieldsTmp[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Erase empty fields (having empty fields causes a warning in the properties dialog)
|
||||
const wxString& spiceField = NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) i );
|
||||
|
||||
auto fieldIt = std::find_if( m_fields.begin(), m_fields.end(), [&]( const SCH_FIELD& f ) {
|
||||
return f.GetName() == spiceField;
|
||||
} );
|
||||
|
||||
if( fieldIt != m_fields.end() )
|
||||
m_fields.erase( fieldIt );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SPICE_MODEL::TransferDataToWindow()
|
||||
{
|
||||
const auto& spiceFields = NETLIST_EXPORTER_PSPICE::GetSpiceFields();
|
||||
|
||||
// Fill out the working buffer
|
||||
for( unsigned int idx = 0; idx < spiceFields.size(); ++idx )
|
||||
{
|
||||
const wxString& spiceField = spiceFields[idx];
|
||||
|
||||
auto fieldIt = std::find_if( m_fields.begin(), m_fields.end(), [&]( const SCH_FIELD& f ) {
|
||||
return f.GetName() == spiceField;
|
||||
} );
|
||||
|
||||
// Do not modify the existing value, just add missing fields with default values
|
||||
if( fieldIt != m_fields.end() && !fieldIt->GetText().IsEmpty() )
|
||||
m_fieldsTmp[idx] = fieldIt->GetText();
|
||||
else
|
||||
m_fieldsTmp[idx] = NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( (SPICE_FIELD) idx, &m_component,
|
||||
NET_USE_X_PREFIX | NET_ADJUST_INCLUDE_PATHS | NET_ADJUST_PASSIVE_VALS );
|
||||
}
|
||||
|
||||
// Analyze the component fields to fill out the dialog
|
||||
char primitive = toupper( m_fieldsTmp[SPICE_PRIMITIVE][0] );
|
||||
|
||||
switch( primitive )
|
||||
{
|
||||
case SP_RESISTOR:
|
||||
case SP_CAPACITOR:
|
||||
case SP_INDUCTOR:
|
||||
m_notebook->SetSelection( m_notebook->FindPage( m_passive ) );
|
||||
m_pasType->SetSelection( primitive == SP_RESISTOR ? 0
|
||||
: primitive == SP_CAPACITOR ? 1
|
||||
: primitive == SP_INDUCTOR ? 2
|
||||
: -1 );
|
||||
m_pasValue->SetValue( m_fieldsTmp[SPICE_MODEL] );
|
||||
break;
|
||||
|
||||
case SP_DIODE:
|
||||
case SP_BJT:
|
||||
case SP_MOSFET:
|
||||
m_notebook->SetSelection( m_notebook->FindPage( m_semiconductor ) );
|
||||
m_semiType->SetSelection( primitive == SP_DIODE ? 0
|
||||
: primitive == SP_BJT ? 1
|
||||
: primitive == SP_MOSFET ? 2
|
||||
: -1 );
|
||||
m_semiModel->SetValue( m_fieldsTmp[SPICE_MODEL] );
|
||||
m_semiLib->SetValue( m_fieldsTmp[SPICE_LIB_FILE] );
|
||||
|
||||
if( !empty( m_semiLib ) )
|
||||
{
|
||||
const wxString& libFile = m_semiLib->GetValue();
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = libFile;
|
||||
updateFromFile( m_semiModel, libFile, "model" );
|
||||
}
|
||||
break;
|
||||
|
||||
case SP_SUBCKT:
|
||||
m_notebook->SetSelection( m_notebook->FindPage( m_ic ) );
|
||||
m_icModel->SetValue( m_fieldsTmp[SPICE_MODEL] );
|
||||
m_icLib->SetValue( m_fieldsTmp[SPICE_LIB_FILE] );
|
||||
|
||||
if( !empty( m_icLib ) )
|
||||
{
|
||||
const wxString& libFile = m_icLib->GetValue();
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = libFile;
|
||||
updateFromFile( m_icModel, libFile, "subckt" );
|
||||
}
|
||||
break;
|
||||
|
||||
case SP_VSOURCE:
|
||||
case SP_ISOURCE:
|
||||
if( !parsePowerSource( m_fieldsTmp[SPICE_MODEL] ) )
|
||||
return false;
|
||||
|
||||
m_notebook->SetSelection( m_notebook->FindPage( m_power ) );
|
||||
m_pwrType->SetSelection( primitive == SP_ISOURCE ? 1 : 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( false, "Unhandled Spice primitive type" );
|
||||
break;
|
||||
}
|
||||
|
||||
m_disabled->SetValue( !NETLIST_EXPORTER_PSPICE::StringToBool( m_fieldsTmp[SPICE_ENABLED] ) );
|
||||
|
||||
// Check if node sequence is different than the default one
|
||||
if( m_fieldsTmp[SPICE_NODE_SEQUENCE]
|
||||
!= NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_NODE_SEQUENCE, &m_component, 0 ) )
|
||||
{
|
||||
m_nodeSeqCheck->SetValue( true );
|
||||
m_nodeSeqVal->SetValue( m_fieldsTmp[SPICE_NODE_SEQUENCE] );
|
||||
}
|
||||
|
||||
return DIALOG_SPICE_MODEL_BASE::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
|
||||
{
|
||||
if( aModel.IsEmpty() )
|
||||
return false;
|
||||
|
||||
// Variables used for generic values processing (filling out wxTextCtrls in sequence)
|
||||
bool genericProcessing = false;
|
||||
unsigned int genericReqParamsCount = 0;
|
||||
std::vector<wxTextCtrl*> genericControls;
|
||||
|
||||
wxStringTokenizer tokenizer( aModel, " ()" );
|
||||
wxString tkn = tokenizer.GetNextToken().Lower();
|
||||
|
||||
try
|
||||
{
|
||||
if( tkn == "dc" )
|
||||
{
|
||||
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrGeneric ) );
|
||||
tkn = tokenizer.GetNextToken().Lower();
|
||||
|
||||
// it might be an optional "dc" or "trans" directive
|
||||
if( tkn == "dc" || tkn == "trans" )
|
||||
tkn = tokenizer.GetNextToken().Lower();
|
||||
|
||||
// DC value
|
||||
m_genDc->SetValue( SPICE_VALUE( tkn ).ToString() );
|
||||
|
||||
if( !tokenizer.HasMoreTokens() )
|
||||
return true;
|
||||
|
||||
tkn = tokenizer.GetNextToken().Lower();
|
||||
|
||||
if( tkn != "ac" )
|
||||
return false;
|
||||
|
||||
// AC magnitude
|
||||
tkn = tokenizer.GetNextToken().Lower();
|
||||
m_genAcMag->SetValue( SPICE_VALUE( tkn ).ToString() );
|
||||
|
||||
// AC phase
|
||||
tkn = tokenizer.GetNextToken().Lower();
|
||||
m_genAcMag->SetValue( SPICE_VALUE( tkn ).ToString() );
|
||||
}
|
||||
|
||||
|
||||
else if( tkn == "pulse" )
|
||||
{
|
||||
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrPulse ) );
|
||||
|
||||
genericProcessing = true;
|
||||
genericReqParamsCount = 2;
|
||||
genericControls = { m_pulseInit, m_pulseNominal, m_pulseDelay,
|
||||
m_pulseRise, m_pulseFall, m_pulseWidth, m_pulsePeriod };
|
||||
}
|
||||
|
||||
|
||||
else if( tkn == "sin" )
|
||||
{
|
||||
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrSin ) );
|
||||
|
||||
genericProcessing = true;
|
||||
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 ) );
|
||||
|
||||
genericProcessing = true;
|
||||
genericReqParamsCount = 2;
|
||||
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 ) );
|
||||
|
||||
while( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
tkn = tokenizer.GetNextToken();
|
||||
SPICE_VALUE time( tkn );
|
||||
|
||||
tkn = tokenizer.GetNextToken();
|
||||
SPICE_VALUE value( tkn );
|
||||
|
||||
addPwlValue( time.ToString(), value.ToString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
// Unhandled power source type
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( genericProcessing )
|
||||
{
|
||||
for( unsigned int i = 0; i < genericControls.size(); ++i )
|
||||
{
|
||||
// If there are no more tokens, let's check if we got at least required fields
|
||||
if( !tokenizer.HasMoreTokens() )
|
||||
return ( i >= genericReqParamsCount );
|
||||
|
||||
tkn = tokenizer.GetNextToken().Lower();
|
||||
genericControls[i]->SetValue( SPICE_VALUE( tkn ).ToString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
// Nothing, the dialog simply will not be filled
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
|
||||
{
|
||||
wxString res;
|
||||
wxWindow* page = m_powerNotebook->GetCurrentPage();
|
||||
|
||||
// Variables for generic processing
|
||||
bool genericProcessing = false;
|
||||
unsigned int genericReqParamsCount = 0;
|
||||
std::vector<wxTextCtrl*> genericControls;
|
||||
|
||||
if( page == m_pwrGeneric )
|
||||
{
|
||||
if( empty( m_genDc ) && empty( m_genAcMag ) )
|
||||
return false;
|
||||
|
||||
if( !empty( m_genDc ) )
|
||||
res += wxString::Format( "dc %s", m_genDc->GetValue() );
|
||||
|
||||
if( !empty( m_genAcMag ) )
|
||||
{
|
||||
res += wxString::Format( " ac %s", m_genAcMag->GetValue() );
|
||||
|
||||
if( !empty( m_genAcPhase ) )
|
||||
res += wxString::Format( " %s", m_genAcPhase->GetValue() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if( page == m_pwrPulse )
|
||||
{
|
||||
genericProcessing = true;
|
||||
res = "pulse";
|
||||
genericReqParamsCount = 2;
|
||||
genericControls = { m_pulseInit, m_pulseNominal, m_pulseDelay,
|
||||
m_pulseRise, m_pulseFall, m_pulseWidth, m_pulsePeriod };
|
||||
}
|
||||
|
||||
|
||||
else if( page == m_pwrSin )
|
||||
{
|
||||
genericProcessing = true;
|
||||
res = "sin";
|
||||
genericReqParamsCount = 2;
|
||||
genericControls = { m_sinOffset, m_sinAmplitude, m_sinFreq, m_sinDelay, m_sinDampFactor };
|
||||
}
|
||||
|
||||
|
||||
else if( page == m_pwrExp )
|
||||
{
|
||||
genericProcessing = true;
|
||||
res = "exp";
|
||||
genericReqParamsCount = 2;
|
||||
genericControls = { m_expInit, m_expPulsed,
|
||||
m_expRiseDelay, m_expRiseConst, m_expFallDelay, m_expFallConst };
|
||||
}
|
||||
|
||||
|
||||
else if( page == m_pwrPwl )
|
||||
{
|
||||
res = "pwl(";
|
||||
|
||||
for( int i = 0; i < m_pwlValList->GetItemCount(); ++i )
|
||||
{
|
||||
res += wxString::Format( "%s %s ", m_pwlValList->GetItemText( i, m_pwlTimeCol ),
|
||||
m_pwlValList->GetItemText( i, m_pwlValueCol ) );
|
||||
}
|
||||
|
||||
res += ")";
|
||||
}
|
||||
|
||||
if( genericProcessing )
|
||||
{
|
||||
unsigned int paramCounter = 0;
|
||||
|
||||
res += "(";
|
||||
|
||||
for( auto textCtrl : genericControls )
|
||||
{
|
||||
if( empty( textCtrl ) )
|
||||
{
|
||||
if( paramCounter < genericReqParamsCount )
|
||||
return false;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
res += wxString::Format( "%s ", textCtrl->GetValue() );
|
||||
++paramCounter;
|
||||
}
|
||||
|
||||
res += ")";
|
||||
}
|
||||
|
||||
aTarget = res;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SPICE_MODEL::updateFromFile( wxComboBox* aComboBox,
|
||||
const wxString& aFilePath, const wxString& aKeyword )
|
||||
{
|
||||
wxString curValue = aComboBox->GetValue();
|
||||
const wxString keyword( aKeyword.Lower() );
|
||||
wxTextFile file;
|
||||
|
||||
if( !file.Open( aFilePath ) )
|
||||
return;
|
||||
|
||||
aComboBox->Clear();
|
||||
|
||||
// Process the file, looking for components
|
||||
for( wxString line = file.GetFirstLine().Lower(); !file.Eof(); line = file.GetNextLine().Lower() )
|
||||
{
|
||||
int idx = line.Find( keyword );
|
||||
|
||||
if( idx != wxNOT_FOUND )
|
||||
{
|
||||
wxString data = line.Mid( idx );
|
||||
data = data.AfterFirst( ' ' );
|
||||
data = data.BeforeFirst( ' ' );
|
||||
data = data.Trim();
|
||||
|
||||
if( !data.IsEmpty() )
|
||||
aComboBox->Append( data );
|
||||
}
|
||||
}
|
||||
|
||||
// Restore the previous value
|
||||
if( !curValue.IsEmpty() )
|
||||
aComboBox->SetValue( curValue );
|
||||
else if( aComboBox->GetCount() > 0 )
|
||||
aComboBox->SetSelection( 0 );
|
||||
}
|
||||
|
||||
|
||||
SCH_FIELD& DIALOG_SPICE_MODEL::getField( int aFieldType )
|
||||
{
|
||||
const wxString& spiceField = NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) aFieldType );
|
||||
|
||||
auto fieldIt = std::find_if( m_fields.begin(), m_fields.end(), [&]( const SCH_FIELD& f ) {
|
||||
return f.GetName() == spiceField;
|
||||
} );
|
||||
|
||||
// Found one, so return it
|
||||
if( fieldIt != m_fields.end() )
|
||||
return *fieldIt;
|
||||
|
||||
// Create a new field with requested name
|
||||
m_fields.emplace_back( wxPoint(), m_fields.size(), &m_component, spiceField );
|
||||
return m_fields.back();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_SPICE_MODEL::addPwlValue( const wxString& aTime, const wxString& aValue )
|
||||
{
|
||||
// TODO execute validators
|
||||
if( aTime.IsEmpty() || aValue.IsEmpty() )
|
||||
return false;
|
||||
|
||||
long idx = m_pwlValList->InsertItem( m_pwlTimeCol, aTime );
|
||||
m_pwlValList->SetItem( idx, m_pwlValueCol, aValue );
|
||||
|
||||
// There is no wxString::ToFloat, but we need to guarantee it fits in 4 bytes
|
||||
double timeD;
|
||||
float timeF;
|
||||
m_pwlTime->GetValue().ToDouble( &timeD );
|
||||
timeF = timeD;
|
||||
|
||||
// Store the time value, so the entries can be sorted
|
||||
m_pwlValList->SetItemData( idx, *reinterpret_cast<long*>( &timeF ) );
|
||||
|
||||
// Sort items by timestamp
|
||||
m_pwlValList->SortItems( comparePwlValues, -1 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SPICE_MODEL::onSemiSelectLib( wxCommandEvent& event )
|
||||
{
|
||||
wxFileDialog openDlg( this, wxT( "Select library" ),
|
||||
wxFileName( m_semiLib->GetValue() ).GetPath(), "",
|
||||
"Spice library file (*.lib)|*.lib;*.LIB|Any file|*",
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( openDlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
m_semiLib->SetValue( openDlg.GetPath() );
|
||||
updateFromFile( m_semiModel, openDlg.GetPath(), "model" );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SPICE_MODEL::onSelectIcLib( wxCommandEvent& event )
|
||||
{
|
||||
wxFileDialog openDlg( this, wxT( "Select library" ),
|
||||
wxFileName( m_icLib->GetValue() ).GetPath(), "",
|
||||
"Spice library file (*.lib)|*.lib;*.LIB|Any file|*",
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( openDlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
m_icLib->SetValue( openDlg.GetPath() );
|
||||
updateFromFile( m_icModel, openDlg.GetPath(), "subckt" );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SPICE_MODEL::onPwlAdd( wxCommandEvent& event )
|
||||
{
|
||||
addPwlValue( m_pwlTime->GetValue(), m_pwlValue->GetValue() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_SPICE_MODEL::onPwlRemove( wxCommandEvent& event )
|
||||
{
|
||||
long idx = m_pwlValList->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
||||
m_pwlValList->DeleteItem( idx );
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_SPICE_MODEL_H
|
||||
#define DIALOG_SPICE_MODEL_H
|
||||
|
||||
#include "dialog_spice_model_base.h"
|
||||
#include <sch_component.h>
|
||||
|
||||
class DIALOG_SPICE_MODEL : public DIALOG_SPICE_MODEL_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aComponent, SCH_FIELDS& aSchFields );
|
||||
|
||||
private:
|
||||
/**
|
||||
* Parse a string describing a power source, so appropriate settings are checked in the dialog
|
||||
* @param aModel contains the string to be parse (e.g. sin(0 1 10k))
|
||||
* @return True if the input string was parsed without errors.
|
||||
*/
|
||||
bool parsePowerSource( const wxString& aModel );
|
||||
|
||||
/**
|
||||
* Generates a string to describe power source parameters, basing on the current selection.
|
||||
* If there are missing fields, it will not modify the target string.
|
||||
* @param aTarget is the destination for the generated string.
|
||||
* @return True if the string was saved successfully.
|
||||
*/
|
||||
bool generatePowerSource( wxString& aTarget ) const;
|
||||
|
||||
/**
|
||||
* Loads a list of components from a file and adds them to a combo box.
|
||||
* @param aComboBox is the target combo box
|
||||
* @param aFilePath is the file to be processed
|
||||
* @param aKeyword is the keyword to select the type of components (e.g. "subckt" or "model")
|
||||
*/
|
||||
void updateFromFile( wxComboBox* aComboBox, const wxString& aFilePath, const wxString& aKeyword );
|
||||
|
||||
/**
|
||||
* Returns or creates a field in the edited schematic fields vector.
|
||||
* @param aFieldType is an SPICE_FIELD enum value.
|
||||
* @return Requested field.
|
||||
*/
|
||||
SCH_FIELD& getField( int aFieldType );
|
||||
|
||||
/**
|
||||
* Adds a value to the PWL values list.
|
||||
* @param aTime is the time value.
|
||||
* @param aValue is the source value at the given time.
|
||||
* @return True if request has completed successfully, false if the data is invalid.
|
||||
*/
|
||||
bool addPwlValue( const wxString& aTime, const wxString& aValue );
|
||||
|
||||
bool TransferDataFromWindow() override;
|
||||
bool TransferDataToWindow() override;
|
||||
|
||||
// Event handlers
|
||||
void onSemiSelectLib( wxCommandEvent& event ) override;
|
||||
void onSelectIcLib( wxCommandEvent& event ) override;
|
||||
void onPwlAdd( wxCommandEvent& event ) override;
|
||||
void onPwlRemove( wxCommandEvent& event ) override;
|
||||
|
||||
///> Edited component
|
||||
SCH_COMPONENT& m_component;
|
||||
|
||||
///> Fields from the component properties dialog
|
||||
SCH_FIELDS& m_fields;
|
||||
|
||||
///> Temporary field values
|
||||
std::map<int, wxString> m_fieldsTmp;
|
||||
|
||||
///> Column identifiers for PWL power source value list
|
||||
long m_pwlTimeCol, m_pwlValueCol;
|
||||
};
|
||||
|
||||
#endif /* DIALOG_SPICE_MODEL_H */
|
|
@ -0,0 +1,473 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 24 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_spice_model_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizer1;
|
||||
bSizer1 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_passive = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer1;
|
||||
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer1->AddGrowableCol( 0 );
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText2 = new wxStaticText( m_passive, wxID_ANY, _("Type"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText2->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pasType = new wxComboBox( m_passive, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
m_pasType->Append( _("Resistor") );
|
||||
m_pasType->Append( _("Capacitor") );
|
||||
m_pasType->Append( _("Inductor") );
|
||||
fgSizer1->Add( m_pasType, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText3 = new wxStaticText( m_passive, wxID_ANY, _("Value"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText3->Wrap( -1 );
|
||||
fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pasValue = new wxTextCtrl( m_passive, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pasValue->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer1->Add( m_pasValue, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_passive->SetSizer( fgSizer1 );
|
||||
m_passive->Layout();
|
||||
fgSizer1->Fit( m_passive );
|
||||
m_notebook->AddPage( m_passive, _("Passive"), true );
|
||||
m_semiconductor = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer3;
|
||||
fgSizer3 = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizer3->AddGrowableCol( 0 );
|
||||
fgSizer3->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText4 = new wxStaticText( m_semiconductor, wxID_ANY, _("Type"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText4->Wrap( -1 );
|
||||
fgSizer3->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_semiType = new wxComboBox( m_semiconductor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
m_semiType->Append( _("Diode") );
|
||||
m_semiType->Append( _("Bipolar transistor (BJT)") );
|
||||
m_semiType->Append( _("MOSFET") );
|
||||
fgSizer3->Add( m_semiType, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticText5 = new wxStaticText( m_semiconductor, wxID_ANY, _("Model"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText5->Wrap( -1 );
|
||||
fgSizer3->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_semiModel = new wxComboBox( m_semiconductor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
fgSizer3->Add( m_semiModel, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticText7 = new wxStaticText( m_semiconductor, wxID_ANY, _("Library"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText7->Wrap( -1 );
|
||||
fgSizer3->Add( m_staticText7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_semiLib = new wxTextCtrl( m_semiconductor, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
fgSizer3->Add( m_semiLib, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_semiSelectLib = new wxButton( m_semiconductor, wxID_ANY, _("Select file..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer3->Add( m_semiSelectLib, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
m_semiconductor->SetSizer( fgSizer3 );
|
||||
m_semiconductor->Layout();
|
||||
fgSizer3->Fit( m_semiconductor );
|
||||
m_notebook->AddPage( m_semiconductor, _("Semiconductor"), false );
|
||||
m_ic = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer4;
|
||||
fgSizer4 = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizer4->AddGrowableCol( 0 );
|
||||
fgSizer4->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText8 = new wxStaticText( m_ic, wxID_ANY, _("Model"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText8->Wrap( -1 );
|
||||
fgSizer4->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_icModel = new wxComboBox( m_ic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
m_icModel->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer4->Add( m_icModel, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticText9 = new wxStaticText( m_ic, wxID_ANY, _("Library"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText9->Wrap( -1 );
|
||||
fgSizer4->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_icLib = new wxTextCtrl( m_ic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
fgSizer4->Add( m_icLib, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_icSelectLib = new wxButton( m_ic, wxID_ANY, _("Select file..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer4->Add( m_icSelectLib, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_ic->SetSizer( fgSizer4 );
|
||||
m_ic->Layout();
|
||||
fgSizer4->Fit( m_ic );
|
||||
m_notebook->AddPage( m_ic, _("Integrated circuit"), false );
|
||||
m_power = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_powerNotebook = new wxNotebook( m_power, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pwrGeneric = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer6;
|
||||
fgSizer6 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer6->AddGrowableCol( 0 );
|
||||
fgSizer6->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText10 = new wxStaticText( m_pwrGeneric, wxID_ANY, _("DC [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText10->Wrap( -1 );
|
||||
fgSizer6->Add( m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_genDc = new wxTextCtrl( m_pwrGeneric, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_genDc->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer6->Add( m_genDc, 0, wxALL, 5 );
|
||||
|
||||
m_staticText11 = new wxStaticText( m_pwrGeneric, wxID_ANY, _("AC magnitude [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText11->Wrap( -1 );
|
||||
fgSizer6->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_genAcMag = new wxTextCtrl( m_pwrGeneric, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer6->Add( m_genAcMag, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText12 = new wxStaticText( m_pwrGeneric, wxID_ANY, _("AC phase [rad]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText12->Wrap( -1 );
|
||||
fgSizer6->Add( m_staticText12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_genAcPhase = new wxTextCtrl( m_pwrGeneric, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer6->Add( m_genAcPhase, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_pwrGeneric->SetSizer( fgSizer6 );
|
||||
m_pwrGeneric->Layout();
|
||||
fgSizer6->Fit( m_pwrGeneric );
|
||||
m_powerNotebook->AddPage( m_pwrGeneric, _("Generic"), true );
|
||||
m_pwrPulse = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer7;
|
||||
fgSizer7 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer7->AddGrowableCol( 0 );
|
||||
fgSizer7->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText13 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Initial value [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText13->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulseInit = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pulseInit->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer7->Add( m_pulseInit, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText14 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Pulsed value [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText14->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulseNominal = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer7->Add( m_pulseNominal, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText15 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Delay time [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText15->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulseDelay = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer7->Add( m_pulseDelay, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText16 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Rise time [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText16->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText16, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulseRise = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer7->Add( m_pulseRise, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText17 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Fall time [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText17->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulseFall = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer7->Add( m_pulseFall, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText18 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Pulse width [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText18->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulseWidth = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer7->Add( m_pulseWidth, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText20 = new wxStaticText( m_pwrPulse, wxID_ANY, _("Period [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText20->Wrap( -1 );
|
||||
fgSizer7->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pulsePeriod = new wxTextCtrl( m_pwrPulse, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer7->Add( m_pulsePeriod, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_pwrPulse->SetSizer( fgSizer7 );
|
||||
m_pwrPulse->Layout();
|
||||
fgSizer7->Fit( m_pwrPulse );
|
||||
m_powerNotebook->AddPage( m_pwrPulse, _("Pulse"), false );
|
||||
m_pwrSin = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer8;
|
||||
fgSizer8 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer8->AddGrowableCol( 0 );
|
||||
fgSizer8->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer8->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText21 = new wxStaticText( m_pwrSin, wxID_ANY, _("DC offset [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText21->Wrap( -1 );
|
||||
fgSizer8->Add( m_staticText21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_sinOffset = new wxTextCtrl( m_pwrSin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_sinOffset->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer8->Add( m_sinOffset, 0, wxALL, 5 );
|
||||
|
||||
m_staticText22 = new wxStaticText( m_pwrSin, wxID_ANY, _("Amplitude [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText22->Wrap( -1 );
|
||||
fgSizer8->Add( m_staticText22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_sinAmplitude = new wxTextCtrl( m_pwrSin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer8->Add( m_sinAmplitude, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText23 = new wxStaticText( m_pwrSin, wxID_ANY, _("Frequency [Hz]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText23->Wrap( -1 );
|
||||
fgSizer8->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_sinFreq = new wxTextCtrl( m_pwrSin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer8->Add( m_sinFreq, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText24 = new wxStaticText( m_pwrSin, wxID_ANY, _("Delay [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText24->Wrap( -1 );
|
||||
fgSizer8->Add( m_staticText24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_sinDelay = new wxTextCtrl( m_pwrSin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer8->Add( m_sinDelay, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText25 = new wxStaticText( m_pwrSin, wxID_ANY, _("Damping factor [1/s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText25->Wrap( -1 );
|
||||
fgSizer8->Add( m_staticText25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_sinDampFactor = new wxTextCtrl( m_pwrSin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer8->Add( m_sinDampFactor, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_pwrSin->SetSizer( fgSizer8 );
|
||||
m_pwrSin->Layout();
|
||||
fgSizer8->Fit( m_pwrSin );
|
||||
m_powerNotebook->AddPage( m_pwrSin, _("Sinusoidal"), false );
|
||||
m_pwrExp = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxFlexGridSizer* fgSizer9;
|
||||
fgSizer9 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer9->AddGrowableCol( 0 );
|
||||
fgSizer9->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText26 = new wxStaticText( m_pwrExp, wxID_ANY, _("Initial value [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText26->Wrap( -1 );
|
||||
fgSizer9->Add( m_staticText26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_expInit = new wxTextCtrl( m_pwrExp, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_expInit->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer9->Add( m_expInit, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText27 = new wxStaticText( m_pwrExp, wxID_ANY, _("Pulsed value [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText27->Wrap( -1 );
|
||||
fgSizer9->Add( m_staticText27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_expPulsed = new wxTextCtrl( m_pwrExp, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer9->Add( m_expPulsed, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText28 = new wxStaticText( m_pwrExp, wxID_ANY, _("Rise delay time [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText28->Wrap( -1 );
|
||||
fgSizer9->Add( m_staticText28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_expRiseDelay = new wxTextCtrl( m_pwrExp, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer9->Add( m_expRiseDelay, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText29 = new wxStaticText( m_pwrExp, wxID_ANY, _("Rise time constant [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText29->Wrap( -1 );
|
||||
fgSizer9->Add( m_staticText29, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_expRiseConst = new wxTextCtrl( m_pwrExp, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer9->Add( m_expRiseConst, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText30 = new wxStaticText( m_pwrExp, wxID_ANY, _("Fall delay time [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText30->Wrap( -1 );
|
||||
fgSizer9->Add( m_staticText30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_expFallDelay = new wxTextCtrl( m_pwrExp, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer9->Add( m_expFallDelay, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText31 = new wxStaticText( m_pwrExp, wxID_ANY, _("Fall time constant [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText31->Wrap( -1 );
|
||||
fgSizer9->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_expFallConst = new wxTextCtrl( m_pwrExp, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer9->Add( m_expFallConst, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_pwrExp->SetSizer( fgSizer9 );
|
||||
m_pwrExp->Layout();
|
||||
fgSizer9->Fit( m_pwrExp );
|
||||
m_powerNotebook->AddPage( m_pwrExp, _("Exponential"), false );
|
||||
m_pwrPwl = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_pwrPwl->SetToolTip( _("Piece-wise linear") );
|
||||
|
||||
wxFlexGridSizer* fgSizer15;
|
||||
fgSizer15 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer15->AddGrowableCol( 0 );
|
||||
fgSizer15->AddGrowableRow( 1 );
|
||||
fgSizer15->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer15->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
|
||||
|
||||
wxFlexGridSizer* fgSizer10;
|
||||
fgSizer10 = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
fgSizer10->AddGrowableCol( 0 );
|
||||
fgSizer10->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer10->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticText34 = new wxStaticText( m_pwrPwl, wxID_ANY, _("Time [s]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText34->Wrap( -1 );
|
||||
fgSizer10->Add( m_staticText34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pwlTime = new wxTextCtrl( m_pwrPwl, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pwlTime->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer10->Add( m_pwlTime, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_staticText35 = new wxStaticText( m_pwrPwl, wxID_ANY, _("Value [V/A]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText35->Wrap( -1 );
|
||||
fgSizer10->Add( m_staticText35, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pwlValue = new wxTextCtrl( m_pwrPwl, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer10->Add( m_pwlValue, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer15->Add( fgSizer10, 1, wxEXPAND, 5 );
|
||||
|
||||
m_pwlAddButton = new wxButton( m_pwrPwl, wxID_ANY, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer15->Add( m_pwlAddButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_pwlValList = new wxListCtrl( m_pwrPwl, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
|
||||
m_pwlValList->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
fgSizer15->Add( m_pwlValList, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_pwlRemoveBtn = new wxButton( m_pwrPwl, wxID_ANY, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer15->Add( m_pwlRemoveBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
m_pwrPwl->SetSizer( fgSizer15 );
|
||||
m_pwrPwl->Layout();
|
||||
fgSizer15->Fit( m_pwrPwl );
|
||||
m_powerNotebook->AddPage( m_pwrPwl, _("PWL"), false );
|
||||
m_pwrFm = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_pwrFm->Hide();
|
||||
|
||||
m_powerNotebook->AddPage( m_pwrFm, _("FM"), false );
|
||||
m_pwrAm = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_pwrAm->Hide();
|
||||
|
||||
m_powerNotebook->AddPage( m_pwrAm, _("AM"), false );
|
||||
m_pwrTransNoise = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_pwrTransNoise->Hide();
|
||||
|
||||
m_powerNotebook->AddPage( m_pwrTransNoise, _("Transient noise"), false );
|
||||
m_pwrRandom = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_pwrRandom->Hide();
|
||||
|
||||
m_powerNotebook->AddPage( m_pwrRandom, _("Random"), false );
|
||||
m_pwrExtData = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_pwrExtData->Hide();
|
||||
|
||||
m_powerNotebook->AddPage( m_pwrExtData, _("External data"), false );
|
||||
|
||||
bSizer4->Add( m_powerNotebook, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxString m_pwrTypeChoices[] = { _("Voltage"), _("Current") };
|
||||
int m_pwrTypeNChoices = sizeof( m_pwrTypeChoices ) / sizeof( wxString );
|
||||
m_pwrType = new wxRadioBox( m_power, wxID_ANY, _("Source type"), wxDefaultPosition, wxDefaultSize, m_pwrTypeNChoices, m_pwrTypeChoices, 1, wxRA_SPECIFY_ROWS );
|
||||
m_pwrType->SetSelection( 0 );
|
||||
bSizer4->Add( m_pwrType, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_power->SetSizer( bSizer4 );
|
||||
m_power->Layout();
|
||||
bSizer4->Fit( m_power );
|
||||
m_notebook->AddPage( m_power, _("Power source"), false );
|
||||
|
||||
bSizer1->Add( m_notebook, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_disabled = new wxCheckBox( this, wxID_ANY, _("Disable component for simulation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer1->Add( m_disabled, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_nodeSeqCheck = new wxCheckBox( this, wxID_ANY, _("Alternate node sequence:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer2->Add( m_nodeSeqCheck, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_nodeSeqVal = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_nodeSeqVal->SetMinSize( wxSize( 200,-1 ) );
|
||||
|
||||
bSizer2->Add( m_nodeSeqVal, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer1->Add( bSizer2, 0, wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizer1->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer1 );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_semiSelectLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSemiSelectLib ), NULL, this );
|
||||
m_icSelectLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSelectIcLib ), 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 );
|
||||
}
|
||||
|
||||
DIALOG_SPICE_MODEL_BASE::~DIALOG_SPICE_MODEL_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_semiSelectLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSemiSelectLib ), NULL, this );
|
||||
m_icSelectLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSelectIcLib ), 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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,148 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 24 2016)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_SPICE_MODEL_BASE_H__
|
||||
#define __DIALOG_SPICE_MODEL_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_SPICE_MODEL_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_SPICE_MODEL_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_notebook;
|
||||
wxPanel* m_passive;
|
||||
wxStaticText* m_staticText2;
|
||||
wxComboBox* m_pasType;
|
||||
wxStaticText* m_staticText3;
|
||||
wxTextCtrl* m_pasValue;
|
||||
wxPanel* m_semiconductor;
|
||||
wxStaticText* m_staticText4;
|
||||
wxComboBox* m_semiType;
|
||||
wxStaticText* m_staticText5;
|
||||
wxComboBox* m_semiModel;
|
||||
wxStaticText* m_staticText7;
|
||||
wxTextCtrl* m_semiLib;
|
||||
wxButton* m_semiSelectLib;
|
||||
wxPanel* m_ic;
|
||||
wxStaticText* m_staticText8;
|
||||
wxComboBox* m_icModel;
|
||||
wxStaticText* m_staticText9;
|
||||
wxTextCtrl* m_icLib;
|
||||
wxButton* m_icSelectLib;
|
||||
wxPanel* m_power;
|
||||
wxNotebook* m_powerNotebook;
|
||||
wxPanel* m_pwrGeneric;
|
||||
wxStaticText* m_staticText10;
|
||||
wxTextCtrl* m_genDc;
|
||||
wxStaticText* m_staticText11;
|
||||
wxTextCtrl* m_genAcMag;
|
||||
wxStaticText* m_staticText12;
|
||||
wxTextCtrl* m_genAcPhase;
|
||||
wxPanel* m_pwrPulse;
|
||||
wxStaticText* m_staticText13;
|
||||
wxTextCtrl* m_pulseInit;
|
||||
wxStaticText* m_staticText14;
|
||||
wxTextCtrl* m_pulseNominal;
|
||||
wxStaticText* m_staticText15;
|
||||
wxTextCtrl* m_pulseDelay;
|
||||
wxStaticText* m_staticText16;
|
||||
wxTextCtrl* m_pulseRise;
|
||||
wxStaticText* m_staticText17;
|
||||
wxTextCtrl* m_pulseFall;
|
||||
wxStaticText* m_staticText18;
|
||||
wxTextCtrl* m_pulseWidth;
|
||||
wxStaticText* m_staticText20;
|
||||
wxTextCtrl* m_pulsePeriod;
|
||||
wxPanel* m_pwrSin;
|
||||
wxStaticText* m_staticText21;
|
||||
wxTextCtrl* m_sinOffset;
|
||||
wxStaticText* m_staticText22;
|
||||
wxTextCtrl* m_sinAmplitude;
|
||||
wxStaticText* m_staticText23;
|
||||
wxTextCtrl* m_sinFreq;
|
||||
wxStaticText* m_staticText24;
|
||||
wxTextCtrl* m_sinDelay;
|
||||
wxStaticText* m_staticText25;
|
||||
wxTextCtrl* m_sinDampFactor;
|
||||
wxPanel* m_pwrExp;
|
||||
wxStaticText* m_staticText26;
|
||||
wxTextCtrl* m_expInit;
|
||||
wxStaticText* m_staticText27;
|
||||
wxTextCtrl* m_expPulsed;
|
||||
wxStaticText* m_staticText28;
|
||||
wxTextCtrl* m_expRiseDelay;
|
||||
wxStaticText* m_staticText29;
|
||||
wxTextCtrl* m_expRiseConst;
|
||||
wxStaticText* m_staticText30;
|
||||
wxTextCtrl* m_expFallDelay;
|
||||
wxStaticText* m_staticText31;
|
||||
wxTextCtrl* m_expFallConst;
|
||||
wxPanel* m_pwrPwl;
|
||||
wxStaticText* m_staticText34;
|
||||
wxTextCtrl* m_pwlTime;
|
||||
wxStaticText* m_staticText35;
|
||||
wxTextCtrl* m_pwlValue;
|
||||
wxButton* m_pwlAddButton;
|
||||
wxListCtrl* m_pwlValList;
|
||||
wxButton* m_pwlRemoveBtn;
|
||||
wxPanel* m_pwrFm;
|
||||
wxPanel* m_pwrAm;
|
||||
wxPanel* m_pwrTransNoise;
|
||||
wxPanel* m_pwrRandom;
|
||||
wxPanel* m_pwrExtData;
|
||||
wxRadioBox* m_pwrType;
|
||||
wxCheckBox* m_disabled;
|
||||
wxCheckBox* m_nodeSeqCheck;
|
||||
wxTextCtrl* m_nodeSeqVal;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onSemiSelectLib( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onSelectIcLib( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onPwlAdd( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onPwlRemove( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 425,630 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~DIALOG_SPICE_MODEL_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_SPICE_MODEL_BASE_H__
|
|
@ -45,7 +45,20 @@ enum SPICE_FIELD {
|
|||
SPICE_MODEL,
|
||||
SPICE_ENABLED,
|
||||
SPICE_NODE_SEQUENCE,
|
||||
SPICE_LIB_FILE
|
||||
SPICE_LIB_FILE,
|
||||
SPICE_FIELD_END // sentinel
|
||||
};
|
||||
|
||||
enum SPICE_PRIMITIVE {
|
||||
SP_RESISTOR = 'R',
|
||||
SP_CAPACITOR = 'C',
|
||||
SP_INDUCTOR = 'L',
|
||||
SP_DIODE = 'D',
|
||||
SP_BJT = 'Q',
|
||||
SP_MOSFET = 'M',
|
||||
SP_SUBCKT = 'X',
|
||||
SP_VSOURCE = 'V',
|
||||
SP_ISOURCE = 'I'
|
||||
};
|
||||
|
||||
/// @todo add NET_ADJUST_INCLUDE_PATHS & NET_ADJUST_PASSIVE_VALS checkboxes in the netlist export dialog
|
||||
|
|
Loading…
Reference in New Issue