at.lcm.x2c.scilab.xcos.x2cAdapter
Class X2cAdapter_Model

java.lang.Object
  extended by at.lcm.x2c.scilab.xcos.x2cAdapter.X2cAdapter_Model

public class X2cAdapter_Model
extends java.lang.Object

Adapter to effectively access x2c for the purpose of xcos to x2c transformation. This adapter encapsulates one x2c model and some corresponding objects of xcos.

Author:
Martin Hochwallner, Markus Aigner

Constructor Summary
X2cAdapter_Model()
           
 
Method Summary
 void addBlock(at.lcm.x2c.core.structure.Block x2c_block, org.scilab.modules.xcos.block.BasicBlock xcos_block)
          Deprecated. 
 void addBlock(java.util.List<java.lang.String> systems, at.lcm.x2c.core.structure.Block x2c_block, org.scilab.modules.xcos.block.BasicBlock xcos_block)
          Adds Block to Model.
 void connectBlocks(java.lang.String srcMaskName, java.lang.String srcOutportName, java.lang.String destMaskName, java.lang.String destInportName)
          Deprecated. 
 void convertParameters()
          walk through all blocks in the model and call convertParameters()
 java.lang.String generateValidLabel(java.lang.String label, java.util.List<java.lang.String> systemNames)
          Generates a valid = unique (not used till now) label based on the provided label.
 java.lang.String generateValidSuperBlockLabel(java.lang.String parent_label, java.lang.String child_label)
          Deprecated. 
 void generateX2cLinks()
          Walk through all blocks in the x2c model.
 X2cBlock getBlockByID(java.lang.String id)
           
 at.lcm.x2c.core.structure.Model getM2cModel()
          Deprecated. 
 at.lcm.x2c.core.structure.Model getModel()
          Returns Model.
 java.lang.String getValidSuperBlockLabel(java.util.List<java.lang.String> parents, java.lang.String child)
          Returns valid SuperBlock name.
 org.scilab.modules.xcos.block.BasicBlock getXcosClock()
          Return the xcosClock.
 boolean hasBlockId(java.lang.String id)
          Check whether a block with this id exists already in the x2c model.
 java.lang.String removeSuperblockPrefixFromLabel(java.lang.String label, java.lang.String superBlockPreFix)
          Deprecated. 
 void setSampleTime(double sampleTime)
          Set the x2c models sample time.
 void setXcosClock(org.scilab.modules.xcos.block.BasicBlock xcosClock)
          Set the xcos clock as the one used by x2c blocks.
 void updateSampletime()
          Extract the sample time out of xcosClock
 void writeToXml(java.lang.String path, java.lang.String filename)
          call x2c_model.writeToXml writeToXml(String, String)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X2cAdapter_Model

public X2cAdapter_Model()
Method Detail

getM2cModel

@Deprecated
public at.lcm.x2c.core.structure.Model getM2cModel()
Deprecated. 


getModel

public at.lcm.x2c.core.structure.Model getModel()
Returns Model.

Returns:
Model

hasBlockId

public boolean hasBlockId(java.lang.String id)
Check whether a block with this id exists already in the x2c model.

Parameters:
id - The id of a block (existing or not).
Returns:
true if a block with id=id exists in the x2c model

addBlock

@Deprecated
public void addBlock(at.lcm.x2c.core.structure.Block x2c_block,
                                org.scilab.modules.xcos.block.BasicBlock xcos_block)
              throws java.lang.Exception
Deprecated. 

Add a new block to the x2c model. condition: Block label must not exist in the x2c model.

Parameters:
x2c_block - The x2c block to add.
xcos_block - The corresponding xcos block.
Throws:
java.lang.Exception

addBlock

public void addBlock(java.util.List<java.lang.String> systems,
                     at.lcm.x2c.core.structure.Block x2c_block,
                     org.scilab.modules.xcos.block.BasicBlock xcos_block)
              throws java.lang.Exception
Adds Block to Model.

Parameters:
systems - Sub-system names
x2c_block - X2C Block
xcos_block - Xcos block
Throws:
java.lang.Exception

setSampleTime

public void setSampleTime(double sampleTime)
Set the x2c models sample time.

Parameters:
sampleTime -

connectBlocks

@Deprecated
public void connectBlocks(java.lang.String srcMaskName,
                                     java.lang.String srcOutportName,
                                     java.lang.String destMaskName,
                                     java.lang.String destInportName)
                   throws java.lang.Exception
Deprecated. 

call x2c_model model.Model.connectBlocks

Parameters:
srcMaskName -
srcOutportName -
destMaskName -
destInportName -
Throws:
java.lang.Exception
See Also:
Model.connectBlocks(String, String, String, String)

getValidSuperBlockLabel

public java.lang.String getValidSuperBlockLabel(java.util.List<java.lang.String> parents,
                                                java.lang.String child)
                                         throws java.lang.Exception
Returns valid SuperBlock name.

Parameters:
parents - Parent system names
child - Child name
Returns:
Valid name
Throws:
java.lang.Exception

generateValidSuperBlockLabel

@Deprecated
public java.lang.String generateValidSuperBlockLabel(java.lang.String parent_label,
                                                                java.lang.String child_label)
                                              throws java.lang.Exception
Deprecated. 

Generate a valid (unique) label for a SuperBlock

Parameters:
parent_label -
child_label -
Returns:
label for a SuperBlock
Throws:
java.lang.Exception

removeSuperblockPrefixFromLabel

@Deprecated
public java.lang.String removeSuperblockPrefixFromLabel(java.lang.String label,
                                                                   java.lang.String superBlockPreFix)
Deprecated. 

Removes parent/superblock prefix from given label.

Parameters:
label -
Returns:
label without superblock prefix

generateValidLabel

public java.lang.String generateValidLabel(java.lang.String label,
                                           java.util.List<java.lang.String> systemNames)
Generates a valid = unique (not used till now) label based on the provided label. If the provided label is unique, it will be returned.

Parameters:
label -
Returns:
valid label for a block

getXcosClock

public org.scilab.modules.xcos.block.BasicBlock getXcosClock()
Return the xcosClock.

Returns:
the xcosClock

setXcosClock

public void setXcosClock(org.scilab.modules.xcos.block.BasicBlock xcosClock)
Set the xcos clock as the one used by x2c blocks.

Parameters:
xcosClock -

writeToXml

public void writeToXml(java.lang.String path,
                       java.lang.String filename)
                throws java.lang.Exception
call x2c_model.writeToXml writeToXml(String, String)

Parameters:
path -
filename -
Throws:
java.lang.Exception
See Also:
Model.writeToXml(String, String)

updateSampletime

public void updateSampletime()
                      throws java.lang.Exception
Extract the sample time out of xcosClock

Throws:
java.lang.Exception

generateX2cLinks

public void generateX2cLinks()
                      throws java.lang.Exception
Walk through all blocks in the x2c model. Find the outputPorts corresponding to the inputPorts and link them in the x2c model

Throws:
java.lang.Exception

getBlockByID

public X2cBlock getBlockByID(java.lang.String id)
                      throws java.lang.Exception
Throws:
java.lang.Exception

convertParameters

public void convertParameters()
                       throws java.lang.Exception
walk through all blocks in the model and call convertParameters()

Throws:
java.lang.Exception


Copyright 2013 LCM. All rights reserved.