Erc for simulation models.
This commit is contained in:
parent
95ebfeeed1
commit
8fc08b9185
|
@ -519,6 +519,12 @@ void DIALOG_ERC::testErc()
|
|||
tester.TestTextVars( m_parent->GetCanvas()->GetView()->GetDrawingSheet() );
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_SIMULATION_MODEL ) )
|
||||
{
|
||||
AdvancePhase( _( "Checking SPICE models..." ) );
|
||||
tester.TestSimModelIssues();
|
||||
}
|
||||
|
||||
if( settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
|
||||
{
|
||||
AdvancePhase( _( "Checking no connect pins for connections..." ) );
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include "connection_graph.h"
|
||||
#include "sim/sim_model.h"
|
||||
#include <common.h> // for ExpandEnvVarSubstitutions
|
||||
#include <erc.h>
|
||||
#include <string_utils.h>
|
||||
|
@ -864,3 +865,43 @@ int ERC_TESTER::TestOffGridEndpoints( int aGridSize )
|
|||
|
||||
return err_count;
|
||||
}
|
||||
|
||||
|
||||
int ERC_TESTER::TestSimModelIssues()
|
||||
{
|
||||
SCH_SHEET_LIST sheets = m_schematic->GetSheets();
|
||||
int err_count = 0;
|
||||
|
||||
for( SCH_SHEET_PATH& sheet : sheets )
|
||||
{
|
||||
std::vector<SCH_MARKER*> markers;
|
||||
|
||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
try
|
||||
{
|
||||
/* JEY TODO
|
||||
std::unique_ptr<SIM_MODEL> model = SIM_MODEL::Create( &sheet, symbol, true );
|
||||
*/
|
||||
}
|
||||
catch( IO_ERROR& e )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_SIMULATION_MODEL );
|
||||
ercItem->SetErrorMessage( e.Problem() );
|
||||
ercItem->SetItems( symbol );
|
||||
|
||||
markers.emplace_back( new SCH_MARKER( ercItem, symbol->GetPosition() ) );
|
||||
}
|
||||
}
|
||||
|
||||
for( SCH_MARKER* marker : markers )
|
||||
{
|
||||
sheet.LastScreen()->Append( marker );
|
||||
err_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return err_count;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,11 @@ public:
|
|||
*/
|
||||
int TestOffGridEndpoints( int aGridSize );
|
||||
|
||||
/**
|
||||
* Test SPICE models for various issues.
|
||||
*/
|
||||
int TestSimModelIssues();
|
||||
|
||||
private:
|
||||
|
||||
SCHEMATIC* m_schematic;
|
||||
|
|
|
@ -134,6 +134,10 @@ ERC_ITEM ERC_ITEM::unresolvedVariable( ERCE_UNRESOLVED_VARIABLE,
|
|||
_( "Unresolved text variable" ),
|
||||
wxT( "unresolved_variable" ) );
|
||||
|
||||
ERC_ITEM ERC_ITEM::simulationModelIssues( ERCE_SIMULATION_MODEL,
|
||||
_( "SPICE model issue" ),
|
||||
wxT( "simulation_model_issue" ) );
|
||||
|
||||
ERC_ITEM ERC_ITEM::wireDangling( ERCE_WIRE_DANGLING,
|
||||
_( "Wires not connected to anything" ),
|
||||
wxT( "wire_dangling" ) );
|
||||
|
@ -191,6 +195,7 @@ std::vector<std::reference_wrapper<RC_ITEM>> ERC_ITEM::allItemTypes( {
|
|||
ERC_ITEM::heading_misc,
|
||||
ERC_ITEM::unannotated,
|
||||
ERC_ITEM::unresolvedVariable,
|
||||
ERC_ITEM::simulationModelIssues,
|
||||
ERC_ITEM::similarLabels,
|
||||
ERC_ITEM::busLabelSyntax,
|
||||
ERC_ITEM::libSymbolIssues,
|
||||
|
@ -226,6 +231,7 @@ std::shared_ptr<ERC_ITEM> ERC_ITEM::Create( int aErrorCode )
|
|||
case ERCE_NETCLASS_CONFLICT: return std::make_shared<ERC_ITEM>( netclassConflict );
|
||||
case ERCE_GLOBLABEL: return std::make_shared<ERC_ITEM>( globalLabelDangling );
|
||||
case ERCE_UNRESOLVED_VARIABLE: return std::make_shared<ERC_ITEM>( unresolvedVariable );
|
||||
case ERCE_SIMULATION_MODEL: return std::make_shared<ERC_ITEM>( simulationModelIssues );
|
||||
case ERCE_WIRE_DANGLING: return std::make_shared<ERC_ITEM>( wireDangling );
|
||||
case ERCE_LIB_SYMBOL_ISSUES: return std::make_shared<ERC_ITEM>( libSymbolIssues );
|
||||
case ERCE_UNANNOTATED: return std::make_shared<ERC_ITEM>( unannotated );
|
||||
|
|
|
@ -94,6 +94,7 @@ private:
|
|||
static ERC_ITEM busToBusConflict;
|
||||
static ERC_ITEM busToNetConflict;
|
||||
static ERC_ITEM unresolvedVariable;
|
||||
static ERC_ITEM simulationModelIssues;
|
||||
static ERC_ITEM wireDangling;
|
||||
static ERC_ITEM libSymbolIssues;
|
||||
static ERC_ITEM unannotated;
|
||||
|
|
|
@ -64,6 +64,7 @@ enum ERCE_T
|
|||
ERCE_NETCLASS_CONFLICT, ///< Multiple labels assign different netclasses to same net.
|
||||
ERCE_GLOBLABEL, ///< A global label is unique.
|
||||
ERCE_UNRESOLVED_VARIABLE, ///< A text variable could not be resolved.
|
||||
ERCE_SIMULATION_MODEL, ///< An error was found in the simulation model.
|
||||
ERCE_WIRE_DANGLING, ///< Some wires are not connected to anything else.
|
||||
ERCE_LIB_SYMBOL_ISSUES, ///< Library symbol changed from current symbol in schematic or
|
||||
///< the library symbol link no longer valid.
|
||||
|
|
Loading…
Reference in New Issue