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)
          Add a new block to the x2c model.
 void connectBlocks(java.lang.String srcMaskName, java.lang.String srcOutportName, java.lang.String destMaskName, java.lang.String destInportName)
          call x2c_model model.Model.connectBlocks
 void convertParameters()
          walk through all blocks in the model and call convertParameters()
 java.lang.String generateValidLabel(java.lang.String label, java.lang.String superBlockPreFix)
          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)
          Generate a valid (unique) label for a SuperBlock
 void generateX2cLinks()
          Walk through all blocks in the x2c model.
 X2cBlock getBlock(java.lang.String blockLabel)
           
 X2cBlock getBlockByID(java.lang.String id)
           
 at.lcm.x2c.core.structure.Model getM2cModel()
          Deprecated. 
 at.lcm.x2c.core.structure.Model getModel()
          Returns Model.
 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.
 boolean hasBlockLabel(java.lang.String label)
          Check whether a block with this label 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

hasBlockLabel

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

Parameters:
label - The label of a block (existing or not).
Returns:
true if a block with label=label exists in the x2c 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

public void addBlock(at.lcm.x2c.core.structure.Block x2c_block,
                     org.scilab.modules.xcos.block.BasicBlock xcos_block)
              throws java.lang.Exception
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

setSampleTime

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

Parameters:
sampleTime -

connectBlocks

public void connectBlocks(java.lang.String srcMaskName,
                          java.lang.String srcOutportName,
                          java.lang.String destMaskName,
                          java.lang.String destInportName)
                   throws java.lang.Exception
call x2c_model model.Model.connectBlocks

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

generateValidSuperBlockLabel

public java.lang.String generateValidSuperBlockLabel(java.lang.String parent_label,
                                                     java.lang.String child_label)
                                              throws java.lang.Exception
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.lang.String superBlockPreFix)
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

getBlock

public X2cBlock getBlock(java.lang.String blockLabel)
                  throws java.lang.Exception
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.